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/uilib/formbuilder.cpp | |
parent | fac0dcbeef6a0c23e780b9751c17883ec9918d6f (diff) |
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/uilib/formbuilder.cpp')
-rw-r--r-- | src/designer/src/lib/uilib/formbuilder.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
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(); |