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

View File

@ -20,15 +20,16 @@
#include "vemptyproperty.h" #include "vemptyproperty.h"
#include <stddef.h>
#include <QBrush> #include <QBrush>
#include <QColor> #include <QColor>
#include <QFlags> #include <QFlags>
#include <QFont> #include <QFont>
#include <stddef.h>
#include "../vproperty.h" #include "../vproperty.h"
namespace VPE { namespace VPE
{
class VPropertyPrivate; class VPropertyPrivate;
} // namespace VPE } // namespace VPE
@ -42,13 +43,11 @@ VPE::VEmptyProperty::VEmptyProperty(const QString& name)
{ {
} }
VPE::VEmptyProperty::VEmptyProperty(VPropertyPrivate *d) VPE::VEmptyProperty::VEmptyProperty(VPropertyPrivate *d)
: VProperty(d) : VProperty(d)
{ {
} }
VPE::VEmptyProperty::~VEmptyProperty() VPE::VEmptyProperty::~VEmptyProperty()
{ {
// //
@ -85,10 +84,9 @@ auto VPE::VEmptyProperty::createEditor(QWidget *parent, const QStyleOptionViewIt
Q_UNUSED(parent) Q_UNUSED(parent)
Q_UNUSED(delegate) Q_UNUSED(delegate)
return NULL; return nullptr;
} }
//! Gets the data from the widget //! Gets the data from the widget
auto VPE::VEmptyProperty::getEditorData(const QWidget *editor) const -> QVariant auto VPE::VEmptyProperty::getEditorData(const QWidget *editor) const -> QVariant
{ {

View File

@ -20,22 +20,22 @@
#include "vpropertyfactorymanager.h" #include "vpropertyfactorymanager.h"
#include <stddef.h>
#include <QList> #include <QList>
#include <QMap> #include <QMap>
#include <QStringList> #include <QStringList>
#include <stddef.h>
#include "vabstractpropertyfactory.h" #include "vabstractpropertyfactory.h"
#include "vproperty.h" #include "vproperty.h"
#include "vpropertyfactorymanager_p.h" #include "vpropertyfactorymanager_p.h"
#include "vstandardpropertyfactory.h" #include "vstandardpropertyfactory.h"
VPE::VPropertyFactoryManager* VPE::VPropertyFactoryManager::DefaultManager = NULL; VPE::VPropertyFactoryManager *VPE::VPropertyFactoryManager::DefaultManager = nullptr;
VPE::VPropertyFactoryManager::VPropertyFactoryManager(QObject *parent) VPE::VPropertyFactoryManager::VPropertyFactoryManager(QObject *parent)
: QObject(parent), d_ptr(new VPropertyFactoryManagerPrivate()) : QObject(parent),
d_ptr(new VPropertyFactoryManagerPrivate())
{ {
} }
VPE::VPropertyFactoryManager::~VPropertyFactoryManager() VPE::VPropertyFactoryManager::~VPropertyFactoryManager()
@ -49,7 +49,6 @@ VPE::VPropertyFactoryManager::~VPropertyFactoryManager()
delete tmpFactory; delete tmpFactory;
} }
delete d_ptr; delete d_ptr;
if (this == DefaultManager) if (this == DefaultManager)
{ {
@ -120,7 +119,7 @@ auto VPE::VPropertyFactoryManager::createProperty(const QString &type, const QSt
const QString &default_value) -> VPE::VProperty * const QString &default_value) -> VPE::VProperty *
{ {
VAbstractPropertyFactory *tmpFactory = getFactory(type); VAbstractPropertyFactory *tmpFactory = getFactory(type);
VProperty* tmpResult = NULL; VProperty *tmpResult = nullptr;
if (tmpFactory) if (tmpFactory)
{ {
tmpResult = tmpFactory->createProperty(type, name); tmpResult = tmpFactory->createProperty(type, name);

View File

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

View File

@ -64,7 +64,7 @@ class QtColorPicker : public QPushButton
Q_PROPERTY(bool colorDialog READ colorDialogEnabled WRITE setColorDialogEnabled) Q_PROPERTY(bool colorDialog READ colorDialogEnabled WRITE setColorDialogEnabled)
public: 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; ~QtColorPicker() override;