Use the "nullptr" literal.

This commit is contained in:
Roman Telezhynskyi 2024-02-19 11:24:10 +02:00
parent 409161c302
commit 304ff66b06
5 changed files with 33 additions and 36 deletions

View File

@ -1641,7 +1641,7 @@ auto dxfRW::writeImage(DRW_Image *ent, const std::string &name) -> DRW_ImageDef
{
// search if exist imagedef with this mane (image inserted more than 1 time)
// RLZ: imagedef_reactor seem needed to read in acad
DRW_ImageDef *id = NULL;
DRW_ImageDef *id = nullptr;
for (unsigned int i = 0; i < imageDef.size(); i++)
{
if (imageDef.at(i)->name == name)
@ -1682,7 +1682,7 @@ auto dxfRW::writeImage(DRW_Image *ent, const std::string &name) -> DRW_ImageDef
id->reactors[idReactor] = toHexStr(static_cast<int>(ent->handle));
return id;
}
return NULL; // not exist in acad 12
return nullptr; // not exist in acad 12
}
auto dxfRW::writeBlockRecord(std::string name) -> bool

View File

@ -20,35 +20,34 @@
#include "vemptyproperty.h"
#include <stddef.h>
#include <QBrush>
#include <QColor>
#include <QFlags>
#include <QFont>
#include <stddef.h>
#include "../vproperty.h"
namespace VPE {
namespace VPE
{
class VPropertyPrivate;
} // namespace VPE
} // namespace VPE
VPE::VEmptyProperty::VEmptyProperty(const QString& name)
: VProperty(name,
VPE::VEmptyProperty::VEmptyProperty(const QString &name)
: VProperty(name,
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QMetaType::UnknownType)
QMetaType::UnknownType)
#else
QVariant::Invalid)
QVariant::Invalid)
#endif
{
}
VPE::VEmptyProperty::VEmptyProperty(VPropertyPrivate *d)
: VProperty(d)
: VProperty(d)
{
}
VPE::VEmptyProperty::~VEmptyProperty()
{
//
@ -61,12 +60,12 @@ auto VPE::VEmptyProperty::data(int column, int role) const -> QVariant
{
return QVariant();
}
if (role == Qt::BackgroundRole)
{
return QBrush(QColor(217, 217, 217));
}
if (role == Qt::FontRole)
{
QFont tmpFont;
@ -85,10 +84,9 @@ auto VPE::VEmptyProperty::createEditor(QWidget *parent, const QStyleOptionViewIt
Q_UNUSED(parent)
Q_UNUSED(delegate)
return NULL;
return nullptr;
}
//! Gets the data from the widget
auto VPE::VEmptyProperty::getEditorData(const QWidget *editor) const -> QVariant
{

View File

@ -20,36 +20,35 @@
#include "vpropertyfactorymanager.h"
#include <stddef.h>
#include <QList>
#include <QMap>
#include <QStringList>
#include <stddef.h>
#include "vabstractpropertyfactory.h"
#include "vproperty.h"
#include "vpropertyfactorymanager_p.h"
#include "vstandardpropertyfactory.h"
VPE::VPropertyFactoryManager* VPE::VPropertyFactoryManager::DefaultManager = NULL;
VPE::VPropertyFactoryManager *VPE::VPropertyFactoryManager::DefaultManager = nullptr;
VPE::VPropertyFactoryManager::VPropertyFactoryManager(QObject *parent)
: QObject(parent), d_ptr(new VPropertyFactoryManagerPrivate())
: QObject(parent),
d_ptr(new VPropertyFactoryManagerPrivate())
{
}
VPE::VPropertyFactoryManager::~VPropertyFactoryManager()
{
// Delete all factories
QList<VAbstractPropertyFactory*> tmpFactories = d_ptr->Factories.values();
QList<VAbstractPropertyFactory *> tmpFactories = d_ptr->Factories.values();
while (!tmpFactories.isEmpty())
{
VAbstractPropertyFactory* tmpFactory = tmpFactories.takeLast();
VAbstractPropertyFactory *tmpFactory = tmpFactories.takeLast();
tmpFactories.removeAll(tmpFactory);
delete tmpFactory;
}
delete d_ptr;
if (this == DefaultManager)
{
@ -57,7 +56,7 @@ VPE::VPropertyFactoryManager::~VPropertyFactoryManager()
}
}
void VPE::VPropertyFactoryManager::registerFactory(const QString& type, VAbstractPropertyFactory* factory)
void VPE::VPropertyFactoryManager::registerFactory(const QString &type, VAbstractPropertyFactory *factory)
{
if (type.isEmpty())
{
@ -70,8 +69,8 @@ void VPE::VPropertyFactoryManager::registerFactory(const QString& type, VAbstrac
d_ptr->Factories[type] = factory;
}
void VPE::VPropertyFactoryManager::unregisterFactory(VAbstractPropertyFactory* factory, const QString& type,
bool delete_if_unused)
void VPE::VPropertyFactoryManager::unregisterFactory(VAbstractPropertyFactory *factory, const QString &type,
bool delete_if_unused)
{
if (!factory)
{
@ -89,7 +88,7 @@ void VPE::VPropertyFactoryManager::unregisterFactory(VAbstractPropertyFactory* f
{
d_ptr->Factories.remove(tmpKey);
}
} while(!tmpKey.isEmpty());
} while (!tmpKey.isEmpty());
}
else
{
@ -119,8 +118,8 @@ auto VPE::VPropertyFactoryManager::getFactory(const QString &type) -> VPE::VAbst
auto VPE::VPropertyFactoryManager::createProperty(const QString &type, const QString &name, const QString &description,
const QString &default_value) -> VPE::VProperty *
{
VAbstractPropertyFactory* tmpFactory = getFactory(type);
VProperty* tmpResult = NULL;
VAbstractPropertyFactory *tmpFactory = getFactory(type);
VProperty *tmpResult = nullptr;
if (tmpFactory)
{
tmpResult = tmpFactory->createProperty(type, name);
@ -140,7 +139,7 @@ auto VPE::VPropertyFactoryManager::createProperty(const QString &type, const QSt
}
// cppcheck-suppress unusedFunction
//VPE::VPropertyFactoryManager *VPE::VPropertyFactoryManager::getDefaultManager()
// VPE::VPropertyFactoryManager *VPE::VPropertyFactoryManager::getDefaultManager()
//{
// if (!DefaultManager)
// {

View File

@ -168,7 +168,7 @@ class ColorPickerItem : public QFrame
Q_OBJECT // NOLINT
public:
ColorPickerItem(const QColor &color = Qt::white, const QString &text = QString(), QWidget *parent = 0);
ColorPickerItem(const QColor &color = Qt::white, const QString &text = QString(), QWidget *parent = nullptr);
~ColorPickerItem();
auto color() const -> QColor;
@ -573,7 +573,7 @@ ColorPickerPopup::ColorPickerPopup(int width, bool withColorDialog, QWidget *par
}
else
{
moreButton = 0;
moreButton = nullptr;
}
eventLoop = nullptr;
@ -709,7 +709,7 @@ void ColorPickerPopup::updateSelected()
{
QLayoutItem *layoutItem;
int i = 0;
while ((layoutItem = grid->itemAt(i)) != 0)
while ((layoutItem = grid->itemAt(i)) != nullptr)
{
QWidget *w = layoutItem->widget();
if (w && w->inherits("ColorPickerItem"))
@ -832,7 +832,7 @@ void ColorPickerPopup::keyPressEvent(QKeyEvent *e)
QLayoutItem *layoutItem;
int i = 0;
while ((layoutItem = grid->itemAt(i)) != 0)
while ((layoutItem = grid->itemAt(i)) != nullptr)
{
QWidget *wl = layoutItem->widget();
if (wl && wl->inherits("ColorPickerItem"))
@ -857,7 +857,7 @@ void ColorPickerPopup::keyPressEvent(QKeyEvent *e)
QLayoutItem *layoutItem;
int i = 0;
while ((layoutItem = grid->itemAt(i)) != 0)
while ((layoutItem = grid->itemAt(i)) != nullptr)
{
QWidget *wl = layoutItem->widget();
if (wl && wl->inherits("ColorPickerItem"))

View File

@ -64,7 +64,7 @@ class QtColorPicker : public QPushButton
Q_PROPERTY(bool colorDialog READ colorDialogEnabled WRITE setColorDialogEnabled)
public:
explicit QtColorPicker(QWidget *parent = 0, int columns = -1, bool enableColorDialog = true);
explicit QtColorPicker(QWidget *parent = nullptr, int columns = -1, bool enableColorDialog = true);
~QtColorPicker() override;