diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-06-03 16:40:05 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-06-05 10:26:08 +0200 |
commit | 13f0365a960538693ee4b52f9e02864d08845fae (patch) | |
tree | cea2924f8113152ff10bdc126ebe5a0c8d3c4f95 /src/designer/src/lib | |
parent | fac0dcbeef6a0c23e780b9751c17883ec9918d6f (diff) | |
download | qttools-13f0365a960538693ee4b52f9e02864d08845fae.tar.gz |
Qt Designer: Introduce nullptr
Apply Fixits by Qt Creator with some amendments.
Change-Id: Idc948b1132fbb61c3ae6706b71659e2e8790fbc6
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'src/designer/src/lib')
140 files changed, 716 insertions, 711 deletions
diff --git a/src/designer/src/lib/extension/default_extensionfactory.cpp b/src/designer/src/lib/extension/default_extensionfactory.cpp index 23d2991e2..af1fe6f21 100644 --- a/src/designer/src/lib/extension/default_extensionfactory.cpp +++ b/src/designer/src/lib/extension/default_extensionfactory.cpp @@ -101,7 +101,7 @@ QExtensionFactory::QExtensionFactory(QExtensionManager *parent) QObject *QExtensionFactory::extension(QObject *object, const QString &iid) const { if (!object) - return 0; + return nullptr; const IdObjectKey key = qMakePair(iid, object); ExtensionMap::iterator it = m_extensions.find(key); @@ -118,7 +118,7 @@ QObject *QExtensionFactory::extension(QObject *object, const QString &iid) const } if (it == m_extensions.end()) - return 0; + return nullptr; return it.value(); } @@ -148,7 +148,7 @@ QObject *QExtensionFactory::createExtension(QObject *object, const QString &iid, Q_UNUSED(iid); Q_UNUSED(parent); - return 0; + return nullptr; } /*! diff --git a/src/designer/src/lib/extension/default_extensionfactory.h b/src/designer/src/lib/extension/default_extensionfactory.h index 58ba7a5e8..f14c33361 100644 --- a/src/designer/src/lib/extension/default_extensionfactory.h +++ b/src/designer/src/lib/extension/default_extensionfactory.h @@ -45,7 +45,7 @@ class QDESIGNER_EXTENSION_EXPORT QExtensionFactory : public QObject, public QAbs Q_OBJECT Q_INTERFACES(QAbstractExtensionFactory) public: - explicit QExtensionFactory(QExtensionManager *parent = Q_NULLPTR); + explicit QExtensionFactory(QExtensionManager *parent = nullptr); QObject *extension(QObject *object, const QString &iid) const override; QExtensionManager *extensionManager() const; diff --git a/src/designer/src/lib/extension/extension.h b/src/designer/src/lib/extension/extension.h index 295f8992d..7d9244287 100644 --- a/src/designer/src/lib/extension/extension.h +++ b/src/designer/src/lib/extension/extension.h @@ -59,13 +59,13 @@ Q_DECLARE_INTERFACE(QAbstractExtensionManager, "org.qt-project.Qt.QAbstractExten template <class T> inline T qt_extension(QAbstractExtensionManager *, QObject *) -{ return Q_NULLPTR; } +{ return nullptr; } #define Q_DECLARE_EXTENSION_INTERFACE(IFace, IId) \ const char * const IFace##_iid = IId; \ Q_DECLARE_INTERFACE(IFace, IId) \ template <> inline IFace *qt_extension<IFace *>(QAbstractExtensionManager *manager, QObject *object) \ -{ QObject *extension = manager->extension(object, Q_TYPEID(IFace)); return extension ? static_cast<IFace *>(extension->qt_metacast(IFace##_iid)) : static_cast<IFace *>(Q_NULLPTR); } +{ QObject *extension = manager->extension(object, Q_TYPEID(IFace)); return extension ? static_cast<IFace *>(extension->qt_metacast(IFace##_iid)) : static_cast<IFace *>(nullptr); } QT_END_NAMESPACE diff --git a/src/designer/src/lib/extension/qextensionmanager.cpp b/src/designer/src/lib/extension/qextensionmanager.cpp index 4b9e7bd54..a5b3a6cc5 100644 --- a/src/designer/src/lib/extension/qextensionmanager.cpp +++ b/src/designer/src/lib/extension/qextensionmanager.cpp @@ -155,7 +155,7 @@ QObject *QExtensionManager::extension(QObject *object, const QString &iid) const if (QObject *ext = (*git)->extension(object, iid)) return ext; - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/designer/src/lib/extension/qextensionmanager.h b/src/designer/src/lib/extension/qextensionmanager.h index c72a1af30..c283a11cb 100644 --- a/src/designer/src/lib/extension/qextensionmanager.h +++ b/src/designer/src/lib/extension/qextensionmanager.h @@ -42,7 +42,7 @@ class QDESIGNER_EXTENSION_EXPORT QExtensionManager: public QObject, public QAbst Q_OBJECT Q_INTERFACES(QAbstractExtensionManager) public: - explicit QExtensionManager(QObject *parent = Q_NULLPTR); + explicit QExtensionManager(QObject *parent = nullptr); ~QExtensionManager(); void registerExtensions(QAbstractExtensionFactory *factory, const QString &iid = QString()) override; diff --git a/src/designer/src/lib/sdk/abstractactioneditor.cpp b/src/designer/src/lib/sdk/abstractactioneditor.cpp index 76e9a818a..c9510347e 100644 --- a/src/designer/src/lib/sdk/abstractactioneditor.cpp +++ b/src/designer/src/lib/sdk/abstractactioneditor.cpp @@ -79,7 +79,7 @@ QDesignerActionEditorInterface::~QDesignerActionEditorInterface() */ QDesignerFormEditorInterface *QDesignerActionEditorInterface::core() const { - return 0; + return nullptr; } /*! diff --git a/src/designer/src/lib/sdk/abstractdialoggui_p.h b/src/designer/src/lib/sdk/abstractdialoggui_p.h index a4e5918e6..705838982 100644 --- a/src/designer/src/lib/sdk/abstractdialoggui_p.h +++ b/src/designer/src/lib/sdk/abstractdialoggui_p.h @@ -77,12 +77,12 @@ public: QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton) = 0; - virtual QString getExistingDirectory(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), QFileDialog::Options options = QFileDialog::ShowDirsOnly)= 0; - virtual QString getOpenFileName(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0)= 0; - virtual QString getOpenImageFileName(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0); - virtual QStringList getOpenFileNames(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0)= 0; - virtual QStringList getOpenImageFileNames(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0); - virtual QString getSaveFileName(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0)= 0; + virtual QString getExistingDirectory(QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString(), QFileDialog::Options options = QFileDialog::ShowDirsOnly)= 0; + virtual QString getOpenFileName(QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = nullptr, QFileDialog::Options options = nullptr)= 0; + virtual QString getOpenImageFileName(QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = nullptr, QFileDialog::Options options = nullptr); + virtual QStringList getOpenFileNames(QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = nullptr, QFileDialog::Options options = nullptr)= 0; + virtual QStringList getOpenImageFileNames(QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = nullptr, QFileDialog::Options options = nullptr); + virtual QString getSaveFileName(QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = nullptr, QFileDialog::Options options = nullptr)= 0; }; QT_END_NAMESPACE diff --git a/src/designer/src/lib/sdk/abstractformeditor.h b/src/designer/src/lib/sdk/abstractformeditor.h index 82f9ed294..60dc35c95 100644 --- a/src/designer/src/lib/sdk/abstractformeditor.h +++ b/src/designer/src/lib/sdk/abstractformeditor.h @@ -65,7 +65,7 @@ class QDESIGNER_SDK_EXPORT QDesignerFormEditorInterface : public QObject { Q_OBJECT public: - explicit QDesignerFormEditorInterface(QObject *parent = Q_NULLPTR); + explicit QDesignerFormEditorInterface(QObject *parent = nullptr); virtual ~QDesignerFormEditorInterface(); QExtensionManager *extensionManager() const; diff --git a/src/designer/src/lib/sdk/abstractformwindow.cpp b/src/designer/src/lib/sdk/abstractformwindow.cpp index 64bc0b68c..585a92024 100644 --- a/src/designer/src/lib/sdk/abstractformwindow.cpp +++ b/src/designer/src/lib/sdk/abstractformwindow.cpp @@ -171,7 +171,7 @@ QDesignerFormWindowInterface::~QDesignerFormWindowInterface() */ QDesignerFormEditorInterface *QDesignerFormWindowInterface::core() const { - return 0; + return nullptr; } /*! @@ -200,7 +200,7 @@ static inline bool stopFindAtTopLevel(const QObject *w, bool stopAtMenu) QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QWidget *w) { - while (w != 0) { + while (w != nullptr) { if (QDesignerFormWindowInterface *fw = qobject_cast<QDesignerFormWindowInterface*>(w)) { return fw; } else { @@ -224,7 +224,7 @@ QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QWidg QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QObject *object) { - while (object != 0) { + while (object != nullptr) { if (QDesignerFormWindowInterface *fw = qobject_cast<QDesignerFormWindowInterface*>(object)) { return fw; } else { @@ -241,7 +241,7 @@ QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QObje object = object->parent(); } - return 0; + return nullptr; } /*! diff --git a/src/designer/src/lib/sdk/abstractformwindow.h b/src/designer/src/lib/sdk/abstractformwindow.h index 716c4db44..6437eecc7 100644 --- a/src/designer/src/lib/sdk/abstractformwindow.h +++ b/src/designer/src/lib/sdk/abstractformwindow.h @@ -63,7 +63,7 @@ public: }; public: - explicit QDesignerFormWindowInterface(QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags()); + explicit QDesignerFormWindowInterface(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags()); virtual ~QDesignerFormWindowInterface(); virtual QString fileName() const = 0; @@ -71,7 +71,7 @@ public: virtual QString contents() const = 0; virtual QStringList checkContents() const = 0; - virtual bool setContents(QIODevice *dev, QString *errorMessage = Q_NULLPTR) = 0; + virtual bool setContents(QIODevice *dev, QString *errorMessage = nullptr) = 0; virtual Feature features() const = 0; virtual bool hasFeature(Feature f) const = 0; @@ -157,7 +157,7 @@ public Q_SLOTS: virtual bool setContents(const QString &contents) = 0; virtual void editWidgets() = 0; - void activateResourceFilePaths(const QStringList &paths, int *errorCount = Q_NULLPTR, QString *errorMessages = Q_NULLPTR); + void activateResourceFilePaths(const QStringList &paths, int *errorCount = nullptr, QString *errorMessages = nullptr); Q_SIGNALS: void mainContainerChanged(QWidget *mainContainer); diff --git a/src/designer/src/lib/sdk/abstractformwindowmanager.h b/src/designer/src/lib/sdk/abstractformwindowmanager.h index 5fcc71ea8..4f826660f 100644 --- a/src/designer/src/lib/sdk/abstractformwindowmanager.h +++ b/src/designer/src/lib/sdk/abstractformwindowmanager.h @@ -49,7 +49,7 @@ class QDESIGNER_SDK_EXPORT QDesignerFormWindowManagerInterface: public QObject { Q_OBJECT public: - explicit QDesignerFormWindowManagerInterface(QObject *parent = Q_NULLPTR); + explicit QDesignerFormWindowManagerInterface(QObject *parent = nullptr); virtual ~QDesignerFormWindowManagerInterface(); enum Action @@ -114,7 +114,7 @@ public: virtual int formWindowCount() const = 0; virtual QDesignerFormWindowInterface *formWindow(int index) const = 0; - virtual QDesignerFormWindowInterface *createFormWindow(QWidget *parentWidget = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags()) = 0; + virtual QDesignerFormWindowInterface *createFormWindow(QWidget *parentWidget = nullptr, Qt::WindowFlags flags = Qt::WindowFlags()) = 0; virtual QDesignerFormEditorInterface *core() const = 0; diff --git a/src/designer/src/lib/sdk/abstractformwindowtool.h b/src/designer/src/lib/sdk/abstractformwindowtool.h index 5d57f7ccb..d6fecf63a 100644 --- a/src/designer/src/lib/sdk/abstractformwindowtool.h +++ b/src/designer/src/lib/sdk/abstractformwindowtool.h @@ -45,7 +45,7 @@ class QDESIGNER_SDK_EXPORT QDesignerFormWindowToolInterface: public QObject { Q_OBJECT public: - explicit QDesignerFormWindowToolInterface(QObject *parent = Q_NULLPTR); + explicit QDesignerFormWindowToolInterface(QObject *parent = nullptr); virtual ~QDesignerFormWindowToolInterface(); virtual QDesignerFormEditorInterface *core() const = 0; diff --git a/src/designer/src/lib/sdk/abstractintegration.cpp b/src/designer/src/lib/sdk/abstractintegration.cpp index 788882cf0..84b3a67e2 100644 --- a/src/designer/src/lib/sdk/abstractintegration.cpp +++ b/src/designer/src/lib/sdk/abstractintegration.cpp @@ -326,7 +326,7 @@ QDesignerIntegrationPrivate::QDesignerIntegrationPrivate(QDesignerIntegration *q headerLowercase(true), m_features(QDesignerIntegrationInterface::DefaultFeature), m_resourceFileWatcherBehaviour(QDesignerIntegrationInterface::PromptToReloadResourceFile), - m_gradientManager(0) + m_gradientManager(nullptr) { } @@ -479,7 +479,7 @@ void QDesignerIntegrationPrivate::updateSelection() { QDesignerFormEditorInterface *core = q->core(); QDesignerFormWindowInterface *formWindow = core->formWindowManager()->activeFormWindow(); - QWidget *selection = 0; + QWidget *selection = nullptr; if (formWindow) { selection = formWindow->cursor()->current(); @@ -549,7 +549,7 @@ QObject *QDesignerIntegrationPrivate::propertyEditorObject() { if (QDesignerPropertyEditorInterface *propertyEditor = q->core()->propertyEditor()) return propertyEditor->object(); - return 0; + return nullptr; } // Load plugins into widget database and factory. @@ -761,7 +761,7 @@ void QDesignerIntegration::updateCustomWidgetPlugins() QDesignerResourceBrowserInterface *QDesignerIntegration::createResourceBrowser(QWidget *) { - return 0; + return nullptr; } QString QDesignerIntegration::contextHelpId() const diff --git a/src/designer/src/lib/sdk/abstractintegration.h b/src/designer/src/lib/sdk/abstractintegration.h index 6437ee569..2c4aa7936 100644 --- a/src/designer/src/lib/sdk/abstractintegration.h +++ b/src/designer/src/lib/sdk/abstractintegration.h @@ -72,7 +72,7 @@ public: }; Q_DECLARE_FLAGS(Feature, FeatureFlag) - explicit QDesignerIntegrationInterface(QDesignerFormEditorInterface *core, QObject *parent = Q_NULLPTR); + explicit QDesignerIntegrationInterface(QDesignerFormEditorInterface *core, QObject *parent = nullptr); virtual ~QDesignerIntegrationInterface(); QDesignerFormEditorInterface *core() const; @@ -80,7 +80,7 @@ public: virtual QWidget *containerWindow(QWidget *widget) const = 0; // Create a resource browser specific to integration. Language integration takes precedence - virtual QDesignerResourceBrowserInterface *createResourceBrowser(QWidget *parent = Q_NULLPTR) = 0; + virtual QDesignerResourceBrowserInterface *createResourceBrowser(QWidget *parent = nullptr) = 0; virtual QString headerSuffix() const = 0; virtual void setHeaderSuffix(const QString &headerSuffix) = 0; @@ -131,7 +131,7 @@ class QDESIGNER_SDK_EXPORT QDesignerIntegration: public QDesignerIntegrationInte { Q_OBJECT public: - explicit QDesignerIntegration(QDesignerFormEditorInterface *core, QObject *parent = Q_NULLPTR); + explicit QDesignerIntegration(QDesignerFormEditorInterface *core, QObject *parent = nullptr); virtual ~QDesignerIntegration(); QString headerSuffix() const; @@ -152,7 +152,7 @@ public: static void initializePlugins(QDesignerFormEditorInterface *formEditor); // Create a resource browser specific to integration. Language integration takes precedence - virtual QDesignerResourceBrowserInterface *createResourceBrowser(QWidget *parent = Q_NULLPTR); + virtual QDesignerResourceBrowserInterface *createResourceBrowser(QWidget *parent = nullptr); virtual QString contextHelpId() const; diff --git a/src/designer/src/lib/sdk/abstractintrospection_p.h b/src/designer/src/lib/sdk/abstractintrospection_p.h index 943bb9b9c..9163fc6b0 100644 --- a/src/designer/src/lib/sdk/abstractintrospection_p.h +++ b/src/designer/src/lib/sdk/abstractintrospection_p.h @@ -80,7 +80,7 @@ public: virtual Kind kind() const = 0; virtual AccessFlags accessFlags() const = 0; - virtual Attributes attributes(const QObject *object = 0) const = 0; + virtual Attributes attributes(const QObject *object = nullptr) const = 0; virtual QVariant::Type type() const = 0; virtual QString name() const = 0; diff --git a/src/designer/src/lib/sdk/abstractlanguage.h b/src/designer/src/lib/sdk/abstractlanguage.h index 6d13f0d16..e31dfa78d 100644 --- a/src/designer/src/lib/sdk/abstractlanguage.h +++ b/src/designer/src/lib/sdk/abstractlanguage.h @@ -66,12 +66,12 @@ public: virtual QDialog *createFormWindowSettingsDialog(QDesignerFormWindowInterface *formWindow, QWidget *parentWidget) = 0; virtual QDesignerResourceBrowserInterface *createResourceBrowser(QWidget *parentWidget) = 0; - virtual QDialog *createPromotionDialog(QDesignerFormEditorInterface *formEditor, QWidget *parentWidget = Q_NULLPTR) = 0; + virtual QDialog *createPromotionDialog(QDesignerFormEditorInterface *formEditor, QWidget *parentWidget = nullptr) = 0; virtual QDialog *createPromotionDialog(QDesignerFormEditorInterface *formEditor, const QString &promotableWidgetClassName, QString *promoteToClassName, - QWidget *parentWidget = Q_NULLPTR) = 0; + QWidget *parentWidget = nullptr) = 0; virtual bool isLanguageResource(const QString &path) const = 0; diff --git a/src/designer/src/lib/sdk/abstractmetadatabase.h b/src/designer/src/lib/sdk/abstractmetadatabase.h index a1378a9e5..d3d729429 100644 --- a/src/designer/src/lib/sdk/abstractmetadatabase.h +++ b/src/designer/src/lib/sdk/abstractmetadatabase.h @@ -62,7 +62,7 @@ class QDESIGNER_SDK_EXPORT QDesignerMetaDataBaseInterface: public QObject { Q_OBJECT public: - explicit QDesignerMetaDataBaseInterface(QObject *parent = Q_NULLPTR); + explicit QDesignerMetaDataBaseInterface(QObject *parent = nullptr); virtual ~QDesignerMetaDataBaseInterface(); virtual QDesignerMetaDataBaseItemInterface *item(QObject *object) const = 0; diff --git a/src/designer/src/lib/sdk/abstractnewformwidget.h b/src/designer/src/lib/sdk/abstractnewformwidget.h index f1ee993a7..8805097bb 100644 --- a/src/designer/src/lib/sdk/abstractnewformwidget.h +++ b/src/designer/src/lib/sdk/abstractnewformwidget.h @@ -42,13 +42,13 @@ class QDESIGNER_SDK_EXPORT QDesignerNewFormWidgetInterface : public QWidget Q_DISABLE_COPY(QDesignerNewFormWidgetInterface) Q_OBJECT public: - explicit QDesignerNewFormWidgetInterface(QWidget *parent = Q_NULLPTR); + explicit QDesignerNewFormWidgetInterface(QWidget *parent = nullptr); virtual ~QDesignerNewFormWidgetInterface(); virtual bool hasCurrentTemplate() const = 0; - virtual QString currentTemplate(QString *errorMessage = Q_NULLPTR) = 0; + virtual QString currentTemplate(QString *errorMessage = nullptr) = 0; - static QDesignerNewFormWidgetInterface *createNewFormWidget(QDesignerFormEditorInterface *core, QWidget *parent = Q_NULLPTR); + static QDesignerNewFormWidgetInterface *createNewFormWidget(QDesignerFormEditorInterface *core, QWidget *parent = nullptr); Q_SIGNALS: void templateActivated(); diff --git a/src/designer/src/lib/sdk/abstractobjectinspector.cpp b/src/designer/src/lib/sdk/abstractobjectinspector.cpp index 8249f17a5..5d8e73849 100644 --- a/src/designer/src/lib/sdk/abstractobjectinspector.cpp +++ b/src/designer/src/lib/sdk/abstractobjectinspector.cpp @@ -85,7 +85,7 @@ QDesignerObjectInspectorInterface::~QDesignerObjectInspectorInterface() */ QDesignerFormEditorInterface *QDesignerObjectInspectorInterface::core() const { - return 0; + return nullptr; } /*! diff --git a/src/designer/src/lib/sdk/abstractpropertyeditor.cpp b/src/designer/src/lib/sdk/abstractpropertyeditor.cpp index c154b834b..82dad6d63 100644 --- a/src/designer/src/lib/sdk/abstractpropertyeditor.cpp +++ b/src/designer/src/lib/sdk/abstractpropertyeditor.cpp @@ -108,7 +108,7 @@ QDesignerPropertyEditorInterface::~QDesignerPropertyEditorInterface() */ QDesignerFormEditorInterface *QDesignerPropertyEditorInterface::core() const { - return 0; + return nullptr; } /*! diff --git a/src/designer/src/lib/sdk/abstractresourcebrowser.h b/src/designer/src/lib/sdk/abstractresourcebrowser.h index d93f51fee..cc49a38ea 100644 --- a/src/designer/src/lib/sdk/abstractresourcebrowser.h +++ b/src/designer/src/lib/sdk/abstractresourcebrowser.h @@ -41,7 +41,7 @@ class QDESIGNER_SDK_EXPORT QDesignerResourceBrowserInterface: public QWidget { Q_OBJECT public: - explicit QDesignerResourceBrowserInterface(QWidget *parent = Q_NULLPTR); + explicit QDesignerResourceBrowserInterface(QWidget *parent = nullptr); virtual ~QDesignerResourceBrowserInterface(); virtual void setCurrentPath(const QString &filePath) = 0; diff --git a/src/designer/src/lib/sdk/abstractwidgetbox.h b/src/designer/src/lib/sdk/abstractwidgetbox.h index c8136c5e8..2b1b42bca 100644 --- a/src/designer/src/lib/sdk/abstractwidgetbox.h +++ b/src/designer/src/lib/sdk/abstractwidgetbox.h @@ -98,7 +98,7 @@ public: }; typedef QList<Category> CategoryList; - explicit QDesignerWidgetBoxInterface(QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags()); + explicit QDesignerWidgetBoxInterface(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags()); virtual ~QDesignerWidgetBoxInterface(); virtual int categoryCount() const = 0; diff --git a/src/designer/src/lib/sdk/abstractwidgetdatabase.cpp b/src/designer/src/lib/sdk/abstractwidgetdatabase.cpp index bcd0ebb9f..a348580ea 100644 --- a/src/designer/src/lib/sdk/abstractwidgetdatabase.cpp +++ b/src/designer/src/lib/sdk/abstractwidgetdatabase.cpp @@ -105,7 +105,7 @@ void QDesignerWidgetDataBaseInterface::append(QDesignerWidgetDataBaseItemInterfa */ QDesignerFormEditorInterface *QDesignerWidgetDataBaseInterface::core() const { - return 0; + return nullptr; } /*! diff --git a/src/designer/src/lib/sdk/abstractwidgetdatabase.h b/src/designer/src/lib/sdk/abstractwidgetdatabase.h index 4be8c1f9a..725846caf 100644 --- a/src/designer/src/lib/sdk/abstractwidgetdatabase.h +++ b/src/designer/src/lib/sdk/abstractwidgetdatabase.h @@ -90,7 +90,7 @@ class QDESIGNER_SDK_EXPORT QDesignerWidgetDataBaseInterface: public QObject { Q_OBJECT public: - explicit QDesignerWidgetDataBaseInterface(QObject *parent = Q_NULLPTR); + explicit QDesignerWidgetDataBaseInterface(QObject *parent = nullptr); virtual ~QDesignerWidgetDataBaseInterface(); virtual int count() const; diff --git a/src/designer/src/lib/sdk/abstractwidgetfactory.h b/src/designer/src/lib/sdk/abstractwidgetfactory.h index b91de47d0..2bec8ba3d 100644 --- a/src/designer/src/lib/sdk/abstractwidgetfactory.h +++ b/src/designer/src/lib/sdk/abstractwidgetfactory.h @@ -42,7 +42,7 @@ class QDESIGNER_SDK_EXPORT QDesignerWidgetFactoryInterface: public QObject { Q_OBJECT public: - explicit QDesignerWidgetFactoryInterface(QObject *parent = Q_NULLPTR); + explicit QDesignerWidgetFactoryInterface(QObject *parent = nullptr); virtual ~QDesignerWidgetFactoryInterface(); virtual QDesignerFormEditorInterface *core() const = 0; @@ -50,7 +50,7 @@ public: virtual QWidget* containerOfWidget(QWidget *w) const = 0; virtual QWidget* widgetOfContainer(QWidget *w) const = 0; - virtual QWidget *createWidget(const QString &name, QWidget *parentWidget = Q_NULLPTR) const = 0; + virtual QWidget *createWidget(const QString &name, QWidget *parentWidget = nullptr) const = 0; virtual QLayout *createLayout(QWidget *widget, QLayout *layout, int type) const = 0; virtual bool isPassiveInteractor(QWidget *widget) = 0; diff --git a/src/designer/src/lib/sdk/taskmenu.h b/src/designer/src/lib/sdk/taskmenu.h index 8f4a6e4e7..68203e705 100644 --- a/src/designer/src/lib/sdk/taskmenu.h +++ b/src/designer/src/lib/sdk/taskmenu.h @@ -48,7 +48,7 @@ Q_DECLARE_EXTENSION_INTERFACE(QDesignerTaskMenuExtension, "org.qt-project.Qt.Des inline QAction *QDesignerTaskMenuExtension::preferredEditAction() const -{ return Q_NULLPTR; } +{ return nullptr; } QT_END_NAMESPACE diff --git a/src/designer/src/lib/shared/actioneditor.cpp b/src/designer/src/lib/shared/actioneditor.cpp index 4297065b5..86cbb4959 100644 --- a/src/designer/src/lib/shared/actioneditor.cpp +++ b/src/designer/src/lib/shared/actioneditor.cpp @@ -106,7 +106,7 @@ ObjectNamingMode ActionEditor::m_objectNamingMode = Underscore; // fixme Qt 6: C ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent, Qt::WindowFlags flags) : QDesignerActionEditorInterface(parent, flags), m_core(core), - m_actionGroups(0), + m_actionGroups(nullptr), m_actionView(new ActionView), m_actionNew(new QAction(tr("New..."), this)), m_actionEdit(new QAction(tr("Edit..."), this)), @@ -119,9 +119,9 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent, m_actionSelectAll(new QAction(tr("Select all"), this)), m_actionDelete(new QAction(tr("Delete"), this)), m_viewModeGroup(new QActionGroup(this)), - m_iconViewAction(0), - m_listViewAction(0), - m_filterWidget(0) + m_iconViewAction(nullptr), + m_listViewAction(nullptr), + m_filterWidget(nullptr) { m_actionView->initialize(m_core); m_actionView->setSelectionMode(QAbstractItemView::ExtendedSelection); @@ -278,14 +278,14 @@ QDesignerFormWindowInterface *ActionEditor::formWindow() const void ActionEditor::setFormWindow(QDesignerFormWindowInterface *formWindow) { - if (formWindow != 0 && formWindow->mainContainer() == 0) - formWindow = 0; + if (formWindow != nullptr && formWindow->mainContainer() == nullptr) + formWindow = nullptr; // we do NOT rely on this function to update the action editor if (m_formWindow == formWindow) return; - if (m_formWindow != 0) { + if (m_formWindow != nullptr) { const ActionList actionList = m_formWindow->mainContainer()->findChildren<QAction*>(); for (QAction *action : actionList) disconnect(action, &QAction::changed, this, &ActionEditor::slotActionChanged); @@ -313,7 +313,7 @@ void ActionEditor::setFormWindow(QDesignerFormWindowInterface *formWindow) const ActionList actionList = formWindow->mainContainer()->findChildren<QAction*>(); for (QAction *action : actionList) - if (!action->isSeparator() && core()->metaDataBase()->item(action) != 0) { + if (!action->isSeparator() && core()->metaDataBase()->item(action) != nullptr) { // Show unless it has a menu. However, listen for change on menu actions also as it might be removed if (!action->menu()) m_actionView->model()->addAction(action); @@ -339,7 +339,7 @@ void ActionEditor::slotCurrentItemChanged(QAction *action) if (!fw) return; - const bool hasCurrentAction = action != 0; + const bool hasCurrentAction = action != nullptr; m_actionEdit->setEnabled(hasCurrentAction); if (!action) { @@ -364,14 +364,14 @@ void ActionEditor::slotCurrentItemChanged(QAction *action) void ActionEditor::slotActionChanged() { QAction *action = qobject_cast<QAction*>(sender()); - Q_ASSERT(action != 0); + Q_ASSERT(action != nullptr); ActionModel *model = m_actionView->model(); const int row = model->findAction(action); if (row == -1) { - if (action->menu() == 0) // action got its menu deleted, create item + if (action->menu() == nullptr) // action got its menu deleted, create item model->addAction(action); - } else if (action->menu() != 0) { // action got its menu created, remove item + } else if (action->menu() != nullptr) { // action got its menu created, remove item model->removeRow(row); } else { // action text or icon changed, update item @@ -406,7 +406,7 @@ void ActionEditor::manageAction(QAction *action) action->setParent(formWindow()->mainContainer()); core()->metaDataBase()->add(action); - if (action->isSeparator() || action->menu() != 0) + if (action->isSeparator() || action->menu() != nullptr) return; QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), action); @@ -421,7 +421,7 @@ void ActionEditor::manageAction(QAction *action) void ActionEditor::unmanageAction(QAction *action) { core()->metaDataBase()->remove(action); - action->setParent(0); + action->setParent(nullptr); disconnect(action, &QAction::changed, this, &ActionEditor::slotActionChanged); @@ -728,7 +728,7 @@ void ActionEditor::mainContainerChanged() { // Invalidate references to objects kept in model if (sender() == formWindow()) - setFormWindow(0); + setFormWindow(nullptr); } void ActionEditor::slotViewMode(QAction *a) diff --git a/src/designer/src/lib/shared/actioneditor_p.h b/src/designer/src/lib/shared/actioneditor_p.h index 0c913d477..39705b256 100644 --- a/src/designer/src/lib/shared/actioneditor_p.h +++ b/src/designer/src/lib/shared/actioneditor_p.h @@ -67,7 +67,8 @@ class QDESIGNER_SHARED_EXPORT ActionEditor: public QDesignerActionEditorInterfac { Q_OBJECT public: - explicit ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent = 0, Qt::WindowFlags flags = 0); + explicit ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent = nullptr, + Qt::WindowFlags flags = {}); ~ActionEditor() override; QDesignerFormWindowInterface *formWindow() const; diff --git a/src/designer/src/lib/shared/actionrepository.cpp b/src/designer/src/lib/shared/actionrepository.cpp index 78ce6f654..2d91a5f00 100644 --- a/src/designer/src/lib/shared/actionrepository.cpp +++ b/src/designer/src/lib/shared/actionrepository.cpp @@ -269,10 +269,10 @@ bool ActionModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int QAction *ActionModel::actionAt(const QModelIndex &index) const { if (!index.isValid()) - return 0; + return nullptr; QStandardItem *i = itemFromIndex(index); if (!i) - return 0; + return nullptr; return actionOfItem(i); } diff --git a/src/designer/src/lib/shared/actionrepository_p.h b/src/designer/src/lib/shared/actionrepository_p.h index c84ba00e6..5f13d786e 100644 --- a/src/designer/src/lib/shared/actionrepository_p.h +++ b/src/designer/src/lib/shared/actionrepository_p.h @@ -67,7 +67,7 @@ public: enum Columns { NameColumn, UsedColumn, TextColumn, ShortCutColumn, CheckedColumn, ToolTipColumn, NumColumns }; enum { ActionRole = Qt::UserRole + 1000 }; - explicit ActionModel(QWidget *parent = 0); + explicit ActionModel(QWidget *parent = nullptr); void initialize(QDesignerFormEditorInterface *core) { m_core = core; } void clearActions(); @@ -115,7 +115,7 @@ class ActionTreeView: public QTreeView { Q_OBJECT public: - explicit ActionTreeView(ActionModel *model, QWidget *parent = 0); + explicit ActionTreeView(ActionModel *model, QWidget *parent = nullptr); QAction *currentAction() const; public slots: @@ -149,7 +149,7 @@ class ActionListView: public QListView { Q_OBJECT public: - explicit ActionListView(ActionModel *model, QWidget *parent = 0); + explicit ActionListView(ActionModel *model, QWidget *parent = nullptr); QAction *currentAction() const; public slots: @@ -187,7 +187,7 @@ class ActionView : public QStackedWidget { public: // Separate initialize() function takes core argument to make this // thing usable as promoted widget. - explicit ActionView(QWidget *parent = 0); + explicit ActionView(QWidget *parent = nullptr); void initialize(QDesignerFormEditorInterface *core) { m_model->initialize(core); } // View mode diff --git a/src/designer/src/lib/shared/codedialog_p.h b/src/designer/src/lib/shared/codedialog_p.h index 02d837e7e..37f798c4f 100644 --- a/src/designer/src/lib/shared/codedialog_p.h +++ b/src/designer/src/lib/shared/codedialog_p.h @@ -55,7 +55,7 @@ enum class UicLanguage; class QDESIGNER_SHARED_EXPORT CodeDialog : public QDialog { Q_OBJECT - explicit CodeDialog(QWidget *parent = 0); + explicit CodeDialog(QWidget *parent = nullptr); public: ~CodeDialog() override; diff --git a/src/designer/src/lib/shared/connectionedit.cpp b/src/designer/src/lib/shared/connectionedit.cpp index 11bfcb4e7..e9064dced 100644 --- a/src/designer/src/lib/shared/connectionedit.cpp +++ b/src/designer/src/lib/shared/connectionedit.cpp @@ -281,8 +281,8 @@ void SetEndPointCommand::undo() Connection::Connection(ConnectionEdit *edit) : m_source_pos(QPoint(-1, -1)), m_target_pos(QPoint(-1, -1)), - m_source(0), - m_target(0), + m_source(nullptr), + m_target(nullptr), m_edit(edit), m_visible(true) { @@ -309,7 +309,7 @@ void Connection::updateVisibility() QWidget *source = widget(EndPoint::Source); QWidget *target = widget(EndPoint::Target); - if (source == 0 || target == 0) { + if (source == nullptr || target == nullptr) { setVisible(false); return; } @@ -342,7 +342,7 @@ bool Connection::isVisible() const bool Connection::ground() const { - return m_target != 0 && m_target == m_edit->m_bg_widget; + return m_target != nullptr && m_target == m_edit->m_bg_widget; } QPoint Connection::endPointPos(EndPoint::Type type) const @@ -448,13 +448,13 @@ void Connection::updateKneeList() m_knee_list.clear(); m_arrow_head.clear(); - if (m_source == 0 || s == QPoint(-1, -1) || t == QPoint(-1, -1)) + if (m_source == nullptr || s == QPoint(-1, -1) || t == QPoint(-1, -1)) return; const QRect r = sr | tr; m_knee_list.append(s); - if (m_target == 0) { + if (m_target == nullptr) { m_knee_list.append(QPoint(t.x(), s.y())); } else if (m_target == m_edit->m_bg_widget) { m_knee_list.append(QPoint(s.x(), t.y())); @@ -629,7 +629,7 @@ void Connection::updateKneeList() void Connection::trimLine() { - if (m_source == 0 || m_source_pos == QPoint(-1, -1) || m_target_pos == QPoint(-1, -1)) + if (m_source == nullptr || m_source_pos == QPoint(-1, -1) || m_target_pos == QPoint(-1, -1)) return; int cnt = m_knee_list.size(); if (cnt < 2) @@ -741,9 +741,9 @@ void Connection::update(bool update_widgets) const { m_edit->update(region()); if (update_widgets) { - if (m_source != 0) + if (m_source != nullptr) m_edit->update(m_source_rect); - if (m_target != 0) + if (m_target != nullptr) m_edit->update(m_target_rect); } @@ -926,12 +926,12 @@ void Connection::checkWidgets() ConnectionEdit::ConnectionEdit(QWidget *parent, QDesignerFormWindowInterface *form) : QWidget(parent), - m_bg_widget(0), + m_bg_widget(nullptr), m_undo_stack(form->commandHistory()), m_enable_update_background(false), - m_tmp_con(0), + m_tmp_con(nullptr), m_start_connection_on_drag(true), - m_widget_under_mouse(0), + m_widget_under_mouse(nullptr), m_inactive_color(Qt::blue), m_active_color(Qt::red) { @@ -951,9 +951,9 @@ void ConnectionEdit::clear() { m_con_list.clear(); m_sel_con_set.clear(); - m_bg_widget = 0; - m_widget_under_mouse = 0; - m_tmp_con = 0; + m_bg_widget = nullptr; + m_widget_under_mouse = nullptr; + m_tmp_con = nullptr; } void ConnectionEdit::setBackground(QWidget *background) @@ -977,7 +977,7 @@ void ConnectionEdit::enableUpdateBackground(bool enable) void ConnectionEdit::updateBackground() { // Might happen while reloading a form. - if (m_bg_widget == 0) + if (m_bg_widget == nullptr) return; if (!m_enable_update_background) @@ -992,10 +992,10 @@ void ConnectionEdit::updateBackground() QWidget *ConnectionEdit::widgetAt(const QPoint &pos) const { - if (m_bg_widget == 0) - return 0; + if (m_bg_widget == nullptr) + return nullptr; QWidget *widget = m_bg_widget->childAt(pos); - if (widget == 0) + if (widget == nullptr) widget = m_bg_widget; return widget; @@ -1004,7 +1004,7 @@ QWidget *ConnectionEdit::widgetAt(const QPoint &pos) const QRect ConnectionEdit::widgetRect(QWidget *w) const { - if (w == 0) + if (w == nullptr) return QRect(); QRect r = w->geometry(); QPoint pos = w->mapToGlobal(QPoint(0, 0)); @@ -1015,7 +1015,7 @@ QRect ConnectionEdit::widgetRect(QWidget *w) const ConnectionEdit::State ConnectionEdit::state() const { - if (m_tmp_con != 0) + if (m_tmp_con != nullptr) return Connecting; if (!m_drag_end_point.isNull()) return Dragging; @@ -1047,10 +1047,10 @@ void ConnectionEdit::paintConnection(QPainter *p, Connection *con, p->setPen(heavy ? m_active_color : m_inactive_color); con->paint(p); - if (source != 0 && source != m_bg_widget) + if (source != nullptr && source != m_bg_widget) set->insert(source, source); - if (target != 0 && target != m_bg_widget) + if (target != nullptr && target != m_bg_widget) set->insert(target, target); } @@ -1068,7 +1068,7 @@ void ConnectionEdit::paintEvent(QPaintEvent *e) paintConnection(&p, con, &heavy_highlight_set, &light_highlight_set); } - if (m_tmp_con != 0) + if (m_tmp_con != nullptr) paintConnection(&p, m_tmp_con, &heavy_highlight_set, &light_highlight_set); if (!m_widget_under_mouse.isNull() && m_widget_under_mouse != m_bg_widget) @@ -1110,7 +1110,7 @@ void ConnectionEdit::paintEvent(QPaintEvent *e) paintEndPoint(&p, con->endPointPos(EndPoint::Source)); - if (con->widget(EndPoint::Target) != 0) + if (con->widget(EndPoint::Target) != nullptr) paintEndPoint(&p, con->endPointPos(EndPoint::Target)); } } @@ -1119,12 +1119,12 @@ void ConnectionEdit::abortConnection() { m_tmp_con->update(); delete m_tmp_con; - m_tmp_con = 0; + m_tmp_con = nullptr; #if QT_CONFIG(cursor) setCursor(QCursor()); #endif if (m_widget_under_mouse == m_bg_widget) - m_widget_under_mouse = 0; + m_widget_under_mouse = nullptr; } void ConnectionEdit::mousePressEvent(QMouseEvent *e) @@ -1140,7 +1140,7 @@ void ConnectionEdit::mousePressEvent(QMouseEvent *e) e->accept(); // Prefer a non-background widget over the connection, // otherwise, widgets covered by the connection labels cannot be accessed - Connection *con_under_mouse = 0; + Connection *con_under_mouse = nullptr; if (!m_widget_under_mouse || m_widget_under_mouse == m_bg_widget) con_under_mouse = connectionAt(e->pos()); @@ -1157,7 +1157,7 @@ void ConnectionEdit::mousePressEvent(QMouseEvent *e) if (!(e->modifiers() & Qt::ShiftModifier)) { startDrag(m_end_point_under_mouse, e->pos()); } - } else if (con_under_mouse != 0) { + } else if (con_under_mouse != nullptr) { if (!(e->modifiers() & Qt::ShiftModifier)) { selectNone(); setSelected(con_under_mouse, true); @@ -1234,9 +1234,9 @@ void ConnectionEdit::findObjectsUnderMouse(const QPoint &pos) // Prefer a non-background widget over the connection, // otherwise, widgets covered by the connection labels cannot be accessed if (w == m_bg_widget && con_under_mouse) - w = 0; + w = nullptr; else - con_under_mouse = 0; + con_under_mouse = nullptr; if (w != m_widget_under_mouse) { if (!m_widget_under_mouse.isNull()) @@ -1302,7 +1302,7 @@ void ConnectionEdit::keyPressEvent(QKeyEvent *e) void ConnectionEdit::startConnection(QWidget *source, const QPoint &pos) { - Q_ASSERT(m_tmp_con == 0); + Q_ASSERT(m_tmp_con == nullptr); m_tmp_con = new Connection(this); m_tmp_con->setEndPoint(EndPoint::Source, source, pos); @@ -1310,17 +1310,17 @@ void ConnectionEdit::startConnection(QWidget *source, const QPoint &pos) void ConnectionEdit::endConnection(QWidget *target, const QPoint &pos) { - Q_ASSERT(m_tmp_con != 0); + Q_ASSERT(m_tmp_con != nullptr); m_tmp_con->setEndPoint(EndPoint::Target, target, pos); QWidget *source = m_tmp_con->widget(EndPoint::Source); - Q_ASSERT(source != 0); - Q_ASSERT(target != 0); + Q_ASSERT(source != nullptr); + Q_ASSERT(target != nullptr); setEnabled(false); Connection *new_con = createConnection(source, target); setEnabled(true); - if (new_con != 0) { + if (new_con != nullptr) { new_con->setEndPoint(EndPoint::Source, source, m_tmp_con->endPointPos(EndPoint::Source)); new_con->setEndPoint(EndPoint::Target, target, m_tmp_con->endPointPos(EndPoint::Target)); m_undo_stack->push(new AddConnectionCommand(this, new_con)); @@ -1328,14 +1328,14 @@ void ConnectionEdit::endConnection(QWidget *target, const QPoint &pos) } delete m_tmp_con; - m_tmp_con = 0; + m_tmp_con = nullptr; findObjectsUnderMouse(mapFromGlobal(QCursor::pos())); } void ConnectionEdit::continueConnection(QWidget *target, const QPoint &pos) { - Q_ASSERT(m_tmp_con != 0); + Q_ASSERT(m_tmp_con != nullptr); m_tmp_con->setEndPoint(EndPoint::Target, target, pos); } @@ -1441,7 +1441,7 @@ Connection *ConnectionEdit::connectionAt(const QPoint &pos) const if (con->contains(pos)) return con; } - return 0; + return nullptr; } CETypes::EndPoint ConnectionEdit::endPointAt(const QPoint &pos) const @@ -1521,10 +1521,10 @@ void ConnectionEdit::resizeEvent(QResizeEvent *e) void ConnectionEdit::setSource(Connection *con, const QString &obj_name) { - QObject *object = 0; + QObject *object = nullptr; if (!obj_name.isEmpty()) { object = m_bg_widget->findChild<QObject*>(obj_name); - if (object == 0 && m_bg_widget->objectName() == obj_name) + if (object == nullptr && m_bg_widget->objectName() == obj_name) object = m_bg_widget; if (object == con->object(EndPoint::Source)) @@ -1535,10 +1535,10 @@ void ConnectionEdit::setSource(Connection *con, const QString &obj_name) void ConnectionEdit::setTarget(Connection *con, const QString &obj_name) { - QObject *object = 0; + QObject *object = nullptr; if (!obj_name.isEmpty()) { object = m_bg_widget->findChild<QObject*>(obj_name); - if (object == 0 && m_bg_widget->objectName() == obj_name) + if (object == nullptr && m_bg_widget->objectName() == obj_name) object = m_bg_widget; if (object == con->object(EndPoint::Target)) @@ -1550,7 +1550,7 @@ void ConnectionEdit::setTarget(Connection *con, const QString &obj_name) Connection *ConnectionEdit::takeConnection(Connection *con) { if (!m_con_list.contains(con)) - return 0; + return nullptr; m_con_list.removeAll(con); return con; } @@ -1558,7 +1558,7 @@ Connection *ConnectionEdit::takeConnection(Connection *con) void ConnectionEdit::clearNewlyAddedConnection() { delete m_tmp_con; - m_tmp_con = 0; + m_tmp_con = nullptr; } void ConnectionEdit::createContextMenu(QMenu &menu) diff --git a/src/designer/src/lib/shared/connectionedit_p.h b/src/designer/src/lib/shared/connectionedit_p.h index 1b9e37dba..c17057d27 100644 --- a/src/designer/src/lib/shared/connectionedit_p.h +++ b/src/designer/src/lib/shared/connectionedit_p.h @@ -74,7 +74,7 @@ public: class EndPoint { public: enum Type { Source, Target }; - explicit EndPoint(Connection *_con = 0, Type _type = Source) : con(_con), type(_type) {} + explicit EndPoint(Connection *_con = nullptr, Type _type = Source) : con(_con), type(_type) {} bool isNull() const { return con == 0; } bool operator == (const EndPoint &other) const { return con == other.con && type == other.type; } bool operator != (const EndPoint &other) const { return !operator == (other); } diff --git a/src/designer/src/lib/shared/dialoggui_p.h b/src/designer/src/lib/shared/dialoggui_p.h index c6d99e3f0..0dde0b34e 100644 --- a/src/designer/src/lib/shared/dialoggui_p.h +++ b/src/designer/src/lib/shared/dialoggui_p.h @@ -72,13 +72,13 @@ public: QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton) override; - QString getExistingDirectory(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), QFileDialog::Options options = QFileDialog::ShowDirsOnly) override; - QString getOpenFileName(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0) override; - QStringList getOpenFileNames(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0) override; - QString getSaveFileName(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0) override; + QString getExistingDirectory(QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString(), QFileDialog::Options options = QFileDialog::ShowDirsOnly) override; + QString getOpenFileName(QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = nullptr, QFileDialog::Options options = nullptr) override; + QStringList getOpenFileNames(QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = nullptr, QFileDialog::Options options = nullptr) override; + QString getSaveFileName(QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = nullptr, QFileDialog::Options options = nullptr) override; - QString getOpenImageFileName(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0) override; - QStringList getOpenImageFileNames(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0) override; + QString getOpenImageFileName(QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = nullptr, QFileDialog::Options options = nullptr) override; + QStringList getOpenImageFileNames(QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = nullptr, QFileDialog::Options options = nullptr) override; private: QFileIconProvider *ensureIconProvider(); diff --git a/src/designer/src/lib/shared/extensionfactory_p.h b/src/designer/src/lib/shared/extensionfactory_p.h index 0f853fc2e..b1afaf66a 100644 --- a/src/designer/src/lib/shared/extensionfactory_p.h +++ b/src/designer/src/lib/shared/extensionfactory_p.h @@ -52,7 +52,7 @@ template <class ExtensionInterface, class Object, class Extension> class ExtensionFactory: public QExtensionFactory { public: - explicit ExtensionFactory(const QString &iid, QExtensionManager *parent = 0); + explicit ExtensionFactory(const QString &iid, QExtensionManager *parent = nullptr); // Convenience for registering the extension. Do not use for derived classes. static void registerExtension(QExtensionManager *mgr, const QString &iid); @@ -85,11 +85,11 @@ template <class ExtensionInterface, class Object, class Extension> QObject *ExtensionFactory<ExtensionInterface, Object, Extension>::createExtension(QObject *qObject, const QString &iid, QObject *parent) const { if (iid != m_iid) - return 0; + return nullptr; Object *object = checkObject(qObject); if (!object) - return 0; + return nullptr; return new Extension(object, parent); } diff --git a/src/designer/src/lib/shared/formlayoutmenu.cpp b/src/designer/src/lib/shared/formlayoutmenu.cpp index 0dd0e57c5..e8948ab6e 100644 --- a/src/designer/src/lib/shared/formlayoutmenu.cpp +++ b/src/designer/src/lib/shared/formlayoutmenu.cpp @@ -370,7 +370,7 @@ QStringList FormLayoutRowDialog::fieldWidgetClasses(QDesignerFormEditorInterface // multimap of base class->custom widgets unless we have a language // extension installed which might do funny things with custom widgets. ClassMap customClassMap; - if (qt_extension<QDesignerLanguageExtension *>(core->extensionManager(), core) == 0) { + if (qt_extension<QDesignerLanguageExtension *>(core->extensionManager(), core) == nullptr) { const QDesignerWidgetDataBaseInterface *wdb = core->widgetDataBase(); const int wdbCount = wdb->count(); for (int w = 0; w < wdbCount; ++w) { @@ -398,10 +398,10 @@ QStringList FormLayoutRowDialog::fieldWidgetClasses(QDesignerFormEditorInterface static QFormLayout *managedFormLayout(const QDesignerFormEditorInterface *core, const QWidget *w) { - QLayout *l = 0; + QLayout *l = nullptr; if (LayoutInfo::managedLayoutType(core, w, &l) == LayoutInfo::Form) return qobject_cast<QFormLayout *>(l); - return 0; + return nullptr; } // Create the widgets of a control row and apply text properties contained @@ -485,7 +485,7 @@ void FormLayoutMenu::populate(QWidget *w, QDesignerFormWindowInterface *fw, Acti m_widget = w; break; default: - m_widget = 0; + m_widget = nullptr; break; } } @@ -511,7 +511,7 @@ QAction *FormLayoutMenu::preferredEditAction(QWidget *w, QDesignerFormWindowInte m_widget = w; return m_populateFormAction; } - return 0; + return nullptr; } } diff --git a/src/designer/src/lib/shared/formwindowbase.cpp b/src/designer/src/lib/shared/formwindowbase.cpp index 47f64829b..73a468b2b 100644 --- a/src/designer/src/lib/shared/formwindowbase.cpp +++ b/src/designer/src/lib/shared/formwindowbase.cpp @@ -90,9 +90,9 @@ FormWindowBasePrivate::FormWindowBasePrivate(QDesignerFormEditorInterface *core) m_feature(QDesignerFormWindowInterface::DefaultFeature), m_grid(m_defaultGrid), m_hasFormGrid(false), - m_pixmapCache(0), - m_iconCache(0), - m_resourceSet(0), + m_pixmapCache(nullptr), + m_iconCache(nullptr), + m_resourceSet(nullptr), m_deviceProfile(QDesignerSharedSettings(core).currentDeviceProfile()), m_lineTerminatorMode(FormWindowBase::NativeLineTerminator), m_saveResourcesBehaviour(FormWindowBase::SaveAllResourceFiles), @@ -398,7 +398,7 @@ const Grid &FormWindowBase::defaultDesignerGrid() QMenu *FormWindowBase::initializePopupMenu(QWidget * /*managedWidget*/) { - return 0; + return nullptr; } // Widget under mouse for finding the Widget to highlight @@ -412,13 +412,13 @@ QWidget *FormWindowBase::widgetUnderMouse(const QPoint &formPos, WidgetUnderMous // the actual widget that's part of the edited GUI. QWidget *rc = widgetAt(formPos); if (!rc || qobject_cast<ConnectionEdit*>(rc)) - return 0; + return nullptr; if (rc == mainContainer()) { // Refuse main container areas if the main container has a container extension, // for example when hitting QToolBox/QTabWidget empty areas. if (qt_extension<QDesignerContainerExtension*>(core()->extensionManager(), rc)) - return 0; + return nullptr; return rc; } @@ -430,12 +430,12 @@ QWidget *FormWindowBase::widgetUnderMouse(const QPoint &formPos, WidgetUnderMous // make sure the position is within the current page const int ci = c->currentIndex(); if (ci < 0) - return 0; + return nullptr; QWidget *page = c->widget(ci); QRect pageGeometry = page->geometry(); pageGeometry.moveTo(page->mapTo(this, pageGeometry.topLeft())); if (!pageGeometry.contains(formPos)) - return 0; + return nullptr; return page; } @@ -477,7 +477,7 @@ QMenu *FormWindowBase::createExtensionTaskMenu(QDesignerFormWindowInterface *fw, actions += intTaskMenu->taskActions(); } if (actions.empty()) - return 0; + return nullptr; if (trailingSeparator && !actions.back()->isSeparator()) { QAction *a = new QAction(fw); a->setSeparator(true); diff --git a/src/designer/src/lib/shared/formwindowbase_p.h b/src/designer/src/lib/shared/formwindowbase_p.h index d6cf094a9..b1e8a2f40 100644 --- a/src/designer/src/lib/shared/formwindowbase_p.h +++ b/src/designer/src/lib/shared/formwindowbase_p.h @@ -70,7 +70,8 @@ class QDESIGNER_SHARED_EXPORT FormWindowBase: public QDesignerFormWindowInterfac public: enum HighlightMode { Restore, Highlight }; - explicit FormWindowBase(QDesignerFormEditorInterface *core, QWidget *parent = 0, Qt::WindowFlags flags = 0); + explicit FormWindowBase(QDesignerFormEditorInterface *core, QWidget *parent = nullptr, + Qt::WindowFlags flags = {}); ~FormWindowBase() override; QVariantMap formData(); diff --git a/src/designer/src/lib/shared/gridpanel_p.h b/src/designer/src/lib/shared/gridpanel_p.h index 997c6d41c..c468caaf8 100644 --- a/src/designer/src/lib/shared/gridpanel_p.h +++ b/src/designer/src/lib/shared/gridpanel_p.h @@ -58,7 +58,7 @@ class QDESIGNER_SHARED_EXPORT GridPanel : public QWidget { Q_OBJECT public: - GridPanel(QWidget *parent = 0); + GridPanel(QWidget *parent = nullptr); ~GridPanel(); void setTitle(const QString &title); diff --git a/src/designer/src/lib/shared/iconselector.cpp b/src/designer/src/lib/shared/iconselector.cpp index d2bf33a13..d9d50e782 100644 --- a/src/designer/src/lib/shared/iconselector.cpp +++ b/src/designer/src/lib/shared/iconselector.cpp @@ -85,7 +85,7 @@ private: }; LanguageResourceDialogPrivate::LanguageResourceDialogPrivate(QDesignerResourceBrowserInterface *rb) : - q_ptr(0), + q_ptr(nullptr), m_browser(rb), m_dialogButtonBox(new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel)) { @@ -158,11 +158,11 @@ QString LanguageResourceDialog::currentPath() const LanguageResourceDialog* LanguageResourceDialog::create(QDesignerFormEditorInterface *core, QWidget *parent) { if (QDesignerLanguageExtension *lang = qt_extension<QDesignerLanguageExtension *>(core->extensionManager(), core)) - if (QDesignerResourceBrowserInterface *rb = lang->createResourceBrowser(0)) + if (QDesignerResourceBrowserInterface *rb = lang->createResourceBrowser(nullptr)) return new LanguageResourceDialog(rb, parent); - if (QDesignerResourceBrowserInterface *rb = core->integration()->createResourceBrowser(0)) + if (QDesignerResourceBrowserInterface *rb = core->integration()->createResourceBrowser(nullptr)) return new LanguageResourceDialog(rb, parent); - return 0; + return nullptr; } // ------------ IconSelectorPrivate @@ -511,7 +511,7 @@ void IconSelector::setPixmapCache(DesignerPixmapCache *pixmapCache) // Validator for theme line edit, accepts empty or non-blank strings. class BlankSuppressingValidator : public QValidator { public: - explicit BlankSuppressingValidator(QObject * parent = 0) : QValidator(parent) {} + explicit BlankSuppressingValidator(QObject * parent = nullptr) : QValidator(parent) {} State validate(QString &input, int &pos) const override { @@ -591,7 +591,7 @@ void IconThemeEditor::updatePreview(const QString &t) // Update preview label with icon. if (t.isEmpty() || !QIcon::hasThemeIcon(t)) { // Empty const QPixmap *currentPixmap = d->m_themeLabel->pixmap(); - if (currentPixmap == 0 || currentPixmap->cacheKey() != d->m_emptyPixmap.cacheKey()) + if (currentPixmap == nullptr || currentPixmap->cacheKey() != d->m_emptyPixmap.cacheKey()) d->m_themeLabel->setPixmap(d->m_emptyPixmap); } else { const QIcon icon = QIcon::fromTheme(t); diff --git a/src/designer/src/lib/shared/iconselector_p.h b/src/designer/src/lib/shared/iconselector_p.h index 59bcaf95f..3aed59164 100644 --- a/src/designer/src/lib/shared/iconselector_p.h +++ b/src/designer/src/lib/shared/iconselector_p.h @@ -67,7 +67,7 @@ class QDESIGNER_SHARED_EXPORT LanguageResourceDialog : public QDialog { Q_OBJECT - explicit LanguageResourceDialog(QDesignerResourceBrowserInterface *rb, QWidget *parent = 0); + explicit LanguageResourceDialog(QDesignerResourceBrowserInterface *rb, QWidget *parent = nullptr); public: ~LanguageResourceDialog() override; @@ -90,7 +90,7 @@ class QDESIGNER_SHARED_EXPORT IconSelector: public QWidget { Q_OBJECT public: - IconSelector(QWidget *parent = 0); + IconSelector(QWidget *parent = nullptr); ~IconSelector() override; void setFormEditor(QDesignerFormEditorInterface *core); // required for dialog gui. @@ -102,7 +102,7 @@ public: // Check whether a pixmap may be read enum CheckMode { CheckFast, CheckFully }; - static bool checkPixmap(const QString &fileName, CheckMode cm = CheckFully, QString *errorMessage = 0); + static bool checkPixmap(const QString &fileName, CheckMode cm = CheckFully, QString *errorMessage = nullptr); // Choose a pixmap from file static QString choosePixmapFile(const QString &directory, QDesignerDialogGuiInterface *dlgGui, QWidget *parent); // Choose a pixmap from resource; use language-dependent resource browser if present @@ -130,7 +130,7 @@ class QDESIGNER_SHARED_EXPORT IconThemeEditor : public QWidget Q_OBJECT Q_PROPERTY(QString theme READ theme WRITE setTheme DESIGNABLE true) public: - explicit IconThemeEditor(QWidget *parent = 0, bool wantResetButton = true); + explicit IconThemeEditor(QWidget *parent = nullptr, bool wantResetButton = true); ~IconThemeEditor() override; QString theme() const; diff --git a/src/designer/src/lib/shared/invisible_widget_p.h b/src/designer/src/lib/shared/invisible_widget_p.h index fbbaf4c92..423e5d293 100644 --- a/src/designer/src/lib/shared/invisible_widget_p.h +++ b/src/designer/src/lib/shared/invisible_widget_p.h @@ -52,7 +52,7 @@ class QDESIGNER_SHARED_EXPORT InvisibleWidget: public QWidget { Q_OBJECT public: - InvisibleWidget(QWidget *parent = 0); + InvisibleWidget(QWidget *parent = nullptr); }; } // namespace qdesigner_internal diff --git a/src/designer/src/lib/shared/layout.cpp b/src/designer/src/lib/shared/layout.cpp index f11600737..261ddedfe 100644 --- a/src/designer/src/lib/shared/layout.cpp +++ b/src/designer/src/lib/shared/layout.cpp @@ -144,7 +144,7 @@ void Layout::setup() QWidget *p = w->parentWidget(); if (p && LayoutInfo::layoutType(m_formWindow->core(), p) != LayoutInfo::NoLayout - && m_formWindow->core()->metaDataBase()->item(p->layout()) != 0) + && m_formWindow->core()->metaDataBase()->item(p->layout()) != nullptr) continue; lists.insert(p, w); @@ -218,7 +218,7 @@ bool Layout::prepareLayout(bool &needMove, bool &needReparent) QDesignerWidgetFactoryInterface *widgetFactory = m_formWindow->core()->widgetFactory(); QDesignerMetaDataBaseInterface *metaDataBase = m_formWindow->core()->metaDataBase(); - if (m_layoutBase == 0) { + if (m_layoutBase == nullptr) { const bool useSplitter = m_layoutType == LayoutInfo::HSplitter || m_layoutType == LayoutInfo::VSplitter; const QString baseWidgetClassName = useSplitter ? QLatin1String("QSplitter") : QLatin1String("QLayoutWidget"); m_layoutBase = widgetFactory->createWidget(baseWidgetClassName, widgetFactory->containerOfWidget(m_parentWidget)); @@ -232,7 +232,7 @@ bool Layout::prepareLayout(bool &needMove, bool &needReparent) metaDataBase->add(m_layoutBase); - Q_ASSERT(m_layoutBase->layout() == 0 || metaDataBase->item(m_layoutBase->layout()) == 0); + Q_ASSERT(m_layoutBase->layout() == nullptr || metaDataBase->item(m_layoutBase->layout()) == nullptr); return true; } @@ -247,7 +247,7 @@ static bool isPageOfContainerWidget(QDesignerFormWindowInterface *fw, QWidget *w QDesignerContainerExtension *c = qt_extension<QDesignerContainerExtension*>( fw->core()->extensionManager(), widget->parentWidget()); - if (c != 0) { + if (c != nullptr) { for (int i = 0; i<c->count(); ++i) { if (widget == c->widget(i)) return true; @@ -392,7 +392,7 @@ void Layout::breakLayout() for (auto it = rects.cbegin(), end = rects.cend(); it != end; ++it) { QWidget *w = it.key(); if (needReparent) { - w->setParent(m_layoutBase->parentWidget(), 0); + w->setParent(m_layoutBase->parentWidget(), nullptr); w->move(m_layoutBasePos + it.value().topLeft()); w->show(); } @@ -438,7 +438,7 @@ static QString suggestLayoutName(const char *className) QLayout *Layout::createLayout(int type) { Q_ASSERT(m_layoutType != LayoutInfo::HSplitter && m_layoutType != LayoutInfo::VSplitter); - QLayout *layout = m_formWindow->core()->widgetFactory()->createLayout(m_layoutBase, 0, type); + QLayout *layout = m_formWindow->core()->widgetFactory()->createLayout(m_layoutBase, nullptr, type); // set a name layout->setObjectName(suggestLayoutName(layout->metaObject()->className())); m_formWindow->ensureUniqueObjectName(layout); @@ -456,7 +456,7 @@ QLayout *Layout::createLayout(int type) void Layout::reparentToLayoutBase(QWidget *w) { if (w->parent() != m_layoutBase) { - w->setParent(m_layoutBase, 0); + w->setParent(m_layoutBase, nullptr); w->move(QPoint(0,0)); } } @@ -562,7 +562,7 @@ void SplitterLayout::doLayout() return; QSplitter *splitter = qobject_cast<QSplitter*>(layoutBaseWidget()); - Q_ASSERT(splitter != 0); + Q_ASSERT(splitter != nullptr); const QWidgetList::const_iterator cend = widgets().constEnd(); @@ -635,7 +635,7 @@ Grid::Grid(Mode mode) : m_mode(mode), m_nrows(0), m_ncols(0), - m_cells(0) + m_cells(nullptr) { } @@ -647,12 +647,12 @@ Grid::~Grid() void Grid::resize(int nrows, int ncols) { delete [] m_cells; - m_cells = 0; + m_cells = nullptr; m_nrows = nrows; m_ncols = ncols; if (const int allocSize = m_nrows * m_ncols) { m_cells = new QWidget*[allocSize]; - std::fill(m_cells, m_cells + allocSize, static_cast<QWidget *>(0)); + std::fill(m_cells, m_cells + allocSize, nullptr); } } @@ -910,7 +910,7 @@ void Grid::shrink() return; // reallocate and copy omitting the empty cells QWidget **simplifiedCells = new QWidget*[simplifiedNCols * simplifiedNRows]; - std::fill(simplifiedCells, simplifiedCells + simplifiedNCols * simplifiedNRows, static_cast<QWidget *>(0)); + std::fill(simplifiedCells, simplifiedCells + simplifiedNCols * simplifiedNRows, nullptr); QWidget **simplifiedPtr = simplifiedCells; for (int r = 0; r < m_nrows; r++) @@ -962,7 +962,7 @@ bool Grid::shrinkFormLayoutSpans() for (int j = col; j < col + colspan - 1; j++) if (i > row + newColSpan - 1 || j > col + newRowSpan - 1) if (cell(i, j) == w) - setCell(i, j, 0); + setCell(i, j, nullptr); shrunk = true; } } @@ -983,9 +983,9 @@ void Grid::reallocFormLayout() for (int r = 0; r < m_nrows; r++) { // Try to find a column where the form columns are empty and // there are widgets further to the right. - if (cell(r, 0) == 0 && cell(r, 1) == 0) { + if (cell(r, 0) == nullptr && cell(r, 1) == nullptr) { int sourceCol = FormLayoutColumns; - QWidget *firstWidget = 0; + QWidget *firstWidget = nullptr; for ( ; sourceCol < m_ncols; sourceCol++) if (QWidget *w = cell(r, sourceCol)) { firstWidget = w; @@ -999,7 +999,7 @@ void Grid::reallocFormLayout() setCell(r, targetCol++, w); // Pad with zero for ( ; targetCol < m_ncols; targetCol++) - setCell(r, targetCol, 0); + setCell(r, targetCol, nullptr); } } // Any protruding widgets left on that row? @@ -1011,7 +1011,7 @@ void Grid::reallocFormLayout() // Reallocate with 2 columns. Just insert the protruding ones as fields. const int formNRows = m_nrows + pastRightWidgetCount; QWidget **formCells = new QWidget*[FormLayoutColumns * formNRows]; - std::fill(formCells, formCells + FormLayoutColumns * formNRows, static_cast<QWidget *>(0)); + std::fill(formCells, formCells + FormLayoutColumns * formNRows, nullptr); QWidget **formPtr = formCells; const int matchingColumns = qMin(m_ncols, static_cast<int>(FormLayoutColumns)); for (int r = 0; r < m_nrows; r++) { @@ -1104,7 +1104,7 @@ void GridLayout<GridLikeLayout, LayoutType, GridMode>::doLayout() if (needReparent) reparentToLayoutBase(w); - Qt::Alignment alignment = Qt::Alignment(0); + Qt::Alignment alignment = Qt::Alignment(nullptr); if (const Spacer *spacer = qobject_cast<const Spacer*>(w)) alignment = spacer->alignment(); @@ -1245,7 +1245,7 @@ Layout* Layout::createLayout(const QWidgetList &widgets, QWidget *parentWidget, break; } Q_ASSERT(0); - return 0; + return nullptr; } } // namespace qdesigner_internal diff --git a/src/designer/src/lib/shared/layout_p.h b/src/designer/src/lib/shared/layout_p.h index 2b97fb823..8e39de0c0 100644 --- a/src/designer/src/lib/shared/layout_p.h +++ b/src/designer/src/lib/shared/layout_p.h @@ -89,7 +89,7 @@ public: void setReparentLayoutWidget(bool v) { m_reparentLayoutWidget = v; } protected: - virtual void finishLayout(bool needMove, QLayout *layout = 0); + virtual void finishLayout(bool needMove, QLayout *layout = nullptr); virtual bool prepareLayout(bool &needMove, bool &needReparent); void setWidgets(const QWidgetList &widgets) { m_widgets = widgets; } diff --git a/src/designer/src/lib/shared/layoutinfo.cpp b/src/designer/src/lib/shared/layoutinfo.cpp index 4fce2584d..30cfabfda 100644 --- a/src/designer/src/lib/shared/layoutinfo.cpp +++ b/src/designer/src/lib/shared/layoutinfo.cpp @@ -99,7 +99,7 @@ LayoutInfo::Type LayoutInfo::managedLayoutType(const QDesignerFormEditorInterfac QLayout **ptrToLayout) { if (ptrToLayout) - *ptrToLayout = 0; + *ptrToLayout = nullptr; if (const QSplitter *splitter = qobject_cast<const QSplitter *>(w)) return splitter->orientation() == Qt::Horizontal ? HSplitter : VSplitter; QLayout *layout = managedLayout(core, w); @@ -121,7 +121,7 @@ QWidget *LayoutInfo::layoutParent(const QDesignerFormEditorInterface *core, QLay o = o->parent(); } - return 0; + return nullptr; } void LayoutInfo::deleteLayout(const QDesignerFormEditorInterface *core, QWidget *widget) @@ -129,11 +129,11 @@ void LayoutInfo::deleteLayout(const QDesignerFormEditorInterface *core, QWidget if (QDesignerContainerExtension *container = qt_extension<QDesignerContainerExtension*>(core->extensionManager(), widget)) widget = container->widget(container->currentIndex()); - Q_ASSERT(widget != 0); + Q_ASSERT(widget != nullptr); QLayout *layout = managedLayout(core, widget); - if (layout == 0 || core->metaDataBase()->item(layout) != 0) { + if (layout == nullptr || core->metaDataBase()->item(layout) != nullptr) { delete layout; widget->updateGeometry(); return; @@ -150,7 +150,7 @@ LayoutInfo::Type LayoutInfo::laidoutWidgetType(const QDesignerFormEditorInterfac if (isManaged) *isManaged = false; if (ptrToLayout) - *ptrToLayout = 0; + *ptrToLayout = nullptr; QWidget *parent = widget->parentWidget(); if (!parent) @@ -203,12 +203,12 @@ QLayout *LayoutInfo::internalLayout(const QWidget *widget) QLayout *LayoutInfo::managedLayout(const QDesignerFormEditorInterface *core, const QWidget *widget) { - if (widget == 0) - return 0; + if (widget == nullptr) + return nullptr; QLayout *layout = widget->layout(); if (!layout) - return 0; + return nullptr; return managedLayout(core, layout); } @@ -222,23 +222,23 @@ QLayout *LayoutInfo::managedLayout(const QDesignerFormEditorInterface *core, QLa /* This code exists mainly for the Q3GroupBox class, for which * widget->layout() returns an internal VBoxLayout. */ const QDesignerMetaDataBaseItemInterface *item = metaDataBase->item(layout); - if (item == 0) { + if (item == nullptr) { layout = layout->findChild<QLayout*>(); item = metaDataBase->item(layout); } if (!item) - return 0; + return nullptr; return layout; } // Is it a a dummy grid placeholder created by Designer? bool LayoutInfo::isEmptyItem(QLayoutItem *item) { - if (item == 0) { + if (item == nullptr) { qDebug() << "** WARNING Zero-item passed on to isEmptyItem(). This indicates a layout inconsistency."; return true; } - return item->spacerItem() != 0; + return item->spacerItem() != nullptr; } QDESIGNER_SHARED_EXPORT void getFormLayoutItemPosition(const QFormLayout *formLayout, int index, int *rowPtr, int *columnPtr, int *rowspanPtr, int *colspanPtr) @@ -273,7 +273,8 @@ QDESIGNER_SHARED_EXPORT void formLayoutAddWidget(QFormLayout *formLayout, QWidge if (spanning) { formLayout->insertRow(r.y(), w); } else { - QWidget *label = 0, *field = 0; + QWidget *label = nullptr; + QWidget *field = nullptr; if (r.x() == 0) { label = w; } else { diff --git a/src/designer/src/lib/shared/layoutinfo_p.h b/src/designer/src/lib/shared/layoutinfo_p.h index de3b80296..e5326203a 100644 --- a/src/designer/src/lib/shared/layoutinfo_p.h +++ b/src/designer/src/lib/shared/layoutinfo_p.h @@ -74,14 +74,14 @@ public: // Examines the immediate layout of the widget. static Type layoutType(const QDesignerFormEditorInterface *core, const QWidget *w); // Examines the managed layout of the widget - static Type managedLayoutType(const QDesignerFormEditorInterface *core, const QWidget *w, QLayout **layout = 0); + static Type managedLayoutType(const QDesignerFormEditorInterface *core, const QWidget *w, QLayout **layout = nullptr); static Type layoutType(const QDesignerFormEditorInterface *core, const QLayout *layout); static Type layoutType(const QString &typeName); static QString layoutName(Type t); static QWidget *layoutParent(const QDesignerFormEditorInterface *core, QLayout *layout); - static Type laidoutWidgetType(const QDesignerFormEditorInterface *core, QWidget *widget, bool *isManaged = 0, QLayout **layout = 0); + static Type laidoutWidgetType(const QDesignerFormEditorInterface *core, QWidget *widget, bool *isManaged = nullptr, QLayout **layout = nullptr); static bool inline isWidgetLaidout(const QDesignerFormEditorInterface *core, QWidget *widget) { return laidoutWidgetType(core, widget) != NoLayout; } static QLayout *managedLayout(const QDesignerFormEditorInterface *core, const QWidget *widget); @@ -92,7 +92,7 @@ public: static bool isEmptyItem(QLayoutItem *item); }; -QDESIGNER_SHARED_EXPORT void getFormLayoutItemPosition(const QFormLayout *formLayout, int index, int *rowPtr, int *columnPtr = 0, int *rowspanPtr = 0, int *colspanPtr = 0); +QDESIGNER_SHARED_EXPORT void getFormLayoutItemPosition(const QFormLayout *formLayout, int index, int *rowPtr, int *columnPtr = nullptr, int *rowspanPtr = nullptr, int *colspanPtr = nullptr); QDESIGNER_SHARED_EXPORT void formLayoutAddWidget(QFormLayout *formLayout, QWidget *w, const QRect &r, bool insert); } // namespace qdesigner_internal diff --git a/src/designer/src/lib/shared/metadatabase.cpp b/src/designer/src/lib/shared/metadatabase.cpp index 16a0066bb..ed0de8dd6 100644 --- a/src/designer/src/lib/shared/metadatabase.cpp +++ b/src/designer/src/lib/shared/metadatabase.cpp @@ -130,15 +130,15 @@ MetaDataBase::~MetaDataBase() MetaDataBaseItem *MetaDataBase::metaDataBaseItem(QObject *object) const { MetaDataBaseItem *i = m_items.value(object); - if (i == 0 || !i->enabled()) - return 0; + if (i == nullptr || !i->enabled()) + return nullptr; return i; } void MetaDataBase::add(QObject *object) { MetaDataBaseItem *item = m_items.value(object); - if (item != 0) { + if (item != nullptr) { item->setEnabled(true); if (debugMetaDatabase) { qDebug() << "MetaDataBase::add: Existing item for " << object->metaObject()->className() << item->name(); diff --git a/src/designer/src/lib/shared/metadatabase_p.h b/src/designer/src/lib/shared/metadatabase_p.h index a27d74fed..48dee4086 100644 --- a/src/designer/src/lib/shared/metadatabase_p.h +++ b/src/designer/src/lib/shared/metadatabase_p.h @@ -89,7 +89,7 @@ class QDESIGNER_SHARED_EXPORT MetaDataBase: public QDesignerMetaDataBaseInterfac { Q_OBJECT public: - explicit MetaDataBase(QDesignerFormEditorInterface *core, QObject *parent = 0); + explicit MetaDataBase(QDesignerFormEditorInterface *core, QObject *parent = nullptr); ~MetaDataBase() override; QDesignerFormEditorInterface *core() const override; diff --git a/src/designer/src/lib/shared/morphmenu.cpp b/src/designer/src/lib/shared/morphmenu.cpp index 5c346b367..a2627ed9a 100644 --- a/src/designer/src/lib/shared/morphmenu.cpp +++ b/src/designer/src/lib/shared/morphmenu.cpp @@ -229,12 +229,12 @@ QLabel *buddyLabelOf(QDesignerFormWindowInterface *fw, QWidget *w) typedef QList<QLabel*> LabelList; const LabelList labelList = fw->findChildren<QLabel*>(); if (labelList.empty()) - return 0; + return nullptr; const LabelList::const_iterator cend = labelList.constEnd(); for (LabelList::const_iterator it = labelList.constBegin(); it != cend; ++it ) if ( (*it)->buddy() == w) return *it; - return 0; + return nullptr; } // Replace widgets in a widget-list type dynamic property of the parent @@ -275,7 +275,7 @@ public: static QStringList candidateClasses(QDesignerFormWindowInterface *fw, QWidget *w); private: - static bool canMorph(QDesignerFormWindowInterface *fw, QWidget *w, int *childContainerCount = 0, MorphCategory *cat = 0); + static bool canMorph(QDesignerFormWindowInterface *fw, QWidget *w, int *childContainerCount = nullptr, MorphCategory *cat = nullptr); void morph(QWidget *before, QWidget *after); QWidget *m_beforeWidget; @@ -313,8 +313,8 @@ bool MorphWidgetCommand::addMorphMacro(QDesignerFormWindowInterface *fw, QWidget MorphWidgetCommand::MorphWidgetCommand(QDesignerFormWindowInterface *formWindow) : QDesignerFormWindowCommand(QString(), formWindow), - m_beforeWidget(0), - m_afterWidget(0) + m_beforeWidget(nullptr), + m_afterWidget(nullptr) { } @@ -443,13 +443,13 @@ void MorphWidgetCommand::morph(QWidget *before, QWidget *after) } else if (QSplitter *splitter = qobject_cast<QSplitter *>(parent)) { const int index = splitter->indexOf(before); before->hide(); - before->setParent(0); + before->setParent(nullptr); splitter->insertWidget(index, after); after->setParent(parent); after->setGeometry(oldGeom); } else { before->hide(); - before->setParent(0); + before->setParent(nullptr); after->setParent(parent); after->setGeometry(oldGeom); } @@ -495,7 +495,7 @@ bool MorphWidgetCommand::canMorph(QDesignerFormWindowInterface *fw, QWidget *w, // Check the parent relationship. We accept only managed parent widgets // with a single, managed layout in which widget is a member. QWidget *parent = w->parentWidget(); - if (parent == 0) + if (parent == nullptr) return false; if (QLayout *pl = LayoutInfo::managedLayout(core, parent)) if (pl->indexOf(w) < 0 || !core->metaDataBase()->item(pl)) @@ -572,8 +572,8 @@ void MorphMenu::slotMorph(const QString &newClassName) bool MorphMenu::populateMenu(QWidget *w, QDesignerFormWindowInterface *fw) { - m_widget = 0; - m_formWindow = 0; + m_widget = nullptr; + m_formWindow = nullptr; // Clear menu if (m_subMenuAction) { diff --git a/src/designer/src/lib/shared/morphmenu_p.h b/src/designer/src/lib/shared/morphmenu_p.h index 5a26734da..9e004ebe3 100644 --- a/src/designer/src/lib/shared/morphmenu_p.h +++ b/src/designer/src/lib/shared/morphmenu_p.h @@ -57,7 +57,7 @@ class QDESIGNER_SHARED_EXPORT MorphMenu : public QObject { public: typedef QList<QAction *> ActionList; - explicit MorphMenu(QObject *parent = 0); + explicit MorphMenu(QObject *parent = nullptr); void populate(QWidget *w, QDesignerFormWindowInterface *fw, ActionList& al); void populate(QWidget *w, QDesignerFormWindowInterface *fw, QMenu& m); diff --git a/src/designer/src/lib/shared/newformwidget.cpp b/src/designer/src/lib/shared/newformwidget.cpp index 39a025b87..4845e5945 100644 --- a/src/designer/src/lib/shared/newformwidget.cpp +++ b/src/designer/src/lib/shared/newformwidget.cpp @@ -126,8 +126,8 @@ NewFormWidget::NewFormWidget(QDesignerFormEditorInterface *core, QWidget *parent QDesignerNewFormWidgetInterface(parentWidget), m_core(core), m_ui(new Ui::NewFormWidget), - m_currentItem(0), - m_acceptedItem(0) + m_currentItem(nullptr), + m_acceptedItem(nullptr) { typedef void (QComboBox::*QComboIntSignal)(int); typedef QList<qdesigner_internal::DeviceProfile> DeviceProfileList; @@ -150,7 +150,7 @@ NewFormWidget::NewFormWidget(QDesignerFormEditorInterface *core, QWidget *parent // Resource templates const QString formTemplate = settings.formTemplate(); - QTreeWidgetItem *selectedItem = 0; + QTreeWidgetItem *selectedItem = nullptr; loadFrom(templatePath, true, uiExtension, formTemplate, selectedItem); // Additional template paths const QStringList formTemplatePaths = settings.formTemplatePaths(); @@ -166,7 +166,7 @@ NewFormWidget::NewFormWidget(QDesignerFormEditorInterface *core, QWidget *parent } // Still no selection - default to first item - if (selectedItem == 0 && m_ui->treeWidget->topLevelItemCount() != 0) { + if (selectedItem == nullptr && m_ui->treeWidget->topLevelItemCount() != 0) { QTreeWidgetItem *firstTopLevel = m_ui->treeWidget->topLevelItem(0); if (firstTopLevel->childCount() > 0) selectedItem = firstTopLevel->child(0); @@ -303,7 +303,7 @@ QImage NewFormWidget::grabForm(QDesignerFormEditorInterface *core, if (!workingDir.isEmpty()) formBuilder.setWorkingDirectory(workingDir); - QWidget *widget = formBuilder.load(&file, 0); + QWidget *widget = formBuilder.load(&file, nullptr); if (!widget) return QImage(); @@ -436,7 +436,7 @@ void NewFormWidget::loadFrom(const QString &path, bool resourceFile, const QStri QTreeWidgetItem *item = new QTreeWidgetItem(root); const QString text = it->baseName().replace(underscore, blank); - if (selectedItemFound == 0 && text == selectedItem) + if (selectedItemFound == nullptr && text == selectedItem) selectedItemFound = item; item->setText(0, text); item->setData(0, TemplateNameRole, it->absoluteFilePath()); @@ -456,7 +456,7 @@ void NewFormWidget::loadFrom(const QString &title, const QStringList &nameList, const QString text = *it; QTreeWidgetItem *item = new QTreeWidgetItem(root); item->setText(0, text); - if (selectedItemFound == 0 && text == selectedItem) + if (selectedItemFound == nullptr && text == selectedItem) selectedItemFound = item; item->setData(0, ClassNameRole, *it); } @@ -545,12 +545,12 @@ qdesigner_internal::DeviceProfile NewFormWidget::currentDeviceProfile() const bool NewFormWidget::hasCurrentTemplate() const { - return m_currentItem != 0; + return m_currentItem != nullptr; } QString NewFormWidget::currentTemplateI(QString *ptrToErrorMessage) { - if (m_currentItem == 0) { + if (m_currentItem == nullptr) { *ptrToErrorMessage = tr("Internal error: No template selected."); return QString(); } diff --git a/src/designer/src/lib/shared/newformwidget_p.h b/src/designer/src/lib/shared/newformwidget_p.h index b0a588461..293e0c907 100644 --- a/src/designer/src/lib/shared/newformwidget_p.h +++ b/src/designer/src/lib/shared/newformwidget_p.h @@ -77,7 +77,7 @@ public: ~NewFormWidget() override; bool hasCurrentTemplate() const override; - QString currentTemplate(QString *errorMessage = 0) override; + QString currentTemplate(QString *errorMessage = nullptr) override; // Convenience for implementing file dialogs with preview static QImage grabForm(QDesignerFormEditorInterface *core, diff --git a/src/designer/src/lib/shared/plaintexteditor_p.h b/src/designer/src/lib/shared/plaintexteditor_p.h index f255487f8..b628b8c0d 100644 --- a/src/designer/src/lib/shared/plaintexteditor_p.h +++ b/src/designer/src/lib/shared/plaintexteditor_p.h @@ -54,7 +54,7 @@ class QDESIGNER_SHARED_EXPORT PlainTextEditorDialog : public QDialog { Q_OBJECT public: - explicit PlainTextEditorDialog(QDesignerFormEditorInterface *core, QWidget *parent = 0); + explicit PlainTextEditorDialog(QDesignerFormEditorInterface *core, QWidget *parent = nullptr); ~PlainTextEditorDialog(); int showDialog(); diff --git a/src/designer/src/lib/shared/plugindialog_p.h b/src/designer/src/lib/shared/plugindialog_p.h index ddd352164..f51d044f8 100644 --- a/src/designer/src/lib/shared/plugindialog_p.h +++ b/src/designer/src/lib/shared/plugindialog_p.h @@ -52,7 +52,7 @@ class PluginDialog : public QDialog { Q_OBJECT public: - explicit PluginDialog(QDesignerFormEditorInterface *core, QWidget *parent = 0); + explicit PluginDialog(QDesignerFormEditorInterface *core, QWidget *parent = nullptr); private slots: void updateCustomWidgetPlugins(); diff --git a/src/designer/src/lib/shared/pluginmanager.cpp b/src/designer/src/lib/shared/pluginmanager.cpp index 4bca2a637..7e2408ad6 100644 --- a/src/designer/src/lib/shared/pluginmanager.cpp +++ b/src/designer/src/lib/shared/pluginmanager.cpp @@ -651,7 +651,7 @@ QStringList QDesignerPluginManager::pluginPaths() const QObject *QDesignerPluginManager::instance(const QString &plugin) const { if (m_d->m_disabledPlugins.contains(plugin)) - return 0; + return nullptr; QPluginLoader loader(plugin); return loader.instance(); diff --git a/src/designer/src/lib/shared/previewconfigurationwidget_p.h b/src/designer/src/lib/shared/previewconfigurationwidget_p.h index 621f46a51..c469cef2d 100644 --- a/src/designer/src/lib/shared/previewconfigurationwidget_p.h +++ b/src/designer/src/lib/shared/previewconfigurationwidget_p.h @@ -59,7 +59,7 @@ class QDESIGNER_SHARED_EXPORT PreviewConfigurationWidget : public QGroupBox Q_OBJECT public: explicit PreviewConfigurationWidget(QDesignerFormEditorInterface *core, - QWidget *parent = 0); + QWidget *parent = nullptr); ~PreviewConfigurationWidget() override; void saveState(); diff --git a/src/designer/src/lib/shared/previewmanager.cpp b/src/designer/src/lib/shared/previewmanager.cpp index 87291ae08..e57f4da60 100644 --- a/src/designer/src/lib/shared/previewmanager.cpp +++ b/src/designer/src/lib/shared/previewmanager.cpp @@ -101,7 +101,7 @@ namespace qdesigner_internal { class DesignerZoomProxyWidget : public ZoomProxyWidget { Q_DISABLE_COPY(DesignerZoomProxyWidget) public: - DesignerZoomProxyWidget(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0); + DesignerZoomProxyWidget(QGraphicsItem *parent = nullptr, Qt::WindowFlags wFlags = {}); protected: QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF() ) const override; }; @@ -122,9 +122,10 @@ QSizeF DesignerZoomProxyWidget::sizeHint(Qt::SizeHint which, const QSizeF & cons class DesignerZoomWidget : public ZoomWidget { Q_DISABLE_COPY(DesignerZoomWidget) public: - DesignerZoomWidget(QWidget *parent = 0); + DesignerZoomWidget(QWidget *parent = nullptr); private: - QGraphicsProxyWidget *createProxyWidget(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0) const override; + QGraphicsProxyWidget *createProxyWidget(QGraphicsItem *parent = nullptr, + Qt::WindowFlags wFlags = {}) const override; }; DesignerZoomWidget::DesignerZoomWidget(QWidget *parent) : @@ -183,10 +184,10 @@ PreviewDeviceSkin::PreviewDeviceSkin(const DeviceSkinParameters ¶meters, QWi DeviceSkin(parameters, parent), m_screenSize(parameters.screenSize()), m_direction(DirectionUp), - m_directionUpAction(0), - m_directionLeftAction(0), - m_directionRightAction(0), - m_closeAction(0) + m_directionUpAction(nullptr), + m_directionLeftAction(nullptr), + m_directionRightAction(nullptr), + m_closeAction(nullptr) { connect(this, &PreviewDeviceSkin::skinKeyPressEvent, this, &PreviewDeviceSkin::slotSkinKeyPressEvent); @@ -206,7 +207,7 @@ void PreviewDeviceSkin::setPreview(QWidget *formWidget) void PreviewDeviceSkin::slotSkinKeyPressEvent(int code, const QString& text, bool autorep) { if (QWidget *focusWidget = QApplication::focusWidget()) { - QKeyEvent e(QEvent::KeyPress,code,0,text,autorep); + QKeyEvent e(QEvent::KeyPress, code, nullptr, text, autorep); QApplication::sendEvent(focusWidget, &e); } } @@ -214,7 +215,7 @@ void PreviewDeviceSkin::slotSkinKeyPressEvent(int code, const QString& text, boo void PreviewDeviceSkin::slotSkinKeyReleaseEvent(int code, const QString& text, bool autorep) { if (QWidget *focusWidget = QApplication::focusWidget()) { - QKeyEvent e(QEvent::KeyRelease,code,0,text,autorep); + QKeyEvent e(QEvent::KeyRelease, code, nullptr, text, autorep); QApplication::sendEvent(focusWidget, &e); } } @@ -352,7 +353,7 @@ private: ZoomablePreviewDeviceSkin::ZoomablePreviewDeviceSkin(const DeviceSkinParameters ¶meters, QWidget *parent) : PreviewDeviceSkin(parameters, parent), m_zoomMenu(new ZoomMenu(this)), - m_zoomSubMenuAction(0), + m_zoomSubMenuAction(nullptr), m_zoomWidget(new DesignerZoomWidget) { connect(m_zoomMenu, &ZoomMenu::zoomChanged, this, &ZoomablePreviewDeviceSkin::setZoomPercent); @@ -567,7 +568,7 @@ public: PreviewManagerPrivate::PreviewManagerPrivate(PreviewManager::PreviewMode mode) : m_mode(mode), - m_core(0), + m_core(nullptr), m_updateBlocked(false) { } @@ -672,7 +673,7 @@ QWidget *PreviewManager::createPreview(const QDesignerFormWindowInterface *fw, // Create QWidget *formWidget = QDesignerFormBuilder::createPreview(fw, pc.style(), pc.applicationStyleSheet(), deviceProfile, errorMessage); if (!formWidget) - return 0; + return nullptr; const QString title = tr("%1 - [Preview]").arg(formWidget->windowTitle()); formWidget = fakeContainer(formWidget); @@ -708,13 +709,13 @@ QWidget *PreviewManager::createPreview(const QDesignerFormWindowInterface *fw, DeviceSkinParameters parameters; if (!parameters.read(deviceSkin, DeviceSkinParameters::ReadAll, errorMessage)) { formWidget->deleteLater(); - return 0; + return nullptr; } it = d->m_deviceSkinConfigCache.insert(deviceSkin, parameters); } QWidget *skinContainer = createDeviceSkinContainer(fw); - PreviewDeviceSkin *skin = 0; + PreviewDeviceSkin *skin = nullptr; if (zoomable) { ZoomablePreviewDeviceSkin *zds = new ZoomablePreviewDeviceSkin(it.value(), skinContainer); zds->setZoomPercent(initialZoom); @@ -747,7 +748,7 @@ QWidget *PreviewManager::showPreview(const QDesignerFormWindowInterface *fw, QWidget *widget = createPreview(fw, pc, deviceProfileIndex, errorMessage, initialZoom); if (!widget) - return 0; + return nullptr; // Install filter for Escape key widget->setAttribute(Qt::WA_DeleteOnClose, true); widget->installEventFilter(this); @@ -799,7 +800,7 @@ QWidget *PreviewManager::raise(const QDesignerFormWindowInterface *fw, const Pre { typedef PreviewManagerPrivate::PreviewDataList PreviewDataList; if (d->m_previews.empty()) - return 0; + return nullptr; // find matching window const PreviewDataList::const_iterator cend = d->m_previews.constEnd(); @@ -811,14 +812,14 @@ QWidget *PreviewManager::raise(const QDesignerFormWindowInterface *fw, const Pre return w; } } - return 0; + return nullptr; } void PreviewManager::closeAllPreviews() { if (!d->m_previews.empty()) { d->m_updateBlocked = true; - d->m_activePreview = 0; + d->m_activePreview = nullptr; for (auto it = d->m_previews.constBegin(), cend = d->m_previews.constEnd(); it != cend ;++it) { if (it->m_widget) it->m_widget->close(); @@ -837,7 +838,7 @@ void PreviewManager::updatePreviewClosed(QWidget *w) // Purge out all 0 or widgets to be deleted for (PreviewDataList::iterator it = d->m_previews.begin(); it != d->m_previews.end() ; ) { QWidget *iw = it->m_widget; // Might be 0 when catching QEvent::Destroyed - if (iw == 0 || iw == w) { + if (iw == nullptr || iw == w) { it = d->m_previews.erase(it); } else { ++it; diff --git a/src/designer/src/lib/shared/promotionmodel.cpp b/src/designer/src/lib/shared/promotionmodel.cpp index ea34f2610..63273c3a7 100644 --- a/src/designer/src/lib/shared/promotionmodel.cpp +++ b/src/designer/src/lib/shared/promotionmodel.cpp @@ -134,8 +134,8 @@ namespace qdesigner_internal { const QSet<QString> usedPromotedClasses = m_core->promotion()->referencedPromotedClassNames(); - QDesignerWidgetDataBaseItemInterface *baseClass = 0; - QStandardItem *baseItem = 0; + QDesignerWidgetDataBaseItemInterface *baseClass = nullptr; + QStandardItem *baseItem = nullptr; const PromotedClasses::const_iterator bcend = promotedClasses.constEnd(); for (PromotedClasses::const_iterator it = promotedClasses.constBegin(); it != bcend; ++it) { diff --git a/src/designer/src/lib/shared/promotiontaskmenu.cpp b/src/designer/src/lib/shared/promotiontaskmenu.cpp index 481b944cc..bb5631d32 100644 --- a/src/designer/src/lib/shared/promotiontaskmenu.cpp +++ b/src/designer/src/lib/shared/promotiontaskmenu.cpp @@ -248,7 +248,7 @@ void PromotionTaskMenu::slotEditPromoteTo() Q_ASSERT(QDesignerPromotionDialog::baseClassNames(core->promotion()).contains(base_class_name)); // Show over promotable widget QString promoteToClassName; - QDialog *promotionEditor = 0; + QDialog *promotionEditor = nullptr; if (QDesignerLanguageExtension *lang = languageExtension(core)) promotionEditor = lang->createPromotionDialog(core, base_class_name, &promoteToClassName, fw); if (!promotionEditor) @@ -311,14 +311,14 @@ QDesignerFormWindowInterface *PromotionTaskMenu::formWindow() const // for QDesignerMenus also. QObject *o = m_widget; QDesignerFormWindowInterface *result = QDesignerFormWindowInterface::findFormWindow(o); - Q_ASSERT(result != 0); + Q_ASSERT(result != nullptr); return result; } void PromotionTaskMenu::editPromotedWidgets(QDesignerFormEditorInterface *core, QWidget* parent) { QDesignerLanguageExtension *lang = languageExtension(core); // Show over non-promotable widget - QDialog *promotionEditor = 0; + QDialog *promotionEditor = nullptr; if (lang) lang->createPromotionDialog(core, parent); if (!promotionEditor) diff --git a/src/designer/src/lib/shared/promotiontaskmenu_p.h b/src/designer/src/lib/shared/promotiontaskmenu_p.h index c9c6312e0..bb382ac1d 100644 --- a/src/designer/src/lib/shared/promotiontaskmenu_p.h +++ b/src/designer/src/lib/shared/promotiontaskmenu_p.h @@ -69,7 +69,7 @@ public: ModeUnmanagedMultiSelection }; - explicit PromotionTaskMenu(QWidget *widget,Mode mode = ModeManagedMultiSelection, QObject *parent = 0); + explicit PromotionTaskMenu(QWidget *widget,Mode mode = ModeManagedMultiSelection, QObject *parent = nullptr); Mode mode() const; void setMode(Mode m); diff --git a/src/designer/src/lib/shared/qdesigner_command.cpp b/src/designer/src/lib/shared/qdesigner_command.cpp index 3ecd994be..ed8bde3de 100644 --- a/src/designer/src/lib/shared/qdesigner_command.cpp +++ b/src/designer/src/lib/shared/qdesigner_command.cpp @@ -119,7 +119,7 @@ static int removeFromWidgetListDynamicProperty(QWidget *parentWidget, QWidget *w InsertWidgetCommand::InsertWidgetCommand(QDesignerFormWindowInterface *formWindow) : QDesignerFormWindowCommand(QString(), formWindow), m_insertMode(QDesignerLayoutDecorationExtension::InsertWidgetMode), - m_layoutHelper(0), + m_layoutHelper(nullptr), m_widgetWasManaged(false) { } @@ -172,7 +172,7 @@ void InsertWidgetCommand::redo() QDesignerFormEditorInterface *core = formWindow()->core(); QDesignerLayoutDecorationExtension *deco = qt_extension<QDesignerLayoutDecorationExtension*>(core->extensionManager(), parentWidget); - if (deco != 0) { + if (deco != nullptr) { const LayoutInfo::Type type = LayoutInfo::layoutType(core, LayoutInfo::managedLayout(core, parentWidget)); m_layoutHelper = LayoutHelper::createLayoutHelper(type); m_layoutHelper->pushState(core, parentWidget); @@ -392,11 +392,11 @@ void ManageWidgetCommandHelper::unmanage(QDesignerFormWindowInterface *fw) DeleteWidgetCommand::DeleteWidgetCommand(QDesignerFormWindowInterface *formWindow) : QDesignerFormWindowCommand(QString(), formWindow), m_layoutType(LayoutInfo::NoLayout), - m_layoutHelper(0), + m_layoutHelper(nullptr), m_flags(0), m_splitterIndex(-1), m_layoutSimplified(false), - m_formItem(0), + m_formItem(nullptr), m_tabOrderIndex(-1), m_widgetOrderIndex(-1), m_zOrderIndex(-1) @@ -772,7 +772,7 @@ void LayoutCommand::undo() delete deco; // release the extension // ### generalize (put in function) - if (!m_layoutBase && lb != 0 && !(qobject_cast<QLayoutWidget*>(lb) || qobject_cast<QSplitter*>(lb))) { + if (!m_layoutBase && lb != nullptr && !(qobject_cast<QLayoutWidget*>(lb) || qobject_cast<QSplitter*>(lb))) { core->metaDataBase()->add(lb); lb->show(); } @@ -783,8 +783,8 @@ void LayoutCommand::undo() // ---- BreakLayoutCommand ---- BreakLayoutCommand::BreakLayoutCommand(QDesignerFormWindowInterface *formWindow) : QDesignerFormWindowCommand(QApplication::translate("Command", "Break layout"), formWindow), - m_layoutHelper(0), - m_properties(0), + m_layoutHelper(nullptr), + m_properties(nullptr), m_propertyMask(0) { } @@ -833,7 +833,7 @@ void BreakLayoutCommand::init(const QWidgetList &widgets, QWidget *layoutBase, b type = LayoutHasState; break; } - Q_ASSERT(m_layout != 0); + Q_ASSERT(m_layout != nullptr); m_layout->sort(); @@ -889,8 +889,8 @@ void BreakLayoutCommand::undo() SimplifyLayoutCommand::SimplifyLayoutCommand(QDesignerFormWindowInterface *formWindow) : QDesignerFormWindowCommand(QApplication::translate("Command", "Simplify Grid Layout"), formWindow), m_area(0, 0, 32767, 32767), - m_layoutBase(0), - m_layoutHelper(0), + m_layoutBase(nullptr), + m_layoutHelper(nullptr), m_layoutSimplified(false) { } @@ -1141,7 +1141,7 @@ void TabWidgetCommand::removePage() void TabWidgetCommand::addPage() { - m_widget->setParent(0); + m_widget->setParent(nullptr); m_tabWidget->insertTab(m_index, m_widget, m_itemIcon, m_itemText); m_widget->show(); m_tabWidget->setCurrentIndex(m_index); @@ -1405,7 +1405,7 @@ void AddStackedWidgetPageCommand::undo() // ---- TabOrderCommand ---- TabOrderCommand::TabOrderCommand(QDesignerFormWindowInterface *formWindow) : QDesignerFormWindowCommand(QApplication::translate("Command", "Change Tab order"), formWindow), - m_widgetItem(0) + m_widgetItem(nullptr) { } @@ -1491,7 +1491,7 @@ void DeleteMenuBarCommand::redo() if (m_mainWindow) { QDesignerContainerExtension *c; c = qt_extension<QDesignerContainerExtension*>(core()->extensionManager(), m_mainWindow); - Q_ASSERT(c != 0); + Q_ASSERT(c != nullptr); for (int i=0; i<c->count(); ++i) { if (c->widget(i) == m_menuBar) { c->remove(i); @@ -1579,7 +1579,7 @@ void DeleteStatusBarCommand::redo() { if (m_mainWindow) { QDesignerContainerExtension *c = qt_extension<QDesignerContainerExtension*>(core()->extensionManager(), m_mainWindow); - Q_ASSERT(c != 0); + Q_ASSERT(c != nullptr); for (int i=0; i<c->count(); ++i) { if (c->widget(i) == m_statusBar) { c->remove(i); @@ -1619,7 +1619,7 @@ void AddToolBarCommand::init(QMainWindow *mainWindow, Qt::ToolBarArea area) m_mainWindow = mainWindow; QDesignerWidgetFactoryInterface * wf = formWindow()->core()->widgetFactory(); // Pass on 0 parent first to avoid reparenting flicker. - m_toolBar = qobject_cast<QToolBar*>(wf->createWidget(QStringLiteral("QToolBar"), 0)); + m_toolBar = qobject_cast<QToolBar*>(wf->createWidget(QStringLiteral("QToolBar"), nullptr)); m_toolBar->setProperty("_q_desiredArea", QVariant(area)); wf->initialize(m_toolBar); m_toolBar->hide(); @@ -1744,7 +1744,7 @@ void AdjustWidgetSizeCommand::redo() /* When doing adjustsize on a selected non-laid out child that has been enlarged * and pushed partially over the top/left edge[s], it is possible that it "disappears" * when shrinking. In that case, move it back so that it remains visible. */ - if (aw->parentWidget()->layout() == 0) { + if (aw->parentWidget()->layout() == nullptr) { const QRect contentsRect = aw->parentWidget()->contentsRect(); const QRect newGeometry = aw->geometry(); QPoint newPos = m_geometry.topLeft(); @@ -1851,7 +1851,7 @@ unsigned ChangeFormLayoutItemRoleCommand::possibleOperations(QDesignerFormEditor if (index == -1) return 0; int row, col, colspan; - getFormLayoutItemPosition(fl, index, &row, &col, 0, &colspan); + getFormLayoutItemPosition(fl, index, &row, &col, nullptr, &colspan); // Spanning item? if (colspan > 1) return SpanningToLabel|SpanningToField; @@ -1868,7 +1868,7 @@ QFormLayout *ChangeFormLayoutItemRoleCommand::managedFormLayoutOf(QDesignerFormE if (QLayout *layout = LayoutInfo::managedLayout(core, w->parentWidget())) if (QFormLayout *fl = qobject_cast<QFormLayout *>(layout)) return fl; - return 0; + return nullptr; } // ---- ChangeLayoutItemGeometry ---- @@ -1880,13 +1880,13 @@ ChangeLayoutItemGeometry::ChangeLayoutItemGeometry(QDesignerFormWindowInterface void ChangeLayoutItemGeometry::init(QWidget *widget, int row, int column, int rowspan, int colspan) { m_widget = widget; - Q_ASSERT(m_widget->parentWidget() != 0); + Q_ASSERT(m_widget->parentWidget() != nullptr); QLayout *layout = LayoutInfo::managedLayout(formWindow()->core(), m_widget->parentWidget()); - Q_ASSERT(layout != 0); + Q_ASSERT(layout != nullptr); QGridLayout *grid = qobject_cast<QGridLayout*>(layout); - Q_ASSERT(grid != 0); + Q_ASSERT(grid != nullptr); const int itemIndex = grid->indexOf(m_widget); Q_ASSERT(itemIndex != -1); @@ -1901,10 +1901,10 @@ void ChangeLayoutItemGeometry::init(QWidget *widget, int row, int column, int ro void ChangeLayoutItemGeometry::changeItemPosition(const QRect &g) { QLayout *layout = LayoutInfo::managedLayout(formWindow()->core(), m_widget->parentWidget()); - Q_ASSERT(layout != 0); + Q_ASSERT(layout != nullptr); QGridLayout *grid = qobject_cast<QGridLayout*>(layout); - Q_ASSERT(grid != 0); + Q_ASSERT(grid != nullptr); const int itemIndex = grid->indexOf(m_widget); Q_ASSERT(itemIndex != -1); @@ -2040,7 +2040,7 @@ void AddContainerWidgetPageCommand::init(QWidget *containerWidget, ContainerType m_index = c->currentIndex(); if (m_index >= 0 && mode == InsertAfter) m_index++; - m_widget = 0; + m_widget = nullptr; const QDesignerFormEditorInterface *core = formWindow()->core(); switch (ct) { case PageContainer: @@ -2055,7 +2055,7 @@ void AddContainerWidgetPageCommand::init(QWidget *containerWidget, ContainerType setPropertySheetWindowTitle(core, m_widget, QApplication::translate("Command", "Subwindow")); break; case WizardContainer: // Apply style, don't manage - m_widget = core->widgetFactory()->createWidget(QStringLiteral("QWizardPage"), 0); + m_widget = core->widgetFactory()->createWidget(QStringLiteral("QWizardPage"), nullptr); break; } formWindow()->ensureUniqueObjectName(m_widget); @@ -2438,7 +2438,7 @@ bool TableWidgetContents::operator==(const TableWidgetContents &rhs) const // ---- ChangeTableContentsCommand ---- ChangeTableContentsCommand::ChangeTableContentsCommand(QDesignerFormWindowInterface *formWindow) : QDesignerFormWindowCommand(QApplication::translate("Command", "Change Table Contents"), - formWindow), m_iconCache(0) + formWindow), m_iconCache(nullptr) { FormWindowBase *fwb = qobject_cast<FormWindowBase *>(formWindow); if (fwb) @@ -2545,7 +2545,7 @@ bool TreeWidgetContents::operator==(const TreeWidgetContents &rhs) const // ---- ChangeTreeContentsCommand ---- ChangeTreeContentsCommand::ChangeTreeContentsCommand(QDesignerFormWindowInterface *formWindow) : QDesignerFormWindowCommand(QApplication::translate("Command", "Change Tree Contents"), formWindow), - m_iconCache(0) + m_iconCache(nullptr) { FormWindowBase *fwb = qobject_cast<FormWindowBase *>(formWindow); if (fwb) @@ -2572,7 +2572,7 @@ void ChangeTreeContentsCommand::undo() // ---- ChangeListContentsCommand ---- ChangeListContentsCommand::ChangeListContentsCommand(QDesignerFormWindowInterface *formWindow) - : QDesignerFormWindowCommand(QString(), formWindow), m_iconCache(0) + : QDesignerFormWindowCommand(QString(), formWindow), m_iconCache(nullptr) { FormWindowBase *fwb = qobject_cast<FormWindowBase *>(formWindow); if (fwb) @@ -2583,7 +2583,7 @@ void ChangeListContentsCommand::init(QListWidget *listWidget, const ListContents &oldItems, const ListContents &items) { m_listWidget = listWidget; - m_comboBox = 0; + m_comboBox = nullptr; m_newItemsState = items; m_oldItemsState = oldItems; @@ -2592,7 +2592,7 @@ void ChangeListContentsCommand::init(QListWidget *listWidget, void ChangeListContentsCommand::init(QComboBox *comboBox, const ListContents &oldItems, const ListContents &items) { - m_listWidget = 0; + m_listWidget = nullptr; m_comboBox = comboBox; m_newItemsState = items; @@ -2620,12 +2620,12 @@ void ChangeListContentsCommand::undo() AddActionCommand::AddActionCommand(QDesignerFormWindowInterface *formWindow) : QDesignerFormWindowCommand(QApplication::translate("Command", "Add action"), formWindow) { - m_action = 0; + m_action = nullptr; } void AddActionCommand::init(QAction *action) { - Q_ASSERT(m_action == 0); + Q_ASSERT(m_action == nullptr); m_action = action; } @@ -2660,7 +2660,7 @@ static RemoveActionCommand::ActionData findActionIn(QAction *action) const int size = actionList.size(); for (int i = 0; i < size; ++i) { if (actionList.at(i) == action) { - QAction *before = 0; + QAction *before = nullptr; if (i + 1 < size) before = actionList.at(i + 1); result.append(RemoveActionCommand::ActionDataItem(before, widget)); @@ -2674,7 +2674,7 @@ static RemoveActionCommand::ActionData findActionIn(QAction *action) void RemoveActionCommand::init(QAction *action) { - Q_ASSERT(m_action == 0); + Q_ASSERT(m_action == nullptr); m_action = action; m_actionData = findActionIn(action); @@ -2710,17 +2710,17 @@ void RemoveActionCommand::undo() ActionInsertionCommand::ActionInsertionCommand(const QString &text, QDesignerFormWindowInterface *formWindow) : QDesignerFormWindowCommand(text, formWindow), - m_parentWidget(0), - m_action(0), - m_beforeAction(0), + m_parentWidget(nullptr), + m_action(nullptr), + m_beforeAction(nullptr), m_update(false) { } void ActionInsertionCommand::init(QWidget *parentWidget, QAction *action, QAction *beforeAction, bool update) { - Q_ASSERT(m_parentWidget == 0); - Q_ASSERT(m_action == 0); + Q_ASSERT(m_parentWidget == nullptr); + Q_ASSERT(m_action == nullptr); m_parentWidget = parentWidget; m_action = action; @@ -2730,8 +2730,8 @@ void ActionInsertionCommand::init(QWidget *parentWidget, QAction *action, QActio void ActionInsertionCommand::insertAction() { - Q_ASSERT(m_action != 0); - Q_ASSERT(m_parentWidget != 0); + Q_ASSERT(m_action != nullptr); + Q_ASSERT(m_parentWidget != nullptr); if (m_beforeAction) m_parentWidget->insertAction(m_beforeAction, m_action); @@ -2749,8 +2749,8 @@ void ActionInsertionCommand::insertAction() } void ActionInsertionCommand::removeAction() { - Q_ASSERT(m_action != 0); - Q_ASSERT(m_parentWidget != 0); + Q_ASSERT(m_action != nullptr); + Q_ASSERT(m_parentWidget != nullptr); if (QDesignerMenu *menu = qobject_cast<QDesignerMenu*>(m_parentWidget)) menu->hideSubMenu(); @@ -2779,11 +2779,11 @@ RemoveActionFromCommand::RemoveActionFromCommand(QDesignerFormWindowInterface *f MenuActionCommand::MenuActionCommand(const QString &text, QDesignerFormWindowInterface *formWindow) : QDesignerFormWindowCommand(text, formWindow), - m_action(0), - m_actionBefore(0), - m_menuParent(0), - m_associatedWidget(0), - m_objectToSelect(0) + m_action(nullptr), + m_actionBefore(nullptr), + m_menuParent(nullptr), + m_associatedWidget(nullptr), + m_objectToSelect(nullptr) { } @@ -2813,10 +2813,10 @@ void MenuActionCommand::insertMenu() void MenuActionCommand::removeMenu() { - m_action->menu()->setParent(0); + m_action->menu()->setParent(nullptr); QMenu *menu = m_action->menu(); core()->metaDataBase()->remove(menu); - menu->setParent(0); + menu->setParent(nullptr); core()->metaDataBase()->remove(m_action); m_associatedWidget->removeAction(m_action); cheapUpdate(); @@ -2837,9 +2837,9 @@ RemoveMenuActionCommand::RemoveMenuActionCommand(QDesignerFormWindowInterface *f // ---- CreateSubmenuCommand ---- CreateSubmenuCommand::CreateSubmenuCommand(QDesignerFormWindowInterface *formWindow) : QDesignerFormWindowCommand(QApplication::translate("Command", "Create submenu"), formWindow), - m_action(0), - m_menu(0), - m_objectToSelect(0) + m_action(nullptr), + m_menu(nullptr), + m_objectToSelect(nullptr) { } @@ -2881,7 +2881,7 @@ void DeleteToolBarCommand::redo() { if (m_mainWindow) { QDesignerContainerExtension *c = qt_extension<QDesignerContainerExtension*>(core()->extensionManager(), m_mainWindow); - Q_ASSERT(c != 0); + Q_ASSERT(c != nullptr); for (int i=0; i<c->count(); ++i) { if (c->widget(i) == m_toolBar) { c->remove(i); diff --git a/src/designer/src/lib/shared/qdesigner_command2.cpp b/src/designer/src/lib/shared/qdesigner_command2.cpp index 8f72e2a0a..e956e7d92 100644 --- a/src/designer/src/lib/shared/qdesigner_command2.cpp +++ b/src/designer/src/lib/shared/qdesigner_command2.cpp @@ -48,7 +48,7 @@ MorphLayoutCommand::MorphLayoutCommand(QDesignerFormWindowInterface *formWindow) m_breakLayoutCommand(new BreakLayoutCommand(formWindow)), m_layoutCommand(new LayoutCommand(formWindow)), m_newType(LayoutInfo::VBox), - m_layoutBase(0) + m_layoutBase(nullptr) { } @@ -143,7 +143,7 @@ QString MorphLayoutCommand::formatDescription(QDesignerFormEditorInterface * /* LayoutAlignmentCommand::LayoutAlignmentCommand(QDesignerFormWindowInterface *formWindow) : QDesignerFormWindowCommand(QApplication::translate("Command", "Change layout alignment"), formWindow), - m_newAlignment(0), m_oldAlignment(0), m_widget(0) + m_newAlignment(nullptr), m_oldAlignment(nullptr), m_widget(nullptr) { } @@ -180,7 +180,7 @@ Qt::Alignment LayoutAlignmentCommand::alignmentOf(const QDesignerFormEditorInter (type == LayoutInfo::HBox || type == LayoutInfo::VBox || type == LayoutInfo::Grid); if (!enabled) - return Qt::Alignment(0); + return Qt::Alignment(nullptr); // Get alignment const int index = layout->indexOf(w); Q_ASSERT(index >= 0); @@ -193,7 +193,7 @@ void LayoutAlignmentCommand::applyAlignment(const QDesignerFormEditorInterface * { // Find layout and apply to item QLayout *layout; - LayoutInfo::laidoutWidgetType(core, w, 0, &layout); + LayoutInfo::laidoutWidgetType(core, w, nullptr, &layout); if (layout) { const int index = layout->indexOf(w); if (index >= 0) { diff --git a/src/designer/src/lib/shared/qdesigner_command2_p.h b/src/designer/src/lib/shared/qdesigner_command2_p.h index 54ecb09ae..8941fbe73 100644 --- a/src/designer/src/lib/shared/qdesigner_command2_p.h +++ b/src/designer/src/lib/shared/qdesigner_command2_p.h @@ -66,7 +66,7 @@ public: bool init(QWidget *w, int newType); - static bool canMorph(const QDesignerFormWindowInterface *formWindow, QWidget *w, int *ptrToCurrentType = 0); + static bool canMorph(const QDesignerFormWindowInterface *formWindow, QWidget *w, int *ptrToCurrentType = nullptr); void redo() override; void undo() override; @@ -93,7 +93,7 @@ public: void undo() override; // Find out alignment and return whether command is enabled. - static Qt::Alignment alignmentOf(const QDesignerFormEditorInterface *core, QWidget *w, bool *enabled = 0); + static Qt::Alignment alignmentOf(const QDesignerFormEditorInterface *core, QWidget *w, bool *enabled = nullptr); private: static void applyAlignment(const QDesignerFormEditorInterface *core, QWidget *w, Qt::Alignment a); diff --git a/src/designer/src/lib/shared/qdesigner_command_p.h b/src/designer/src/lib/shared/qdesigner_command_p.h index 204cf8ddb..2aae590df 100644 --- a/src/designer/src/lib/shared/qdesigner_command_p.h +++ b/src/designer/src/lib/shared/qdesigner_command_p.h @@ -369,7 +369,7 @@ public: inline QWidgetList widgets() const { return m_widgets; } void init(QWidget *parentWidget, const QWidgetList &widgets, LayoutInfo::Type layoutType, - QWidget *layoutBase = 0, + QWidget *layoutBase = nullptr, // Reparent/Hide instances of QLayoutWidget. bool reparentLayoutWidget = true); @@ -424,7 +424,7 @@ public: bool init(QWidget *layoutBase); // Quick check - static bool canSimplify(QDesignerFormEditorInterface *core, const QWidget *w, int *layoutType = 0); + static bool canSimplify(QDesignerFormEditorInterface *core, const QWidget *w, int *layoutType = nullptr); void redo() override; void undo() override; @@ -1011,7 +1011,7 @@ public: void undo() override; struct ActionDataItem { - ActionDataItem(QAction *_before = 0, QWidget *_widget = 0) + ActionDataItem(QAction *_before = nullptr, QWidget *_widget = nullptr) : before(_before), widget(_widget) {} QAction *before; QWidget *widget; @@ -1031,7 +1031,7 @@ protected: ActionInsertionCommand(const QString &text, QDesignerFormWindowInterface *formWindow); public: - void init(QWidget *parentWidget, QAction *action, QAction *beforeAction = 0, bool update = true); + void init(QWidget *parentWidget, QAction *action, QAction *beforeAction = nullptr, bool update = true); protected: void insertAction(); @@ -1107,7 +1107,7 @@ class CreateSubmenuCommand : public QDesignerFormWindowCommand public: explicit CreateSubmenuCommand(QDesignerFormWindowInterface *formWindow); - void init(QDesignerMenu *menu, QAction *action, QObject *m_objectToSelect = 0); + void init(QDesignerMenu *menu, QAction *action, QObject *m_objectToSelect = nullptr); void redo() override; void undo() override; private: diff --git a/src/designer/src/lib/shared/qdesigner_dnditem.cpp b/src/designer/src/lib/shared/qdesigner_dnditem.cpp index e6ba17219..db714d950 100644 --- a/src/designer/src/lib/shared/qdesigner_dnditem.cpp +++ b/src/designer/src/lib/shared/qdesigner_dnditem.cpp @@ -49,17 +49,17 @@ namespace qdesigner_internal { QDesignerDnDItem::QDesignerDnDItem(DropType type, QWidget *source) : m_source(source), m_type(type), - m_dom_ui(0), - m_widget(0), - m_decoration(0) + m_dom_ui(nullptr), + m_widget(nullptr), + m_decoration(nullptr) { } void QDesignerDnDItem::init(DomUI *ui, QWidget *widget, QWidget *decoration, const QPoint &global_mouse_pos) { - Q_ASSERT(widget != 0 || ui != 0); - Q_ASSERT(decoration != 0); + Q_ASSERT(widget != nullptr || ui != nullptr); + Q_ASSERT(decoration != nullptr); m_dom_ui = ui; m_widget = widget; @@ -70,7 +70,7 @@ void QDesignerDnDItem::init(DomUI *ui, QWidget *widget, QWidget *decoration, QDesignerDnDItem::~QDesignerDnDItem() { - if (m_decoration != 0) + if (m_decoration != nullptr) m_decoration->deleteLater(); delete m_dom_ui; } diff --git a/src/designer/src/lib/shared/qdesigner_dnditem_p.h b/src/designer/src/lib/shared/qdesigner_dnditem_p.h index 8f5e20068..fd5618d7d 100644 --- a/src/designer/src/lib/shared/qdesigner_dnditem_p.h +++ b/src/designer/src/lib/shared/qdesigner_dnditem_p.h @@ -58,7 +58,7 @@ namespace qdesigner_internal { class QDESIGNER_SHARED_EXPORT QDesignerDnDItem: public QDesignerDnDItemInterface { public: - explicit QDesignerDnDItem(DropType type, QWidget *source = 0); + explicit QDesignerDnDItem(DropType type, QWidget *source = nullptr); ~QDesignerDnDItem() override; DomUI *domUi() const override; diff --git a/src/designer/src/lib/shared/qdesigner_dockwidget.cpp b/src/designer/src/lib/shared/qdesigner_dockwidget.cpp index 8619c22be..278f9b829 100644 --- a/src/designer/src/lib/shared/qdesigner_dockwidget.cpp +++ b/src/designer/src/lib/shared/qdesigner_dockwidget.cpp @@ -61,7 +61,7 @@ void QDesignerDockWidget::setDocked(bool b) if (b && !docked()) { // Dock it // ### undo/redo stack - setParent(0); + setParent(nullptr); c->addWidget(this); formWindow()->selectWidget(this, formWindow()->cursor()->isWidgetSelected(this)); } else if (!b && docked()) { @@ -119,7 +119,7 @@ QMainWindow *QDesignerDockWidget::findMainWindow() const { if (QDesignerFormWindowInterface *fw = formWindow()) return qobject_cast<QMainWindow*>(fw->mainContainer()); - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/designer/src/lib/shared/qdesigner_dockwidget_p.h b/src/designer/src/lib/shared/qdesigner_dockwidget_p.h index 59cf72ab5..7db332495 100644 --- a/src/designer/src/lib/shared/qdesigner_dockwidget_p.h +++ b/src/designer/src/lib/shared/qdesigner_dockwidget_p.h @@ -53,7 +53,7 @@ class QDESIGNER_SHARED_EXPORT QDesignerDockWidget: public QDockWidget Q_PROPERTY(Qt::DockWidgetArea dockWidgetArea READ dockWidgetArea WRITE setDockWidgetArea DESIGNABLE docked STORED false) Q_PROPERTY(bool docked READ docked WRITE setDocked DESIGNABLE inMainWindow STORED false) public: - QDesignerDockWidget(QWidget *parent = 0); + QDesignerDockWidget(QWidget *parent = nullptr); ~QDesignerDockWidget() override; bool docked() const; diff --git a/src/designer/src/lib/shared/qdesigner_formbuilder.cpp b/src/designer/src/lib/shared/qdesigner_formbuilder.cpp index a2f1d1560..260316381 100644 --- a/src/designer/src/lib/shared/qdesigner_formbuilder.cpp +++ b/src/designer/src/lib/shared/qdesigner_formbuilder.cpp @@ -75,10 +75,10 @@ QDesignerFormBuilder::QDesignerFormBuilder(QDesignerFormEditorInterface *core, const DeviceProfile &deviceProfile) : m_core(core), m_deviceProfile(deviceProfile), - m_pixmapCache(0), - m_iconCache(0), + m_pixmapCache(nullptr), + m_iconCache(nullptr), m_ignoreCreateResources(false), - m_tempResourceSet(0), + m_tempResourceSet(nullptr), m_mainWidget(true) { Q_ASSERT(m_core); @@ -110,10 +110,10 @@ QWidget *QDesignerFormBuilder::create(DomUI *ui, QWidget *parentWidget) core()->resourceModel()->setCurrentResourceSet(resourceSet); core()->resourceModel()->removeResourceSet(m_tempResourceSet); - m_tempResourceSet = 0; + m_tempResourceSet = nullptr; m_ignoreCreateResources = false; - m_pixmapCache = 0; - m_iconCache = 0; + m_pixmapCache = nullptr; + m_iconCache = nullptr; m_customWidgetsWithScript.clear(); return widget; @@ -121,7 +121,7 @@ QWidget *QDesignerFormBuilder::create(DomUI *ui, QWidget *parentWidget) QWidget *QDesignerFormBuilder::createWidget(const QString &widgetName, QWidget *parentWidget, const QString &name) { - QWidget *widget = 0; + QWidget *widget = nullptr; if (widgetName == QStringLiteral("QToolBar")) { widget = new QToolBar(parentWidget); @@ -295,7 +295,7 @@ void QDesignerFormBuilder::createResources(DomResources *resources) if (m_ignoreCreateResources) return; QStringList paths; - if (resources != 0) { + if (resources != nullptr) { const auto &dom_include = resources->elementInclude(); for (DomResource *res : dom_include) { QString path = QDir::cleanPath(workingDirectory().absoluteFilePath(res->attributeLocation())); @@ -331,10 +331,10 @@ QWidget *QDesignerFormBuilder::createPreview(const QDesignerFormWindowInterface QBuffer buffer(&bytes); buffer.open(QIODevice::ReadOnly); - QWidget *widget = builder.load(&buffer, 0); + QWidget *widget = builder.load(&buffer, nullptr); if (!widget) { // Shouldn't happen *errorMessage = QCoreApplication::translate("QDesignerFormBuilder", "The preview failed to build."); - return 0; + return nullptr; } // Make sure palette is applied const QString styleToUse = styleName.isEmpty() ? builder.deviceProfile().style() : styleName; @@ -378,7 +378,7 @@ QWidget *QDesignerFormBuilder::createPreview(const QDesignerFormWindowInterface fw->core()->dialogGui()->message(dialogParent, QDesignerDialogGuiInterface::PreviewFailureMessage, QMessageBox::Warning, QCoreApplication::translate("QDesignerFormBuilder", "Designer"), errorMessage, QMessageBox::Ok); - return 0; + return nullptr; } return widget; } diff --git a/src/designer/src/lib/shared/qdesigner_formbuilder_p.h b/src/designer/src/lib/shared/qdesigner_formbuilder_p.h index bceeb2a60..e70bfd507 100644 --- a/src/designer/src/lib/shared/qdesigner_formbuilder_p.h +++ b/src/designer/src/lib/shared/qdesigner_formbuilder_p.h @@ -70,7 +70,7 @@ public: QDesignerFormBuilder(QDesignerFormEditorInterface *core, const DeviceProfile &deviceProfile = DeviceProfile()); - virtual QWidget *createWidget(DomWidget *ui_widget, QWidget *parentWidget = 0) + virtual QWidget *createWidget(DomWidget *ui_widget, QWidget *parentWidget = nullptr) { return QFormBuilder::create(ui_widget, parentWidget); } inline QDesignerFormEditorInterface *core() const diff --git a/src/designer/src/lib/shared/qdesigner_formwindowcommand.cpp b/src/designer/src/lib/shared/qdesigner_formwindowcommand.cpp index 6b70031cd..a469dd520 100644 --- a/src/designer/src/lib/shared/qdesigner_formwindowcommand.cpp +++ b/src/designer/src/lib/shared/qdesigner_formwindowcommand.cpp @@ -67,7 +67,7 @@ QDesignerFormEditorInterface *QDesignerFormWindowCommand::core() const if (QDesignerFormWindowInterface *fw = formWindow()) return fw->core(); - return 0; + return nullptr; } void QDesignerFormWindowCommand::undo() diff --git a/src/designer/src/lib/shared/qdesigner_formwindowcommand_p.h b/src/designer/src/lib/shared/qdesigner_formwindowcommand_p.h index 49531a739..bccc11d1b 100644 --- a/src/designer/src/lib/shared/qdesigner_formwindowcommand_p.h +++ b/src/designer/src/lib/shared/qdesigner_formwindowcommand_p.h @@ -59,7 +59,7 @@ class QDESIGNER_SHARED_EXPORT QDesignerFormWindowCommand: public QUndoCommand public: QDesignerFormWindowCommand(const QString &description, QDesignerFormWindowInterface *formWindow, - QUndoCommand *parent = 0); + QUndoCommand *parent = nullptr); void undo() override; void redo() override; diff --git a/src/designer/src/lib/shared/qdesigner_formwindowmanager_p.h b/src/designer/src/lib/shared/qdesigner_formwindowmanager_p.h index 22226cfc6..5ee960fd8 100644 --- a/src/designer/src/lib/shared/qdesigner_formwindowmanager_p.h +++ b/src/designer/src/lib/shared/qdesigner_formwindowmanager_p.h @@ -57,7 +57,7 @@ class QDESIGNER_SHARED_EXPORT QDesignerFormWindowManager { Q_OBJECT public: - explicit QDesignerFormWindowManager(QObject *parent = 0); + explicit QDesignerFormWindowManager(QObject *parent = nullptr); ~QDesignerFormWindowManager() override; virtual PreviewManager *previewManager() const = 0; diff --git a/src/designer/src/lib/shared/qdesigner_introspection.cpp b/src/designer/src/lib/shared/qdesigner_introspection.cpp index 9884c6bba..a2dfd037f 100644 --- a/src/designer/src/lib/shared/qdesigner_introspection.cpp +++ b/src/designer/src/lib/shared/qdesigner_introspection.cpp @@ -99,7 +99,7 @@ namespace { Kind kind() const override { return m_kind; } AccessFlags accessFlags() const override { return m_access; } - Attributes attributes(const QObject *object = 0) const override; + Attributes attributes(const QObject *object = nullptr) const override; QVariant::Type type() const override { return m_property.type(); } QString name() const override { return m_name; } @@ -126,7 +126,7 @@ namespace { m_name(charToQString(m_property.name())), m_typeName(charToQString(m_property.typeName())), m_kind(OtherKind), - m_enumerator(0) + m_enumerator(nullptr) { if (m_property.isFlagType() || m_property.isEnumType()) { const QMetaEnum metaEnum = m_property.enumerator(); @@ -299,7 +299,7 @@ namespace { m_className(charToQString(metaObject->className())), m_introspection(introspection), m_metaObject(metaObject), - m_userProperty(0) + m_userProperty(nullptr) { const int numEnumerators = metaObject->enumeratorCount(); m_enumerators.reserve(numEnumerators); @@ -332,7 +332,7 @@ namespace { { const QMetaObject *qSuperClass = m_metaObject->superClass(); if (!qSuperClass) - return 0; + return nullptr; return m_introspection->metaObjectForQMetaObject(qSuperClass); } diff --git a/src/designer/src/lib/shared/qdesigner_membersheet.cpp b/src/designer/src/lib/shared/qdesigner_membersheet.cpp index 47451f5a3..8f54ac451 100644 --- a/src/designer/src/lib/shared/qdesigner_membersheet.cpp +++ b/src/designer/src/lib/shared/qdesigner_membersheet.cpp @@ -56,7 +56,7 @@ static QDesignerFormEditorInterface *formEditorForObject(QObject *o) { o = o->parent(); } while(o); Q_ASSERT(o); - return 0; + return nullptr; } // ------------ QDesignerMemberSheetPrivate @@ -132,7 +132,7 @@ QString QDesignerMemberSheet::declaredInClass(int index) const for (;;) { const QDesignerMetaObjectInterface *tmp = meta_obj->superClass(); - if (tmp == 0) + if (tmp == nullptr) break; if (tmp->indexOfMethod(member) == -1) break; @@ -248,7 +248,7 @@ QObject *QDesignerMemberSheetFactory::createExtension(QObject *object, const QSt return new QDesignerMemberSheet(object, parent); } - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/designer/src/lib/shared/qdesigner_membersheet_p.h b/src/designer/src/lib/shared/qdesigner_membersheet_p.h index 85f4ea742..b67ad3792 100644 --- a/src/designer/src/lib/shared/qdesigner_membersheet_p.h +++ b/src/designer/src/lib/shared/qdesigner_membersheet_p.h @@ -56,7 +56,7 @@ class QDESIGNER_SHARED_EXPORT QDesignerMemberSheet: public QObject, public QDesi Q_INTERFACES(QDesignerMemberSheetExtension) public: - explicit QDesignerMemberSheet(QObject *object, QObject *parent = 0); + explicit QDesignerMemberSheet(QObject *object, QObject *parent = nullptr); ~QDesignerMemberSheet() override; int indexOf(const QString &name) const override; @@ -93,7 +93,7 @@ class QDESIGNER_SHARED_EXPORT QDesignerMemberSheetFactory: public QExtensionFact Q_INTERFACES(QAbstractExtensionFactory) public: - QDesignerMemberSheetFactory(QExtensionManager *parent = 0); + QDesignerMemberSheetFactory(QExtensionManager *parent = nullptr); protected: QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const override; diff --git a/src/designer/src/lib/shared/qdesigner_menu.cpp b/src/designer/src/lib/shared/qdesigner_menu.cpp index 99380ba7c..5a3b39438 100644 --- a/src/designer/src/lib/shared/qdesigner_menu.cpp +++ b/src/designer/src/lib/shared/qdesigner_menu.cpp @@ -312,9 +312,9 @@ bool QDesignerMenu::handleMouseDoubleClickEvent(QWidget *, QMouseEvent *event) QWidget *target = QApplication::widgetAt(event->globalPos()); QMenuBar *mb = qobject_cast<QMenuBar*>(target); QDesignerMenu *menu = qobject_cast<QDesignerMenu*>(target); - if (mb != 0 || menu != 0) { + if (mb != nullptr || menu != nullptr) { const QPoint pt = target->mapFromGlobal(event->globalPos()); - QAction *action = mb == 0 ? menu->actionAt(pt) : mb->actionAt(pt); + QAction *action = mb == nullptr ? menu->actionAt(pt) : mb->actionAt(pt); if (action) sendMouseEventTo(target, pt, event); } @@ -386,7 +386,7 @@ bool QDesignerMenu::handleMousePressEvent(QWidget * /*widget*/, QMouseEvent *eve const int old_index = m_currentIndex; m_currentIndex = index; - if ((hasSubMenuPixmap(action) || action->menu() != 0) + if ((hasSubMenuPixmap(action) || action->menu() != nullptr) && pm_rect.contains(m_startPosition)) { if (m_currentIndex == m_lastSubMenuIndex) { hideSubMenu(); @@ -469,7 +469,7 @@ bool QDesignerMenu::handleContextMenuEvent(QWidget *, QContextMenuEvent *event) QAction *addSeparatorAction = menu.addAction(tr("Insert separator")); addSeparatorAction->setData(itemData); - QAction *removeAction = 0; + QAction *removeAction = nullptr; if (action->isSeparator()) removeAction = menu.addAction(tr("Remove separator")); else @@ -490,10 +490,10 @@ void QDesignerMenu::slotAddSeparator() return; QAction *a = qvariant_cast<QAction*>(action->data()); - Q_ASSERT(a != 0); + Q_ASSERT(a != nullptr); const int pos = actions().indexOf(a); - QAction *action_before = 0; + QAction *action_before = nullptr; if (pos != -1) action_before = safeActionAt(pos); @@ -507,7 +507,7 @@ void QDesignerMenu::slotAddSeparator() if (parentMenu()) { QAction *parent_action = parentMenu()->currentAction(); - if (parent_action->menu() == 0) { + if (parent_action->menu() == nullptr) { CreateSubmenuCommand *cmd = new CreateSubmenuCommand(fw); cmd->init(parentMenu(), parentMenu()->currentAction()); fw->commandHistory()->push(cmd); @@ -527,7 +527,7 @@ void QDesignerMenu::slotRemoveSelectedAction() void QDesignerMenu::deleteAction(QAction *a) { const int pos = actions().indexOf(a); - QAction *action_before = 0; + QAction *action_before = nullptr; if (pos != -1) action_before = safeActionAt(pos + 1); @@ -547,7 +547,7 @@ QRect QDesignerMenu::subMenuPixmapRect(QAction *action) const bool QDesignerMenu::hasSubMenuPixmap(QAction *action) const { - return action != 0 + return action != nullptr && qobject_cast<SpecialMenuAction*>(action) == 0 && !action->isSeparator() && !action->menu() @@ -621,7 +621,7 @@ QDesignerMenu *QDesignerMenu::findActivatedMenu() const return activeDesignerMenu; } - return 0; + return nullptr; } bool QDesignerMenu::eventFilter(QObject *object, QEvent *event) @@ -804,7 +804,7 @@ void QDesignerMenu::dropEvent(QDropEvent *event) if (parentMenu()) { QAction *parent_action = parentMenu()->currentAction(); - if (parent_action->menu() == 0) { + if (parent_action->menu() == nullptr) { CreateSubmenuCommand *cmd = new CreateSubmenuCommand(fw); cmd->init(parentMenu(), parentMenu()->currentAction(), action); fw->commandHistory()->push(cmd); @@ -839,7 +839,7 @@ QDesignerActionProviderExtension *QDesignerMenu::actionProvider() return qt_extension<QDesignerActionProviderExtension*>(core->extensionManager(), this); } - return 0; + return nullptr; } void QDesignerMenu::closeMenuChain() @@ -940,7 +940,7 @@ void QDesignerMenu::moveDown(bool ctrl) QAction *QDesignerMenu::currentAction() const { if (m_currentIndex < 0 || m_currentIndex >= actions().count()) - return 0; + return nullptr; return safeActionAt(m_currentIndex); } @@ -956,7 +956,7 @@ void QDesignerMenu::selectCurrentAction() if (!action || action == m_addSeparator || action == m_addItem) return; - QDesignerObjectInspector *oi = 0; + QDesignerObjectInspector *oi = nullptr; if (QDesignerFormWindowInterface *fw = formWindow()) oi = qobject_cast<QDesignerObjectInspector *>(fw->core()->objectInspector()); @@ -1001,9 +1001,9 @@ void QDesignerMenu::createRealMenuAction(QAction *action) void QDesignerMenu::removeRealMenu(QAction *action) { QDesignerMenu *menu = qobject_cast<QDesignerMenu*>(action->menu()); - if (menu == 0) + if (menu == nullptr) return; - action->setMenu(0); + action->setMenu(nullptr); m_subMenus.insert(action, menu); QDesignerFormEditorInterface *core = formWindow()->core(); core->metaDataBase()->remove(menu); @@ -1107,7 +1107,7 @@ QDesignerMenuBar *QDesignerMenu::parentMenuBar() const return m->parentMenuBar(); } - return 0; + return nullptr; } void QDesignerMenu::setVisible(bool visible) @@ -1145,7 +1145,7 @@ void QDesignerMenu::enterEditMode() if (parentMenu()) { QAction *parent_action = parentMenu()->currentAction(); - if (parent_action->menu() == 0) { + if (parent_action->menu() == nullptr) { CreateSubmenuCommand *cmd = new CreateSubmenuCommand(fw); cmd->init(parentMenu(), parentMenu()->currentAction()); fw->commandHistory()->push(cmd); @@ -1164,14 +1164,14 @@ void QDesignerMenu::leaveEditMode(LeaveEditMode mode) if (mode == Default) return; - QAction *action = 0; + QAction *action = nullptr; QDesignerFormWindowInterface *fw = formWindow(); if (m_currentIndex < realActionCount()) { action = safeActionAt(m_currentIndex); fw->beginCommand(QApplication::translate("Command", "Set action text")); } else { - Q_ASSERT(fw != 0); + Q_ASSERT(fw != nullptr); fw->beginCommand(QApplication::translate("Command", "Insert action")); action = createAction(ActionEditor::actionTextToName(m_editor->text())); InsertActionIntoCommand *cmd = new InsertActionIntoCommand(fw); @@ -1185,7 +1185,7 @@ void QDesignerMenu::leaveEditMode(LeaveEditMode mode) if (parentMenu()) { QAction *parent_action = parentMenu()->currentAction(); - if (parent_action->menu() == 0) { + if (parent_action->menu() == nullptr) { CreateSubmenuCommand *cmd = new CreateSubmenuCommand(fw); cmd->init(parentMenu(), parentMenu()->currentAction(), action); fw->commandHistory()->push(cmd); @@ -1210,7 +1210,7 @@ void QDesignerMenu::showLineEdit() { m_showSubMenuTimer->stop(); - QAction *action = 0; + QAction *action = nullptr; if (m_currentIndex < realActionCount()) action = safeActionAt(m_currentIndex); @@ -1291,7 +1291,7 @@ bool QDesignerMenu::swap(int a, int b) QAction *QDesignerMenu::safeActionAt(int index) const { if (index < 0 || index >= actions().count()) - return 0; + return nullptr; return actions().at(index); } @@ -1308,7 +1308,7 @@ void QDesignerMenu::deleteAction() { QAction *action = currentAction(); const int pos = actions().indexOf(action); - QAction *action_before = 0; + QAction *action_before = nullptr; if (pos != -1) action_before = safeActionAt(pos + 1); diff --git a/src/designer/src/lib/shared/qdesigner_menu_p.h b/src/designer/src/lib/shared/qdesigner_menu_p.h index 4933e6319..5fc8f3c8e 100644 --- a/src/designer/src/lib/shared/qdesigner_menu_p.h +++ b/src/designer/src/lib/shared/qdesigner_menu_p.h @@ -68,7 +68,7 @@ class QDESIGNER_SHARED_EXPORT QDesignerMenu: public QMenu { Q_OBJECT public: - QDesignerMenu(QWidget *parent = 0); + QDesignerMenu(QWidget *parent = nullptr); ~QDesignerMenu() override; bool eventFilter(QObject *object, QEvent *event) override; diff --git a/src/designer/src/lib/shared/qdesigner_menubar.cpp b/src/designer/src/lib/shared/qdesigner_menubar.cpp index 7687e592b..d3aa2a717 100644 --- a/src/designer/src/lib/shared/qdesigner_menubar.cpp +++ b/src/designer/src/lib/shared/qdesigner_menubar.cpp @@ -384,11 +384,11 @@ ActionList QDesignerMenuBar::contextMenuActions() QVariant itemData; itemData.setValue(action); - QAction *remove_action = new QAction(tr("Remove Menu '%1'").arg(action->menu()->objectName()), 0); + QAction *remove_action = new QAction(tr("Remove Menu '%1'").arg(action->menu()->objectName()), nullptr); remove_action->setData(itemData); connect(remove_action, &QAction::triggered, this, &QDesignerMenuBar::deleteMenu); rc.push_back(remove_action); - QAction *sep = new QAction(0); + QAction *sep = new QAction(nullptr); sep->setSeparator(true); rc.push_back(sep); } @@ -396,7 +396,7 @@ ActionList QDesignerMenuBar::contextMenuActions() m_promotionTaskMenu->addActions(formWindow(), PromotionTaskMenu::TrailingSeparator, rc); - QAction *remove_menubar = new QAction(tr("Remove Menu Bar"), 0); + QAction *remove_menubar = new QAction(tr("Remove Menu Bar"), nullptr); connect(remove_menubar, &QAction::triggered, this, &QDesignerMenuBar::slotRemoveMenuBar); rc.push_back(remove_menubar); return rc; @@ -421,7 +421,7 @@ bool QDesignerMenuBar::handleContextMenuEvent(QWidget *, QContextMenuEvent *even void QDesignerMenuBar::slotRemoveMenuBar() { - Q_ASSERT(formWindow() != 0); + Q_ASSERT(formWindow() != nullptr); QDesignerFormWindowInterface *fw = formWindow(); @@ -452,7 +452,7 @@ void QDesignerMenuBar::leaveEditMode(LeaveEditMode mode) if (m_editor->text().isEmpty()) return; - QAction *action = 0; + QAction *action = nullptr; QDesignerFormWindowInterface *fw = formWindow(); Q_ASSERT(fw); @@ -482,7 +482,7 @@ void QDesignerMenuBar::leaveEditMode(LeaveEditMode mode) void QDesignerMenuBar::showLineEdit() { - QAction *action = 0; + QAction *action = nullptr; if (m_currentIndex >= 0 && m_currentIndex < realActionCount()) action = safeActionAt(m_currentIndex); @@ -567,7 +567,7 @@ void QDesignerMenuBar::adjustIndicator(const QPoint &pos) { const int index = findAction(pos); QAction *action = safeActionAt(index); - Q_ASSERT(action != 0); + Q_ASSERT(action != nullptr); if (pos != QPoint(-1, -1)) { QDesignerMenu *m = qobject_cast<QDesignerMenu*>(action->menu()); @@ -700,13 +700,13 @@ QDesignerActionProviderExtension *QDesignerMenuBar::actionProvider() return qt_extension<QDesignerActionProviderExtension*>(core->extensionManager(), this); } - return 0; + return nullptr; } QAction *QDesignerMenuBar::currentAction() const { if (m_currentIndex < 0 || m_currentIndex >= actions().count()) - return 0; + return nullptr; return safeActionAt(m_currentIndex); } @@ -804,7 +804,7 @@ void QDesignerMenuBar::deleteMenuAction(QAction *action) { if (action && !qobject_cast<SpecialMenuAction*>(action)) { const int pos = actions().indexOf(action); - QAction *action_before = 0; + QAction *action_before = nullptr; if (pos != -1) action_before = safeActionAt(pos + 1); @@ -859,7 +859,7 @@ void QDesignerMenuBar::showMenu(int index) QAction *QDesignerMenuBar::safeActionAt(int index) const { if (index < 0 || index >= actions().count()) - return 0; + return nullptr; return actions().at(index); } @@ -936,7 +936,7 @@ void QDesignerMenuBar::updateCurrentAction(bool selectAction) if (!menu) return; - QDesignerObjectInspector *oi = 0; + QDesignerObjectInspector *oi = nullptr; if (QDesignerFormWindowInterface *fw = formWindow()) oi = qobject_cast<QDesignerObjectInspector *>(fw->core()->objectInspector()); diff --git a/src/designer/src/lib/shared/qdesigner_menubar_p.h b/src/designer/src/lib/shared/qdesigner_menubar_p.h index 5cc299cc5..5ec5132ab 100644 --- a/src/designer/src/lib/shared/qdesigner_menubar_p.h +++ b/src/designer/src/lib/shared/qdesigner_menubar_p.h @@ -63,7 +63,7 @@ class SpecialMenuAction: public QAction { Q_OBJECT public: - SpecialMenuAction(QObject *parent = 0); + SpecialMenuAction(QObject *parent = nullptr); ~SpecialMenuAction() override; }; @@ -73,7 +73,7 @@ class QDESIGNER_SHARED_EXPORT QDesignerMenuBar: public QMenuBar { Q_OBJECT public: - QDesignerMenuBar(QWidget *parent = 0); + QDesignerMenuBar(QWidget *parent = nullptr); ~QDesignerMenuBar() override; bool eventFilter(QObject *object, QEvent *event) override; diff --git a/src/designer/src/lib/shared/qdesigner_objectinspector_p.h b/src/designer/src/lib/shared/qdesigner_objectinspector_p.h index 7c7464cfb..be7925d6e 100644 --- a/src/designer/src/lib/shared/qdesigner_objectinspector_p.h +++ b/src/designer/src/lib/shared/qdesigner_objectinspector_p.h @@ -72,7 +72,7 @@ class QDESIGNER_SHARED_EXPORT QDesignerObjectInspector: public QDesignerObjectIn { Q_OBJECT public: - explicit QDesignerObjectInspector(QWidget *parent = 0, Qt::WindowFlags flags = 0); + explicit QDesignerObjectInspector(QWidget *parent = nullptr, Qt::WindowFlags flags = {}); // Select a qobject unmanaged by form window virtual bool selectObject(QObject *o) = 0; diff --git a/src/designer/src/lib/shared/qdesigner_promotion.cpp b/src/designer/src/lib/shared/qdesigner_promotion.cpp index 65cf35cff..d0403866e 100644 --- a/src/designer/src/lib/shared/qdesigner_promotion.cpp +++ b/src/designer/src/lib/shared/qdesigner_promotion.cpp @@ -79,7 +79,7 @@ namespace { const int index = promotedWidgetDataBaseIndex(widgetDataBase, className, errorMessage); if (index == -1) - return 0; + return nullptr; return widgetDataBase->item(index); } diff --git a/src/designer/src/lib/shared/qdesigner_promotiondialog.cpp b/src/designer/src/lib/shared/qdesigner_promotiondialog.cpp index 24e10fb70..1467efbe3 100644 --- a/src/designer/src/lib/shared/qdesigner_promotiondialog.cpp +++ b/src/designer/src/lib/shared/qdesigner_promotiondialog.cpp @@ -187,14 +187,14 @@ namespace qdesigner_internal { const QString &promotableWidgetClassName, QString *promoteTo) : QDialog(parent), - m_mode(promotableWidgetClassName.isEmpty() || promoteTo == 0 ? ModeEdit : ModeEditChooseClass), + m_mode(promotableWidgetClassName.isEmpty() || promoteTo == nullptr ? ModeEdit : ModeEditChooseClass), m_promotableWidgetClassName(promotableWidgetClassName), m_core(core), m_promoteTo(promoteTo), m_promotion(core->promotion()), m_model(new PromotionModel(core)), m_treeView(new QTreeView), - m_buttonBox(0), + m_buttonBox(nullptr), m_removeButton(new QPushButton(createIconSet(QString::fromUtf8("minus.png")), QString())) { m_buttonBox = createButtonBox(); @@ -352,7 +352,7 @@ namespace qdesigner_internal { flags = 0; const QModelIndexList indexes = selected.indexes(); if (indexes.empty()) - return 0; + return nullptr; const PromotionModel::ModelData data = m_model->modelData(indexes.constFirst()); QDesignerWidgetDataBaseItemInterface *dbItem = data.promotedItem; diff --git a/src/designer/src/lib/shared/qdesigner_promotiondialog_p.h b/src/designer/src/lib/shared/qdesigner_promotiondialog_p.h index 461b02192..e9cb7d4fe 100644 --- a/src/designer/src/lib/shared/qdesigner_promotiondialog_p.h +++ b/src/designer/src/lib/shared/qdesigner_promotiondialog_p.h @@ -69,7 +69,7 @@ namespace qdesigner_internal { public: explicit NewPromotedClassPanel(const QStringList &baseClasses, int selectedBaseClass = -1, - QWidget *parent = 0); + QWidget *parent = nullptr); QString promotedHeaderSuffix() const { return m_promotedHeaderSuffix; } void setPromotedHeaderSuffix(const QString &s) { m_promotedHeaderSuffix = s; } @@ -111,9 +111,9 @@ namespace qdesigner_internal { enum Mode { ModeEdit, ModeEditChooseClass }; explicit QDesignerPromotionDialog(QDesignerFormEditorInterface *core, - QWidget *parent = 0, + QWidget *parent = nullptr, const QString &promotableWidgetClassName = QString(), - QString *promoteTo = 0); + QString *promoteTo = nullptr); // Return an alphabetically ordered list of base class names for adding new classes. static const QStringList &baseClassNames(const QDesignerPromotionInterface *promotion); diff --git a/src/designer/src/lib/shared/qdesigner_propertycommand.cpp b/src/designer/src/lib/shared/qdesigner_propertycommand.cpp index d93df7e0e..9f4eec9ce 100644 --- a/src/designer/src/lib/shared/qdesigner_propertycommand.cpp +++ b/src/designer/src/lib/shared/qdesigner_propertycommand.cpp @@ -1332,7 +1332,7 @@ bool ResetPropertyCommand::init(const ObjectList &list, const QString &aproperty ++it; } if (!modifiedList.contains(referenceObject)) - referenceObject = Q_NULLPTR; + referenceObject = nullptr; if (modifiedList.isEmpty() || !initList(modifiedList, apropertyName, referenceObject)) return false; diff --git a/src/designer/src/lib/shared/qdesigner_propertycommand_p.h b/src/designer/src/lib/shared/qdesigner_propertycommand_p.h index 2eef88cd7..78ed73181 100644 --- a/src/designer/src/lib/shared/qdesigner_propertycommand_p.h +++ b/src/designer/src/lib/shared/qdesigner_propertycommand_p.h @@ -137,7 +137,7 @@ class QDESIGNER_SHARED_EXPORT PropertyListCommand : public QDesignerFormWindowCo public: typedef QList<QObject *> ObjectList; - explicit PropertyListCommand(QDesignerFormWindowInterface *formWindow, QUndoCommand *parent = 0); + explicit PropertyListCommand(QDesignerFormWindowInterface *formWindow, QUndoCommand *parent = nullptr); QObject* object(int index = 0) const; @@ -156,7 +156,7 @@ protected: bool add(QObject *object, const QString &propertyName); // Init from a list and make sure referenceObject is added first to obtain the right property group - bool initList(const ObjectList &list, const QString &apropertyName, QObject *referenceObject = 0); + bool initList(const ObjectList &list, const QString &apropertyName, QObject *referenceObject = nullptr); // set a new value, return update mask unsigned setValue(QVariant value, bool changed, unsigned subPropertyMask); @@ -209,11 +209,11 @@ class QDESIGNER_SHARED_EXPORT SetPropertyCommand: public PropertyListCommand public: typedef QList<QObject *> ObjectList; - explicit SetPropertyCommand(QDesignerFormWindowInterface *formWindow, QUndoCommand *parent = 0); + explicit SetPropertyCommand(QDesignerFormWindowInterface *formWindow, QUndoCommand *parent = nullptr); bool init(QObject *object, const QString &propertyName, const QVariant &newValue); bool init(const ObjectList &list, const QString &propertyName, const QVariant &newValue, - QObject *referenceObject = 0, bool enableSubPropertyHandling = true); + QObject *referenceObject = nullptr, bool enableSubPropertyHandling = true); inline QVariant newValue() const @@ -246,7 +246,7 @@ public: explicit ResetPropertyCommand(QDesignerFormWindowInterface *formWindow); bool init(QObject *object, const QString &propertyName); - bool init(const ObjectList &list, const QString &propertyName, QObject *referenceObject = 0); + bool init(const ObjectList &list, const QString &propertyName, QObject *referenceObject = nullptr); virtual void redo(); diff --git a/src/designer/src/lib/shared/qdesigner_propertyeditor_p.h b/src/designer/src/lib/shared/qdesigner_propertyeditor_p.h index 1cd9f4cc8..2cdd1fc8f 100644 --- a/src/designer/src/lib/shared/qdesigner_propertyeditor_p.h +++ b/src/designer/src/lib/shared/qdesigner_propertyeditor_p.h @@ -56,7 +56,7 @@ class QDESIGNER_SHARED_EXPORT QDesignerPropertyEditor: public QDesignerPropertyE { Q_OBJECT public: - explicit QDesignerPropertyEditor(QWidget *parent = 0, Qt::WindowFlags flags = 0); + explicit QDesignerPropertyEditor(QWidget *parent = nullptr, Qt::WindowFlags flags = nullptr); // A pair <ValidationMode, bool isTranslatable>. typedef QPair<TextPropertyValidationMode, bool> StringPropertyParameters; diff --git a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp index c1628f7ec..a60f183df 100644 --- a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp +++ b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp @@ -64,7 +64,7 @@ static const QDesignerMetaObjectInterface *propertyIntroducedBy(const QDesignerM if (meta->superClass()) return propertyIntroducedBy(meta->superClass(), index); - return 0; + return nullptr; } // Layout fake properties (prefixed by 'layout' to distinguish them from other 'margins' @@ -108,7 +108,7 @@ static QDesignerFormEditorInterface *formEditorForObject(QObject *o) { o = o->parent(); } while(o); Q_ASSERT(o); - return 0; + return nullptr; } static bool hasLayoutAttributes(QDesignerFormEditorInterface *core, QObject *object) @@ -181,7 +181,7 @@ public: PropertyType propertyType(int index) const; QString transformLayoutPropertyName(int index) const; - QLayout* layout(QDesignerPropertySheetExtension **layoutPropertySheet = 0) const; + QLayout* layout(QDesignerPropertySheetExtension **layoutPropertySheet = nullptr) const; static ObjectType objectType(const QObject *o); bool isReloadableProperty(int index) const; @@ -390,11 +390,11 @@ QDesignerPropertySheetPrivate::QDesignerPropertySheetPrivate(QDesignerPropertySh m_objectType(QDesignerPropertySheet::objectTypeFromObject(object)), m_canHaveLayoutAttributes(hasLayoutAttributes(m_core, object)), m_object(object), - m_lastLayout(0), - m_lastLayoutPropertySheet(0), + m_lastLayout(nullptr), + m_lastLayoutPropertySheet(nullptr), m_LastLayoutByDesigner(false), - m_pixmapCache(0), - m_iconCache(0) + m_pixmapCache(nullptr), + m_iconCache(nullptr) { } @@ -418,23 +418,23 @@ QLayout* QDesignerPropertySheetPrivate::layout(QDesignerPropertySheetExtension * // only if it is managed by designer and not one created on a custom widget. // (attempt to cache the value as this requires some hoops). if (layoutPropertySheet) - *layoutPropertySheet = 0; + *layoutPropertySheet = nullptr; if (!m_object->isWidgetType() || !m_canHaveLayoutAttributes) - return 0; + return nullptr; QWidget *widget = qobject_cast<QWidget*>(m_object); QLayout *widgetLayout = qdesigner_internal::LayoutInfo::internalLayout(widget); if (!widgetLayout) { - m_lastLayout = 0; - m_lastLayoutPropertySheet = 0; - return 0; + m_lastLayout = nullptr; + m_lastLayoutPropertySheet = nullptr; + return nullptr; } // Smart logic to avoid retrieving the meta DB from the widget every time. if (widgetLayout != m_lastLayout) { m_lastLayout = widgetLayout; m_LastLayoutByDesigner = false; - m_lastLayoutPropertySheet = 0; + m_lastLayoutPropertySheet = nullptr; // Is this a layout managed by designer or some layout on a custom widget? if (qdesigner_internal::LayoutInfo::managedLayout(m_core ,widgetLayout)) { m_LastLayoutByDesigner = true; @@ -442,7 +442,7 @@ QLayout* QDesignerPropertySheetPrivate::layout(QDesignerPropertySheetExtension * } } if (!m_LastLayoutByDesigner) - return 0; + return nullptr; if (layoutPropertySheet) *layoutPropertySheet = m_lastLayoutPropertySheet; @@ -566,7 +566,7 @@ QDesignerPropertySheet::QDesignerPropertySheet(QObject *object, QObject *parent) while (baseMeta &&baseMeta->className().startsWith(QStringLiteral("QDesigner"))) { baseMeta = baseMeta->superClass(); } - Q_ASSERT(baseMeta != 0); + Q_ASSERT(baseMeta != nullptr); QDesignerFormWindowInterface *formWindow = QDesignerFormWindowInterface::findFormWindow(d->m_object); d->m_fwb = qobject_cast<qdesigner_internal::FormWindowBase *>(formWindow); @@ -1639,10 +1639,10 @@ QDesignerAbstractPropertySheetFactory::~QDesignerAbstractPropertySheetFactory() QObject *QDesignerAbstractPropertySheetFactory::extension(QObject *object, const QString &iid) const { if (!object) - return 0; + return nullptr; if (iid != m_impl->m_propertySheetId && iid != m_impl->m_dynamicPropertySheetId) - return 0; + return nullptr; QObject *ext = m_impl->m_extensions.value(object, 0); if (!ext && (ext = createPropertySheet(object, const_cast<QDesignerAbstractPropertySheetFactory*>(this)))) { diff --git a/src/designer/src/lib/shared/qdesigner_propertysheet_p.h b/src/designer/src/lib/shared/qdesigner_propertysheet_p.h index b7c2113a4..4da33b525 100644 --- a/src/designer/src/lib/shared/qdesigner_propertysheet_p.h +++ b/src/designer/src/lib/shared/qdesigner_propertysheet_p.h @@ -69,7 +69,7 @@ class QDESIGNER_SHARED_EXPORT QDesignerPropertySheet: public QObject, public QDe Q_OBJECT Q_INTERFACES(QDesignerPropertySheetExtension QDesignerDynamicPropertySheetExtension) public: - explicit QDesignerPropertySheet(QObject *object, QObject *parent = 0); + explicit QDesignerPropertySheet(QObject *object, QObject *parent = nullptr); ~QDesignerPropertySheet() override; int indexOf(const QString &name) const override; @@ -190,7 +190,7 @@ class QDESIGNER_SHARED_EXPORT QDesignerAbstractPropertySheetFactory: public QExt Q_OBJECT Q_INTERFACES(QAbstractExtensionFactory) public: - explicit QDesignerAbstractPropertySheetFactory(QExtensionManager *parent = 0); + explicit QDesignerAbstractPropertySheetFactory(QExtensionManager *parent = nullptr); ~QDesignerAbstractPropertySheetFactory() override; QObject *extension(QObject *object, const QString &iid) const override; @@ -212,7 +212,7 @@ private: template <class Object, class PropertySheet> class QDesignerPropertySheetFactory : public QDesignerAbstractPropertySheetFactory { public: - explicit QDesignerPropertySheetFactory(QExtensionManager *parent = 0); + explicit QDesignerPropertySheetFactory(QExtensionManager *parent = nullptr); static void registerExtension(QExtensionManager *mgr); @@ -232,7 +232,7 @@ QObject *QDesignerPropertySheetFactory<Object, PropertySheet>::createPropertyShe { Object *object = qobject_cast<Object *>(qObject); if (!object) - return 0; + return nullptr; return new PropertySheet(object, parent); } diff --git a/src/designer/src/lib/shared/qdesigner_stackedbox.cpp b/src/designer/src/lib/shared/qdesigner_stackedbox.cpp index e132a23ec..a85df2693 100644 --- a/src/designer/src/lib/shared/qdesigner_stackedbox.cpp +++ b/src/designer/src/lib/shared/qdesigner_stackedbox.cpp @@ -187,7 +187,7 @@ QStackedWidgetEventFilter::QStackedWidgetEventFilter(QStackedWidget *parent) : m_actionInsertPage(new QAction(tr("Before Current Page"), this)), m_actionInsertPageAfter(new QAction(tr("After Current Page"), this)), m_actionChangePageOrder(new QAction(tr("Change Page Order..."), this)), - m_pagePromotionTaskMenu(new qdesigner_internal::PromotionTaskMenu(0, qdesigner_internal::PromotionTaskMenu::ModeSingleWidget, this)) + m_pagePromotionTaskMenu(new qdesigner_internal::PromotionTaskMenu(nullptr, qdesigner_internal::PromotionTaskMenu::ModeSingleWidget, this)) { setButtonToolTipEnabled(true); connect(m_actionPreviousPage, &QAction::triggered, this, &QStackedWidgetEventFilter::prevPage); @@ -211,14 +211,14 @@ QStackedWidgetEventFilter *QStackedWidgetEventFilter::eventFilterOf(const QStack if (QStackedWidgetEventFilter *ef = qobject_cast<QStackedWidgetEventFilter *>(o)) return ef; } - return 0; + return nullptr; } QMenu *QStackedWidgetEventFilter::addStackedWidgetContextMenuActions(const QStackedWidget *stackedWidget, QMenu *popup) { QStackedWidgetEventFilter *filter = eventFilterOf(stackedWidget); if (!filter) - return 0; + return nullptr; return filter->addContextMenuActions(popup); } @@ -299,7 +299,7 @@ void QStackedWidgetEventFilter::gotoPage(int page) { QMenu *QStackedWidgetEventFilter::addContextMenuActions(QMenu *popup) { - QMenu *pageMenu = 0; + QMenu *pageMenu = nullptr; const int count = stackedWidget()->count(); const bool hasSeveralPages = count > 1; m_actionDeletePage->setEnabled(count); @@ -346,7 +346,7 @@ bool QStackedWidgetPropertySheet::isEnabled(int index) const { if (propertyName(index) != QLatin1String(pagePropertyName)) return QDesignerPropertySheet::isEnabled(index); - return m_stackedWidget->currentWidget() != 0; + return m_stackedWidget->currentWidget() != nullptr; } void QStackedWidgetPropertySheet::setProperty(int index, const QVariant &value) diff --git a/src/designer/src/lib/shared/qdesigner_stackedbox_p.h b/src/designer/src/lib/shared/qdesigner_stackedbox_p.h index 22d4cffdf..851e3b294 100644 --- a/src/designer/src/lib/shared/qdesigner_stackedbox_p.h +++ b/src/designer/src/lib/shared/qdesigner_stackedbox_p.h @@ -129,7 +129,7 @@ private: // PropertySheet to handle the "currentPageName" property class QDESIGNER_SHARED_EXPORT QStackedWidgetPropertySheet : public QDesignerPropertySheet { public: - explicit QStackedWidgetPropertySheet(QStackedWidget *object, QObject *parent = 0); + explicit QStackedWidgetPropertySheet(QStackedWidget *object, QObject *parent = nullptr); void setProperty(int index, const QVariant &value) override; QVariant property(int index) const override; diff --git a/src/designer/src/lib/shared/qdesigner_tabwidget.cpp b/src/designer/src/lib/shared/qdesigner_tabwidget.cpp index ea4577e47..e8b744bb3 100644 --- a/src/designer/src/lib/shared/qdesigner_tabwidget.cpp +++ b/src/designer/src/lib/shared/qdesigner_tabwidget.cpp @@ -72,13 +72,13 @@ private: QTabWidgetEventFilter::QTabWidgetEventFilter(QTabWidget *parent) : QObject(parent), m_tabWidget(parent), - m_dropIndicator(0), - m_dragPage(0), + m_dropIndicator(nullptr), + m_dragPage(nullptr), m_mousePressed(false), m_actionDeletePage(new QAction(tr("Delete"), this)), m_actionInsertPage(new QAction(tr("Before Current Page"), this)), m_actionInsertPageAfter(new QAction(tr("After Current Page"), this)), - m_pagePromotionTaskMenu(new qdesigner_internal::PromotionTaskMenu(0, qdesigner_internal::PromotionTaskMenu::ModeSingleWidget, this)) + m_pagePromotionTaskMenu(new qdesigner_internal::PromotionTaskMenu(nullptr, qdesigner_internal::PromotionTaskMenu::ModeSingleWidget, this)) { tabBar()->setAcceptDrops(true); tabBar()->installEventFilter(this); @@ -103,14 +103,14 @@ QTabWidgetEventFilter *QTabWidgetEventFilter::eventFilterOf(const QTabWidget *ta if (QTabWidgetEventFilter *ef = qobject_cast<QTabWidgetEventFilter*>(o)) return ef; } - return 0; + return nullptr; } QMenu *QTabWidgetEventFilter::addTabWidgetContextMenuActions(const QTabWidget *tabWidget, QMenu *popup) { QTabWidgetEventFilter *filter = eventFilterOf(tabWidget); if (!filter) - return 0; + return nullptr; return filter->addContextMenuActions(popup); } @@ -352,7 +352,7 @@ int QTabWidgetEventFilter::pageFromPosition(const QPoint &pos, QRect &rect) cons QMenu *QTabWidgetEventFilter::addContextMenuActions(QMenu *popup) { - QMenu *pageMenu = 0; + QMenu *pageMenu = nullptr; const int count = m_tabWidget->count(); m_actionDeletePage->setEnabled(count); if (count) { diff --git a/src/designer/src/lib/shared/qdesigner_tabwidget_p.h b/src/designer/src/lib/shared/qdesigner_tabwidget_p.h index ab431fb60..8a13c13b8 100644 --- a/src/designer/src/lib/shared/qdesigner_tabwidget_p.h +++ b/src/designer/src/lib/shared/qdesigner_tabwidget_p.h @@ -106,7 +106,7 @@ private: // PropertySheet to handle the page properties class QDESIGNER_SHARED_EXPORT QTabWidgetPropertySheet : public QDesignerPropertySheet { public: - explicit QTabWidgetPropertySheet(QTabWidget *object, QObject *parent = 0); + explicit QTabWidgetPropertySheet(QTabWidget *object, QObject *parent = nullptr); void setProperty(int index, const QVariant &value) override; QVariant property(int index) const override; diff --git a/src/designer/src/lib/shared/qdesigner_taskmenu.cpp b/src/designer/src/lib/shared/qdesigner_taskmenu.cpp index 8842b41f8..f1783587f 100644 --- a/src/designer/src/lib/shared/qdesigner_taskmenu.cpp +++ b/src/designer/src/lib/shared/qdesigner_taskmenu.cpp @@ -84,7 +84,7 @@ static inline QAction *createSeparatorHelper(QObject *parent) { static QString objName(const QDesignerFormEditorInterface *core, QObject *object) { QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), object); - Q_ASSERT(sheet != 0); + Q_ASSERT(sheet != nullptr); const QString objectNameProperty = QStringLiteral("objectName"); const int index = sheet->indexOf(objectNameProperty); @@ -170,7 +170,7 @@ private: QAction *LayoutAlignmentMenu::createAction(const QString &text, int data, QMenu *menu, QActionGroup *ag) { - QAction * a = new QAction(text, 0); + QAction * a = new QAction(text, nullptr); a->setCheckable(true); a->setData(QVariant(data)); menu->addAction(a); @@ -250,7 +250,7 @@ bool LayoutAlignmentMenu::setAlignment(const QDesignerFormEditorInterface *core, Qt::Alignment LayoutAlignmentMenu::alignment() const { - Qt::Alignment alignment = 0; + Qt::Alignment alignment = nullptr; if (const QAction *horizAction = m_horizGroup->checkedAction()) if (const int horizAlign = horizAction->data().toInt()) alignment |= static_cast<Qt::Alignment>(horizAlign); @@ -295,7 +295,7 @@ public: }; QDesignerTaskMenuPrivate::QDesignerTaskMenuPrivate(QWidget *widget, QObject *parent) : - m_q(0), + m_q(nullptr), m_widget(widget), m_separator(createSeparatorHelper(parent)), m_separator2(createSeparatorHelper(parent)), @@ -400,7 +400,7 @@ QWidget *QDesignerTaskMenu::widget() const QDesignerFormWindowInterface *QDesignerTaskMenu::formWindow() const { QDesignerFormWindowInterface *result = QDesignerFormWindowInterface::findFormWindow(widget()); - Q_ASSERT(result != 0); + Q_ASSERT(result != nullptr); return result; } @@ -521,7 +521,7 @@ QList<QAction*> QDesignerTaskMenu::taskActions() const void QDesignerTaskMenu::changeObjectName() { QDesignerFormWindowInterface *fw = formWindow(); - Q_ASSERT(fw != 0); + Q_ASSERT(fw != nullptr); const QString oldObjectName = objName(fw->core(), widget()); @@ -542,7 +542,7 @@ void QDesignerTaskMenu::changeTextProperty(const QString &propertyName, const QS QDesignerFormWindowInterface *fw = formWindow(); if (!fw) return; - Q_ASSERT(d->m_widget->parentWidget() != 0); + Q_ASSERT(d->m_widget->parentWidget() != nullptr); const QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(fw->core()->extensionManager(), d->m_widget); const int index = sheet->indexOf(propertyName); @@ -680,7 +680,7 @@ void QDesignerTaskMenu::applySize(QAction *a) const int mask = a->data().toInt(); const int size = selection.size(); - fw->commandHistory()->beginMacro(tr("Set size constraint on %n widget(s)", 0, size)); + fw->commandHistory()->beginMacro(tr("Set size constraint on %n widget(s)", nullptr, size)); for (int i = 0; i < size; i++) createSizeCommand(fw, selection.at(i), mask); fw->commandHistory()->endMacro(); diff --git a/src/designer/src/lib/shared/qdesigner_toolbar.cpp b/src/designer/src/lib/shared/qdesigner_toolbar.cpp index c686c8fb1..753be7b95 100644 --- a/src/designer/src/lib/shared/qdesigner_toolbar.cpp +++ b/src/designer/src/lib/shared/qdesigner_toolbar.cpp @@ -69,7 +69,7 @@ void ToolBarEventFilter::install(QToolBar *tb) ToolBarEventFilter::ToolBarEventFilter(QToolBar *tb) : QObject(tb), m_toolBar(tb), - m_promotionTaskMenu(0) + m_promotionTaskMenu(nullptr) { } @@ -81,7 +81,7 @@ ToolBarEventFilter *ToolBarEventFilter::eventFilterOf(const QToolBar *tb) if (ToolBarEventFilter *ef = qobject_cast<ToolBarEventFilter *>(o)) return ef; } - return 0; + return nullptr; } bool ToolBarEventFilter::eventFilter (QObject *watched, QEvent *event) @@ -130,7 +130,7 @@ ActionList ToolBarEventFilter::contextMenuActions(const QPoint &globalPos) // Insert before if (action && index != 0 && !action->isSeparator()) { - QAction *newSeperatorAct = new QAction(tr("Insert Separator before '%1'").arg(action->objectName()), 0); + QAction *newSeperatorAct = new QAction(tr("Insert Separator before '%1'").arg(action->objectName()), nullptr); itemData.setValue(action); newSeperatorAct->setData(itemData); connect(newSeperatorAct, &QAction::triggered, this, &ToolBarEventFilter::slotInsertSeparator); @@ -139,8 +139,8 @@ ActionList ToolBarEventFilter::contextMenuActions(const QPoint &globalPos) // Append separator if (actions.empty() || !actions.back()->isSeparator()) { - QAction *newSeperatorAct = new QAction(tr("Append Separator"), 0); - itemData.setValue(static_cast<QAction*>(0)); + QAction *newSeperatorAct = new QAction(tr("Append Separator"), nullptr); + itemData.setValue(static_cast<QAction*>(nullptr)); newSeperatorAct->setData(itemData); connect(newSeperatorAct, &QAction::triggered, this, &ToolBarEventFilter::slotInsertSeparator); rc.push_back(newSeperatorAct); @@ -151,14 +151,14 @@ ActionList ToolBarEventFilter::contextMenuActions(const QPoint &globalPos) m_promotionTaskMenu->addActions(formWindow(), PromotionTaskMenu::LeadingSeparator|PromotionTaskMenu::TrailingSeparator, rc); // Remove if (action) { - QAction *a = new QAction(tr("Remove action '%1'").arg(action->objectName()), 0); + QAction *a = new QAction(tr("Remove action '%1'").arg(action->objectName()), nullptr); itemData.setValue(action); a->setData(itemData); connect(a, &QAction::triggered, this, &ToolBarEventFilter::slotRemoveSelectedAction); rc.push_back(a); } - QAction *remove_toolbar = new QAction(tr("Remove Toolbar '%1'").arg(m_toolBar->objectName()), 0); + QAction *remove_toolbar = new QAction(tr("Remove Toolbar '%1'").arg(m_toolBar->objectName()), nullptr); connect(remove_toolbar, &QAction::triggered, this, &ToolBarEventFilter::slotRemoveToolBar); rc.push_back(remove_toolbar); return rc; @@ -171,7 +171,7 @@ bool ToolBarEventFilter::handleContextMenuEvent(QContextMenuEvent * event ) const QPoint globalPos = event->globalPos(); const ActionList al = contextMenuActions(event->globalPos()); - QMenu menu(0); + QMenu menu(nullptr); const ActionList::const_iterator acend = al.constEnd(); for (ActionList::const_iterator it = al.constBegin(); it != acend; ++it) menu.addAction(*it); @@ -186,14 +186,14 @@ void ToolBarEventFilter::slotRemoveSelectedAction() return; QAction *a = qvariant_cast<QAction*>(action->data()); - Q_ASSERT(a != 0); + Q_ASSERT(a != nullptr); QDesignerFormWindowInterface *fw = formWindow(); Q_ASSERT(fw); const ActionList actions = m_toolBar->actions(); const int pos = actions.indexOf(a); - QAction *action_before = 0; + QAction *action_before = nullptr; if (pos != -1 && actions.count() > pos + 1) action_before = actions.at(pos + 1); @@ -358,7 +358,7 @@ bool ToolBarEventFilter::handleDropEvent(QDropEvent *event) } // Try to find action to 'insert before'. Click on action or in free area, else ignore. - QAction *beforeAction = 0; + QAction *beforeAction = nullptr; const QPoint pos = event->pos(); const int index = actionIndexAt(m_toolBar, pos, m_toolBar->orientation()); if (index != -1) { @@ -407,7 +407,7 @@ void ToolBarEventFilter::startDrag(const QPoint &pos, Qt::KeyboardModifiers modi hideDragIndicator(); if (dropAction == Qt::MoveAction) { const ActionList currentActions = m_toolBar->actions(); - QAction *previous = 0; + QAction *previous = nullptr; if (index >= 0 && index < currentActions.size()) previous = currentActions.at(index); InsertActionIntoCommand *cmd = new InsertActionIntoCommand(fw); @@ -421,7 +421,7 @@ QAction *ToolBarEventFilter::actionAt(const QToolBar *tb, const QPoint &pos) { const int index = actionIndexAt(tb, pos, tb->orientation()); if (index == -1) - return 0; + return nullptr; return tb->actions().at(index); } diff --git a/src/designer/src/lib/shared/qdesigner_toolbox.cpp b/src/designer/src/lib/shared/qdesigner_toolbox.cpp index 90911a9fa..434b22c55 100644 --- a/src/designer/src/lib/shared/qdesigner_toolbox.cpp +++ b/src/designer/src/lib/shared/qdesigner_toolbox.cpp @@ -51,7 +51,7 @@ QToolBoxHelper::QToolBoxHelper(QToolBox *toolbox) : m_actionInsertPage(new QAction(tr("Before Current Page"), this)), m_actionInsertPageAfter(new QAction(tr("After Current Page"), this)), m_actionChangePageOrder(new QAction(tr("Change Page Order..."), this)), - m_pagePromotionTaskMenu(new qdesigner_internal::PromotionTaskMenu(0, qdesigner_internal::PromotionTaskMenu::ModeSingleWidget, this)) + m_pagePromotionTaskMenu(new qdesigner_internal::PromotionTaskMenu(nullptr, qdesigner_internal::PromotionTaskMenu::ModeSingleWidget, this)) { connect(m_actionDeletePage, &QAction::triggered, this, &QToolBoxHelper::removeCurrentPage); connect(m_actionInsertPage, &QAction::triggered, this, &QToolBoxHelper::addPage); @@ -110,14 +110,14 @@ QToolBoxHelper *QToolBoxHelper::helperOf(const QToolBox *toolbox) if (QToolBoxHelper *h = qobject_cast<QToolBoxHelper *>(o)) return h; } - return 0; + return nullptr; } QMenu *QToolBoxHelper::addToolBoxContextMenuActions(const QToolBox *toolbox, QMenu *popup) { QToolBoxHelper *helper = helperOf(toolbox); if (!helper) - return 0; + return nullptr; return helper->addContextMenuActions(popup); } @@ -203,7 +203,7 @@ void QToolBoxHelper::setCurrentItemBackgroundRole(QPalette::ColorRole role) QMenu *QToolBoxHelper::addContextMenuActions(QMenu *popup) const { - QMenu *pageMenu = 0; + QMenu *pageMenu = nullptr; const int count = m_toolbox->count(); m_actionDeletePage->setEnabled(count > 1); if (count) { diff --git a/src/designer/src/lib/shared/qdesigner_toolbox_p.h b/src/designer/src/lib/shared/qdesigner_toolbox_p.h index 12be40c39..70dc68d9d 100644 --- a/src/designer/src/lib/shared/qdesigner_toolbox_p.h +++ b/src/designer/src/lib/shared/qdesigner_toolbox_p.h @@ -94,7 +94,7 @@ private: // PropertySheet to handle the page properties class QDESIGNER_SHARED_EXPORT QToolBoxWidgetPropertySheet : public QDesignerPropertySheet { public: - explicit QToolBoxWidgetPropertySheet(QToolBox *object, QObject *parent = 0); + explicit QToolBoxWidgetPropertySheet(QToolBox *object, QObject *parent = nullptr); void setProperty(int index, const QVariant &value) override; QVariant property(int index) const override; diff --git a/src/designer/src/lib/shared/qdesigner_utils.cpp b/src/designer/src/lib/shared/qdesigner_utils.cpp index 015963b3c..acbfc99f4 100644 --- a/src/designer/src/lib/shared/qdesigner_utils.cpp +++ b/src/designer/src/lib/shared/qdesigner_utils.cpp @@ -693,7 +693,7 @@ namespace qdesigner_internal QDESIGNER_SHARED_EXPORT QAction *preferredEditAction(QDesignerFormEditorInterface *core, QWidget *managedWidget) { - QAction *action = 0; + QAction *action = nullptr; if (const QDesignerTaskMenuExtension *taskMenu = qt_extension<QDesignerTaskMenuExtension*>(core->extensionManager(), managedWidget)) { action = taskMenu->preferredEditAction(); if (!action) { diff --git a/src/designer/src/lib/shared/qdesigner_utils_p.h b/src/designer/src/lib/shared/qdesigner_utils_p.h index 4d858a60b..e5ad490c8 100644 --- a/src/designer/src/lib/shared/qdesigner_utils_p.h +++ b/src/designer/src/lib/shared/qdesigner_utils_p.h @@ -87,9 +87,9 @@ public: MetaEnum() {} void addKey(IntType value, const QString &name); - QString valueToKey(IntType value, bool *ok = 0) const; + QString valueToKey(IntType value, bool *ok = nullptr) const; // Ignorant of scopes. - IntType keyToValue(QString key, bool *ok = 0) const; + IntType keyToValue(QString key, bool *ok = nullptr) const; const QString &name() const { return m_name; } const QString &scope() const { return m_scope; } @@ -164,13 +164,13 @@ public: DesignerMetaEnum() {} enum SerializationMode { FullyQualified, NameOnly }; - QString toString(int value, SerializationMode sm, bool *ok = 0) const; + QString toString(int value, SerializationMode sm, bool *ok = nullptr) const; QString messageToStringFailed(int value) const; QString messageParseFailed(const QString &s) const; // parse a string (ignorant of scopes) - int parseEnum(const QString &s, bool *ok = 0) const { return keyToValue(s, ok); } + int parseEnum(const QString &s, bool *ok = nullptr) const { return keyToValue(s, ok); } }; // -------------- DesignerMetaFlags: Meta type for flags. @@ -189,7 +189,7 @@ public: QString messageParseFailed(const QString &s) const; // parse a string (ignorant of scopes) - int parseFlags(const QString &s, bool *ok = 0) const; + int parseFlags(const QString &s, bool *ok = nullptr) const; }; // -------------- EnumValue: Returned by the property sheet for enumerations @@ -289,7 +289,7 @@ class QDESIGNER_SHARED_EXPORT DesignerPixmapCache : public QObject { Q_OBJECT public: - DesignerPixmapCache(QObject *parent = 0); + DesignerPixmapCache(QObject *parent = nullptr); QPixmap pixmap(const PropertySheetPixmapValue &value) const; void clear(); signals: @@ -303,7 +303,7 @@ class QDESIGNER_SHARED_EXPORT DesignerIconCache : public QObject { Q_OBJECT public: - explicit DesignerIconCache(DesignerPixmapCache *pixmapCache, QObject *parent = 0); + explicit DesignerIconCache(DesignerPixmapCache *pixmapCache, QObject *parent = nullptr); QIcon icon(const PropertySheetIconValue &value) const; void clear(); signals: @@ -466,7 +466,7 @@ private: namespace Utils { -inline int valueOf(const QVariant &value, bool *ok = 0) +inline int valueOf(const QVariant &value, bool *ok = nullptr) { if (value.canConvert<PropertySheetEnumValue>()) { if (ok) @@ -484,7 +484,7 @@ inline int valueOf(const QVariant &value, bool *ok = 0) inline bool isObjectAncestorOf(QObject *ancestor, QObject *child) { QObject *obj = child; - while (obj != 0) { + while (obj != nullptr) { if (obj == ancestor) return true; obj = obj->parent(); diff --git a/src/designer/src/lib/shared/qdesigner_widget_p.h b/src/designer/src/lib/shared/qdesigner_widget_p.h index bc9e62cbd..c12970692 100644 --- a/src/designer/src/lib/shared/qdesigner_widget_p.h +++ b/src/designer/src/lib/shared/qdesigner_widget_p.h @@ -56,7 +56,7 @@ class QDESIGNER_SHARED_EXPORT QDesignerWidget : public QWidget { Q_OBJECT public: - explicit QDesignerWidget(QDesignerFormWindowInterface* formWindow, QWidget *parent = 0); + explicit QDesignerWidget(QDesignerFormWindowInterface* formWindow, QWidget *parent = nullptr); ~QDesignerWidget() override; QDesignerFormWindowInterface* formWindow() const; diff --git a/src/designer/src/lib/shared/qdesigner_widgetbox.cpp b/src/designer/src/lib/shared/qdesigner_widgetbox.cpp index ec1bd5471..1ca79d777 100644 --- a/src/designer/src/lib/shared/qdesigner_widgetbox.cpp +++ b/src/designer/src/lib/shared/qdesigner_widgetbox.cpp @@ -183,7 +183,7 @@ DomUI *QDesignerWidgetBox::xmlToUi(const QString &name, const QString &xml, bool QString *errorMessage) { QXmlStreamReader reader(xml); - DomUI *ui = 0; + DomUI *ui = nullptr; // The xml description must either contain a root element "ui" with a child element "widget" // or "widget" as the root element (4.3 legacy) @@ -216,14 +216,14 @@ DomUI *QDesignerWidgetBox::xmlToUi(const QString &name, const QString &xml, bool "specified for the widget %3: %4\n%5") .arg(reader.lineNumber()).arg(reader.columnNumber()) .arg(name, reader.errorString(), xml); - return 0; + return nullptr; } if (!ui || !ui->elementWidget()) { delete ui; *errorMessage = tr("The XML code specified for the widget %1 does not contain " "any widget elements.\n%2").arg(name, xml); - return 0; + return nullptr; } if (insertFakeTopLevel) { diff --git a/src/designer/src/lib/shared/qdesigner_widgetbox_p.h b/src/designer/src/lib/shared/qdesigner_widgetbox_p.h index 55b6d834d..efedb34b2 100644 --- a/src/designer/src/lib/shared/qdesigner_widgetbox_p.h +++ b/src/designer/src/lib/shared/qdesigner_widgetbox_p.h @@ -57,7 +57,7 @@ class QDESIGNER_SHARED_EXPORT QDesignerWidgetBox : public QDesignerWidgetBoxInte public: enum LoadMode { LoadMerge, LoadReplace, LoadCustomWidgetsOnly }; - explicit QDesignerWidgetBox(QWidget *parent = 0, Qt::WindowFlags flags = 0); + explicit QDesignerWidgetBox(QWidget *parent = nullptr, Qt::WindowFlags flags = nullptr); LoadMode loadMode() const; void setLoadMode(LoadMode lm); diff --git a/src/designer/src/lib/shared/qdesigner_widgetitem.cpp b/src/designer/src/lib/shared/qdesigner_widgetitem.cpp index 03f8a241f..93dd2112e 100644 --- a/src/designer/src/lib/shared/qdesigner_widgetitem.cpp +++ b/src/designer/src/lib/shared/qdesigner_widgetitem.cpp @@ -63,7 +63,7 @@ static QWidgetItem *createDesignerWidgetItem(const QLayout *layout, QWidget *wid if (DebugWidgetItem) qDebug() << "QDesignerWidgetItem: Noncontainer: " << layout << widget; - return 0; + return nullptr; } static QString sizePolicyToString(const QSizePolicy &p) @@ -93,7 +93,7 @@ static const QLayout *findLayoutOfItem(const QLayout *haystack, const QLayoutIte if (const QLayout *containing = findLayoutOfItem(childLayout, needle)) return containing; } - return 0; + return nullptr; } @@ -224,7 +224,7 @@ bool QDesignerWidgetItem::check(const QLayout *layout, QWidget *w, Qt::Orientati // well. Avoid nested layouts (as the effective stretch cannot be easily // computed and may mess things up). if (ptrToOrientations) - *ptrToOrientations = 0; + *ptrToOrientations = nullptr; const QObject *layoutParent = layout->parent(); if (!layoutParent || !layoutParent->isWidgetType() || !WidgetFactory::isFormEditorObject(layoutParent)) @@ -272,7 +272,7 @@ void QDesignerWidgetItem::install() void QDesignerWidgetItem::deinstall() { - QLayoutPrivate::widgetItemFactoryMethod = 0; + QLayoutPrivate::widgetItemFactoryMethod = nullptr; } const QLayout *QDesignerWidgetItem::containingLayout() const @@ -296,7 +296,7 @@ void QDesignerWidgetItem::layoutChanged() { if (DebugWidgetItem) qDebug() << Q_FUNC_INFO; - m_cachedContainingLayout = 0; + m_cachedContainingLayout = nullptr; } bool QDesignerWidgetItem::eventFilter(QObject * /* watched */, QEvent *event) diff --git a/src/designer/src/lib/shared/qdesigner_widgetitem_p.h b/src/designer/src/lib/shared/qdesigner_widgetitem_p.h index d65be4833..a8a92d227 100644 --- a/src/designer/src/lib/shared/qdesigner_widgetitem_p.h +++ b/src/designer/src/lib/shared/qdesigner_widgetitem_p.h @@ -87,7 +87,7 @@ public: void setNonLaidOutSizeHint(const QSize &s); // Check whether a QDesignerWidgetItem should be installed - static bool check(const QLayout *layout, QWidget *w, Qt::Orientations *ptrToOrientations = 0); + static bool check(const QLayout *layout, QWidget *w, Qt::Orientations *ptrToOrientations = nullptr); // Register itself using QLayoutPrivate's widget item factory method hook static void install(); diff --git a/src/designer/src/lib/shared/qlayout_widget.cpp b/src/designer/src/lib/shared/qlayout_widget.cpp index 2c9daa162..9b6911dcd 100644 --- a/src/designer/src/lib/shared/qlayout_widget.cpp +++ b/src/designer/src/lib/shared/qlayout_widget.cpp @@ -172,7 +172,7 @@ static QLayout *recreateManagedLayout(const QDesignerFormEditorInterface *core, qdesigner_internal::LayoutProperties properties; const int mask = properties.fromPropertySheet(core, lt, qdesigner_internal::LayoutProperties::AllProperties); qdesigner_internal::LayoutInfo::deleteLayout(core, w); - QLayout *rc = core->widgetFactory()->createLayout(w, 0, t); + QLayout *rc = core->widgetFactory()->createLayout(w, nullptr, t); properties.toPropertySheet(core, rc, mask, true); return rc; } @@ -508,7 +508,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const delete boxLayout->takeAt(index); if (visible) before->hide(); - before->setParent(0); + before->setParent(nullptr); boxLayout->insertWidget(index, after); ok = true; } @@ -543,7 +543,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const if ( (*it)->widget() == w) return *it; - return 0; + return nullptr; } BoxLayoutHelper::LayoutItemVector BoxLayoutHelper::disassembleLayout(QLayout *lt) @@ -725,7 +725,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const const LayoutItemRectMap::const_iterator icend = itemMap.constEnd(); for (LayoutItemRectMap::const_iterator it = itemMap.constBegin(); it != icend; ++it) { const QRect info = it.value(); - const Qt::Alignment alignment = widgetAlignmentMap.value(it.key()->widget(), Qt::Alignment(0)); + const Qt::Alignment alignment = widgetAlignmentMap.value(it.key()->widget(), {}); grid->addItem(it.key(), info.y(), info.x(), info.height(), info.width(), alignment); } // create spacers @@ -963,7 +963,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const delete gridLayout->takeAt(index); if (visible) before->hide(); - before->setParent(0); + before->setParent(nullptr); gridLayout->addWidget(after, row, column, rowSpan, columnSpan); ok = true; } @@ -1041,7 +1041,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const QFormLayout *form = qobject_cast<QFormLayout *>(lt); Q_ASSERT(form); int row, column, colspan; - getFormLayoutItemPosition(form, index, &row, &column, 0, &colspan); + getFormLayoutItemPosition(form, index, &row, &column, nullptr, &colspan); return QRect(column, row, colspan, 1); } @@ -1070,7 +1070,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const } // delete old item and pad with by spacer items int row, column, colspan; - getFormLayoutItemPosition(formLayout, index, &row, &column, 0, &colspan); + getFormLayoutItemPosition(formLayout, index, &row, &column, nullptr, &colspan); if (debugLayout) qDebug() << "FormLayoutHelper::removeWidget: #" << index << widget << " at " << row << column << colspan; delete formLayout->takeAt(index); @@ -1094,7 +1094,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const delete formLayout->takeAt(index); if (visible) before->hide(); - before->setParent(0); + before->setParent(nullptr); formLayout->setWidget(row, role, after); ok = true; } @@ -1116,7 +1116,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const if (!LayoutInfo::isEmptyItem(item)) { QWidget *w = item->widget(); Q_ASSERT(w); - getFormLayoutItemPosition(lt, i, &row, &column, 0, &colspan); + getFormLayoutItemPosition(lt, i, &row, &column, nullptr, &colspan); if (colspan > 1 || column == 0) rc[row].first = w; if (colspan > 1 || column == 1) @@ -1154,7 +1154,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const formLayout = static_cast<QFormLayout*>(recreateManagedLayout(core, widgetWithManagedLayout, formLayout )); for (int r = 0; r < rowCount; r++) { QWidget *widgets[FormLayoutColumns] = { storedState[r].first, storedState[r].second }; - const bool spanning = widgets[0] != 0 && widgets[0] == widgets[1]; + const bool spanning = widgets[0] != nullptr && widgets[0] == widgets[1]; if (spanning) { formLayout->setWidget(r, QFormLayout::SpanningRole, widgets[0]); } else { @@ -1191,7 +1191,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const LayoutItemPairs pairs(rowCount, LayoutItemPair(0, 0)); for (int i = formLayout->count() - 1; i >= 0; i--) { int row, col,colspan; - getFormLayoutItemPosition(formLayout, i, &row, &col, 0, &colspan); + getFormLayoutItemPosition(formLayout, i, &row, &col, nullptr, &colspan); if (colspan > 1) { pairs[row].first = pairs[row].second = formLayout->takeAt(i); } else { @@ -1226,7 +1226,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const LayoutHelper *LayoutHelper::createLayoutHelper(int type) { - LayoutHelper *rc = 0; + LayoutHelper *rc = nullptr; switch (type) { case LayoutInfo::HBox: rc = new BoxLayoutHelper(Qt::Horizontal); @@ -1540,7 +1540,7 @@ namespace { class QBoxLayoutSupport: public QLayoutSupport { public: - QBoxLayoutSupport(QDesignerFormWindowInterface *formWindow, QWidget *widget, Qt::Orientation orientation, QObject *parent = 0); + QBoxLayoutSupport(QDesignerFormWindowInterface *formWindow, QWidget *widget, Qt::Orientation orientation, QObject *parent = nullptr); void insertWidget(QWidget *widget, const QPair<int, int> &cell) override; void removeWidget(QWidget *widget) override; @@ -1671,7 +1671,7 @@ class GridLikeLayoutSupportBase: public QLayoutSupport { public: - GridLikeLayoutSupportBase(QDesignerFormWindowInterface *formWindow, QWidget *widget, LayoutHelper *helper, QObject *parent = 0) : + GridLikeLayoutSupportBase(QDesignerFormWindowInterface *formWindow, QWidget *widget, LayoutHelper *helper, QObject *parent = nullptr) : QLayoutSupport(formWindow, widget, helper, parent) {} void insertWidget(QWidget *widget, const QPair<int, int> &cell) override; @@ -1786,7 +1786,7 @@ class QGridLayoutSupport: public GridLikeLayoutSupportBase<QGridLayout> { public: - QGridLayoutSupport(QDesignerFormWindowInterface *formWindow, QWidget *widget, QObject *parent = 0); + QGridLayoutSupport(QDesignerFormWindowInterface *formWindow, QWidget *widget, QObject *parent = nullptr); void simplify() override; void insertRow(int row) override; @@ -1833,7 +1833,7 @@ void QGridLayoutSupport::simplify() class QFormLayoutSupport: public GridLikeLayoutSupportBase<QFormLayout> { public: - QFormLayoutSupport(QDesignerFormWindowInterface *formWindow, QWidget *widget, QObject *parent = 0); + QFormLayoutSupport(QDesignerFormWindowInterface *formWindow, QWidget *widget, QObject *parent = nullptr); void simplify() override {} void insertRow(int /*row*/) override {} @@ -1861,7 +1861,7 @@ QLayoutSupport *QLayoutSupport::createLayoutSupport(QDesignerFormWindowInterface { const QLayout *layout = LayoutInfo::managedLayout(formWindow->core(), widget); Q_ASSERT(layout); - QLayoutSupport *rc = 0; + QLayoutSupport *rc = nullptr; switch (LayoutInfo::layoutType(formWindow->core(), layout)) { case LayoutInfo::HBox: rc = new QBoxLayoutSupport(formWindow, widget, Qt::Horizontal, parent); @@ -1992,7 +1992,7 @@ int QLayoutWidget::layoutLeftMargin() const { if (m_leftMargin < 0 && layout()) { int margin; - layout()->getContentsMargins(&margin, 0, 0, 0); + layout()->getContentsMargins(&margin, nullptr, nullptr, nullptr); return margin; } return m_leftMargin; @@ -2015,7 +2015,7 @@ int QLayoutWidget::layoutTopMargin() const { if (m_topMargin < 0 && layout()) { int margin; - layout()->getContentsMargins(0, &margin, 0, 0); + layout()->getContentsMargins(nullptr, &margin, nullptr, nullptr); return margin; } return m_topMargin; @@ -2038,7 +2038,7 @@ int QLayoutWidget::layoutRightMargin() const { if (m_rightMargin < 0 && layout()) { int margin; - layout()->getContentsMargins(0, 0, &margin, 0); + layout()->getContentsMargins(nullptr, nullptr, &margin, nullptr); return margin; } return m_rightMargin; @@ -2061,7 +2061,7 @@ int QLayoutWidget::layoutBottomMargin() const { if (m_bottomMargin < 0 && layout()) { int margin; - layout()->getContentsMargins(0, 0, 0, &margin); + layout()->getContentsMargins(nullptr, nullptr, nullptr, &margin); return margin; } return m_bottomMargin; diff --git a/src/designer/src/lib/shared/qlayout_widget_p.h b/src/designer/src/lib/shared/qlayout_widget_p.h index 23bc736b3..ff91bd392 100644 --- a/src/designer/src/lib/shared/qlayout_widget_p.h +++ b/src/designer/src/lib/shared/qlayout_widget_p.h @@ -165,7 +165,7 @@ class QDESIGNER_SHARED_EXPORT QLayoutSupport: public QObject, public QDesignerLa Q_INTERFACES(QDesignerLayoutDecorationExtension) protected: - QLayoutSupport(QDesignerFormWindowInterface *formWindow, QWidget *widget, LayoutHelper *helper, QObject *parent = 0); + QLayoutSupport(QDesignerFormWindowInterface *formWindow, QWidget *widget, LayoutHelper *helper, QObject *parent = nullptr); public: ~QLayoutSupport() override; @@ -203,7 +203,7 @@ public: static bool canSimplifyQuickCheck(const QGridLayout *); static bool canSimplifyQuickCheck(const QFormLayout *fl); // Factory function, create layout support according to layout type of widget - static QLayoutSupport *createLayoutSupport(QDesignerFormWindowInterface *formWindow, QWidget *widget, QObject *parent = 0); + static QLayoutSupport *createLayoutSupport(QDesignerFormWindowInterface *formWindow, QWidget *widget, QObject *parent = nullptr); protected: // figure out insertion position and mode from indicator on empty cell if supported @@ -246,7 +246,7 @@ class QDESIGNER_SHARED_EXPORT QLayoutWidget: public QWidget { Q_OBJECT public: - explicit QLayoutWidget(QDesignerFormWindowInterface *formWindow, QWidget *parent = 0); + explicit QLayoutWidget(QDesignerFormWindowInterface *formWindow, QWidget *parent = nullptr); int layoutLeftMargin() const; void setLayoutLeftMargin(int layoutMargin); diff --git a/src/designer/src/lib/shared/qsimpleresource.cpp b/src/designer/src/lib/shared/qsimpleresource.cpp index 0cedba686..705d7b608 100644 --- a/src/designer/src/lib/shared/qsimpleresource.cpp +++ b/src/designer/src/lib/shared/qsimpleresource.cpp @@ -216,7 +216,7 @@ void QSimpleResource::addCustomWidgetsToWidgetDatabase(const QDesignerFormEditor void QSimpleResource::handleDomCustomWidgets(const QDesignerFormEditorInterface *core, const DomCustomWidgets *dom_custom_widgets) { - if (dom_custom_widgets == 0) + if (dom_custom_widgets == nullptr) return; auto custom_widget_list = dom_custom_widgets->elementCustomWidget(); // Attempt to insert each item derived from its base class. diff --git a/src/designer/src/lib/shared/qsimpleresource_p.h b/src/designer/src/lib/shared/qsimpleresource_p.h index e2d768451..c615f4ee2 100644 --- a/src/designer/src/lib/shared/qsimpleresource_p.h +++ b/src/designer/src/lib/shared/qsimpleresource_p.h @@ -124,8 +124,8 @@ public: // A widget parent needs to be specified, otherwise, the widget factory cannot locate the form window via parent // and thus is not able to construct special widgets (QLayoutWidget). - virtual FormBuilderClipboard paste(DomUI *ui, QWidget *widgetParent, QObject *actionParent = 0) = 0; - virtual FormBuilderClipboard paste(QIODevice *dev, QWidget *widgetParent, QObject *actionParent = 0) = 0; + virtual FormBuilderClipboard paste(DomUI *ui, QWidget *widgetParent, QObject *actionParent = nullptr) = 0; + virtual FormBuilderClipboard paste(QIODevice *dev, QWidget *widgetParent, QObject *actionParent = nullptr) = 0; }; } // namespace qdesigner_internal diff --git a/src/designer/src/lib/shared/qtresourceeditordialog.cpp b/src/designer/src/lib/shared/qtresourceeditordialog.cpp index a7f956c70..f2275d0b9 100644 --- a/src/designer/src/lib/shared/qtresourceeditordialog.cpp +++ b/src/designer/src/lib/shared/qtresourceeditordialog.cpp @@ -269,7 +269,7 @@ class QtQrcManager : public QObject { Q_OBJECT public: - QtQrcManager(QObject *parent = 0); + QtQrcManager(QObject *parent = nullptr); ~QtQrcManager() override; QList<QtQrcFile *> qrcFiles() const; @@ -279,7 +279,7 @@ public: QtQrcFile *qrcFileOf(QtResourcePrefix *resourcePrefix) const; QtResourcePrefix *resourcePrefixOf(QtResourceFile *resourceFile) const; - QtQrcFile *importQrcFile(const QtQrcFileData &qrcFileData, QtQrcFile *beforeQrcFile = 0); + QtQrcFile *importQrcFile(const QtQrcFileData &qrcFileData, QtQrcFile *beforeQrcFile = nullptr); void exportQrcFile(QtQrcFile *qrcFile, QtQrcFileData *qrcFileData) const; QIcon icon(const QString &resourceFullPath) const; @@ -297,20 +297,20 @@ public: public slots: - QtQrcFile *insertQrcFile(const QString &path, QtQrcFile *beforeQrcFile = 0, bool newFile = false); + QtQrcFile *insertQrcFile(const QString &path, QtQrcFile *beforeQrcFile = nullptr, bool newFile = false); void moveQrcFile(QtQrcFile *qrcFile, QtQrcFile *beforeQrcFile); void setInitialState(QtQrcFile *qrcFile, const QtQrcFileData &initialState); void removeQrcFile(QtQrcFile *qrcFile); QtResourcePrefix *insertResourcePrefix(QtQrcFile *qrcFile, const QString &prefix, - const QString &language, QtResourcePrefix *beforeResourcePrefix = 0); + const QString &language, QtResourcePrefix *beforeResourcePrefix = nullptr); void moveResourcePrefix(QtResourcePrefix *resourcePrefix, QtResourcePrefix *beforeResourcePrefix); // the same qrc file??? void changeResourcePrefix(QtResourcePrefix *resourcePrefix, const QString &newPrefix); void changeResourceLanguage(QtResourcePrefix *resourcePrefix, const QString &newLanguage); void removeResourcePrefix(QtResourcePrefix *resourcePrefix); QtResourceFile *insertResourceFile(QtResourcePrefix *resourcePrefix, const QString &path, - const QString &alias, QtResourceFile *beforeResourceFile = 0); + const QString &alias, QtResourceFile *beforeResourceFile = nullptr); void moveResourceFile(QtResourceFile *resourceFile, QtResourceFile *beforeResourceFile); // the same prefix??? void changeResourceAlias(QtResourceFile *resourceFile, const QString &newAlias); void removeResourceFile(QtResourceFile *resourceFile); @@ -377,11 +377,11 @@ QtQrcFile *QtQrcManager::importQrcFile(const QtQrcFileData &qrcFileData, QtQrcFi { QtQrcFile *qrcFile = insertQrcFile(qrcFileData.qrcPath, beforeQrcFile); if (!qrcFile) - return 0; + return nullptr; for (const QtResourcePrefixData &prefixData : qrcFileData.resourceList) { - QtResourcePrefix *resourcePrefix = insertResourcePrefix(qrcFile, prefixData.prefix, prefixData.language, 0); + QtResourcePrefix *resourcePrefix = insertResourcePrefix(qrcFile, prefixData.prefix, prefixData.language, nullptr); for (const QtResourceFileData &fileData : prefixData.resourceFileList) - insertResourceFile(resourcePrefix, fileData.path, fileData.alias, 0); + insertResourceFile(resourcePrefix, fileData.path, fileData.alias, nullptr); } setInitialState(qrcFile, qrcFileData); return qrcFile; @@ -439,64 +439,64 @@ bool QtQrcManager::exists(QtQrcFile *qrcFile) const QtQrcFile *QtQrcManager::prevQrcFile(QtQrcFile *qrcFile) const { if (!qrcFile) - return 0; + return nullptr; const int idx = m_qrcFiles.indexOf(qrcFile); if (idx <= 0) - return 0; + return nullptr; return m_qrcFiles.at(idx - 1); } QtQrcFile *QtQrcManager::nextQrcFile(QtQrcFile *qrcFile) const { if (!qrcFile) - return 0; + return nullptr; const int idx = m_qrcFiles.indexOf(qrcFile); if (idx < 0 || idx == m_qrcFiles.size() - 1) - return 0; + return nullptr; return m_qrcFiles.at(idx + 1); } QtResourcePrefix *QtQrcManager::prevResourcePrefix(QtResourcePrefix *resourcePrefix) const { if (!resourcePrefix) - return 0; + return nullptr; QList<QtResourcePrefix *> prefixes = qrcFileOf(resourcePrefix)->resourcePrefixList(); const int idx = prefixes.indexOf(resourcePrefix); if (idx <= 0) - return 0; + return nullptr; return prefixes.at(idx - 1); } QtResourcePrefix *QtQrcManager::nextResourcePrefix(QtResourcePrefix *resourcePrefix) const { if (!resourcePrefix) - return 0; + return nullptr; QList<QtResourcePrefix *> prefixes = qrcFileOf(resourcePrefix)->resourcePrefixList(); const int idx = prefixes.indexOf(resourcePrefix); if (idx < 0 || idx == prefixes.size() - 1) - return 0; + return nullptr; return prefixes.at(idx + 1); } QtResourceFile *QtQrcManager::prevResourceFile(QtResourceFile *resourceFile) const { if (!resourceFile) - return 0; + return nullptr; QList<QtResourceFile *> files = resourcePrefixOf(resourceFile)->resourceFiles(); const int idx = files.indexOf(resourceFile); if (idx <= 0) - return 0; + return nullptr; return files.at(idx - 1); } QtResourceFile *QtQrcManager::nextResourceFile(QtResourceFile *resourceFile) const { if (!resourceFile) - return 0; + return nullptr; QList<QtResourceFile *> files = resourcePrefixOf(resourceFile)->resourceFiles(); const int idx = files.indexOf(resourceFile); if (idx < 0 || idx == files.size() - 1) - return 0; + return nullptr; return files.at(idx + 1); } @@ -510,7 +510,7 @@ void QtQrcManager::clear() QtQrcFile *QtQrcManager::insertQrcFile(const QString &path, QtQrcFile *beforeQrcFile, bool newFile) { if (m_pathToQrc.contains(path)) - return 0; + return nullptr; int idx = m_qrcFiles.indexOf(beforeQrcFile); if (idx < 0) @@ -545,7 +545,7 @@ void QtQrcManager::moveQrcFile(QtQrcFile *qrcFile, QtQrcFile *beforeQrcFile) if (idx == beforeIdx - 1) // the same position, nothing changes return; - QtQrcFile *oldBefore = 0; + QtQrcFile *oldBefore = nullptr; if (idx < m_qrcFiles.size() - 1) oldBefore = m_qrcFiles.at(idx + 1); @@ -585,7 +585,7 @@ QtResourcePrefix *QtQrcManager::insertResourcePrefix(QtQrcFile *qrcFile, const Q const QString &language, QtResourcePrefix *beforeResourcePrefix) { if (!qrcFile) - return 0; + return nullptr; int idx = qrcFile->m_resourcePrefixes.indexOf(beforeResourcePrefix); if (idx < 0) @@ -623,7 +623,7 @@ void QtQrcManager::moveResourcePrefix(QtResourcePrefix *resourcePrefix, QtResour if (idx == beforeIdx - 1) // the same position, nothing changes return; - QtResourcePrefix *oldBefore = 0; + QtResourcePrefix *oldBefore = nullptr; if (idx < qrcFile->m_resourcePrefixes.size() - 1) oldBefore = qrcFile->m_resourcePrefixes.at(idx + 1); @@ -687,7 +687,7 @@ QtResourceFile *QtQrcManager::insertResourceFile(QtResourcePrefix *resourcePrefi const QString &alias, QtResourceFile *beforeResourceFile) { if (!resourcePrefix) - return 0; + return nullptr; int idx = resourcePrefix->m_resourceFiles.indexOf(beforeResourceFile); if (idx < 0) @@ -735,7 +735,7 @@ void QtQrcManager::moveResourceFile(QtResourceFile *resourceFile, QtResourceFile if (idx == beforeIdx - 1) // the same position, nothing changes return; - QtResourceFile *oldBefore = 0; + QtResourceFile *oldBefore = nullptr; if (idx < resourcePrefix->m_resourceFiles.size() - 1) oldBefore = resourcePrefix->m_resourceFiles.at(idx + 1); @@ -961,7 +961,7 @@ void QtResourceEditorDialogPrivate::slotQrcFileRemoved(QtQrcFile *qrcFile) { QListWidgetItem *item = m_qrcFileToItem.value(qrcFile); if (item == m_ui.qrcFileList->currentItem()) - m_ui.qrcFileList->setCurrentItem(0); // this should trigger list view signal currentItemChanged(0), and slot should set m_currentQrcFile to 0 + m_ui.qrcFileList->setCurrentItem(nullptr); // this should trigger list view signal currentItemChanged(0), and slot should set m_currentQrcFile to 0 m_ignoreCurrentChanged = true; delete item; m_ignoreCurrentChanged = false; @@ -972,7 +972,7 @@ void QtResourceEditorDialogPrivate::slotQrcFileRemoved(QtQrcFile *qrcFile) QStandardItem *QtResourceEditorDialogPrivate::insertResourcePrefix(QtResourcePrefix *resourcePrefix) { if (m_qrcManager->qrcFileOf(resourcePrefix) != m_currentQrcFile) - return 0; + return nullptr; QtResourcePrefix *prevResourcePrefix = m_qrcManager->prevResourcePrefix(resourcePrefix); QStandardItem *prevItem = m_resourcePrefixToPrefixItem.value(prevResourcePrefix); @@ -1198,7 +1198,7 @@ void QtResourceEditorDialogPrivate::slotCurrentQrcFileChanged(QListWidgetItem *i m_currentQrcFile = newCurrentQrcFile; slotCurrentTreeViewItemChanged(QModelIndex()); - QStandardItem *firstPrefix = 0; // select first prefix + QStandardItem *firstPrefix = nullptr; // select first prefix if (m_currentQrcFile) { const QList<QtResourcePrefix *> newPrefixList = m_currentQrcFile->resourcePrefixList(); for (QtResourcePrefix *resourcePrefix : newPrefixList) { @@ -1316,7 +1316,7 @@ QString QtResourceEditorDialogPrivate::getSaveFileNameWithExtension(QWidget *par QString saveFile; while (true) { - saveFile = m_dlgGui->getSaveFileName(parent, title, dir, filter, 0, QFileDialog::DontConfirmOverwrite); + saveFile = m_dlgGui->getSaveFileName(parent, title, dir, filter, nullptr, QFileDialog::DontConfirmOverwrite); if (saveFile.isEmpty()) return saveFile; @@ -1443,7 +1443,7 @@ QtResourceFile *QtResourceEditorDialogPrivate::getCurrentResourceFile() const QStandardItem *currentItem = m_treeModel->itemFromIndex(m_treeSelection->currentIndex()); - QtResourceFile *currentResourceFile = 0; + QtResourceFile *currentResourceFile = nullptr; if (currentItem) { currentResourceFile = m_pathItemToResourceFile.value(currentItem); if (!currentResourceFile) @@ -1456,7 +1456,7 @@ QtResourcePrefix *QtResourceEditorDialogPrivate::getCurrentResourcePrefix() cons { QStandardItem *currentItem = m_treeModel->itemFromIndex(m_treeSelection->currentIndex()); - QtResourcePrefix *currentResourcePrefix = 0; + QtResourcePrefix *currentResourcePrefix = nullptr; if (currentItem) { currentResourcePrefix = m_prefixItemToResourcePrefix.value(currentItem); if (!currentResourcePrefix) { @@ -1689,7 +1689,7 @@ void QtResourceEditorDialogPrivate::slotRemove() if (!resourcePrefix) resourcePrefix = m_languageItemToResourcePrefix.value(item); - QStandardItem *newCurrentItem = 0; + QStandardItem *newCurrentItem = nullptr; if (resourceFile) { QtResourceFile *nextFile = m_qrcManager->nextResourceFile(resourceFile); diff --git a/src/designer/src/lib/shared/qtresourceeditordialog_p.h b/src/designer/src/lib/shared/qtresourceeditordialog_p.h index 331472293..e92668eaf 100644 --- a/src/designer/src/lib/shared/qtresourceeditordialog_p.h +++ b/src/designer/src/lib/shared/qtresourceeditordialog_p.h @@ -59,16 +59,16 @@ public: QString selectedResource() const; static QString editResources(QDesignerFormEditorInterface *core, QtResourceModel *model, - QDesignerDialogGuiInterface *dlgGui, QWidget *parent = 0); + QDesignerDialogGuiInterface *dlgGui, QWidget *parent = nullptr); // Helper to display a message box with rcc logs in case of errors. - static void displayResourceFailures(const QString &logOutput, QDesignerDialogGuiInterface *dlgGui, QWidget *parent = 0); + static void displayResourceFailures(const QString &logOutput, QDesignerDialogGuiInterface *dlgGui, QWidget *parent = nullptr); public slots: void accept() override; private: - QtResourceEditorDialog(QDesignerFormEditorInterface *core, QDesignerDialogGuiInterface *dlgGui, QWidget *parent = 0); + QtResourceEditorDialog(QDesignerFormEditorInterface *core, QDesignerDialogGuiInterface *dlgGui, QWidget *parent = nullptr); ~QtResourceEditorDialog() override; QScopedPointer<class QtResourceEditorDialogPrivate> d_ptr; diff --git a/src/designer/src/lib/shared/qtresourcemodel.cpp b/src/designer/src/lib/shared/qtresourcemodel.cpp index 0675d08d8..d9e078463 100644 --- a/src/designer/src/lib/shared/qtresourcemodel.cpp +++ b/src/designer/src/lib/shared/qtresourcemodel.cpp @@ -49,13 +49,13 @@ class QtResourceSetPrivate QtResourceSet *q_ptr; Q_DECLARE_PUBLIC(QtResourceSet) public: - QtResourceSetPrivate(QtResourceModel *model = 0); + QtResourceSetPrivate(QtResourceModel *model = nullptr); QtResourceModel *m_resourceModel; }; QtResourceSetPrivate::QtResourceSetPrivate(QtResourceModel *model) : - q_ptr(0), + q_ptr(nullptr), m_resourceModel(model) { } @@ -68,7 +68,7 @@ class QtResourceModelPrivate Q_DISABLE_COPY(QtResourceModelPrivate) public: QtResourceModelPrivate(); - void activate(QtResourceSet *resourceSet, const QStringList &newPaths, int *errorCount = 0, QString *errorMessages = 0); + void activate(QtResourceSet *resourceSet, const QStringList &newPaths, int *errorCount = nullptr, QString *errorMessages = nullptr); void removeOldPaths(QtResourceSet *resourceSet, const QStringList &newPaths); QMap<QString, bool> m_pathToModified; @@ -147,7 +147,7 @@ void QtResourceSet::setModified(const QString &path) const QByteArray *QtResourceModelPrivate::createResource(const QString &path, QStringList *contents, int *errorCount, QIODevice &errorDevice) const { typedef RCCResourceLibrary::ResourceDataFileMap ResourceDataFileMap; - const QByteArray *rc = 0; + const QByteArray *rc = nullptr; *errorCount = -1; contents->clear(); do { @@ -519,7 +519,7 @@ void QtResourceModel::removeResourceSet(QtResourceSet *resourceSet) if (!resourceSet) return; if (currentResourceSet() == resourceSet) - setCurrentResourceSet(0); + setCurrentResourceSet(nullptr); // remove rcc files for those paths which are not used in any other resource set d_ptr->removeOldPaths(resourceSet, QStringList()); diff --git a/src/designer/src/lib/shared/qtresourcemodel_p.h b/src/designer/src/lib/shared/qtresourcemodel_p.h index 4430da4a9..c1f1086fd 100644 --- a/src/designer/src/lib/shared/qtresourcemodel_p.h +++ b/src/designer/src/lib/shared/qtresourcemodel_p.h @@ -65,7 +65,7 @@ public: // resource set) it is automatically unloaded. The removed file can also be // marked as modified (later when another resource set which contains // removed path is activated will be reloaded) - void activateResourceFilePaths(const QStringList &paths, int *errorCount = 0, QString *errorMessages = 0); + void activateResourceFilePaths(const QStringList &paths, int *errorCount = nullptr, QString *errorMessages = nullptr); bool isModified(const QString &path) const; // for all paths in resource model (redundant here, maybe it should be removed from here) void setModified(const QString &path); // for all paths in resource model (redundant here, maybe it should be removed from here) @@ -84,7 +84,7 @@ class QDESIGNER_SHARED_EXPORT QtResourceModel : public QObject // one instance p { Q_OBJECT public: - QtResourceModel(QObject *parent = 0); + QtResourceModel(QObject *parent = nullptr); ~QtResourceModel(); QStringList loadedQrcFiles() const; @@ -94,13 +94,13 @@ public: QList<QtResourceSet *> resourceSets() const; QtResourceSet *currentResourceSet() const; - void setCurrentResourceSet(QtResourceSet *resourceSet, int *errorCount = 0, QString *errorMessages = 0); + void setCurrentResourceSet(QtResourceSet *resourceSet, int *errorCount = nullptr, QString *errorMessages = nullptr); QtResourceSet *addResourceSet(const QStringList &paths); void removeResourceSet(QtResourceSet *resourceSet); - void reload(const QString &path, int *errorCount = 0, QString *errorMessages = 0); - void reload(int *errorCount = 0, QString *errorMessages = 0); + void reload(const QString &path, int *errorCount = nullptr, QString *errorMessages = nullptr); + void reload(int *errorCount = nullptr, QString *errorMessages = nullptr); // Contents of the current resource set (content file to qrc path) QMap<QString, QString> contents() const; diff --git a/src/designer/src/lib/shared/qtresourceview.cpp b/src/designer/src/lib/shared/qtresourceview.cpp index db9e4e4f8..61f00a53d 100644 --- a/src/designer/src/lib/shared/qtresourceview.cpp +++ b/src/designer/src/lib/shared/qtresourceview.cpp @@ -76,7 +76,7 @@ static const char *ResourceViewDialogC = "ResourceDialog"; // ---------------- ResourceListWidget: A list widget that has drag enabled class ResourceListWidget : public QListWidget { public: - ResourceListWidget(QWidget *parent = 0); + ResourceListWidget(QWidget *parent = nullptr); protected: void startDrag(Qt::DropActions supportedActions) override; @@ -377,7 +377,7 @@ void QtResourceViewPrivate::createPaths() } QQueue<QPair<QString, QTreeWidgetItem *> > pathToParentItemQueue; - pathToParentItemQueue.enqueue(qMakePair(root, static_cast<QTreeWidgetItem *>(0))); + pathToParentItemQueue.enqueue(qMakePair(root, static_cast<QTreeWidgetItem *>(nullptr))); while (!pathToParentItemQueue.isEmpty()) { QPair<QString, QTreeWidgetItem *> pathToParentItem = pathToParentItemQueue.dequeue(); const QString path = pathToParentItem.first; @@ -496,7 +496,7 @@ void QtResourceViewPrivate::filterOutResources() QTreeWidgetItem *QtResourceViewPrivate::createPath(const QString &path, QTreeWidgetItem *parent) { - QTreeWidgetItem *item = 0; + QTreeWidgetItem *item = nullptr; if (parent) item = new QTreeWidgetItem(parent); else @@ -815,7 +815,7 @@ public: }; QtResourceViewDialogPrivate::QtResourceViewDialogPrivate(QDesignerFormEditorInterface *core) : - q_ptr(0), + q_ptr(nullptr), m_core(core), m_view(new QtResourceView(core)), m_box(new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel)) diff --git a/src/designer/src/lib/shared/qtresourceview_p.h b/src/designer/src/lib/shared/qtresourceview_p.h index 732b1fd62..dc47b384a 100644 --- a/src/designer/src/lib/shared/qtresourceview_p.h +++ b/src/designer/src/lib/shared/qtresourceview_p.h @@ -55,7 +55,7 @@ class QDESIGNER_SHARED_EXPORT QtResourceView : public QWidget { Q_OBJECT public: - explicit QtResourceView(QDesignerFormEditorInterface *core, QWidget *parent = 0); + explicit QtResourceView(QDesignerFormEditorInterface *core, QWidget *parent = nullptr); ~QtResourceView(); void setDragEnabled(bool dragEnabled); @@ -77,8 +77,8 @@ public: enum ResourceType { ResourceImage, ResourceStyleSheet, ResourceOther }; static QString encodeMimeData(ResourceType resourceType, const QString &path); - static bool decodeMimeData(const QMimeData *md, ResourceType *t = 0, QString *file = 0); - static bool decodeMimeData(const QString &text, ResourceType *t = 0, QString *file = 0); + static bool decodeMimeData(const QMimeData *md, ResourceType *t = nullptr, QString *file = nullptr); + static bool decodeMimeData(const QString &text, ResourceType *t = nullptr, QString *file = nullptr); signals: void resourceSelected(const QString &resource); @@ -109,7 +109,7 @@ class QDESIGNER_SHARED_EXPORT QtResourceViewDialog : public QDialog { Q_OBJECT public: - explicit QtResourceViewDialog(QDesignerFormEditorInterface *core, QWidget *parent = 0); + explicit QtResourceViewDialog(QDesignerFormEditorInterface *core, QWidget *parent = nullptr); ~QtResourceViewDialog() override; QString selectedResource() const; diff --git a/src/designer/src/lib/shared/rcc.cpp b/src/designer/src/lib/shared/rcc.cpp index d2cdb4f25..b98f17e07 100644 --- a/src/designer/src/lib/shared/rcc.cpp +++ b/src/designer/src/lib/shared/rcc.cpp @@ -129,7 +129,7 @@ RCCFileInfo::RCCFileInfo(const QString &name, const QFileInfo &fileInfo, m_language = language; m_country = country; m_flags = flags; - m_parent = 0; + m_parent = nullptr; m_nameOffset = 0; m_dataOffset = 0; m_childOffset = 0; @@ -328,7 +328,7 @@ RCCResourceLibrary::Strings::Strings() : } RCCResourceLibrary::RCCResourceLibrary() - : m_root(0), + : m_root(nullptr), m_format(C_Code), m_verbose(false), m_compressLevel(CONSTANT_COMPRESSLEVEL_DEFAULT), @@ -553,7 +553,7 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice, return false; } - if (m_root == 0) { + if (m_root == nullptr) { const QString msg = QString::fromUtf8("RCC: Warning: No resources in '%1'.\n").arg(fname); m_errorDevice->write(msg.toUtf8()); if (!ignoreErrors && m_format == Binary) { @@ -610,9 +610,9 @@ void RCCResourceLibrary::reset() { if (m_root) { delete m_root; - m_root = 0; + m_root = nullptr; } - m_errorDevice = 0; + m_errorDevice = nullptr; m_failedResources.clear(); } diff --git a/src/designer/src/lib/shared/richtexteditor.cpp b/src/designer/src/lib/shared/richtexteditor.cpp index 2988dad31..434b72104 100644 --- a/src/designer/src/lib/shared/richtexteditor.cpp +++ b/src/designer/src/lib/shared/richtexteditor.cpp @@ -116,7 +116,7 @@ static inline bool isWhiteSpace(const QStringRef &in) // Richtext simplification filter: Remove hard-coded font settings, // <style> elements, <p> attributes other than 'align' and // and unnecessary meta-information. -QString simplifyRichTextFilter(const QString &in, bool *isPlainTextPtr = 0) +QString simplifyRichTextFilter(const QString &in, bool *isPlainTextPtr = nullptr) { unsigned elementCount = 0; bool paragraphAlignmentFound = false; @@ -162,10 +162,10 @@ class RichTextEditor : public QTextEdit { Q_OBJECT public: - explicit RichTextEditor(QWidget *parent = 0); + explicit RichTextEditor(QWidget *parent = nullptr); void setDefaultFont(QFont font); - QToolBar *createToolBar(QDesignerFormEditorInterface *core, QWidget *parent = 0); + QToolBar *createToolBar(QDesignerFormEditorInterface *core, QWidget *parent = nullptr); bool simplifyRichText() const { return m_simplifyRichText; } @@ -189,7 +189,7 @@ class AddLinkDialog : public QDialog Q_OBJECT public: - AddLinkDialog(RichTextEditor *editor, QWidget *parent = 0); + AddLinkDialog(RichTextEditor *editor, QWidget *parent = nullptr); ~AddLinkDialog() override; int showDialog(); @@ -258,7 +258,7 @@ class HtmlTextEdit : public QTextEdit Q_OBJECT public: - HtmlTextEdit(QWidget *parent = 0) + HtmlTextEdit(QWidget *parent = nullptr) : QTextEdit(parent) {} @@ -349,7 +349,7 @@ void ColorAction::setColor(const QColor &color) void ColorAction::chooseColor() { - const QColor col = QColorDialog::getColor(m_color, 0); + const QColor col = QColorDialog::getColor(m_color, nullptr); if (col.isValid() && col != m_color) { setColor(col); emit colorChanged(m_color); @@ -362,7 +362,7 @@ class RichTextEditorToolBar : public QToolBar public: RichTextEditorToolBar(QDesignerFormEditorInterface *core, RichTextEditor *editor, - QWidget *parent = 0); + QWidget *parent = nullptr); public slots: void updateActions(); @@ -400,7 +400,7 @@ private: static QAction *createCheckableAction(const QIcon &icon, const QString &text, QObject *receiver, const char *slot, - QObject *parent = 0) + QObject *parent = nullptr) { QAction *result = new QAction(parent); result->setIcon(icon); @@ -465,22 +465,22 @@ RichTextEditorToolBar::RichTextEditorToolBar(QDesignerFormEditorInterface *core, m_align_left_action = createCheckableAction( createIconSet(QStringLiteral("textleft.png")), - tr("Left Align"), editor, 0, alignment_group); + tr("Left Align"), editor, nullptr, alignment_group); addAction(m_align_left_action); m_align_center_action = createCheckableAction( createIconSet(QStringLiteral("textcenter.png")), - tr("Center"), editor, 0, alignment_group); + tr("Center"), editor, nullptr, alignment_group); addAction(m_align_center_action); m_align_right_action = createCheckableAction( createIconSet(QStringLiteral("textright.png")), - tr("Right Align"), editor, 0, alignment_group); + tr("Right Align"), editor, nullptr, alignment_group); addAction(m_align_right_action); m_align_justify_action = createCheckableAction( createIconSet(QStringLiteral("textjustify.png")), - tr("Justify"), editor, 0, alignment_group); + tr("Justify"), editor, nullptr, alignment_group); addAction(m_align_justify_action); m_layoutDirectionAction = createCheckableAction( @@ -630,7 +630,7 @@ void RichTextEditorToolBar::layoutDirectionChanged() void RichTextEditorToolBar::updateActions() { - if (m_editor == 0) { + if (m_editor == nullptr) { setEnabled(false); return; } diff --git a/src/designer/src/lib/shared/richtexteditor_p.h b/src/designer/src/lib/shared/richtexteditor_p.h index 7098e7ce2..4fc166e3c 100644 --- a/src/designer/src/lib/shared/richtexteditor_p.h +++ b/src/designer/src/lib/shared/richtexteditor_p.h @@ -59,7 +59,7 @@ class QDESIGNER_SHARED_EXPORT RichTextEditorDialog : public QDialog { Q_OBJECT public: - explicit RichTextEditorDialog(QDesignerFormEditorInterface *core, QWidget *parent = 0); + explicit RichTextEditorDialog(QDesignerFormEditorInterface *core, QWidget *parent = nullptr); ~RichTextEditorDialog(); int showDialog(); diff --git a/src/designer/src/lib/shared/selectsignaldialog.cpp b/src/designer/src/lib/shared/selectsignaldialog.cpp index f097aeadb..39d1bb145 100644 --- a/src/designer/src/lib/shared/selectsignaldialog.cpp +++ b/src/designer/src/lib/shared/selectsignaldialog.cpp @@ -129,7 +129,7 @@ static QString declaredInClass(const QDesignerMetaObjectInterface *metaObject, c for (;;) { const QDesignerMetaObjectInterface *tmpMeta = meta->superClass(); - if (tmpMeta == 0) + if (tmpMeta == nullptr) break; if (tmpMeta->indexOfMethod(member) == -1) break; diff --git a/src/designer/src/lib/shared/signalslotdialog.cpp b/src/designer/src/lib/shared/signalslotdialog.cpp index 6720f97b2..5c0d9e1fe 100644 --- a/src/designer/src/lib/shared/signalslotdialog.cpp +++ b/src/designer/src/lib/shared/signalslotdialog.cpp @@ -120,7 +120,7 @@ namespace { // on closing (adds missing parentheses). class SignatureDelegate : public QItemDelegate { public: - SignatureDelegate(QObject * parent = 0); + SignatureDelegate(QObject * parent = nullptr); QWidget * createEditor (QWidget * parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override; void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override; @@ -189,7 +189,7 @@ namespace { FakeMethodMetaDBCommand::FakeMethodMetaDBCommand(QDesignerFormWindowInterface *formWindow) : qdesigner_internal::QDesignerFormWindowCommand(QApplication::translate("Command", "Change signals/slots"), formWindow), - m_object(0) + m_object(nullptr) { } @@ -311,7 +311,7 @@ void SignaturePanel::setData(const SignalSlotDialogData &d) { m_model->clear(); - QStandardItem *lastExisting = 0; + QStandardItem *lastExisting = nullptr; for (const QString &s : d.m_existingMethods) { lastExisting = createDisabledItem(s); m_model->appendRow(lastExisting); @@ -455,7 +455,7 @@ bool SignalSlotDialog::editPromotedClass(QDesignerFormEditorInterface *core, con if (baseClassName.isEmpty()) return false; - QWidget *widget = core->widgetFactory()->createWidget(baseClassName, 0); + QWidget *widget = core->widgetFactory()->createWidget(baseClassName, nullptr); if (!widget) return false; const bool rc = editPromotedClass(core, promotedClassName, widget, parent, mode); diff --git a/src/designer/src/lib/shared/signalslotdialog_p.h b/src/designer/src/lib/shared/signalslotdialog_p.h index 5848cd229..e0253bcc5 100644 --- a/src/designer/src/lib/shared/signalslotdialog_p.h +++ b/src/designer/src/lib/shared/signalslotdialog_p.h @@ -74,7 +74,7 @@ class SignatureModel : public QStandardItemModel { Q_OBJECT public: - SignatureModel(QObject *parent = 0); + SignatureModel(QObject *parent = nullptr); bool setData (const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; signals: @@ -127,18 +127,18 @@ class QDESIGNER_SHARED_EXPORT SignalSlotDialog : public QDialog { public: enum FocusMode { FocusSlots, FocusSignals }; - explicit SignalSlotDialog(QDesignerDialogGuiInterface *dialogGui, QWidget *parent = 0, FocusMode m = FocusSlots); + explicit SignalSlotDialog(QDesignerDialogGuiInterface *dialogGui, QWidget *parent = nullptr, FocusMode m = FocusSlots); ~SignalSlotDialog() override; DialogCode showDialog(SignalSlotDialogData &slotData, SignalSlotDialogData &signalData); // Edit fake methods stored in MetaDataBase (per instance, used for main containers) - static bool editMetaDataBase(QDesignerFormWindowInterface *fw, QObject *object, QWidget *parent = 0, FocusMode m = FocusSlots); + static bool editMetaDataBase(QDesignerFormWindowInterface *fw, QObject *object, QWidget *parent = nullptr, FocusMode m = FocusSlots); // Edit fake methods of a promoted class stored in WidgetDataBase (synthesizes a widget to obtain existing members). - static bool editPromotedClass(QDesignerFormEditorInterface *core, const QString &promotedClassName, QWidget *parent = 0, FocusMode m = FocusSlots); + static bool editPromotedClass(QDesignerFormEditorInterface *core, const QString &promotedClassName, QWidget *parent = nullptr, FocusMode m = FocusSlots); // Edit fake methods of a promoted class stored in WidgetDataBase on a base class instance. - static bool editPromotedClass(QDesignerFormEditorInterface *core, QObject *baseObject, QWidget *parent = 0, FocusMode m = FocusSlots); + static bool editPromotedClass(QDesignerFormEditorInterface *core, QObject *baseObject, QWidget *parent = nullptr, FocusMode m = FocusSlots); private slots: void slotCheckSignature(const QString &signature, bool *ok); diff --git a/src/designer/src/lib/shared/spacer_widget.cpp b/src/designer/src/lib/shared/spacer_widget.cpp index 7176b56e7..15daa9d8c 100644 --- a/src/designer/src/lib/shared/spacer_widget.cpp +++ b/src/designer/src/lib/shared/spacer_widget.cpp @@ -87,7 +87,7 @@ bool Spacer::isInLayout() const void Spacer::paintEvent(QPaintEvent *) { // Only draw spacers when we're editting widgets - if (m_formWindow != 0 && m_formWindow->currentTool() != 0) + if (m_formWindow != nullptr && m_formWindow->currentTool() != 0) return; QPainter p(this); diff --git a/src/designer/src/lib/shared/spacer_widget_p.h b/src/designer/src/lib/shared/spacer_widget_p.h index e0f30ad65..cbb9dd6d7 100644 --- a/src/designer/src/lib/shared/spacer_widget_p.h +++ b/src/designer/src/lib/shared/spacer_widget_p.h @@ -61,7 +61,7 @@ class QDESIGNER_SHARED_EXPORT Spacer: public QWidget Q_PROPERTY(QSize sizeHint READ sizeHintProperty WRITE setSizeHintProperty DESIGNABLE true STORED true) public: - Spacer(QWidget *parent = 0); + Spacer(QWidget *parent = nullptr); QSize sizeHint() const override; diff --git a/src/designer/src/lib/shared/stylesheeteditor.cpp b/src/designer/src/lib/shared/stylesheeteditor.cpp index f52ac1443..c7b36c422 100644 --- a/src/designer/src/lib/shared/stylesheeteditor.cpp +++ b/src/designer/src/lib/shared/stylesheeteditor.cpp @@ -126,7 +126,7 @@ StyleSheetEditorDialog::StyleSheetEditorDialog(QDesignerFormEditorInterface *cor "background-image", "border-image", "image", - 0 + nullptr }; const char * const colorProperties[] = { @@ -141,7 +141,7 @@ StyleSheetEditorDialog::StyleSheetEditorDialog(QDesignerFormEditorInterface *cor "gridline-color", "selection-color", "selection-background-color", - 0 + nullptr }; QMenu *resourceActionMenu = new QMenu(this); @@ -390,7 +390,7 @@ StyleSheetPropertyEditorDialog::StyleSheetPropertyEditorDialog(QWidget *parent, m_fw(fw), m_widget(widget) { - Q_ASSERT(m_fw != 0); + Q_ASSERT(m_fw != nullptr); QPushButton *apply = buttonBox()->addButton(QDialogButtonBox::Apply); QObject::connect(apply, &QAbstractButton::clicked, @@ -400,7 +400,7 @@ StyleSheetPropertyEditorDialog::StyleSheetPropertyEditorDialog(QWidget *parent, QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(m_fw->core()->extensionManager(), m_widget); - Q_ASSERT(sheet != 0); + Q_ASSERT(sheet != nullptr); const int index = sheet->indexOf(QLatin1String(styleSheetProperty)); const PropertySheetStringValue value = qvariant_cast<PropertySheetStringValue>(sheet->property(index)); setText(value.value()); diff --git a/src/designer/src/lib/shared/stylesheeteditor_p.h b/src/designer/src/lib/shared/stylesheeteditor_p.h index a9db798ea..ee6c3bc84 100644 --- a/src/designer/src/lib/shared/stylesheeteditor_p.h +++ b/src/designer/src/lib/shared/stylesheeteditor_p.h @@ -59,7 +59,7 @@ class QDESIGNER_SHARED_EXPORT StyleSheetEditor : public QTextEdit { Q_OBJECT public: - StyleSheetEditor(QWidget *parent = 0); + StyleSheetEditor(QWidget *parent = nullptr); }; // Edit a style sheet. diff --git a/src/designer/src/lib/shared/textpropertyeditor.cpp b/src/designer/src/lib/shared/textpropertyeditor.cpp index f0fcbfdf8..88e8841b6 100644 --- a/src/designer/src/lib/shared/textpropertyeditor.cpp +++ b/src/designer/src/lib/shared/textpropertyeditor.cpp @@ -234,7 +234,7 @@ namespace qdesigner_internal { switch (m_validationMode) { case ValidationStyleSheet: m_lineEdit->setValidator(new StyleSheetValidator(m_lineEdit)); - m_lineEdit->setCompleter(0); + m_lineEdit->setCompleter(nullptr); break; case ValidationMultiLine: case ValidationRichText: @@ -242,20 +242,20 @@ namespace qdesigner_internal { // While it is not possible to actually type a newline characters, // it can be pasted into the line edit. m_lineEdit->setValidator(new ReplacementValidator(m_lineEdit, NewLineChar, EscapedNewLine)); - m_lineEdit->setCompleter(0); + m_lineEdit->setCompleter(nullptr); break; case ValidationSingleLine: // Set a validator that replaces newline characters by a blank. m_lineEdit->setValidator(new ReplacementValidator(m_lineEdit, NewLineChar, QString(QLatin1Char(' ')))); - m_lineEdit->setCompleter(0); + m_lineEdit->setCompleter(nullptr); break; case ValidationObjectName: setRegularExpressionValidator(QStringLiteral("^[_a-zA-Z][_a-zA-Z0-9]{1,1023}$")); - m_lineEdit->setCompleter(0); + m_lineEdit->setCompleter(nullptr); break; case ValidationObjectNameScope: setRegularExpressionValidator(QStringLiteral("^[_a-zA-Z:][_a-zA-Z0-9:]{1,1023}$")); - m_lineEdit->setCompleter(0); + m_lineEdit->setCompleter(nullptr); break; case ValidationURL: { static QStringList urlCompletions; diff --git a/src/designer/src/lib/shared/textpropertyeditor_p.h b/src/designer/src/lib/shared/textpropertyeditor_p.h index 25b7f543d..fa899ed9e 100644 --- a/src/designer/src/lib/shared/textpropertyeditor_p.h +++ b/src/designer/src/lib/shared/textpropertyeditor_p.h @@ -77,7 +77,7 @@ namespace qdesigner_internal { UpdateOnFinished }; - explicit TextPropertyEditor(QWidget *parent = 0, EmbeddingMode embeddingMode = EmbeddingNone, TextPropertyValidationMode validationMode = ValidationMultiLine); + explicit TextPropertyEditor(QWidget *parent = nullptr, EmbeddingMode embeddingMode = EmbeddingNone, TextPropertyValidationMode validationMode = ValidationMultiLine); TextPropertyValidationMode textPropertyValidationMode() const { return m_validationMode; } void setTextPropertyValidationMode(TextPropertyValidationMode vm); diff --git a/src/designer/src/lib/shared/widgetdatabase.cpp b/src/designer/src/lib/shared/widgetdatabase.cpp index 380af73cc..0b79041ce 100644 --- a/src/designer/src/lib/shared/widgetdatabase.cpp +++ b/src/designer/src/lib/shared/widgetdatabase.cpp @@ -424,9 +424,9 @@ QList<QVariant> WidgetDataBase::defaultPropertyValues(const QString &name) WidgetFactory *factory = qobject_cast<WidgetFactory *>(m_core->widgetFactory()); Q_ASSERT(factory); // Create non-widgets, widgets in order - QObject* object = factory->createObject(name, 0); + QObject* object = factory->createObject(name, nullptr); if (!object) - object = factory->createWidget(name, 0); + object = factory->createWidget(name, nullptr); if (!object) { qDebug() << "** WARNING Factory failed to create " << name; return QList<QVariant>(); @@ -655,9 +655,9 @@ QString WidgetDataBase::scaleFormTemplate(const QString &xml, const QSize &size, const QString geometryPropertyName = QStringLiteral("geometry"); const QString minimumSizePropertyName = QStringLiteral("minimumSize"); const QString maximumSizePropertyName = QStringLiteral("maximumSize"); - DomProperty *geomProperty = 0; - DomProperty *minimumSizeProperty = 0; - DomProperty *maximumSizeProperty = 0; + DomProperty *geomProperty = nullptr; + DomProperty *minimumSizeProperty = nullptr; + DomProperty *maximumSizeProperty = nullptr; auto properties = domWidget->elementProperty(); for (DomProperty *p : properties) { @@ -768,10 +768,10 @@ QDESIGNER_SHARED_EXPORT QDesignerWidgetDataBaseItemInterface * if (className.isEmpty() || baseClassName.isEmpty()) { qWarning("** WARNING %s called with an empty class names: '%s' extends '%s'.", Q_FUNC_INFO, className.toUtf8().constData(), baseClassName.toUtf8().constData()); - return 0; + return nullptr; } // Check whether item already exists. - QDesignerWidgetDataBaseItemInterface *derivedItem = 0; + QDesignerWidgetDataBaseItemInterface *derivedItem = nullptr; const int existingIndex = db->indexOfClassName(className); if ( existingIndex != -1) derivedItem = db->item(existingIndex); @@ -800,7 +800,7 @@ QDESIGNER_SHARED_EXPORT QDesignerWidgetDataBaseItemInterface * if (baseIndex == -1) { if (debugWidgetDataBase) qDebug() << "appendDerived failed due to missing base class"; - return 0; + return nullptr; } const QDesignerWidgetDataBaseItemInterface *baseItem = db->item(baseIndex); derivedItem = WidgetDataBaseItem::clone(baseItem); diff --git a/src/designer/src/lib/shared/widgetdatabase_p.h b/src/designer/src/lib/shared/widgetdatabase_p.h index 95c363860..e8afa1064 100644 --- a/src/designer/src/lib/shared/widgetdatabase_p.h +++ b/src/designer/src/lib/shared/widgetdatabase_p.h @@ -145,7 +145,7 @@ class QDESIGNER_SHARED_EXPORT WidgetDataBase: public QDesignerWidgetDataBaseInte { Q_OBJECT public: - explicit WidgetDataBase(QDesignerFormEditorInterface *core, QObject *parent = 0); + explicit WidgetDataBase(QDesignerFormEditorInterface *core, QObject *parent = nullptr); ~WidgetDataBase() override; QDesignerFormEditorInterface *core() const override; diff --git a/src/designer/src/lib/shared/widgetfactory.cpp b/src/designer/src/lib/shared/widgetfactory.cpp index c467aeaaf..44c438e42 100644 --- a/src/designer/src/lib/shared/widgetfactory.cpp +++ b/src/designer/src/lib/shared/widgetfactory.cpp @@ -194,8 +194,8 @@ const char *WidgetFactory::disableStyleCustomPaintingPropertyC = "_q_custom_styl WidgetFactory::WidgetFactory(QDesignerFormEditorInterface *core, QObject *parent) : QDesignerWidgetFactoryInterface(parent), m_core(core), - m_formWindow(0), - m_currentStyle(0) + m_formWindow(nullptr), + m_currentStyle(nullptr) { } @@ -223,13 +223,13 @@ QObject* WidgetFactory::createObject(const QString &className, QObject* parent) { if (className.isEmpty()) { qWarning("** WARNING %s called with an empty class name", Q_FUNC_INFO); - return 0; + return nullptr; } if (className == m_strings.m_qAction) return new QAction(parent); if (className == m_strings.m_qButtonGroup) return new QButtonGroup(parent); - return 0; + return nullptr; } // Check for mismatched class names in plugins, which is hard to track. @@ -256,7 +256,7 @@ QWidget* WidgetFactory::createCustomWidget(const QString &className, QWidget *p *creationError = false; CustomWidgetFactoryMap::const_iterator it = m_customFactory.constFind(className); if (it == m_customFactory.constEnd()) - return 0; + return nullptr; QDesignerCustomWidgetInterface *factory = it.value(); QWidget *rc = factory->createWidget(parentWidget); @@ -264,7 +264,7 @@ QWidget* WidgetFactory::createCustomWidget(const QString &className, QWidget *p if (!rc) { *creationError = true; designerWarning(tr("The custom widget factory registered for widgets of class %1 returned 0.").arg(className)); - return 0; + return nullptr; } // Figure out the base class unless it is known static QSet<QString> knownCustomClasses; @@ -278,7 +278,7 @@ QWidget* WidgetFactory::createCustomWidget(const QString &className, QWidget *p // over. if (mo && mo->className() == className) mo = mo->superClass(); - while (mo != 0) { + while (mo != nullptr) { if (core()->widgetDataBase()->indexOfClassName(mo->className()) != -1) { wdb->item(widgetInfoIndex)->setExtends(mo->className()); break; @@ -310,14 +310,14 @@ QWidget *WidgetFactory::createWidget(const QString &widgetName, QWidget *parentW { if (widgetName.isEmpty()) { qWarning("** WARNING %s called with an empty class name", Q_FUNC_INFO); - return 0; + return nullptr; } // Preview or for form window? QDesignerFormWindowInterface *fw = m_formWindow; if (! fw) fw = QDesignerFormWindowInterface::findFormWindow(parentWidget); - QWidget *w = 0; + QWidget *w = nullptr; do { // 1) custom. If there is an explicit failure(factory wants to indicate something is wrong), // return 0, do not try to find fallback, which might be worse in the case of Q3 widget. @@ -392,7 +392,7 @@ QWidget *WidgetFactory::createWidget(const QString &widgetName, QWidget *parentW const QString fallBackBaseClass = m_strings.m_qWidget; QDesignerWidgetDataBaseInterface *db = core()->widgetDataBase(); QDesignerWidgetDataBaseItemInterface *item = db->item(db->indexOfClassName(widgetName)); - if (item == 0) { + if (item == nullptr) { // Emergency: Create, derived from QWidget QString includeFile = widgetName.toLower(); includeFile += QStringLiteral(".h"); @@ -411,7 +411,7 @@ QWidget *WidgetFactory::createWidget(const QString &widgetName, QWidget *parentW } } while (false); - Q_ASSERT(w != 0); + Q_ASSERT(w != nullptr); if (m_currentStyle) w->setStyle(m_currentStyle); initializeCommon(w); @@ -425,7 +425,7 @@ QWidget *WidgetFactory::createWidget(const QString &widgetName, QWidget *parentW QString WidgetFactory::classNameOf(QDesignerFormEditorInterface *c, const QObject* o) { - if (o == 0) + if (o == nullptr) return QString(); const char *className = o->metaObject()->className(); @@ -468,7 +468,7 @@ QLayout *WidgetFactory::createUnmanagedLayout(QWidget *parentWidget, int type) Q_ASSERT(0); break; } - return 0; + return nullptr; } @@ -480,7 +480,7 @@ QLayout *WidgetFactory::createLayout(QWidget *widget, QLayout *parentLayout, int { QDesignerMetaDataBaseInterface *metaDataBase = core()->metaDataBase(); - if (parentLayout == 0) { + if (parentLayout == nullptr) { QWidget *page = containerOfWidget(widget); if (page) { widget = page; @@ -493,13 +493,13 @@ QLayout *WidgetFactory::createLayout(QWidget *widget, QLayout *parentLayout, int } } - Q_ASSERT(metaDataBase->item(widget) != 0); // ensure the widget is managed + Q_ASSERT(metaDataBase->item(widget) != nullptr); // ensure the widget is managed - if (parentLayout == 0 && metaDataBase->item(widget->layout()) == 0) { + if (parentLayout == nullptr && metaDataBase->item(widget->layout()) == nullptr) { parentLayout = widget->layout(); } - QWidget *parentWidget = parentLayout != 0 ? 0 : widget; + QWidget *parentWidget = parentLayout != nullptr ? nullptr : widget; QLayout *layout = createUnmanagedLayout(parentWidget, type); metaDataBase->add(layout); // add the layout in the MetaDataBase @@ -520,15 +520,15 @@ QLayout *WidgetFactory::createLayout(QWidget *widget, QLayout *parentLayout, int sheet->setChanged(index, true); } - if (metaDataBase->item(widget->layout()) == 0) { - Q_ASSERT(layout->parent() == 0); + if (metaDataBase->item(widget->layout()) == nullptr) { + Q_ASSERT(layout->parent() == nullptr); QBoxLayout *box = qobject_cast<QBoxLayout*>(widget->layout()); if (!box) { // we support only unmanaged box layouts const QString msg = tr("Attempt to add a layout to a widget '%1' (%2) which already has an unmanaged layout of type %3.\n" "This indicates an inconsistency in the ui-file."). arg(widget->objectName(), classNameOf(core(), widget), classNameOf(core(), widget->layout())); designerWarning(msg); - return 0; + return nullptr; } box->addLayout(layout); } @@ -565,13 +565,13 @@ QWidget* WidgetFactory::widgetOfContainer(QWidget *w) const { // ### cleanup if (!w) - return 0; + return nullptr; if (w->parentWidget() && w->parentWidget()->parentWidget() && w->parentWidget()->parentWidget()->parentWidget() && qobject_cast<QToolBox*>(w->parentWidget()->parentWidget()->parentWidget())) return w->parentWidget()->parentWidget()->parentWidget(); - while (w != 0) { + while (w != nullptr) { if (core()->widgetDataBase()->isContainer(w) || (w && qobject_cast<QDesignerFormWindowInterface*>(w->parentWidget()))) return w; @@ -708,7 +708,7 @@ static inline bool isApplicationStyle(const QString &styleName) void WidgetFactory::setStyleName(const QString &styleName) { - m_currentStyle = isApplicationStyle(styleName) ? static_cast<QStyle*>(0) : getStyle(styleName); + m_currentStyle = isApplicationStyle(styleName) ? nullptr : getStyle(styleName); } QStyle *WidgetFactory::style() const @@ -727,7 +727,7 @@ QStyle *WidgetFactory::getStyle(const QString &styleName) if (!style) { const QString msg = tr("Cannot create style '%1'.").arg(styleName); designerWarning(msg); - return 0; + return nullptr; } it = m_styleCache.insert(styleName, style); } diff --git a/src/designer/src/lib/shared/widgetfactory_p.h b/src/designer/src/lib/shared/widgetfactory_p.h index 1d3c17bdf..1c85339c5 100644 --- a/src/designer/src/lib/shared/widgetfactory_p.h +++ b/src/designer/src/lib/shared/widgetfactory_p.h @@ -66,7 +66,7 @@ class QDESIGNER_SHARED_EXPORT WidgetFactory: public QDesignerWidgetFactoryInterf { Q_OBJECT public: - explicit WidgetFactory(QDesignerFormEditorInterface *core, QObject *parent = 0); + explicit WidgetFactory(QDesignerFormEditorInterface *core, QObject *parent = nullptr); ~WidgetFactory(); QWidget* containerOfWidget(QWidget *widget) const override; diff --git a/src/designer/src/lib/shared/zoomwidget.cpp b/src/designer/src/lib/shared/zoomwidget.cpp index 1c7c2f981..9c6453516 100644 --- a/src/designer/src/lib/shared/zoomwidget.cpp +++ b/src/designer/src/lib/shared/zoomwidget.cpp @@ -302,7 +302,7 @@ void ZoomWidget::setWidget(QWidget *w, Qt::WindowFlags wFlags) m_proxy->deleteLater(); } // Set window flags on the outer proxy for them to take effect - m_proxy = createProxyWidget(0, Qt::Window); + m_proxy = createProxyWidget(nullptr, Qt::Window); m_proxy->setWidget(w); m_proxy->setWindowFlags(wFlags); diff --git a/src/designer/src/lib/shared/zoomwidget_p.h b/src/designer/src/lib/shared/zoomwidget_p.h index 833a605ad..f6085f28d 100644 --- a/src/designer/src/lib/shared/zoomwidget_p.h +++ b/src/designer/src/lib/shared/zoomwidget_p.h @@ -62,7 +62,7 @@ class QDESIGNER_SHARED_EXPORT ZoomMenu : public QObject { Q_DISABLE_COPY(ZoomMenu) public: - ZoomMenu(QObject *parent = 0); + ZoomMenu(QObject *parent = nullptr); void addActions(QMenu *m); int zoom() const; @@ -94,7 +94,7 @@ class QDESIGNER_SHARED_EXPORT ZoomView : public QGraphicsView Q_OBJECT Q_DISABLE_COPY(ZoomView) public: - ZoomView(QWidget *parent = 0); + ZoomView(QWidget *parent = nullptr); /* Zoom in percent (for easily implementing menus) and qreal zoomFactor * in sync */ @@ -140,7 +140,7 @@ private: class QDESIGNER_SHARED_EXPORT ZoomProxyWidget : public QGraphicsProxyWidget { Q_DISABLE_COPY(ZoomProxyWidget) public: - explicit ZoomProxyWidget(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0); + explicit ZoomProxyWidget(QGraphicsItem *parent = nullptr, Qt::WindowFlags wFlags = {}); protected: QVariant itemChange(GraphicsItemChange change, const QVariant &value) override; @@ -163,8 +163,8 @@ class QDESIGNER_SHARED_EXPORT ZoomWidget : public ZoomView Q_DISABLE_COPY(ZoomWidget) public: - ZoomWidget(QWidget *parent = 0); - void setWidget(QWidget *w, Qt::WindowFlags wFlags = 0); + ZoomWidget(QWidget *parent = nullptr); + void setWidget(QWidget *w, Qt::WindowFlags wFlags = {}); const QGraphicsProxyWidget *proxy() const { return m_proxy; } QGraphicsProxyWidget *proxy() { return m_proxy; } @@ -196,8 +196,9 @@ protected: private: // Factory function for QGraphicsProxyWidgets which can be overwritten. Default creates a ZoomProxyWidget - virtual QGraphicsProxyWidget *createProxyWidget(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0) const; - QSize widgetSizeToViewSize(const QSize &s, bool *ptrToValid = 0) const; + virtual QGraphicsProxyWidget *createProxyWidget(QGraphicsItem *parent = nullptr, + Qt::WindowFlags wFlags = {}) const; + QSize widgetSizeToViewSize(const QSize &s, bool *ptrToValid = nullptr) const; void resizeToWidgetSize(); QSize viewPortMargin() const; diff --git a/src/designer/src/lib/uilib/abstractformbuilder.cpp b/src/designer/src/lib/uilib/abstractformbuilder.cpp index 38201b912..e759406b8 100644 --- a/src/designer/src/lib/uilib/abstractformbuilder.cpp +++ b/src/designer/src/lib/uilib/abstractformbuilder.cpp @@ -209,7 +209,7 @@ QWidget *QAbstractFormBuilder::create(DomUI *ui, QWidget *parentWidget) DomWidget *ui_widget = ui->elementWidget(); if (!ui_widget) - return 0; + return nullptr; initialize(ui); @@ -234,7 +234,7 @@ QWidget *QAbstractFormBuilder::create(DomUI *ui, QWidget *parentWidget) return widget; } d->clear(); - return 0; + return nullptr; } /*! @@ -263,7 +263,7 @@ QWidget *QAbstractFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidge { QWidget *w = createWidget(ui_widget->attributeClass(), parentWidget, ui_widget->attributeName()); if (!w) - return 0; + return nullptr; applyProperties(w, ui_widget->elementProperty()); @@ -292,7 +292,7 @@ QWidget *QAbstractFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidge const auto &elementLayout = ui_widget->elementLayout(); for (DomLayout *ui_lay : elementLayout) { - QLayout *child_lay = create(ui_lay, 0, w); + QLayout *child_lay = create(ui_lay, nullptr, w); Q_UNUSED( child_lay ); } @@ -348,7 +348,7 @@ QAction *QAbstractFormBuilder::create(DomAction *ui_action, QObject *parent) { QAction *a = createAction(parent, ui_action->attributeName()); if (!a) - return 0; + return nullptr; d->m_actions.insert(ui_action->attributeName(), a); applyProperties(a, ui_action->elementProperty()); @@ -362,7 +362,7 @@ QActionGroup *QAbstractFormBuilder::create(DomActionGroup *ui_action_group, QObj { QActionGroup *a = createActionGroup(parent, ui_action_group->attributeName()); if (!a) - return 0; + return nullptr; d->m_actionGroups.insert(ui_action_group->attributeName(), a); applyProperties(a, ui_action_group->elementProperty()); @@ -407,7 +407,7 @@ bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidge const QFormBuilderStrings &strings = QFormBuilderStrings::instance(); const DomPropertyHash attributes = propertyMap(ui_widget->elementAttribute()); - if (parentWidget == 0) + if (parentWidget == nullptr) return true; // Check special cases. First: Custom container const QString className = QLatin1String(parentWidget->metaObject()->className()); @@ -479,7 +479,7 @@ bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidge #if QT_CONFIG(tabwidget) else if (QTabWidget *tabWidget = qobject_cast<QTabWidget*>(parentWidget)) { - widget->setParent(0); + widget->setParent(nullptr); const int tabIndex = tabWidget->count(); if (const DomProperty *titleP = attributes.value(strings.titleAttribute, 0)) @@ -637,10 +637,10 @@ QLayout *QAbstractFormBuilder::create(DomLayout *ui_layout, QLayout *parentLayou { QObject *p = parentLayout; - if (p == 0) + if (p == nullptr) p = parentWidget; - Q_ASSERT(p != 0); + Q_ASSERT(p != nullptr); bool tracking = false; @@ -651,10 +651,10 @@ QLayout *QAbstractFormBuilder::create(DomLayout *ui_layout, QLayout *parentLayou QLayout *layout = createLayout(ui_layout->attributeClass(), p, ui_layout->hasAttributeName() ? ui_layout->attributeName() : QString()); - if (layout == 0) + if (layout == nullptr) return 0; - if (tracking && layout->parent() == 0) { + if (tracking && layout->parent() == nullptr) { QBoxLayout *box = qobject_cast<QBoxLayout*>(parentWidget->layout()); if (!box) { // only QBoxLayout is supported const QString widgetClass = QString::fromUtf8(parentWidget->metaObject()->className()); @@ -663,7 +663,7 @@ QLayout *QAbstractFormBuilder::create(DomLayout *ui_layout, QLayout *parentLayou "This indicates an inconsistency in the ui-file."). arg(parentWidget->objectName(), widgetClass, layoutClass); uiLibWarning(msg); - return 0; + return nullptr; } box->addLayout(layout); } @@ -794,7 +794,7 @@ static inline QString alignmentValue(Qt::Alignment a) static inline Qt::Alignment alignmentFromDom(const QString &in) { - Qt::Alignment rc = 0; + Qt::Alignment rc = nullptr; if (!in.isEmpty()) { const QVector<QStringRef> flags = in.splitRef(QLatin1Char('|')); for (const QStringRef &f : flags) { @@ -872,7 +872,7 @@ QLayoutItem *QAbstractFormBuilder::create(DomLayoutItem *ui_layoutItem, QLayout return item; } qWarning() << QCoreApplication::translate("QAbstractFormBuilder", "Empty widget item in %1 '%2'.").arg(QString::fromUtf8(layout->metaObject()->className()), layout->objectName()); - return 0; + return nullptr; } case DomLayoutItem::Spacer: { QSize size(0, 0); @@ -898,7 +898,7 @@ QLayoutItem *QAbstractFormBuilder::create(DomLayoutItem *ui_layoutItem, QLayout } } - QSpacerItem *spacer = 0; + QSpacerItem *spacer = nullptr; if (isVspacer) spacer = new QSpacerItem(size.width(), size.height(), QSizePolicy::Minimum, sizeType); else @@ -912,7 +912,7 @@ QLayoutItem *QAbstractFormBuilder::create(DomLayoutItem *ui_layoutItem, QLayout break; } - return 0; + return nullptr; } /*! @@ -1032,7 +1032,7 @@ QBrush QAbstractFormBuilder::setupBrush(DomBrush *brush) const QGradient::Type type = enumKeyToValue<QGradient::Type>(gradientType_enum, gradient->attributeType().toLatin1()); - QGradient *gr = 0; + QGradient *gr = nullptr; if (type == QGradient::LinearGradient) { gr = new QLinearGradient(QPointF(gradient->attributeStartX(), gradient->attributeStartY()), @@ -1161,7 +1161,7 @@ QWidget *QAbstractFormBuilder::createWidget(const QString &widgetName, QWidget * Q_UNUSED(widgetName); Q_UNUSED(parentWidget); Q_UNUSED(name); - return 0; + return nullptr; } /*! @@ -1172,7 +1172,7 @@ QLayout *QAbstractFormBuilder::createLayout(const QString &layoutName, QObject * Q_UNUSED(layoutName); Q_UNUSED(parent); Q_UNUSED(name); - return 0; + return nullptr; } /*! @@ -1205,8 +1205,8 @@ QActionGroup *QAbstractFormBuilder::createActionGroup(QObject *parent, const QSt */ void QAbstractFormBuilder::save(QIODevice *dev, QWidget *widget) { - DomWidget *ui_widget = createDom(widget, 0); - Q_ASSERT( ui_widget != 0 ); + DomWidget *ui_widget = createDom(widget, nullptr); + Q_ASSERT( ui_widget != nullptr ); DomUI *ui = new DomUI(); ui->setAttributeVersion(QStringLiteral("4.0")); @@ -1272,7 +1272,7 @@ DomWidget *QAbstractFormBuilder::createDom(QWidget *widget, DomWidget *ui_parent if (recursive) { if (QLayout *layout = widget->layout()) { - if (DomLayout *ui_layout = createDom(layout, 0, ui_parentWidget)) { + if (DomLayout *ui_layout = createDom(layout, nullptr, ui_parentWidget)) { QVector<DomLayout *> ui_layouts; ui_layouts.append(ui_layout); @@ -1338,7 +1338,7 @@ DomWidget *QAbstractFormBuilder::createDom(QWidget *widget, DomWidget *ui_parent ui_widgets.append(ui_child); } } else if (QAction *childAction = qobject_cast<QAction*>(obj)) { - if (childAction->actionGroup() != 0) { + if (childAction->actionGroup() != nullptr) { // it will be added later. continue; } @@ -1382,7 +1382,7 @@ DomActionRef *QAbstractFormBuilder::createActionRefDom(QAction *action) { QString name = action->objectName(); - if (action->menu() != 0) + if (action->menu() != nullptr) name = action->menu()->objectName(); DomActionRef *ui_action_ref = new DomActionRef(); @@ -1396,7 +1396,7 @@ DomActionRef *QAbstractFormBuilder::createActionRefDom(QAction *action) // Struct to store layout item parameters for saving layout items struct FormBuilderSaveLayoutEntry { - explicit FormBuilderSaveLayoutEntry(QLayoutItem *li = 0) : + explicit FormBuilderSaveLayoutEntry(QLayoutItem *li = nullptr) : item(li) {} void setAlignment(Qt::Alignment al); @@ -1561,7 +1561,7 @@ DomSpacer *QAbstractFormBuilder::createDom(QSpacerItem *spacer, DomLayout *ui_la DomSpacer *ui_spacer = new DomSpacer(); QList<DomProperty*> properties; - DomProperty *prop = 0; + DomProperty *prop = nullptr; const QFormBuilderStrings &strings = QFormBuilderStrings::instance(); // sizeHint property prop = new DomProperty(); @@ -1587,7 +1587,7 @@ DomSpacer *QAbstractFormBuilder::createDom(QSpacerItem *spacer, DomLayout *ui_la DomProperty *QAbstractFormBuilder::createProperty(QObject *obj, const QString &pname, const QVariant &v) { if (!checkProperty(obj, pname)) { - return 0; + return nullptr; } return variantToDomProperty(this, obj->metaObject(), pname, v); } @@ -1618,7 +1618,7 @@ QList<DomProperty*> QAbstractFormBuilder::computeProperties(QObject *obj) const QVariant v = prop.read(obj); - DomProperty *dom_prop = 0; + DomProperty *dom_prop = nullptr; if (v.type() == QVariant::Int) { dom_prop = new DomProperty(); @@ -1718,7 +1718,7 @@ void QAbstractFormBuilder::applyTabStops(QWidget *widget, DomTabStops *tabStops) */ DomCustomWidgets *QAbstractFormBuilder::saveCustomWidgets() { - return 0; + return nullptr; } /*! @@ -1726,7 +1726,7 @@ DomCustomWidgets *QAbstractFormBuilder::saveCustomWidgets() */ DomTabStops *QAbstractFormBuilder::saveTabStops() { - return 0; + return nullptr; } /*! @@ -1734,7 +1734,7 @@ DomTabStops *QAbstractFormBuilder::saveTabStops() */ DomResources *QAbstractFormBuilder::saveResources() { - return 0; + return nullptr; } /*! @@ -1747,7 +1747,7 @@ DomButtonGroups *QAbstractFormBuilder::saveButtonGroups(const QWidget *mainConta // Save fst order buttongroup children of maincontainer const QObjectList &mchildren = mainContainer->children(); if (mchildren.empty()) - return 0; + return nullptr; QVector<DomButtonGroup *> domGroups; for (QObject *o : mchildren) { if (auto bg = qobject_cast<QButtonGroup *>(o)) @@ -1755,7 +1755,7 @@ DomButtonGroups *QAbstractFormBuilder::saveButtonGroups(const QWidget *mainConta domGroups.push_back(dg); } if (domGroups.empty()) - return 0; + return nullptr; DomButtonGroups *rc = new DomButtonGroups; rc->setElementButtonGroup(domGroups); return rc; @@ -2274,7 +2274,7 @@ void QAbstractFormBuilder::loadTreeWidgetExtraInfo(DomWidget *ui_widget, QTreeWi const DomItem *domItem = pair.first; QTreeWidgetItem *parentItem = pair.second; - QTreeWidgetItem *currentItem = 0; + QTreeWidgetItem *currentItem = nullptr; if (parentItem) currentItem = new QTreeWidgetItem(parentItem); @@ -2389,7 +2389,7 @@ void QAbstractFormBuilder::loadComboBoxExtraInfo(DomWidget *ui_widget, QComboBox QVariant textData; QVariant iconData; - DomProperty *p = 0; + DomProperty *p = nullptr; p = properties.value(strings.textAttribute); if (p && p->elementString()) { @@ -2450,7 +2450,7 @@ void QAbstractFormBuilder::loadButtonExtraInfo(const DomWidget *ui_widget, QAbst } // Create button group on demand? QButtonGroup *&group = it.value().second; - if (group == 0) { + if (group == nullptr) { group = new QButtonGroup; group->setObjectName(groupName); applyProperties(group, it.value().first->elementProperty()); @@ -2600,7 +2600,7 @@ void QAbstractFormBuilder::setWorkingDirectory(const QDir &directory) DomAction *QAbstractFormBuilder::createDom(QAction *action) { if (action->parentWidget() == action->menu() || action->isSeparator()) - return 0; + return nullptr; DomAction *ui_action = new DomAction; ui_action->setAttributeName(action->objectName()); @@ -2618,7 +2618,7 @@ DomAction *QAbstractFormBuilder::createDom(QAction *action) DomButtonGroup *QAbstractFormBuilder::createDom(QButtonGroup *buttonGroup) { if (buttonGroup->buttons().count() == 0) // Empty group left over on form? - return 0; + return nullptr; DomButtonGroup *domButtonGroup = new DomButtonGroup; domButtonGroup->setAttributeName(buttonGroup->objectName()); @@ -2750,7 +2750,7 @@ DomProperty* QAbstractFormBuilder::iconToDomProperty(const QIcon &icon) const { Q_UNUSED(icon); qWarning() << "QAbstractFormBuilder::iconToDomProperty() is obsoleted"; - return 0; + return nullptr; } /*! @@ -2761,7 +2761,7 @@ DomProperty* QAbstractFormBuilder::iconToDomProperty(const QIcon &icon) const DomProperty *QAbstractFormBuilder::saveResource(const QVariant &v) const { if (v.isNull()) - return 0; + return nullptr; DomProperty *p = resourceBuilder()->saveResource(workingDirectory(), v); if (p) @@ -2777,7 +2777,7 @@ DomProperty *QAbstractFormBuilder::saveResource(const QVariant &v) const DomProperty *QAbstractFormBuilder::saveText(const QString &attributeName, const QVariant &v) const { if (v.isNull()) - return 0; + return nullptr; DomProperty *p = textBuilder()->saveText(v); if (p) @@ -2801,7 +2801,7 @@ const DomResourcePixmap *QAbstractFormBuilder::domPixmap(const DomProperty* p) { default: break; } - return 0; + return nullptr; } /*! diff --git a/src/designer/src/lib/uilib/abstractformbuilder.h b/src/designer/src/lib/uilib/abstractformbuilder.h index a5431f13b..8d015c91f 100644 --- a/src/designer/src/lib/uilib/abstractformbuilder.h +++ b/src/designer/src/lib/uilib/abstractformbuilder.h @@ -124,7 +124,7 @@ public: QDir workingDirectory() const; void setWorkingDirectory(const QDir &directory); - virtual QWidget *load(QIODevice *dev, QWidget *parentWidget = Q_NULLPTR); + virtual QWidget *load(QIODevice *dev, QWidget *parentWidget = nullptr); virtual void save(QIODevice *dev, QWidget *widget); QString errorString() const; diff --git a/src/designer/src/lib/uilib/formbuilder.cpp b/src/designer/src/lib/uilib/formbuilder.cpp index d5defe039..7ba7f445a 100644 --- a/src/designer/src/lib/uilib/formbuilder.cpp +++ b/src/designer/src/lib/uilib/formbuilder.cpp @@ -173,22 +173,22 @@ QWidget *QFormBuilder::createWidget(const QString &widgetName, QWidget *parentWi if (widgetName.isEmpty()) { //: Empty class name passed to widget factory method qWarning() << QCoreApplication::translate("QFormBuilder", "An empty class name was passed on to %1 (object name: '%2').").arg(QString::fromUtf8(Q_FUNC_INFO), name); - return 0; + return nullptr; } - QWidget *w = 0; + QWidget *w = nullptr; #if QT_CONFIG(tabwidget) if (qobject_cast<QTabWidget*>(parentWidget)) - parentWidget = 0; + parentWidget = nullptr; #endif #if QT_CONFIG(stackedwidget) if (qobject_cast<QStackedWidget*>(parentWidget)) - parentWidget = 0; + parentWidget = nullptr; #endif #if QT_CONFIG(toolbox) if (qobject_cast<QToolBox*>(parentWidget)) - parentWidget = 0; + parentWidget = nullptr; #endif // ### special-casing for Line (QFrame) -- fix for 4.2 @@ -220,11 +220,11 @@ QWidget *QFormBuilder::createWidget(const QString &widgetName, QWidget *parentWi // try with a registered custom widget QDesignerCustomWidgetInterface *factory = d->m_customWidgets.value(widgetName); - if (factory != 0) + if (factory != nullptr) w = factory->createWidget(parentWidget); } while(false); - if (w == 0) { // Attempt to instantiate base class of promoted/custom widgets + if (w == nullptr) { // Attempt to instantiate base class of promoted/custom widgets const QString baseClassName = d->customWidgetBaseClass(widgetName); if (!baseClassName.isEmpty()) { qWarning() << QCoreApplication::translate("QFormBuilder", "QFormBuilder was unable to create a custom widget of the class '%1'; defaulting to base class '%2'.").arg(widgetName, baseClassName); @@ -232,9 +232,9 @@ QWidget *QFormBuilder::createWidget(const QString &widgetName, QWidget *parentWi } } - if (w == 0) { // nothing to do + if (w == nullptr) { // nothing to do qWarning() << QCoreApplication::translate("QFormBuilder", "QFormBuilder was unable to create a widget of the class '%1'.").arg(widgetName); - return 0; + return nullptr; } w->setObjectName(name); @@ -250,7 +250,7 @@ QWidget *QFormBuilder::createWidget(const QString &widgetName, QWidget *parentWi */ QLayout *QFormBuilder::createLayout(const QString &layoutName, QObject *parent, const QString &name) { - QLayout *l = 0; + QLayout *l = nullptr; QWidget *parentWidget = qobject_cast<QWidget*>(parent); QLayout *parentLayout = qobject_cast<QLayout*>(parent); @@ -325,9 +325,9 @@ static QObject *objectByName(QWidget *topLevel, const QString &name) */ void QFormBuilder::createConnections(DomConnections *ui_connections, QWidget *widget) { - Q_ASSERT(widget != 0); + Q_ASSERT(widget != nullptr); - if (ui_connections == 0) + if (ui_connections == nullptr) return; const auto &connections = ui_connections->elementConnection(); diff --git a/src/designer/src/lib/uilib/formbuilderextra.cpp b/src/designer/src/lib/uilib/formbuilderextra.cpp index f38f9f82d..01d79c557 100644 --- a/src/designer/src/lib/uilib/formbuilderextra.cpp +++ b/src/designer/src/lib/uilib/formbuilderextra.cpp @@ -103,7 +103,7 @@ QFormBuilderExtra::~QFormBuilderExtra() void QFormBuilderExtra::clear() { m_buddies.clear(); - m_parentWidget = 0; + m_parentWidget = nullptr; m_parentWidgetIsSet = false; m_customWidgetDataHash.clear(); m_buttonGroups.clear(); @@ -217,13 +217,13 @@ void QFormBuilderExtra::applyInternalProperties() const bool QFormBuilderExtra::applyBuddy(const QString &buddyName, BuddyMode applyMode, QLabel *label) { if (buddyName.isEmpty()) { - label->setBuddy(0); + label->setBuddy(nullptr); return false; } const QWidgetList widgets = label->topLevelWidget()->findChildren<QWidget*>(buddyName); if (widgets.empty()) { - label->setBuddy(0); + label->setBuddy(nullptr); return false; } @@ -235,7 +235,7 @@ bool QFormBuilderExtra::applyBuddy(const QString &buddyName, BuddyMode applyMode } } - label->setBuddy(0); + label->setBuddy(nullptr); return false; } @@ -312,7 +312,7 @@ void QFormBuilderExtra::clearResourceBuilder() { if (m_resourceBuilder) { delete m_resourceBuilder; - m_resourceBuilder = 0; + m_resourceBuilder = nullptr; } } @@ -333,7 +333,7 @@ void QFormBuilderExtra::clearTextBuilder() { if (m_textBuilder) { delete m_textBuilder; - m_textBuilder = 0; + m_textBuilder = nullptr; } } diff --git a/src/designer/src/lib/uilib/properties.cpp b/src/designer/src/lib/uilib/properties.cpp index 578506b5a..0e18d3ca9 100644 --- a/src/designer/src/lib/uilib/properties.cpp +++ b/src/designer/src/lib/uilib/properties.cpp @@ -681,7 +681,7 @@ DomProperty *variantToDomProperty(QAbstractFormBuilder *afb, const QMetaObject * break; } uiLibWarning(msgCannotWriteProperty(pname, v)); - } return 0; + } return nullptr; } return dom_prop; } diff --git a/src/designer/src/lib/uilib/properties_p.h b/src/designer/src/lib/uilib/properties_p.h index 05bd3cd7b..aa707b323 100644 --- a/src/designer/src/lib/uilib/properties_p.h +++ b/src/designer/src/lib/uilib/properties_p.h @@ -133,7 +133,7 @@ public: // Convert key to value for a given QMetaEnum template <class EnumType> -inline EnumType enumKeyToValue(const QMetaEnum &metaEnum,const char *key, const EnumType* = 0) +inline EnumType enumKeyToValue(const QMetaEnum &metaEnum,const char *key, const EnumType* = nullptr) { int val = metaEnum.keyToValue(key); if (val == -1) { @@ -147,7 +147,7 @@ inline EnumType enumKeyToValue(const QMetaEnum &metaEnum,const char *key, const // Convert keys to value for a given QMetaEnum template <class EnumType> -inline EnumType enumKeysToValue(const QMetaEnum &metaEnum,const char *keys, const EnumType* = 0) +inline EnumType enumKeysToValue(const QMetaEnum &metaEnum,const char *keys, const EnumType* = nullptr) { int val = metaEnum.keysToValue(keys); if (val == -1) { diff --git a/src/designer/src/lib/uilib/resourcebuilder.cpp b/src/designer/src/lib/uilib/resourcebuilder.cpp index 2a3d79d21..f6bdaed5e 100644 --- a/src/designer/src/lib/uilib/resourcebuilder.cpp +++ b/src/designer/src/lib/uilib/resourcebuilder.cpp @@ -149,7 +149,7 @@ DomProperty *QResourceBuilder::saveResource(const QDir &workingDirectory, const { Q_UNUSED(workingDirectory); Q_UNUSED(value); - return 0; + return nullptr; } bool QResourceBuilder::isResourceProperty(const DomProperty *p) const diff --git a/src/designer/src/lib/uilib/textbuilder.cpp b/src/designer/src/lib/uilib/textbuilder.cpp index a33062f26..abf148a93 100644 --- a/src/designer/src/lib/uilib/textbuilder.cpp +++ b/src/designer/src/lib/uilib/textbuilder.cpp @@ -77,7 +77,7 @@ QVariant QTextBuilder::toNativeValue(const QVariant &value) const DomProperty *QTextBuilder::saveText(const QVariant &value) const { Q_UNUSED(value); - return 0; + return nullptr; } #ifdef QFORMINTERNAL_NAMESPACE |