From 13f0365a960538693ee4b52f9e02864d08845fae Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 3 Jun 2019 16:40:05 +0200 Subject: Qt Designer: Introduce nullptr Apply Fixits by Qt Creator with some amendments. Change-Id: Idc948b1132fbb61c3ae6706b71659e2e8790fbc6 Reviewed-by: Jarek Kobus --- .../src/components/buddyeditor/buddyeditor.cpp | 34 +++--- .../components/buddyeditor/buddyeditor_plugin.cpp | 6 +- .../components/buddyeditor/buddyeditor_tool.cpp | 4 +- .../src/components/buddyeditor/buddyeditor_tool.h | 2 +- .../formeditor/default_actionprovider.cpp | 2 +- .../components/formeditor/default_actionprovider.h | 6 +- .../components/formeditor/default_container.cpp | 4 +- .../src/components/formeditor/default_container.h | 12 +- .../formeditor/default_layoutdecoration.cpp | 4 +- .../formeditor/default_layoutdecoration.h | 2 +- .../components/formeditor/deviceprofiledialog.h | 2 +- .../src/components/formeditor/dpi_chooser.cpp | 2 +- .../src/components/formeditor/dpi_chooser.h | 2 +- .../components/formeditor/embeddedoptionspage.h | 2 +- .../src/components/formeditor/formeditor.h | 2 +- .../formeditor/formeditor_optionspage.cpp | 2 +- .../src/components/formeditor/formwindow.cpp | 132 ++++++++++----------- .../src/components/formeditor/formwindow.h | 6 +- .../components/formeditor/formwindow_dnditem.cpp | 10 +- .../formeditor/formwindow_widgetstack.cpp | 13 +- .../components/formeditor/formwindow_widgetstack.h | 4 +- .../src/components/formeditor/formwindowcursor.h | 2 +- .../components/formeditor/formwindowmanager.cpp | 48 ++++---- .../src/components/formeditor/formwindowmanager.h | 4 +- .../components/formeditor/formwindowsettings.cpp | 4 +- .../formeditor/itemview_propertysheet.cpp | 2 +- .../components/formeditor/itemview_propertysheet.h | 4 +- .../components/formeditor/layout_propertysheet.h | 2 +- .../src/components/formeditor/line_propertysheet.h | 2 +- .../src/components/formeditor/previewactiongroup.h | 2 +- .../components/formeditor/qdesigner_resource.cpp | 114 +++++++++--------- .../src/components/formeditor/qdesigner_resource.h | 4 +- .../formeditor/qlayoutwidget_propertysheet.h | 2 +- .../formeditor/qmainwindow_container.cpp | 10 +- .../components/formeditor/qmainwindow_container.h | 2 +- .../components/formeditor/qmdiarea_container.cpp | 14 +-- .../src/components/formeditor/qmdiarea_container.h | 4 +- .../components/formeditor/qwizard_container.cpp | 2 +- .../src/components/formeditor/qwizard_container.h | 6 +- .../components/formeditor/spacer_propertysheet.h | 2 +- .../components/formeditor/templateoptionspage.h | 2 +- .../components/formeditor/tool_widgeteditor.cpp | 14 +-- .../src/components/formeditor/widgetselection.cpp | 26 ++-- .../src/components/lib/qdesigner_components.cpp | 2 +- .../components/objectinspector/objectinspector.cpp | 33 +++--- .../components/objectinspector/objectinspector.h | 2 +- .../objectinspector/objectinspectormodel.cpp | 12 +- .../propertyeditor/designerpropertymanager.cpp | 32 ++--- .../propertyeditor/designerpropertymanager.h | 4 +- .../propertyeditor/fontpropertymanager.cpp | 2 +- .../propertyeditor/newdynamicpropertydialog.h | 2 +- .../components/propertyeditor/paletteeditor.cpp | 2 +- .../src/components/propertyeditor/paletteeditor.h | 10 +- .../propertyeditor/paletteeditorbutton.cpp | 2 +- .../propertyeditor/paletteeditorbutton.h | 2 +- .../src/components/propertyeditor/previewframe.cpp | 4 +- .../components/propertyeditor/propertyeditor.cpp | 34 +++--- .../src/components/propertyeditor/propertyeditor.h | 2 +- .../components/propertyeditor/stringlisteditor.h | 4 +- .../propertyeditor/stringlisteditorbutton.cpp | 2 +- .../propertyeditor/stringlisteditorbutton.h | 2 +- .../components/signalsloteditor/connectdialog.cpp | 4 +- .../components/signalsloteditor/connectdialog_p.h | 2 +- .../signalsloteditor/signalslot_utils.cpp | 6 +- .../signalsloteditor/signalsloteditor.cpp | 30 ++--- .../signalsloteditor/signalsloteditor_p.h | 6 +- .../signalsloteditor/signalsloteditor_plugin.cpp | 6 +- .../signalsloteditor/signalsloteditor_tool.cpp | 4 +- .../signalsloteditor/signalsloteditor_tool.h | 2 +- .../signalsloteditor/signalsloteditorwindow.cpp | 36 +++--- .../signalsloteditor/signalsloteditorwindow.h | 2 +- .../components/tabordereditor/tabordereditor.cpp | 4 +- .../tabordereditor/tabordereditor_plugin.cpp | 6 +- .../tabordereditor/tabordereditor_tool.cpp | 4 +- .../tabordereditor/tabordereditor_tool.h | 2 +- .../src/components/taskmenu/button_taskmenu.cpp | 20 ++-- .../src/components/taskmenu/button_taskmenu.h | 14 +-- .../src/components/taskmenu/combobox_taskmenu.cpp | 6 +- .../src/components/taskmenu/combobox_taskmenu.h | 2 +- .../taskmenu/containerwidget_taskmenu.cpp | 14 +-- .../components/taskmenu/containerwidget_taskmenu.h | 8 +- .../src/components/taskmenu/groupbox_taskmenu.h | 2 +- .../components/taskmenu/inplace_widget_helper.cpp | 2 +- .../src/components/taskmenu/itemlisteditor.cpp | 4 +- .../src/components/taskmenu/label_taskmenu.h | 2 +- .../src/components/taskmenu/layouttaskmenu.cpp | 2 +- .../src/components/taskmenu/layouttaskmenu.h | 4 +- .../src/components/taskmenu/lineedit_taskmenu.h | 2 +- .../components/taskmenu/listwidget_taskmenu.cpp | 2 +- .../src/components/taskmenu/listwidget_taskmenu.h | 2 +- .../src/components/taskmenu/listwidgeteditor.cpp | 12 +- .../src/components/taskmenu/menutaskmenu.cpp | 4 +- .../src/components/taskmenu/menutaskmenu.h | 4 +- .../components/taskmenu/tablewidget_taskmenu.cpp | 2 +- .../src/components/taskmenu/tablewidget_taskmenu.h | 2 +- .../src/components/taskmenu/tablewidgeteditor.cpp | 18 +-- .../src/components/taskmenu/taskmenu_component.cpp | 2 +- .../src/components/taskmenu/taskmenu_component.h | 2 +- .../src/components/taskmenu/textedit_taskmenu.h | 4 +- .../src/components/taskmenu/toolbar_taskmenu.cpp | 4 +- .../src/components/taskmenu/toolbar_taskmenu.h | 4 +- .../components/taskmenu/treewidget_taskmenu.cpp | 2 +- .../src/components/taskmenu/treewidget_taskmenu.h | 2 +- .../src/components/taskmenu/treewidgeteditor.cpp | 24 ++-- .../src/components/widgetbox/widgetbox.cpp | 8 +- src/designer/src/components/widgetbox/widgetbox.h | 3 +- .../src/components/widgetbox/widgetbox_dnditem.cpp | 10 +- .../widgetbox/widgetboxcategorylistview.cpp | 4 +- .../widgetbox/widgetboxcategorylistview.h | 2 +- .../components/widgetbox/widgetboxtreewidget.cpp | 24 ++-- .../src/components/widgetbox/widgetboxtreewidget.h | 2 +- src/designer/src/designer/appfontdialog.cpp | 2 +- src/designer/src/designer/appfontdialog.h | 4 +- src/designer/src/designer/mainwindow.cpp | 2 +- src/designer/src/designer/mainwindow.h | 4 +- src/designer/src/designer/newform.cpp | 10 +- src/designer/src/designer/preferencesdialog.h | 2 +- src/designer/src/designer/qdesigner.cpp | 6 +- src/designer/src/designer/qdesigner_actions.cpp | 8 +- .../src/designer/qdesigner_appearanceoptions.h | 2 +- src/designer/src/designer/qdesigner_formwindow.cpp | 2 +- src/designer/src/designer/qdesigner_formwindow.h | 2 +- src/designer/src/designer/qdesigner_server.cpp | 6 +- src/designer/src/designer/qdesigner_server.h | 4 +- src/designer/src/designer/qdesigner_toolwindow.cpp | 14 +-- src/designer/src/designer/qdesigner_toolwindow.h | 2 +- src/designer/src/designer/qdesigner_workbench.cpp | 40 +++---- src/designer/src/designer/saveformastemplate.h | 2 +- src/designer/src/designer/versiondialog.cpp | 2 +- .../src/lib/extension/default_extensionfactory.cpp | 6 +- .../src/lib/extension/default_extensionfactory.h | 2 +- src/designer/src/lib/extension/extension.h | 4 +- .../src/lib/extension/qextensionmanager.cpp | 2 +- src/designer/src/lib/extension/qextensionmanager.h | 2 +- src/designer/src/lib/sdk/abstractactioneditor.cpp | 2 +- src/designer/src/lib/sdk/abstractdialoggui_p.h | 12 +- src/designer/src/lib/sdk/abstractformeditor.h | 2 +- src/designer/src/lib/sdk/abstractformwindow.cpp | 8 +- src/designer/src/lib/sdk/abstractformwindow.h | 6 +- .../src/lib/sdk/abstractformwindowmanager.h | 4 +- src/designer/src/lib/sdk/abstractformwindowtool.h | 2 +- src/designer/src/lib/sdk/abstractintegration.cpp | 8 +- src/designer/src/lib/sdk/abstractintegration.h | 8 +- src/designer/src/lib/sdk/abstractintrospection_p.h | 2 +- src/designer/src/lib/sdk/abstractlanguage.h | 4 +- src/designer/src/lib/sdk/abstractmetadatabase.h | 2 +- src/designer/src/lib/sdk/abstractnewformwidget.h | 6 +- .../src/lib/sdk/abstractobjectinspector.cpp | 2 +- .../src/lib/sdk/abstractpropertyeditor.cpp | 2 +- src/designer/src/lib/sdk/abstractresourcebrowser.h | 2 +- src/designer/src/lib/sdk/abstractwidgetbox.h | 2 +- .../src/lib/sdk/abstractwidgetdatabase.cpp | 2 +- src/designer/src/lib/sdk/abstractwidgetdatabase.h | 2 +- src/designer/src/lib/sdk/abstractwidgetfactory.h | 4 +- src/designer/src/lib/sdk/taskmenu.h | 2 +- src/designer/src/lib/shared/actioneditor.cpp | 30 ++--- src/designer/src/lib/shared/actioneditor_p.h | 3 +- src/designer/src/lib/shared/actionrepository.cpp | 4 +- src/designer/src/lib/shared/actionrepository_p.h | 8 +- src/designer/src/lib/shared/codedialog_p.h | 2 +- src/designer/src/lib/shared/connectionedit.cpp | 90 +++++++------- src/designer/src/lib/shared/connectionedit_p.h | 2 +- src/designer/src/lib/shared/dialoggui_p.h | 12 +- src/designer/src/lib/shared/extensionfactory_p.h | 6 +- src/designer/src/lib/shared/formlayoutmenu.cpp | 10 +- src/designer/src/lib/shared/formwindowbase.cpp | 18 +-- src/designer/src/lib/shared/formwindowbase_p.h | 3 +- src/designer/src/lib/shared/gridpanel_p.h | 2 +- src/designer/src/lib/shared/iconselector.cpp | 12 +- src/designer/src/lib/shared/iconselector_p.h | 8 +- src/designer/src/lib/shared/invisible_widget_p.h | 2 +- src/designer/src/lib/shared/layout.cpp | 38 +++--- src/designer/src/lib/shared/layout_p.h | 2 +- src/designer/src/lib/shared/layoutinfo.cpp | 27 +++-- src/designer/src/lib/shared/layoutinfo_p.h | 6 +- src/designer/src/lib/shared/metadatabase.cpp | 6 +- src/designer/src/lib/shared/metadatabase_p.h | 2 +- src/designer/src/lib/shared/morphmenu.cpp | 20 ++-- src/designer/src/lib/shared/morphmenu_p.h | 2 +- src/designer/src/lib/shared/newformwidget.cpp | 18 +-- src/designer/src/lib/shared/newformwidget_p.h | 2 +- src/designer/src/lib/shared/plaintexteditor_p.h | 2 +- src/designer/src/lib/shared/plugindialog_p.h | 2 +- src/designer/src/lib/shared/pluginmanager.cpp | 2 +- .../src/lib/shared/previewconfigurationwidget_p.h | 2 +- src/designer/src/lib/shared/previewmanager.cpp | 39 +++--- src/designer/src/lib/shared/promotionmodel.cpp | 4 +- src/designer/src/lib/shared/promotiontaskmenu.cpp | 6 +- src/designer/src/lib/shared/promotiontaskmenu_p.h | 2 +- src/designer/src/lib/shared/qdesigner_command.cpp | 108 ++++++++--------- src/designer/src/lib/shared/qdesigner_command2.cpp | 8 +- src/designer/src/lib/shared/qdesigner_command2_p.h | 4 +- src/designer/src/lib/shared/qdesigner_command_p.h | 10 +- src/designer/src/lib/shared/qdesigner_dnditem.cpp | 12 +- src/designer/src/lib/shared/qdesigner_dnditem_p.h | 2 +- .../src/lib/shared/qdesigner_dockwidget.cpp | 4 +- .../src/lib/shared/qdesigner_dockwidget_p.h | 2 +- .../src/lib/shared/qdesigner_formbuilder.cpp | 22 ++-- .../src/lib/shared/qdesigner_formbuilder_p.h | 2 +- .../src/lib/shared/qdesigner_formwindowcommand.cpp | 2 +- .../src/lib/shared/qdesigner_formwindowcommand_p.h | 2 +- .../src/lib/shared/qdesigner_formwindowmanager_p.h | 2 +- .../src/lib/shared/qdesigner_introspection.cpp | 8 +- .../src/lib/shared/qdesigner_membersheet.cpp | 6 +- .../src/lib/shared/qdesigner_membersheet_p.h | 4 +- src/designer/src/lib/shared/qdesigner_menu.cpp | 48 ++++---- src/designer/src/lib/shared/qdesigner_menu_p.h | 2 +- src/designer/src/lib/shared/qdesigner_menubar.cpp | 24 ++-- src/designer/src/lib/shared/qdesigner_menubar_p.h | 4 +- .../src/lib/shared/qdesigner_objectinspector_p.h | 2 +- .../src/lib/shared/qdesigner_promotion.cpp | 2 +- .../src/lib/shared/qdesigner_promotiondialog.cpp | 6 +- .../src/lib/shared/qdesigner_promotiondialog_p.h | 6 +- .../src/lib/shared/qdesigner_propertycommand.cpp | 2 +- .../src/lib/shared/qdesigner_propertycommand_p.h | 10 +- .../src/lib/shared/qdesigner_propertyeditor_p.h | 2 +- .../src/lib/shared/qdesigner_propertysheet.cpp | 34 +++--- .../src/lib/shared/qdesigner_propertysheet_p.h | 8 +- .../src/lib/shared/qdesigner_stackedbox.cpp | 10 +- .../src/lib/shared/qdesigner_stackedbox_p.h | 2 +- .../src/lib/shared/qdesigner_tabwidget.cpp | 12 +- .../src/lib/shared/qdesigner_tabwidget_p.h | 2 +- src/designer/src/lib/shared/qdesigner_taskmenu.cpp | 16 +-- src/designer/src/lib/shared/qdesigner_toolbar.cpp | 26 ++-- src/designer/src/lib/shared/qdesigner_toolbox.cpp | 8 +- src/designer/src/lib/shared/qdesigner_toolbox_p.h | 2 +- src/designer/src/lib/shared/qdesigner_utils.cpp | 2 +- src/designer/src/lib/shared/qdesigner_utils_p.h | 18 +-- src/designer/src/lib/shared/qdesigner_widget_p.h | 2 +- .../src/lib/shared/qdesigner_widgetbox.cpp | 6 +- .../src/lib/shared/qdesigner_widgetbox_p.h | 2 +- .../src/lib/shared/qdesigner_widgetitem.cpp | 10 +- .../src/lib/shared/qdesigner_widgetitem_p.h | 2 +- src/designer/src/lib/shared/qlayout_widget.cpp | 42 +++---- src/designer/src/lib/shared/qlayout_widget_p.h | 6 +- src/designer/src/lib/shared/qsimpleresource.cpp | 2 +- src/designer/src/lib/shared/qsimpleresource_p.h | 4 +- .../src/lib/shared/qtresourceeditordialog.cpp | 66 +++++------ .../src/lib/shared/qtresourceeditordialog_p.h | 6 +- src/designer/src/lib/shared/qtresourcemodel.cpp | 10 +- src/designer/src/lib/shared/qtresourcemodel_p.h | 10 +- src/designer/src/lib/shared/qtresourceview.cpp | 8 +- src/designer/src/lib/shared/qtresourceview_p.h | 8 +- src/designer/src/lib/shared/rcc.cpp | 10 +- src/designer/src/lib/shared/richtexteditor.cpp | 26 ++-- src/designer/src/lib/shared/richtexteditor_p.h | 2 +- src/designer/src/lib/shared/selectsignaldialog.cpp | 2 +- src/designer/src/lib/shared/signalslotdialog.cpp | 8 +- src/designer/src/lib/shared/signalslotdialog_p.h | 10 +- src/designer/src/lib/shared/spacer_widget.cpp | 2 +- src/designer/src/lib/shared/spacer_widget_p.h | 2 +- src/designer/src/lib/shared/stylesheeteditor.cpp | 8 +- src/designer/src/lib/shared/stylesheeteditor_p.h | 2 +- src/designer/src/lib/shared/textpropertyeditor.cpp | 10 +- src/designer/src/lib/shared/textpropertyeditor_p.h | 2 +- src/designer/src/lib/shared/widgetdatabase.cpp | 16 +-- src/designer/src/lib/shared/widgetdatabase_p.h | 2 +- src/designer/src/lib/shared/widgetfactory.cpp | 48 ++++---- src/designer/src/lib/shared/widgetfactory_p.h | 2 +- src/designer/src/lib/shared/zoomwidget.cpp | 2 +- src/designer/src/lib/shared/zoomwidget_p.h | 15 +-- src/designer/src/lib/uilib/abstractformbuilder.cpp | 86 +++++++------- src/designer/src/lib/uilib/abstractformbuilder.h | 2 +- src/designer/src/lib/uilib/formbuilder.cpp | 24 ++-- src/designer/src/lib/uilib/formbuilderextra.cpp | 12 +- src/designer/src/lib/uilib/properties.cpp | 2 +- src/designer/src/lib/uilib/properties_p.h | 4 +- src/designer/src/lib/uilib/resourcebuilder.cpp | 2 +- src/designer/src/lib/uilib/textbuilder.cpp | 2 +- .../src/plugins/qquickwidget/qquickwidget_plugin.h | 2 +- src/designer/src/uitools/quiloader.cpp | 16 +-- 271 files changed, 1288 insertions(+), 1288 deletions(-) diff --git a/src/designer/src/components/buddyeditor/buddyeditor.cpp b/src/designer/src/components/buddyeditor/buddyeditor.cpp index d5a779580..8218fb43a 100644 --- a/src/designer/src/components/buddyeditor/buddyeditor.cpp +++ b/src/designer/src/components/buddyeditor/buddyeditor.cpp @@ -75,7 +75,7 @@ static bool canBeBuddy(QWidget *w, QDesignerFormWindowInterface *form) static QString buddy(QLabel *label, QDesignerFormEditorInterface *core) { QDesignerPropertySheetExtension *sheet = qt_extension(core->extensionManager(), label); - if (sheet == 0) + if (sheet == nullptr) return QString(); const int prop_idx = sheet->indexOf(QLatin1String(buddyPropertyC)); if (prop_idx == -1) @@ -103,24 +103,24 @@ QWidget *BuddyEditor::widgetAt(const QPoint &pos) const { QWidget *w = ConnectionEdit::widgetAt(pos); - while (w != 0 && !m_formWindow->isManaged(w)) + while (w != nullptr && !m_formWindow->isManaged(w)) w = w->parentWidget(); if (!w) return w; if (state() == Editing) { QLabel *label = qobject_cast(w); - if (label == 0) - return 0; + if (label == nullptr) + return nullptr; const int cnt = connectionCount(); for (int i = 0; i < cnt; ++i) { Connection *con = connection(i); if (con->widget(EndPoint::Source) == w) - return 0; + return nullptr; } } else { if (!canBeBuddy(w, m_formWindow)) - return 0; + return nullptr; } return w; @@ -138,7 +138,7 @@ QDesignerFormWindowInterface *BuddyEditor::formWindow() const void BuddyEditor::updateBackground() { - if (m_updating || background() == 0) + if (m_updating || background() == nullptr) return; ConnectionEdit::updateBackground(); @@ -218,7 +218,7 @@ void BuddyEditor::setBackground(QWidget *background) if (buddy_name.isEmpty()) continue; QWidget *target = background->findChild(buddy_name); - if (target == 0) + if (target == nullptr) continue; Connection *con = new Connection(this); @@ -239,17 +239,17 @@ static QUndoCommand *createBuddyCommand(QDesignerFormWindowInterface *fw, QLabel void BuddyEditor::endConnection(QWidget *target, const QPoint &pos) { Connection *tmp_con = newlyAddedConnection(); - Q_ASSERT(tmp_con != 0); + Q_ASSERT(tmp_con != nullptr); tmp_con->setEndPoint(EndPoint::Target, target, pos); QWidget *source = 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, tmp_con->endPointPos(EndPoint::Source)); new_con->setEndPoint(EndPoint::Target, target, tmp_con->endPointPos(EndPoint::Target)); @@ -308,7 +308,7 @@ void BuddyEditor::deleteSelected() if (selectedConnections.isEmpty()) return; - undoStack()->beginMacro(tr("Remove %n buddies", 0, selectedConnections.size())); + undoStack()->beginMacro(tr("Remove %n buddies", nullptr, selectedConnections.size())); for (Connection *con : selectedConnections) { setSelected(con, false); con->update(); @@ -340,7 +340,7 @@ void BuddyEditor::autoBuddy() QWidgetList buddies; for (LabelList::iterator it = labelList.begin(); it != labelList.end(); ) { QLabel *label = *it; - QWidget *newBuddy = 0; + QWidget *newBuddy = nullptr; if (m_formWindow->isManaged(label)) { const QString buddy_name = buddy(label, m_formWindow->core()); if (buddy_name.isEmpty()) @@ -359,7 +359,7 @@ void BuddyEditor::autoBuddy() return; const int count = labelList.size(); Q_ASSERT(count == buddies.size()); - undoStack()->beginMacro(tr("Add %n buddies", 0, count)); + undoStack()->beginMacro(tr("Add %n buddies", nullptr, count)); for (int i = 0; i < count; i++) undoStack()->push(createBuddyCommand(m_formWindow, labelList.at(i), buddies.at(i))); undoStack()->endMacro(); @@ -377,7 +377,7 @@ QWidget *BuddyEditor::findBuddy(QLabel *l, const QWidgetList &existingBuddies) c // Try to find next managed neighbour on horizontal line const QRect geom = l->geometry(); const int y = geom.center().y(); - QWidget *neighbour = 0; + QWidget *neighbour = nullptr; switch (l->layoutDirection()) { case Qt::LayoutDirectionAuto: case Qt::LeftToRight: { // Walk right to find next managed neighbour @@ -402,7 +402,7 @@ QWidget *BuddyEditor::findBuddy(QLabel *l, const QWidgetList &existingBuddies) c if (neighbour && !existingBuddies.contains(neighbour) && canBeBuddy(neighbour, m_formWindow)) return neighbour; - return 0; + return nullptr; } void BuddyEditor::createContextMenu(QMenu &menu) diff --git a/src/designer/src/components/buddyeditor/buddyeditor_plugin.cpp b/src/designer/src/components/buddyeditor/buddyeditor_plugin.cpp index 201c30f50..ec7a13941 100644 --- a/src/designer/src/components/buddyeditor/buddyeditor_plugin.cpp +++ b/src/designer/src/components/buddyeditor/buddyeditor_plugin.cpp @@ -80,7 +80,7 @@ QDesignerFormEditorInterface *BuddyEditorPlugin::core() const void BuddyEditorPlugin::addFormWindow(QDesignerFormWindowInterface *formWindow) { - Q_ASSERT(formWindow != 0); + Q_ASSERT(formWindow != nullptr); Q_ASSERT(m_tools.contains(formWindow) == false); BuddyEditorTool *tool = new BuddyEditorTool(formWindow, this); @@ -91,7 +91,7 @@ void BuddyEditorPlugin::addFormWindow(QDesignerFormWindowInterface *formWindow) void BuddyEditorPlugin::removeFormWindow(QDesignerFormWindowInterface *formWindow) { - Q_ASSERT(formWindow != 0); + Q_ASSERT(formWindow != nullptr); Q_ASSERT(m_tools.contains(formWindow) == true); BuddyEditorTool *tool = m_tools.value(formWindow); @@ -109,7 +109,7 @@ QAction *BuddyEditorPlugin::action() const void BuddyEditorPlugin::activeFormWindowChanged(QDesignerFormWindowInterface *formWindow) { - m_action->setEnabled(formWindow != 0); + m_action->setEnabled(formWindow != nullptr); } QT_END_NAMESPACE diff --git a/src/designer/src/components/buddyeditor/buddyeditor_tool.cpp b/src/designer/src/components/buddyeditor/buddyeditor_tool.cpp index fa156fbd3..51b6e4988 100644 --- a/src/designer/src/components/buddyeditor/buddyeditor_tool.cpp +++ b/src/designer/src/components/buddyeditor/buddyeditor_tool.cpp @@ -68,8 +68,8 @@ bool BuddyEditorTool::handleEvent(QWidget *widget, QWidget *managedWidget, QEven QWidget *BuddyEditorTool::editor() const { if (!m_editor) { - Q_ASSERT(formWindow() != 0); - m_editor = new BuddyEditor(formWindow(), 0); + Q_ASSERT(formWindow() != nullptr); + m_editor = new BuddyEditor(formWindow(), nullptr); connect(formWindow(), &QDesignerFormWindowInterface::mainContainerChanged, m_editor.data(), &BuddyEditor::setBackground); connect(formWindow(), &QDesignerFormWindowInterface::changed, diff --git a/src/designer/src/components/buddyeditor/buddyeditor_tool.h b/src/designer/src/components/buddyeditor/buddyeditor_tool.h index 1cfe8393a..1bcee7d7e 100644 --- a/src/designer/src/components/buddyeditor/buddyeditor_tool.h +++ b/src/designer/src/components/buddyeditor/buddyeditor_tool.h @@ -49,7 +49,7 @@ class QT_BUDDYEDITOR_EXPORT BuddyEditorTool: public QDesignerFormWindowToolInter { Q_OBJECT public: - explicit BuddyEditorTool(QDesignerFormWindowInterface *formWindow, QObject *parent = 0); + explicit BuddyEditorTool(QDesignerFormWindowInterface *formWindow, QObject *parent = nullptr); ~BuddyEditorTool() override; QDesignerFormEditorInterface *core() const override; diff --git a/src/designer/src/components/formeditor/default_actionprovider.cpp b/src/designer/src/components/formeditor/default_actionprovider.cpp index 53f1f9ec5..663ce8731 100644 --- a/src/designer/src/components/formeditor/default_actionprovider.cpp +++ b/src/designer/src/components/formeditor/default_actionprovider.cpp @@ -45,7 +45,7 @@ namespace qdesigner_internal { ActionProviderBase::ActionProviderBase(QWidget *widget) : m_indicator(new InvisibleWidget(widget)) { - Q_ASSERT(widget != 0); + Q_ASSERT(widget != nullptr); m_indicator->setAutoFillBackground(true); m_indicator->setBackgroundRole(QPalette::Window); diff --git a/src/designer/src/components/formeditor/default_actionprovider.h b/src/designer/src/components/formeditor/default_actionprovider.h index 05c436299..85619f33d 100644 --- a/src/designer/src/components/formeditor/default_actionprovider.h +++ b/src/designer/src/components/formeditor/default_actionprovider.h @@ -64,7 +64,7 @@ class QT_FORMEDITOR_EXPORT QToolBarActionProvider: public QObject, public Action Q_OBJECT Q_INTERFACES(QDesignerActionProviderExtension) public: - explicit QToolBarActionProvider(QToolBar *widget, QObject *parent = 0); + explicit QToolBarActionProvider(QToolBar *widget, QObject *parent = nullptr); QRect actionGeometry(QAction *action) const override; QAction *actionAt(const QPoint &pos) const override; @@ -82,7 +82,7 @@ class QT_FORMEDITOR_EXPORT QMenuBarActionProvider: public QObject, public Action Q_OBJECT Q_INTERFACES(QDesignerActionProviderExtension) public: - explicit QMenuBarActionProvider(QMenuBar *widget, QObject *parent = 0); + explicit QMenuBarActionProvider(QMenuBar *widget, QObject *parent = nullptr); QRect actionGeometry(QAction *action) const override; QAction *actionAt(const QPoint &pos) const override; @@ -97,7 +97,7 @@ class QT_FORMEDITOR_EXPORT QMenuActionProvider: public QObject, public ActionPro Q_OBJECT Q_INTERFACES(QDesignerActionProviderExtension) public: - explicit QMenuActionProvider(QMenu *widget, QObject *parent = 0); + explicit QMenuActionProvider(QMenu *widget, QObject *parent = nullptr); QRect actionGeometry(QAction *action) const override; QAction *actionAt(const QPoint &pos) const override; diff --git a/src/designer/src/components/formeditor/default_container.cpp b/src/designer/src/components/formeditor/default_container.cpp index 066c5b49c..747000aa6 100644 --- a/src/designer/src/components/formeditor/default_container.cpp +++ b/src/designer/src/components/formeditor/default_container.cpp @@ -43,7 +43,7 @@ static inline void setCurrentContainerIndex(int index, Container *container) static inline void ensureNoParent(QWidget *widget) { if (widget->parentWidget()) - widget->setParent(0); + widget->setParent(nullptr); } static const char *PageLabel = "Page"; @@ -145,7 +145,7 @@ void QToolBoxContainer::remove(int index) QScrollAreaContainer::QScrollAreaContainer(QScrollArea *widget, QObject *parent) : QObject(parent), - SingleChildContainer(widget, widget->widget() == 0) + SingleChildContainer(widget, widget->widget() == nullptr) { } // ------------------- QDockWidgetContainer diff --git a/src/designer/src/components/formeditor/default_container.h b/src/designer/src/components/formeditor/default_container.h index 2f112aea8..337ddc445 100644 --- a/src/designer/src/components/formeditor/default_container.h +++ b/src/designer/src/components/formeditor/default_container.h @@ -49,7 +49,7 @@ class QStackedWidgetContainer: public QObject, public QDesignerContainerExtensio Q_OBJECT Q_INTERFACES(QDesignerContainerExtension) public: - explicit QStackedWidgetContainer(QStackedWidget *widget, QObject *parent = 0); + explicit QStackedWidgetContainer(QStackedWidget *widget, QObject *parent = nullptr); int count() const override { return m_widget->count(); } QWidget *widget(int index) const override { return m_widget->widget(index); } @@ -71,7 +71,7 @@ class QTabWidgetContainer: public QObject, public QDesignerContainerExtension Q_OBJECT Q_INTERFACES(QDesignerContainerExtension) public: - explicit QTabWidgetContainer(QTabWidget *widget, QObject *parent = 0); + explicit QTabWidgetContainer(QTabWidget *widget, QObject *parent = nullptr); int count() const override { return m_widget->count(); } QWidget *widget(int index) const override { return m_widget->widget(index); } @@ -93,7 +93,7 @@ class QToolBoxContainer: public QObject, public QDesignerContainerExtension Q_OBJECT Q_INTERFACES(QDesignerContainerExtension) public: - explicit QToolBoxContainer(QToolBox *widget, QObject *parent = 0); + explicit QToolBoxContainer(QToolBox *widget, QObject *parent = nullptr); int count() const override { return m_widget->count(); } QWidget *widget(int index) const override { return m_widget->widget(index); } @@ -162,7 +162,7 @@ int SingleChildContainer::currentIndex() const template void SingleChildContainer::addWidget(QWidget *widget) { - Q_ASSERT(m_container->widget() == 0); + Q_ASSERT(m_container->widget() == nullptr); widget->setParent(m_container); m_container->setWidget(widget); } @@ -179,7 +179,7 @@ class QScrollAreaContainer: public QObject, public SingleChildContainer QDesignerStackedWidgetContainerFactory; diff --git a/src/designer/src/components/formeditor/default_layoutdecoration.cpp b/src/designer/src/components/formeditor/default_layoutdecoration.cpp index 0a5a5691a..9a45b01b6 100644 --- a/src/designer/src/components/formeditor/default_layoutdecoration.cpp +++ b/src/designer/src/components/formeditor/default_layoutdecoration.cpp @@ -48,7 +48,7 @@ QDesignerLayoutDecorationFactory::QDesignerLayoutDecorationFactory(QExtensionMan QObject *QDesignerLayoutDecorationFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const { if (!object->isWidgetType() || iid != Q_TYPEID(QDesignerLayoutDecorationExtension)) - return 0; + return nullptr; QWidget *widget = qobject_cast(object); @@ -59,7 +59,7 @@ QObject *QDesignerLayoutDecorationFactory::createExtension(QObject *object, cons if (LayoutInfo::managedLayout(fw->core(), widget)) return QLayoutSupport::createLayoutSupport(fw, widget, parent); - return 0; + return nullptr; } } diff --git a/src/designer/src/components/formeditor/default_layoutdecoration.h b/src/designer/src/components/formeditor/default_layoutdecoration.h index 4ed70221f..412824ff5 100644 --- a/src/designer/src/components/formeditor/default_layoutdecoration.h +++ b/src/designer/src/components/formeditor/default_layoutdecoration.h @@ -43,7 +43,7 @@ class QDesignerLayoutDecorationFactory: public QExtensionFactory Q_OBJECT Q_INTERFACES(QAbstractExtensionFactory) public: - explicit QDesignerLayoutDecorationFactory(QExtensionManager *parent = 0); + explicit QDesignerLayoutDecorationFactory(QExtensionManager *parent = nullptr); protected: QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const override; diff --git a/src/designer/src/components/formeditor/deviceprofiledialog.h b/src/designer/src/components/formeditor/deviceprofiledialog.h index 11c69f497..539827c78 100644 --- a/src/designer/src/components/formeditor/deviceprofiledialog.h +++ b/src/designer/src/components/formeditor/deviceprofiledialog.h @@ -64,7 +64,7 @@ class DeviceProfileDialog : public QDialog Q_DISABLE_COPY(DeviceProfileDialog) Q_OBJECT public: - explicit DeviceProfileDialog(QDesignerDialogGuiInterface *dlgGui, QWidget *parent = 0); + explicit DeviceProfileDialog(QDesignerDialogGuiInterface *dlgGui, QWidget *parent = nullptr); ~DeviceProfileDialog(); DeviceProfile deviceProfile() const; diff --git a/src/designer/src/components/formeditor/dpi_chooser.cpp b/src/designer/src/components/formeditor/dpi_chooser.cpp index 915623f40..d20f2ef05 100644 --- a/src/designer/src/components/formeditor/dpi_chooser.cpp +++ b/src/designer/src/components/formeditor/dpi_chooser.cpp @@ -82,7 +82,7 @@ DPI_Chooser::DPI_Chooser(QWidget *parent) : // Predefined settings: System DeviceProfile::systemResolution(&(m_systemEntry->dpiX), &(m_systemEntry->dpiY)); - m_systemEntry->description = 0; + m_systemEntry->description = nullptr; const struct DPI_Entry *systemEntry = m_systemEntry; //: System resolution m_predefinedCombo->addItem(tr("System (%1 x %2)").arg(m_systemEntry->dpiX).arg(m_systemEntry->dpiY), QVariant::fromValue(systemEntry)); diff --git a/src/designer/src/components/formeditor/dpi_chooser.h b/src/designer/src/components/formeditor/dpi_chooser.h index a04b2bdb0..2ff7f9b77 100644 --- a/src/designer/src/components/formeditor/dpi_chooser.h +++ b/src/designer/src/components/formeditor/dpi_chooser.h @@ -57,7 +57,7 @@ class DPI_Chooser : public QWidget { Q_OBJECT public: - explicit DPI_Chooser(QWidget *parent = 0); + explicit DPI_Chooser(QWidget *parent = nullptr); ~DPI_Chooser(); void getDPI(int *dpiX, int *dpiY) const; diff --git a/src/designer/src/components/formeditor/embeddedoptionspage.h b/src/designer/src/components/formeditor/embeddedoptionspage.h index f0d8b96ff..9522aa53f 100644 --- a/src/designer/src/components/formeditor/embeddedoptionspage.h +++ b/src/designer/src/components/formeditor/embeddedoptionspage.h @@ -47,7 +47,7 @@ class EmbeddedOptionsControl : public QWidget { Q_DISABLE_COPY(EmbeddedOptionsControl) Q_OBJECT public: - explicit EmbeddedOptionsControl(QDesignerFormEditorInterface *core, QWidget *parent = 0); + explicit EmbeddedOptionsControl(QDesignerFormEditorInterface *core, QWidget *parent = nullptr); ~EmbeddedOptionsControl(); bool isDirty() const; diff --git a/src/designer/src/components/formeditor/formeditor.h b/src/designer/src/components/formeditor/formeditor.h index 1edbfe384..25698c23d 100644 --- a/src/designer/src/components/formeditor/formeditor.h +++ b/src/designer/src/components/formeditor/formeditor.h @@ -43,7 +43,7 @@ class QT_FORMEDITOR_EXPORT FormEditor: public QDesignerFormEditorInterface { Q_OBJECT public: - FormEditor(QObject *parent = 0); + FormEditor(QObject *parent = nullptr); ~FormEditor() override; public slots: void slotQrcFileChangedExternally(const QString &path); diff --git a/src/designer/src/components/formeditor/formeditor_optionspage.cpp b/src/designer/src/components/formeditor/formeditor_optionspage.cpp index 564b5964e..0ad956d7e 100644 --- a/src/designer/src/components/formeditor/formeditor_optionspage.cpp +++ b/src/designer/src/components/formeditor/formeditor_optionspage.cpp @@ -56,7 +56,7 @@ namespace qdesigner_internal { class ZoomSettingsWidget : public QGroupBox { Q_DISABLE_COPY(ZoomSettingsWidget) public: - explicit ZoomSettingsWidget(QWidget *parent = 0); + explicit ZoomSettingsWidget(QWidget *parent = nullptr); void fromSettings(const QDesignerSharedSettings &s); void toSettings(QDesignerSharedSettings &s) const; diff --git a/src/designer/src/components/formeditor/formwindow.cpp b/src/designer/src/components/formeditor/formwindow.cpp index 9f988273a..6f58d0255 100644 --- a/src/designer/src/components/formeditor/formwindow.cpp +++ b/src/designer/src/components/formeditor/formwindow.cpp @@ -180,7 +180,7 @@ void FormWindow::Selection::clear() { if (!m_usedSelections.empty()) { for (auto it = m_usedSelections.begin(), mend = m_usedSelections.end(); it != mend; ++it) - it.value()->setWidget(0); + it.value()->setWidget(nullptr); m_usedSelections.clear(); } } @@ -195,7 +195,7 @@ void FormWindow::Selection::clearSelectionPool() WidgetSelection *FormWindow::Selection::addWidget(FormWindow* fw, QWidget *w) { WidgetSelection *rc = m_usedSelections.value(w); - if (rc != 0) { + if (rc != nullptr) { rc->show(); rc->updateActive(); return rc; @@ -208,7 +208,7 @@ WidgetSelection *FormWindow::Selection::addWidget(FormWindow* fw, QWidget *w) } } - if (rc == 0) { + if (rc == nullptr) { rc = new WidgetSelection(fw); m_selectionPool.push_back(rc); } @@ -224,11 +224,11 @@ QWidget* FormWindow::Selection::removeWidget(QWidget *w) if (!s) return w; - s->setWidget(0); + s->setWidget(nullptr); m_usedSelections.remove(w); if (m_usedSelections.isEmpty()) - return 0; + return nullptr; return (*m_usedSelections.begin())->widget(); } @@ -313,9 +313,9 @@ FormWindow::FormWindow(FormEditor *core, QWidget *parent, Qt::WindowFlags flags) FormWindow::~FormWindow() { - Q_ASSERT(core() != 0); - Q_ASSERT(core()->metaDataBase() != 0); - Q_ASSERT(core()->formWindowManager() != 0); + Q_ASSERT(core() != nullptr); + Q_ASSERT(core()->metaDataBase() != nullptr); + Q_ASSERT(core()->formWindowManager() != nullptr); core()->formWindowManager()->removeFormWindow(this); core()->metaDataBase()->remove(this); @@ -324,8 +324,8 @@ FormWindow::~FormWindow() for (QWidget *w : l) core()->metaDataBase()->remove(w); - m_widgetStack = 0; - m_rubberBand = 0; + m_widgetStack = nullptr; + m_rubberBand = nullptr; if (resourceSet()) core()->resourceModel()->removeResourceSet(resourceSet()); delete m_selection; @@ -414,12 +414,12 @@ void FormWindow::init() connect(m_geometryChangedTimer, &QTimer::timeout, this, &QDesignerFormWindowInterface::geometryChanged); - m_rubberBand = 0; + m_rubberBand = nullptr; setFocusPolicy(Qt::StrongFocus); - m_mainContainer = 0; - m_currentWidget = 0; + m_mainContainer = nullptr; + m_currentWidget = nullptr; connect(&m_undoStack, &QUndoStack::indexChanged, this, &QDesignerFormWindowInterface::changed); @@ -449,11 +449,11 @@ void FormWindow::clearMainContainer() { if (m_mainContainer) { setCurrentTool(0); - m_widgetStack->setMainContainer(0); + m_widgetStack->setMainContainer(nullptr); core()->metaDataBase()->remove(m_mainContainer); unmanageWidget(m_mainContainer); delete m_mainContainer; - m_mainContainer = 0; + m_mainContainer = nullptr; } } @@ -519,7 +519,7 @@ static QWidget *findSelectedParent(QDesignerFormWindowInterface *fw, const QWidg if (fw->isManaged(p)) if (cursor->isWidgetSelected(p) == selected) return p; - return 0; + return nullptr; } // Mouse modifiers. @@ -562,7 +562,7 @@ void FormWindow::handleClickSelection(QWidget *managedWidget, unsigned mouseMode return; } - QWidget *selectionCandidate = 0; + QWidget *selectionCandidate = nullptr; // Hierarchy cycling: If the same widget clicked again: Attempt to cycle // trough the hierarchy. Find the next currently selected parent if (sameWidget && (mouseMode & CycleParentModifier)) @@ -838,7 +838,7 @@ void FormWindow::endRectDraw() { if (m_rubberBand) { delete m_rubberBand; - m_rubberBand = 0; + m_rubberBand = nullptr; } } @@ -1236,17 +1236,17 @@ QWidget *FormWindow::createWidget(DomUI *ui, const QRect &rc, QWidget *target) { QWidget *container = findContainer(target, false); if (!container) - return 0; + return nullptr; if (isMainContainer(container)) { if (QMainWindow *mw = qobject_cast(container)) { - Q_ASSERT(mw->centralWidget() != 0); + Q_ASSERT(mw->centralWidget() != nullptr); container = mw->centralWidget(); } } QDesignerResource resource(this); const FormBuilderClipboard clipboard = resource.paste(ui, container); if (clipboard.m_widgets.size() != 1) // multiple-paste from DomUI not supported yet - return 0; + return nullptr; QWidget *widget = clipboard.m_widgets.first(); insertWidget(widget, rc, container); return widget; @@ -1254,7 +1254,7 @@ QWidget *FormWindow::createWidget(DomUI *ui, const QRect &rc, QWidget *target) static bool isDescendant(const QWidget *parent, const QWidget *child) { - for (; child != 0; child = child->parentWidget()) { + for (; child != nullptr; child = child->parentWidget()) { if (child == parent) return true; } @@ -1282,7 +1282,7 @@ void FormWindow::raiseChildSelections(QWidget *w) QWidget *FormWindow::containerAt(const QPoint &pos, QWidget *notParentOf) { - QWidget *container = 0; + QWidget *container = nullptr; int depth = -1; const QWidgetList selected = selectedWidgets(); if (rect().contains(mapFromGlobal(pos))) { @@ -1308,7 +1308,7 @@ QWidget *FormWindow::containerAt(const QPoint &pos, QWidget *notParentOf) break; w = w->parentWidget(); } - if (!(w == 0 || w->isWindow())) + if (!(w == nullptr || w->isWindow())) continue; // we did not get through the full while loop int wd = widgetDepth(wit); @@ -1485,7 +1485,7 @@ PropertyHelper::Value ArrowKeyPropertyHelper::setValue(QDesignerFormWindowInterf class ArrowKeyPropertyCommand: public SetPropertyCommand { public: explicit ArrowKeyPropertyCommand(QDesignerFormWindowInterface *fw, - QUndoCommand *p = 0); + QUndoCommand *p = nullptr); void init(QWidgetList &l, const ArrowKeyOperation &op); @@ -1681,9 +1681,7 @@ QWidget *FormWindow::innerContainer(QWidget *outerContainer) const if (m_core->widgetDataBase()->isContainer(outerContainer)) if (const QDesignerContainerExtension *container = qt_extension(m_core->extensionManager(), outerContainer)) { const int currentIndex = container->currentIndex(); - return currentIndex >= 0 ? - container->widget(currentIndex) : - static_cast(0); + return currentIndex >= 0 ? container->widget(currentIndex) : nullptr; } return outerContainer; } @@ -1692,7 +1690,7 @@ QWidget *FormWindow::containerForPaste() const { QWidget *w = mainContainer(); if (!w) - return 0; + return nullptr; do { // Try to find a close parent, for example a non-laid-out // QFrame/QGroupBox when a widget within it is selected. @@ -1717,13 +1715,13 @@ QWidget *FormWindow::containerForPaste() const w = innerContainer(w); if (!w) - return 0; + return nullptr; if (LayoutInfo::layoutType(m_core, w) != LayoutInfo::NoLayout) - return 0; + return nullptr; // Go up via container extension (also includes step from QMainWindow to its central widget) w = m_core->widgetFactory()->containerOfWidget(w); - if (w == 0 || LayoutInfo::layoutType(m_core, w) != LayoutInfo::NoLayout) - return 0; + if (w == nullptr || LayoutInfo::layoutType(m_core, w) != LayoutInfo::NoLayout) + return nullptr; if (debugFormWindow) qDebug() <<"containerForPaste() " << w; @@ -1737,10 +1735,10 @@ static inline DomUI *domUIFromClipboard(int *widgetCount, int *actionCount) *widgetCount = *actionCount = 0; const QString clipboardText = qApp->clipboard()->text(); if (clipboardText.isEmpty() || clipboardText.indexOf(QLatin1Char('<')) == -1) - return 0; + return nullptr; QXmlStreamReader reader(clipboardText); - DomUI *ui = 0; + DomUI *ui = nullptr; const QString uiElement = QStringLiteral("ui"); while (!reader.atEnd()) { if (reader.readNext() == QXmlStreamReader::StartElement) { @@ -1754,10 +1752,10 @@ static inline DomUI *domUIFromClipboard(int *widgetCount, int *actionCount) } if (reader.hasError()) { delete ui; - ui = 0; + ui = nullptr; designerWarning(QCoreApplication::translate("FormWindow", "Error while pasting clipboard contents at line %1, column %2: %3"). arg(reader.lineNumber()).arg(reader.columnNumber()).arg(reader.errorString())); - return 0; + return nullptr; } if (const DomWidget *topLevel = ui->elementWidget()) { @@ -1766,7 +1764,7 @@ static inline DomUI *domUIFromClipboard(int *widgetCount, int *actionCount) } if (*widgetCount == 0 && *actionCount == 0) { delete ui; - return 0; + return nullptr; } return ui; } @@ -1775,9 +1773,9 @@ static inline DomUI *domUIFromClipboard(int *widgetCount, int *actionCount) static inline QString pasteCommandDescription(int widgetCount, int actionCount) { if (widgetCount == 0) - return FormWindow::tr("Paste %n action(s)", 0, actionCount); + return FormWindow::tr("Paste %n action(s)", nullptr, actionCount); if (actionCount == 0) - return FormWindow::tr("Paste %n widget(s)", 0, widgetCount); + return FormWindow::tr("Paste %n widget(s)", nullptr, widgetCount); return FormWindow::tr("Paste (%1 widgets, %2 actions)").arg(widgetCount).arg(actionCount); } @@ -1803,7 +1801,7 @@ static void positionPastedWidgetsAtMousePosition(FormWindow *fw, const QPoint &c // get the stacked-offset effect of Designer 4.3, that is, offset by grid if Ctrl-V is pressed continuously do { const QPoint bottomRight = cursorPos + QPoint(pasteArea.width(), pasteArea.height()) - QPoint(1, 1); - if (bottomRight.y() > parentGeometry.bottom() || parent->childAt(bottomRight) == 0) + if (bottomRight.y() > parentGeometry.bottom() || parent->childAt(bottomRight) == nullptr) break; cursorPos += QPoint(grid.deltaX(), grid.deltaY()); } while (true); @@ -1818,7 +1816,7 @@ void FormWindow::paste(PasteMode pasteMode) { // Avoid QDesignerResource constructing widgets that are not used as // QDesignerResource manages the widgets it creates (creating havoc if one remains unused) - DomUI *ui = 0; + DomUI *ui = nullptr; do { int widgetCount; int actionCount; @@ -1832,8 +1830,8 @@ void FormWindow::paste(PasteMode pasteMode) break; // Check for widgets: need a container - QWidget *pasteContainer = widgetCount ? containerForPaste() : 0; - if (widgetCount && pasteContainer == 0) { + QWidget *pasteContainer = widgetCount ? containerForPaste() : nullptr; + if (widgetCount && pasteContainer == nullptr) { const QString message = tr("Cannot paste widgets. Designer could not find a container " "without a layout to paste into."); @@ -2069,7 +2067,7 @@ bool FormWindow::handleMouseButtonDblClickEvent(QWidget *w, QWidget *managedWidg QMenu *FormWindow::initializePopupMenu(QWidget *managedWidget) { if (!isManaged(managedWidget) || currentTool()) - return 0; + return nullptr; // Make sure the managedWidget is selected and current since // the SetPropertyCommands must use the right reference @@ -2091,7 +2089,7 @@ QMenu *FormWindow::initializePopupMenu(QWidget *managedWidget) QMetaObject::invokeMethod(core()->formWindowManager(), "slotUpdateActions"); } - QWidget *contextMenuWidget = 0; + QWidget *contextMenuWidget = nullptr; if (isMainContainer(managedWidget)) { // press on a child widget contextMenuWidget = mainContainer(); @@ -2108,11 +2106,11 @@ QMenu *FormWindow::initializePopupMenu(QWidget *managedWidget) } if (!contextMenuWidget) - return 0; + return nullptr; QMenu *contextMenu = createPopupMenu(contextMenuWidget); if (!contextMenu) - return 0; + return nullptr; emit contextMenuRequested(contextMenu, contextMenuWidget); return contextMenu; @@ -2160,7 +2158,7 @@ bool FormWindow::setContents(QIODevice *dev, QString *errorMessageIn /* = 0 */) } if (errorMessageIn) *errorMessageIn = r.errorString(); - return w != 0; + return w != nullptr; } bool FormWindow::setContents(const QString &contents) @@ -2255,7 +2253,7 @@ QAction *FormWindow::createSelectAncestorSubMenu(QWidget *w) if (isManaged(p) && !isWidgetSelected(p)) parents.push_back(p); if (parents.empty()) - return 0; + return nullptr; // Create a submenu listing the managed, unselected parents QMenu *menu = new QMenu; QActionGroup *ag = new QActionGroup(menu); @@ -2267,7 +2265,7 @@ QAction *FormWindow::createSelectAncestorSubMenu(QWidget *w) a->setData(QVariant::fromValue(w)); menu->addAction(a); } - QAction *ma = new QAction(tr("Select Ancestor"), 0); + QAction *ma = new QAction(tr("Select Ancestor"), nullptr); ma->setMenu(menu); return ma; } @@ -2372,7 +2370,7 @@ QWidget *FormWindow::findContainer(QWidget *w, bool excludeLayout) const { if (!isChildOf(w, this) || const_cast(w) == this) - return 0; + return nullptr; QDesignerWidgetFactoryInterface *widgetFactory = core()->widgetFactory(); QDesignerWidgetDataBaseInterface *widgetDataBase = core()->widgetDataBase(); @@ -2467,10 +2465,10 @@ QWidget *FormWindow::containerAt(const QPoint &pos) static QWidget *childAt_SkipDropLine(QWidget *w, QPoint pos) { - const QObjectList child_list = w->children(); + const QObjectList &child_list = w->children(); for (int i = child_list.size() - 1; i >= 0; --i) { QObject *child_obj = child_list[i]; - if (qobject_cast(child_obj) != 0) + if (qobject_cast(child_obj) != nullptr) continue; QWidget *child = qobject_cast(child_obj); if (!child || child->isWindow() || !child->isVisible() || @@ -2484,7 +2482,7 @@ static QWidget *childAt_SkipDropLine(QWidget *w, QPoint pos) return child; } - return 0; + return nullptr; } QWidget *FormWindow::widgetAt(const QPoint &pos) @@ -2492,7 +2490,7 @@ QWidget *FormWindow::widgetAt(const QPoint &pos) QWidget *w = childAt(pos); if (qobject_cast(w) != 0) w = childAt_SkipDropLine(this, pos); - return (w == 0 || w == formContainer()) ? this : w; + return (w == nullptr || w == formContainer()) ? this : w; } void FormWindow::highlightWidget(QWidget *widget, const QPoint &pos, HighlightMode mode) @@ -2505,7 +2503,7 @@ void FormWindow::highlightWidget(QWidget *widget, const QPoint &pos, HighlightMo QWidget *container = findContainer(widget, false); - if (container == 0 || core()->metaDataBase()->item(container) == 0) + if (container == nullptr || core()->metaDataBase()->item(container) == nullptr) return; if (QDesignerActionProviderExtension *g = qt_extension(core()->extensionManager(), container)) { @@ -2579,7 +2577,7 @@ QDesignerFormWindowToolInterface *FormWindow::tool(int index) const void FormWindow::registerTool(QDesignerFormWindowToolInterface *tool) { - Q_ASSERT(tool != 0); + Q_ASSERT(tool != nullptr); m_widgetStack->addTool(tool); @@ -2599,11 +2597,11 @@ int FormWindow::currentTool() const bool FormWindow::handleEvent(QWidget *widget, QWidget *managedWidget, QEvent *event) { - if (m_widgetStack == 0) + if (m_widgetStack == nullptr) return false; QDesignerFormWindowToolInterface *tool = m_widgetStack->currentTool(); - if (tool == 0) + if (tool == nullptr) return false; return tool->handleEvent(widget, managedWidget, event); @@ -2702,7 +2700,7 @@ void FormWindow::dragWidgetWithinForm(QWidget *widget, const QRect &targetGeomet { const bool fromLayout = canDragWidgetInLayout(core(), widget); const QDesignerLayoutDecorationExtension *targetDeco = qt_extension(core()->extensionManager(), targetContainer); - const bool toLayout = targetDeco != 0; + const bool toLayout = targetDeco != nullptr; if (fromLayout) { // Drag from Layout: We need to delete the widget properly to store the layout state @@ -2827,7 +2825,7 @@ bool FormWindow::dropWidgets(const QList &item_list, { QWidget *parent = target; - if (parent == 0) + if (parent == nullptr) parent = mainContainer(); // You can only drop stuff onto the central widget of a QMainWindow // ### generalize to use container extension @@ -2843,7 +2841,7 @@ bool FormWindow::dropWidgets(const QList &item_list, } QWidget *container = findContainer(parent, false); - if (container == 0) + if (container == nullptr) return false; beginCommand(tr("Drop widget")); @@ -2852,7 +2850,7 @@ bool FormWindow::dropWidgets(const QList &item_list, highlightWidget(target, target->mapFromGlobal(global_mouse_pos), FormWindow::Restore); QPoint offset; - QDesignerDnDItemInterface *current = 0; + QDesignerDnDItemInterface *current = nullptr; QDesignerFormWindowCursorInterface *c = cursor(); for (QDesignerDnDItemInterface *item : qAsConst(item_list)) { QWidget *w = item->widget(); @@ -2872,7 +2870,7 @@ bool FormWindow::dropWidgets(const QList &item_list, for (QDesignerDnDItemInterface *item : qAsConst(item_list)) { DomUI *dom_ui = item->domUi(); QRect geometry = item->decoration()->geometry(); - Q_ASSERT(dom_ui != 0); + Q_ASSERT(dom_ui != nullptr); geometry.moveTopLeft(container->mapFromGlobal(geometry.topLeft()) + offset); if (item->type() == QDesignerDnDItemInterface::CopyDrop) { // from widget box or CTRL + mouse move @@ -2885,13 +2883,13 @@ bool FormWindow::dropWidgets(const QList &item_list, mainContainer()->setFocus(Qt::MouseFocusReason); // in case focus was in e.g. object inspector } else { // same form move QWidget *widget = item->widget(); - Q_ASSERT(widget != 0); + Q_ASSERT(widget != nullptr); QDesignerFormWindowInterface *dest = findFormWindow(widget); if (dest == this) { dragWidgetWithinForm(widget, geometry, container); } else { // from other form FormWindow *source = qobject_cast(item->source()); - Q_ASSERT(source != 0); + Q_ASSERT(source != nullptr); source->deleteWidgetList(QWidgetList() << widget); QWidget *new_widget = createWidget(dom_ui, geometry, parent); diff --git a/src/designer/src/components/formeditor/formwindow.h b/src/designer/src/components/formeditor/formwindow.h index e2fb78400..abecc8252 100644 --- a/src/designer/src/components/formeditor/formwindow.h +++ b/src/designer/src/components/formeditor/formwindow.h @@ -77,7 +77,7 @@ public: ChangeLayoutSpanHandleOperation }; - explicit FormWindow(FormEditor *core, QWidget *parent = 0, Qt::WindowFlags flags = 0); + explicit FormWindow(FormEditor *core, QWidget *parent = nullptr, Qt::WindowFlags flags = {}); ~FormWindow() override; QDesignerFormEditorInterface *core() const override; @@ -118,7 +118,7 @@ public: void setFileName(const QString &fileName) override; QString contents() const override; - bool setContents(QIODevice *dev, QString *errorMessage = 0) override; + bool setContents(QIODevice *dev, QString *errorMessage = nullptr) override; bool setContents(const QString &) override; QDir absoluteDir() const override; @@ -223,7 +223,7 @@ public slots: #endif void selectAll(); - void createLayout(int type, QWidget *container = 0); + void createLayout(int type, QWidget *container = nullptr); void morphLayout(QWidget *container, int newType); void breakLayout(QWidget *w); diff --git a/src/designer/src/components/formeditor/formwindow_dnditem.cpp b/src/designer/src/components/formeditor/formwindow_dnditem.cpp index a5a9321a9..2df8c9aa6 100644 --- a/src/designer/src/components/formeditor/formwindow_dnditem.cpp +++ b/src/designer/src/components/formeditor/formwindow_dnditem.cpp @@ -45,7 +45,7 @@ using namespace qdesigner_internal; static QWidget *decorationFromWidget(QWidget *w) { - QLabel *label = new QLabel(0, Qt::ToolTip); + QLabel *label = new QLabel(nullptr, Qt::ToolTip); QPixmap pm = w->grab(QRect(0, 0, -1, -1)); label->setPixmap(pm); label->resize((QSizeF(pm.size()) / pm.devicePixelRatio()).toSize()); @@ -68,17 +68,17 @@ FormWindowDnDItem::FormWindowDnDItem(QDesignerDnDItemInterface::DropType type, F QPoint pos = widget->mapToGlobal(QPoint(0, 0)); decoration->move(pos); - init(0, widget, decoration, global_mouse_pos); + init(nullptr, widget, decoration, global_mouse_pos); } DomUI *FormWindowDnDItem::domUi() const { DomUI *result = QDesignerDnDItem::domUi(); - if (result != 0) + if (result != nullptr) return result; FormWindow *form = qobject_cast(source()); - if (widget() == 0 || form == 0) - return 0; + if (widget() == nullptr || form == nullptr) + return nullptr; QtResourceModel *resourceModel = form->core()->resourceModel(); QtResourceSet *currentResourceSet = resourceModel->currentResourceSet(); diff --git a/src/designer/src/components/formeditor/formwindow_widgetstack.cpp b/src/designer/src/components/formeditor/formwindow_widgetstack.cpp index c9fc88f04..18126c145 100644 --- a/src/designer/src/components/formeditor/formwindow_widgetstack.cpp +++ b/src/designer/src/components/formeditor/formwindow_widgetstack.cpp @@ -104,9 +104,9 @@ void FormWindowWidgetStack::setCurrentTool(int index) void FormWindowWidgetStack::setSenderAsCurrentTool() { - QDesignerFormWindowToolInterface *tool = 0; + QDesignerFormWindowToolInterface *tool = nullptr; QAction *action = qobject_cast(sender()); - if (action == 0) { + if (action == nullptr) { qDebug("FormWindowWidgetStack::setSenderAsCurrentTool(): sender is not a QAction"); return; } @@ -118,7 +118,7 @@ void FormWindowWidgetStack::setSenderAsCurrentTool() } } - if (tool == 0) { + if (tool == nullptr) { qDebug("FormWindowWidgetStack::setSenderAsCurrentTool(): unknown tool"); return; } @@ -147,7 +147,8 @@ void FormWindowWidgetStack::setMainContainer(QWidget *w) // This code is triggered once by the formwindow and // by integrations doing "revert to saved". Anything changing? const int previousCount = m_formContainerLayout->count(); - QWidget *previousMainContainer = previousCount ? m_formContainerLayout->itemAt(0)->widget() : static_cast(0); + QWidget *previousMainContainer = previousCount + ? m_formContainerLayout->itemAt(0)->widget() : nullptr; if (previousMainContainer == w) return; // Swap @@ -177,7 +178,7 @@ void FormWindowWidgetStack::addTool(QDesignerFormWindowToolInterface *tool) QDesignerFormWindowToolInterface *FormWindowWidgetStack::tool(int index) const { if (index < 0 || index >= count()) - return 0; + return nullptr; return m_tools.at(index); } @@ -190,7 +191,7 @@ int FormWindowWidgetStack::currentIndex() const QWidget *FormWindowWidgetStack::defaultEditor() const { if (m_tools.isEmpty()) - return 0; + return nullptr; return m_tools.at(0)->editor(); } diff --git a/src/designer/src/components/formeditor/formwindow_widgetstack.h b/src/designer/src/components/formeditor/formwindow_widgetstack.h index de535e0ca..01ee921fd 100644 --- a/src/designer/src/components/formeditor/formwindow_widgetstack.h +++ b/src/designer/src/components/formeditor/formwindow_widgetstack.h @@ -46,7 +46,7 @@ class QT_FORMEDITOR_EXPORT FormWindowWidgetStack: public QObject { Q_OBJECT public: - FormWindowWidgetStack(QObject *parent = 0); + FormWindowWidgetStack(QObject *parent = nullptr); ~FormWindowWidgetStack() override; QLayout *layout() const; @@ -57,7 +57,7 @@ public: int currentIndex() const; int indexOf(QDesignerFormWindowToolInterface *tool) const; - void setMainContainer(QWidget *w = 0); + void setMainContainer(QWidget *w = nullptr); // Return the widget containing the form which can be used to apply embedded design settings to. // These settings should not affect the other editing tools. diff --git a/src/designer/src/components/formeditor/formwindowcursor.h b/src/designer/src/components/formeditor/formwindowcursor.h index 4ac73798c..e8f699928 100644 --- a/src/designer/src/components/formeditor/formwindowcursor.h +++ b/src/designer/src/components/formeditor/formwindowcursor.h @@ -43,7 +43,7 @@ class QT_FORMEDITOR_EXPORT FormWindowCursor: public QObject, public QDesignerFor { Q_OBJECT public: - explicit FormWindowCursor(FormWindow *fw, QObject *parent = 0); + explicit FormWindowCursor(FormWindow *fw, QObject *parent = nullptr); ~FormWindowCursor() override; QDesignerFormWindowInterface *formWindow() const override; diff --git a/src/designer/src/components/formeditor/formwindowmanager.cpp b/src/designer/src/components/formeditor/formwindowmanager.cpp index 914180fe6..d1edb231c 100644 --- a/src/designer/src/components/formeditor/formwindowmanager.cpp +++ b/src/designer/src/components/formeditor/formwindowmanager.cpp @@ -102,12 +102,12 @@ namespace qdesigner_internal { FormWindowManager::FormWindowManager(QDesignerFormEditorInterface *core, QObject *parent) : QDesignerFormWindowManager(parent), m_core(core), - m_activeFormWindow(0), + m_activeFormWindow(nullptr), m_previewManager(new PreviewManager(PreviewManager::SingleFormNonModalPreview, this)), m_createLayoutContext(LayoutContainer), - m_morphLayoutContainer(0), - m_actionGroupPreviewInStyle(0), - m_actionShowFormWindowSettingsDialog(0) + m_morphLayoutContainer(nullptr), + m_actionGroupPreviewInStyle(nullptr), + m_actionShowFormWindowSettingsDialog(nullptr) { setupActions(); qApp->installEventFilter(this); @@ -145,7 +145,7 @@ bool FormWindowManager::eventFilter(QObject *o, QEvent *e) // If we don't have an active form, we only listen for WindowActivate to speed up integrations const QEvent::Type eventType = e->type(); - if (m_activeFormWindow == 0 && eventType != QEvent::WindowActivate) + if (m_activeFormWindow == nullptr && eventType != QEvent::WindowActivate) return false; switch (eventType) { // Uninteresting events @@ -198,7 +198,7 @@ bool FormWindowManager::eventFilter(QObject *o, QEvent *e) } FormWindow *fw = FormWindow::findFormWindow(widget); - if (fw == 0) { + if (fw == nullptr) { return false; } @@ -294,7 +294,7 @@ void FormWindowManager::removeFormWindow(QDesignerFormWindowInterface *w) emit formWindowRemoved(formWindow); if (formWindow == m_activeFormWindow) - setActiveFormWindow(0); + setActiveFormWindow(nullptr); // Make sure that widget box is enabled by default if (m_formWindows.isEmpty() && m_core->widgetBox()) @@ -313,7 +313,7 @@ void FormWindowManager::setActiveFormWindow(QDesignerFormWindowInterface *w) m_activeFormWindow = formWindow; - QtResourceSet *resourceSet = 0; + QtResourceSet *resourceSet = nullptr; if (formWindow) resourceSet = formWindow->resourceSet(); m_core->resourceModel()->setCurrentResourceSet(resourceSet); @@ -332,7 +332,7 @@ void FormWindowManager::setActiveFormWindow(QDesignerFormWindowInterface *w) m_activeFormWindow->emitSelectionChanged(); m_activeFormWindow->commandHistory()->setActive(); // Trigger setActiveSubWindow on mdi area unless we are in toplevel mode - QMdiSubWindow *mdiSubWindow = 0; + QMdiSubWindow *mdiSubWindow = nullptr; if (QWidget *formwindow = m_activeFormWindow->parentWidget()) { mdiSubWindow = qobject_cast(formwindow->parentWidget()); } @@ -611,7 +611,7 @@ void FormWindowManager::slotActionBreakLayoutActivated() void FormWindowManager::slotActionSimplifyLayoutActivated() { - Q_ASSERT(m_activeFormWindow != 0); + Q_ASSERT(m_activeFormWindow != nullptr); QWidgetList selectedWidgets = m_activeFormWindow->selectedWidgets(); m_activeFormWindow->simplifySelection(&selectedWidgets); if (selectedWidgets.size() != 1) @@ -626,7 +626,7 @@ void FormWindowManager::slotActionSimplifyLayoutActivated() void FormWindowManager::slotActionAdjustSizeActivated() { - Q_ASSERT(m_activeFormWindow != 0); + Q_ASSERT(m_activeFormWindow != nullptr); m_activeFormWindow->beginCommand(tr("Adjust Size")); @@ -634,7 +634,7 @@ void FormWindowManager::slotActionAdjustSizeActivated() m_activeFormWindow->simplifySelection(&selectedWidgets); if (selectedWidgets.isEmpty()) { - Q_ASSERT(m_activeFormWindow->mainContainer() != 0); + Q_ASSERT(m_activeFormWindow->mainContainer() != nullptr); selectedWidgets.append(m_activeFormWindow->mainContainer()); } @@ -688,7 +688,7 @@ QWidgetList FormWindowManager::layoutsToBeBroken(QWidget *w) const QWidget *parent = w->parentWidget(); if (m_activeFormWindow->isMainContainer(w)) - parent = 0; + parent = nullptr; QWidget *widget = core()->widgetFactory()->containerOfWidget(w); @@ -806,7 +806,7 @@ static inline bool hasManagedLayoutItems(const QDesignerFormEditorInterface *cor void FormWindowManager::slotUpdateActions() { m_createLayoutContext = LayoutSelection; - m_morphLayoutContainer = 0; + m_morphLayoutContainer = nullptr; bool canMorphIntoVBoxLayout = false; bool canMorphIntoHBoxLayout = false; bool canMorphIntoGridLayout = false; @@ -824,7 +824,7 @@ void FormWindowManager::slotUpdateActions() bool canChangeZOrder = true; do { - if (m_activeFormWindow == 0 || m_activeFormWindow->currentTool() != 0) + if (m_activeFormWindow == nullptr || m_activeFormWindow->currentTool() != 0) break; breakAvailable = hasLayoutsToBeBroken(); @@ -862,7 +862,7 @@ void FormWindowManager::slotUpdateActions() // Manipulate layout of a single widget m_createLayoutContext = LayoutSelection; QWidget *widget = core()->widgetFactory()->containerOfWidget(simplifiedSelection.first()); - if (widget == 0) // We are looking at a page-based container with 0 pages + if (widget == nullptr) // We are looking at a page-based container with 0 pages break; const QDesignerWidgetDataBaseInterface *db = m_core->widgetDataBase(); @@ -878,7 +878,7 @@ void FormWindowManager::slotUpdateActions() layoutContainer = (item->isContainer() || m_activeFormWindow->isMainContainer(widget)); - layoutAvailable = layoutContainer && m_activeFormWindow->hasInsertedChildren(widget) && managedLayout == 0; + layoutAvailable = layoutContainer && m_activeFormWindow->hasInsertedChildren(widget) && managedLayout == nullptr; simplifyAvailable = SimplifyLayoutCommand::canSimplify(m_core, widget); if (layoutAvailable) { m_createLayoutContext = LayoutContainer; @@ -912,7 +912,7 @@ void FormWindowManager::slotUpdateActions() m_actionRaise->setEnabled(canChangeZOrder && selectedWidgetCount > 0); - m_actionSelectAll->setEnabled(m_activeFormWindow != 0); + m_actionSelectAll->setEnabled(m_activeFormWindow != nullptr); m_actionAdjustSize->setEnabled(unlaidoutWidgetCount > 0); @@ -925,7 +925,7 @@ void FormWindowManager::slotUpdateActions() m_actionBreakLayout->setEnabled(breakAvailable); m_actionSimplifyLayout->setEnabled(simplifyAvailable); - m_actionShowFormWindowSettingsDialog->setEnabled(m_activeFormWindow != 0); + m_actionShowFormWindowSettingsDialog->setEnabled(m_activeFormWindow != nullptr); } QDesignerFormWindowInterface *FormWindowManager::createFormWindow(QWidget *parentWidget, Qt::WindowFlags flags) @@ -972,12 +972,12 @@ void FormWindowManager::slotActionShowFormWindowSettingsDialog() if (!fw) return; - QDialog *settingsDialog = 0; + QDialog *settingsDialog = nullptr; const bool wasDirty = fw->isDirty(); // Ask the language extension for a dialog. If not, create our own if (QDesignerLanguageExtension *lang = qt_extension(m_core->extensionManager(), m_core)) - settingsDialog = lang->createFormWindowSettingsDialog(fw, /*parent=*/ 0); + settingsDialog = lang->createFormWindowSettingsDialog(fw, /*parent=*/ nullptr); if (!settingsDialog) settingsDialog = new FormWindowSettings(fw); @@ -1042,14 +1042,14 @@ QAction *FormWindowManager::action(Action action) const return m_actionShowFormWindowSettingsDialog; } qWarning("FormWindowManager::action: Unhanded enumeration value %d", action); - return 0; + return nullptr; } QActionGroup *FormWindowManager::actionGroup(ActionGroup actionGroup) const { switch (actionGroup) { case QDesignerFormWindowManagerInterface::StyledPreviewActionGroup: - if (m_actionGroupPreviewInStyle == 0) { + if (m_actionGroupPreviewInStyle == nullptr) { // Wish we could make the 'this' pointer mutable ;-) QObject *parent = const_cast(this); m_actionGroupPreviewInStyle = new PreviewActionGroup(m_core, parent); @@ -1059,7 +1059,7 @@ QActionGroup *FormWindowManager::actionGroup(ActionGroup actionGroup) const return m_actionGroupPreviewInStyle; } qWarning("FormWindowManager::actionGroup: Unhanded enumeration value %d", actionGroup); - return 0; + return nullptr; } } diff --git a/src/designer/src/components/formeditor/formwindowmanager.h b/src/designer/src/components/formeditor/formwindowmanager.h index f2f007186..d9723cea6 100644 --- a/src/designer/src/components/formeditor/formwindowmanager.h +++ b/src/designer/src/components/formeditor/formwindowmanager.h @@ -58,7 +58,7 @@ class QT_FORMEDITOR_EXPORT FormWindowManager { Q_OBJECT public: - explicit FormWindowManager(QDesignerFormEditorInterface *core, QObject *parent = 0); + explicit FormWindowManager(QDesignerFormEditorInterface *core, QObject *parent = nullptr); ~FormWindowManager() override; QDesignerFormEditorInterface *core() const override; @@ -71,7 +71,7 @@ public: int formWindowCount() const override; QDesignerFormWindowInterface *formWindow(int index) const override; - QDesignerFormWindowInterface *createFormWindow(QWidget *parentWidget = 0, Qt::WindowFlags flags = 0) override; + QDesignerFormWindowInterface *createFormWindow(QWidget *parentWidget = nullptr, Qt::WindowFlags flags = {}) override; QPixmap createPreviewPixmap() const override; diff --git a/src/designer/src/components/formeditor/formwindowsettings.cpp b/src/designer/src/components/formeditor/formwindowsettings.cpp index 63fabf615..2ed718d88 100644 --- a/src/designer/src/components/formeditor/formwindowsettings.cpp +++ b/src/designer/src/components/formeditor/formwindowsettings.cpp @@ -108,9 +108,9 @@ void FormWindowData::fromFormWindow(FormWindowBase* fw) QStyle *style = fw->formContainer()->style(); layoutDefaultEnabled = defaultMargin != INT_MIN || defaultSpacing != INT_MIN; if (defaultMargin == INT_MIN) - defaultMargin = style->pixelMetric(QStyle::PM_DefaultChildMargin, 0); + defaultMargin = style->pixelMetric(QStyle::PM_DefaultChildMargin, nullptr); if (defaultSpacing == INT_MIN) - defaultSpacing = style->pixelMetric(QStyle::PM_DefaultLayoutSpacing, 0); + defaultSpacing = style->pixelMetric(QStyle::PM_DefaultLayoutSpacing, nullptr); marginFunction.clear(); diff --git a/src/designer/src/components/formeditor/itemview_propertysheet.cpp b/src/designer/src/components/formeditor/itemview_propertysheet.cpp index 897110f1d..71adf7397 100644 --- a/src/designer/src/components/formeditor/itemview_propertysheet.cpp +++ b/src/designer/src/components/formeditor/itemview_propertysheet.cpp @@ -143,7 +143,7 @@ QString ItemViewPropertySheetPrivate::fakePropertyName(const QString &prefix, ItemViewPropertySheet::ItemViewPropertySheet(QTreeView *treeViewObject, QObject *parent) : QDesignerPropertySheet(treeViewObject, parent), - d(new ItemViewPropertySheetPrivate(core(), treeViewObject->header(), 0)) + d(new ItemViewPropertySheetPrivate(core(), treeViewObject->header(), nullptr)) { initHeaderProperties(treeViewObject->header(), QStringLiteral("header")); } diff --git a/src/designer/src/components/formeditor/itemview_propertysheet.h b/src/designer/src/components/formeditor/itemview_propertysheet.h index ad010599e..c5cd1f410 100644 --- a/src/designer/src/components/formeditor/itemview_propertysheet.h +++ b/src/designer/src/components/formeditor/itemview_propertysheet.h @@ -46,8 +46,8 @@ class ItemViewPropertySheet: public QDesignerPropertySheet Q_OBJECT Q_INTERFACES(QDesignerPropertySheetExtension) public: - explicit ItemViewPropertySheet(QTreeView *treeViewObject, QObject *parent = 0); - explicit ItemViewPropertySheet(QTableView *tableViewObject, QObject *parent = 0); + explicit ItemViewPropertySheet(QTreeView *treeViewObject, QObject *parent = nullptr); + explicit ItemViewPropertySheet(QTableView *tableViewObject, QObject *parent = nullptr); ~ItemViewPropertySheet(); QHash propertyNameMap() const; diff --git a/src/designer/src/components/formeditor/layout_propertysheet.h b/src/designer/src/components/formeditor/layout_propertysheet.h index 27682ad66..559f09d4a 100644 --- a/src/designer/src/components/formeditor/layout_propertysheet.h +++ b/src/designer/src/components/formeditor/layout_propertysheet.h @@ -46,7 +46,7 @@ class LayoutPropertySheet: public QDesignerPropertySheet Q_OBJECT Q_INTERFACES(QDesignerPropertySheetExtension) public: - explicit LayoutPropertySheet(QLayout *object, QObject *parent = 0); + explicit LayoutPropertySheet(QLayout *object, QObject *parent = nullptr); ~LayoutPropertySheet() override; void setProperty(int index, const QVariant &value) override; diff --git a/src/designer/src/components/formeditor/line_propertysheet.h b/src/designer/src/components/formeditor/line_propertysheet.h index 1268153ee..ebd3960d7 100644 --- a/src/designer/src/components/formeditor/line_propertysheet.h +++ b/src/designer/src/components/formeditor/line_propertysheet.h @@ -42,7 +42,7 @@ class LinePropertySheet: public QDesignerPropertySheet Q_OBJECT Q_INTERFACES(QDesignerPropertySheetExtension) public: - explicit LinePropertySheet(Line *object, QObject *parent = 0); + explicit LinePropertySheet(Line *object, QObject *parent = nullptr); ~LinePropertySheet() override; void setProperty(int index, const QVariant &value) override; diff --git a/src/designer/src/components/formeditor/previewactiongroup.h b/src/designer/src/components/formeditor/previewactiongroup.h index ed639319a..168c6c603 100644 --- a/src/designer/src/components/formeditor/previewactiongroup.h +++ b/src/designer/src/components/formeditor/previewactiongroup.h @@ -56,7 +56,7 @@ class PreviewActionGroup : public QActionGroup Q_DISABLE_COPY(PreviewActionGroup) Q_OBJECT public: - explicit PreviewActionGroup(QDesignerFormEditorInterface *core, QObject *parent = 0); + explicit PreviewActionGroup(QDesignerFormEditorInterface *core, QObject *parent = nullptr); signals: void preview(const QString &style, int deviceProfileIndex); diff --git a/src/designer/src/components/formeditor/qdesigner_resource.cpp b/src/designer/src/components/formeditor/qdesigner_resource.cpp index c2344dd76..72ad5ab2a 100644 --- a/src/designer/src/components/formeditor/qdesigner_resource.cpp +++ b/src/designer/src/components/formeditor/qdesigner_resource.cpp @@ -162,9 +162,9 @@ QDesignerResourceBuilder::QDesignerResourceBuilder(QDesignerFormEditorInterface static inline void setIconPixmap(QIcon::Mode m, QIcon::State s, const QDir &workingDirectory, QString path, PropertySheetIconValue &icon, - const QDesignerLanguageExtension *lang = 0) + const QDesignerLanguageExtension *lang = nullptr) { - if (lang == 0 || !lang->isLanguageResource(path)) + if (lang == nullptr || !lang->isLanguageResource(path)) path = QFileInfo(workingDirectory, path).absoluteFilePath(); icon.setPixmap(m, s, PropertySheetPixmapValue(path)); } @@ -176,7 +176,7 @@ QVariant QDesignerResourceBuilder::loadResource(const QDir &workingDirectory, co PropertySheetPixmapValue pixmap; DomResourcePixmap *dp = property->elementPixmap(); if (!dp->text().isEmpty()) { - if (m_lang != 0 && m_lang->isLanguageResource(dp->text())) { + if (m_lang != nullptr && m_lang->isLanguageResource(dp->text())) { pixmap.setPath(dp->text()); } else { pixmap.setPath(QFileInfo(workingDirectory, dp->text()).absoluteFilePath()); @@ -319,7 +319,7 @@ DomProperty *QDesignerResourceBuilder::saveResource(const QDir &workingDirectory } } delete p; - return 0; + return nullptr; } bool QDesignerResourceBuilder::isResourceType(const QVariant &value) const @@ -418,14 +418,14 @@ DomProperty *QDesignerTextBuilder::saveText(const QVariant &value) const } if (value.canConvert()) return stringToDomProperty(value.toString()); - return 0; + return nullptr; } QDesignerResource::QDesignerResource(FormWindow *formWindow) : QEditorFormBuilder(formWindow->core()), m_formWindow(formWindow), m_copyWidget(false), - m_selected(0), + m_selected(nullptr), m_resourceBuilder(new QDesignerResourceBuilder(m_formWindow->core(), m_formWindow->pixmapCache(), m_formWindow->iconCache())) { // Check language unless extension present (Jambi) @@ -479,7 +479,7 @@ void QDesignerResource::saveDom(DomUI *ui, QWidget *widget) QAbstractFormBuilder::saveDom(ui, widget); QDesignerPropertySheetExtension *sheet = qt_extension(core()->extensionManager(), widget); - Q_ASSERT(sheet != 0); + Q_ASSERT(sheet != nullptr); const QVariant classVar = sheet->property(sheet->indexOf(QStringLiteral("objectName"))); QString classStr; @@ -491,7 +491,7 @@ void QDesignerResource::saveDom(DomUI *ui, QWidget *widget) for (int index = 0; index < m_formWindow->toolCount(); ++index) { QDesignerFormWindowToolInterface *tool = m_formWindow->tool(index); - Q_ASSERT(tool != 0); + Q_ASSERT(tool != nullptr); tool->saveToDom(ui, widget); } @@ -633,12 +633,12 @@ QWidget *QDesignerResource::create(DomUI *ui, QWidget *parentWidget) const QString errorMessage = QApplication::translate("Designer", "This file cannot be read because the extra info extension failed to load."); core()->dialogGui()->message(parentWidget->window(), QDesignerDialogGuiInterface::FormLoadFailureMessage, QMessageBox::Warning, messageBoxTitle(), errorMessage, QMessageBox::Ok); - return 0; + return nullptr; } } qdesigner_internal::WidgetFactory *factory = qobject_cast(core()->widgetFactory()); - Q_ASSERT(factory != 0); + Q_ASSERT(factory != nullptr); QDesignerFormWindowInterface *previousFormWindow = factory->currentFormWindow(m_formWindow); @@ -712,7 +712,7 @@ QWidget *QDesignerResource::create(DomUI *ui, QWidget *parentWidget) // Load tools for (int index = 0; index < m_formWindow->toolCount(); ++index) { QDesignerFormWindowToolInterface *tool = m_formWindow->tool(index); - Q_ASSERT(tool != 0); + Q_ASSERT(tool != nullptr); tool->loadFromDom(ui, mainWidget); } } @@ -786,7 +786,7 @@ QWidget *QDesignerResource::create(DomWidget *ui_widget, QWidget *parentWidget) QDesignerContainerExtension *container = qt_extension(core()->extensionManager(), parentWidget); - if (container == 0) { + if (container == nullptr) { // generate a QLayoutWidget iff the parent is not an QDesignerContainerExtension. ui_widget->setAttributeClass(QStringLiteral("QLayoutWidget")); } @@ -801,8 +801,8 @@ QWidget *QDesignerResource::create(DomWidget *ui_widget, QWidget *parentWidget) // restore the actions ui_widget->setElementAddAction(actionRefs); - if (w == 0) - return 0; + if (w == nullptr) + return nullptr; // ### generalize using the extension manager QDesignerMenu *menu = qobject_cast(w); @@ -882,7 +882,7 @@ QLayoutItem *QDesignerResource::create(DomLayoutItem *ui_layoutItem, QLayout *la core()->metaDataBase()->add(layoutWidget); if (m_formWindow) m_formWindow->manageWidget(layoutWidget); - (void) create(ui_layout, 0, layoutWidget); + (void) create(ui_layout, nullptr, layoutWidget); return new QWidgetItem(layoutWidget); } return QAbstractFormBuilder::create(ui_layoutItem, layout, parentWidget); @@ -1025,7 +1025,7 @@ QWidget *QDesignerResource::createWidget(const QString &widgetName, QWidget *par QWidget *w = core()->widgetFactory()->createWidget(widgetName, parentWidget); if (!w) - return 0; + return nullptr; if (name.isEmpty()) { QDesignerWidgetDataBaseInterface *db = core()->widgetDataBase(); @@ -1059,13 +1059,13 @@ QWidget *QDesignerResource::createWidget(const QString &widgetName, QWidget *par QLayout *QDesignerResource::createLayout(const QString &layoutName, QObject *parent, const QString &name) { - QWidget *layoutBase = 0; + QWidget *layoutBase = nullptr; QLayout *layout = qobject_cast(parent); if (parent->isWidgetType()) layoutBase = static_cast(parent); else { - Q_ASSERT( layout != 0 ); + Q_ASSERT( layout != nullptr ); layoutBase = layout->parentWidget(); } @@ -1075,7 +1075,7 @@ QLayout *QDesignerResource::createLayout(const QString &layoutName, QObject *par layoutType = LayoutInfo::Grid; } QLayout *lay = core()->widgetFactory()->createLayout(layoutBase, layout, layoutType); - if (lay != 0) + if (lay != nullptr) changeObjectName(lay, name); return lay; @@ -1086,13 +1086,13 @@ DomWidget *QDesignerResource::createDom(QWidget *widget, DomWidget *ui_parentWid { QDesignerMetaDataBaseItemInterface *item = core()->metaDataBase()->item(widget); if (!item) - return 0; + return nullptr; if (qobject_cast(widget) && !m_copyWidget) - return 0; + return nullptr; const QDesignerWidgetDataBaseInterface *wdb = core()->widgetDataBase(); - QDesignerWidgetDataBaseItemInterface *widgetInfo = 0; + QDesignerWidgetDataBaseItemInterface *widgetInfo = nullptr; const int widgetInfoIndex = wdb->indexOfObject(widget, false); if (widgetInfoIndex != -1) { widgetInfo = wdb->item(widgetInfoIndex); @@ -1105,12 +1105,12 @@ DomWidget *QDesignerResource::createDom(QWidget *widget, DomWidget *ui_parentWid break; // There are faulty files around that have name==extends } else { const int extendsIndex = wdb->indexOfClassName(customInfo->extends()); - customInfo = extendsIndex != -1 ? wdb->item(extendsIndex) : static_cast(0); + customInfo = extendsIndex != -1 ? wdb->item(extendsIndex) : nullptr; } } } - DomWidget *w = 0; + DomWidget *w = nullptr; if (QTabWidget *tabWidget = qobject_cast(widget)) w = saveWidget(tabWidget, ui_parentWidget); @@ -1129,7 +1129,7 @@ DomWidget *QDesignerResource::createDom(QWidget *widget, DomWidget *ui_parentWid else w = QAbstractFormBuilder::createDom(widget, ui_parentWidget, recursive); - Q_ASSERT( w != 0 ); + Q_ASSERT( w != nullptr ); if (!qobject_cast(widget) && w->attributeClass() == QStringLiteral("QWidget")) { w->setAttributeNative(true); @@ -1142,7 +1142,7 @@ DomWidget *QDesignerResource::createDom(QWidget *widget, DomWidget *ui_parentWid w->setAttributeName(widget->objectName()); if (isPromoted( core(), widget)) { // is promoted? - Q_ASSERT(widgetInfo != 0); + Q_ASSERT(widgetInfo != nullptr); w->setAttributeName(widget->objectName()); w->setAttributeClass(widgetInfo->name()); @@ -1157,7 +1157,7 @@ DomWidget *QDesignerResource::createDom(QWidget *widget, DomWidget *ui_parentWid break; } } - } else if (widgetInfo != 0 && m_usedCustomWidgets.contains(widgetInfo)) { + } else if (widgetInfo != nullptr && m_usedCustomWidgets.contains(widgetInfo)) { if (widgetInfo->name() != w->attributeClass()) w->setAttributeClass(widgetInfo->name()); } @@ -1169,26 +1169,26 @@ DomLayout *QDesignerResource::createDom(QLayout *layout, DomLayout *ui_parentLay { QDesignerMetaDataBaseItemInterface *item = core()->metaDataBase()->item(layout); - if (item == 0) { + if (item == nullptr) { layout = layout->findChild(); // refresh the meta database item item = core()->metaDataBase()->item(layout); } - if (item == 0) { + if (item == nullptr) { // nothing to do. - return 0; + return nullptr; } if (qobject_cast(layout->parentWidget()) != 0) { // nothing to do. - return 0; + return nullptr; } m_chain.push(layout); DomLayout *l = QAbstractFormBuilder::createDom(layout, ui_parentLayout, ui_parentWidget); - Q_ASSERT(l != 0); + Q_ASSERT(l != nullptr); LayoutPropertySheet::stretchAttributesToDom(core(), layout, l); m_chain.pop(); @@ -1198,11 +1198,11 @@ DomLayout *QDesignerResource::createDom(QLayout *layout, DomLayout *ui_parentLay DomLayoutItem *QDesignerResource::createDom(QLayoutItem *item, DomLayout *ui_layout, DomWidget *ui_parentWidget) { - DomLayoutItem *ui_item = 0; + DomLayoutItem *ui_item = nullptr; if (Spacer *s = qobject_cast(item->widget())) { if (!core()->metaDataBase()->item(s)) - return 0; + return nullptr; DomSpacer *spacer = new DomSpacer(); const QString objectName = s->objectName(); @@ -1224,7 +1224,7 @@ DomLayoutItem *QDesignerResource::createDom(QLayoutItem *item, DomLayout *ui_lay } else if (!item->spacerItem()) { // we use spacer as fake item in the Designer ui_item = QAbstractFormBuilder::createDom(item, ui_layout, ui_parentWidget); } else { - return 0; + return nullptr; } return ui_item; } @@ -1252,7 +1252,7 @@ DomTabStops *QDesignerResource::saveTabStops() return dom; } - return 0; + return nullptr; } void QDesignerResource::applyTabStops(QWidget *widget, DomTabStops *tabStops) @@ -1536,7 +1536,7 @@ bool QDesignerResource::checkProperty(QObject *obj, const QString &prop) const if (prop == QStringLiteral("objectName") || prop == QStringLiteral("spacerName")) // ### don't store the property objectName return false; - QWidget *check_widget = 0; + QWidget *check_widget = nullptr; if (obj->isWidgetType()) check_widget = static_cast(obj); @@ -1570,19 +1570,19 @@ bool QDesignerResource::checkProperty(QObject *obj, const QString &prop) const bool QDesignerResource::addItem(DomLayoutItem *ui_item, QLayoutItem *item, QLayout *layout) { - if (item->widget() == 0) { + if (item->widget() == nullptr) { return false; } QGridLayout *grid = qobject_cast(layout); QBoxLayout *box = qobject_cast(layout); - if (grid != 0) { + if (grid != nullptr) { const int rowSpan = ui_item->hasAttributeRowSpan() ? ui_item->attributeRowSpan() : 1; const int colSpan = ui_item->hasAttributeColSpan() ? ui_item->attributeColSpan() : 1; grid->addWidget(item->widget(), ui_item->attributeRow(), ui_item->attributeColumn(), rowSpan, colSpan, item->alignment()); return true; - } else if (box != 0) { + } else if (box != nullptr) { box->addItem(item); return true; } @@ -1679,7 +1679,7 @@ bool QDesignerResource::copy(QIODevice *dev, const FormBuilderClipboard &selecti DomUI *QDesignerResource::copy(const FormBuilderClipboard &selection) { if (selection.empty()) - return 0; + return nullptr; m_copyWidget = true; @@ -1694,7 +1694,7 @@ DomUI *QDesignerResource::copy(const FormBuilderClipboard &selection) QWidget *w = selection.m_widgets.at(i); m_selected = w; DomWidget *ui_child = createDom(w, ui_widget); - m_selected = 0; + m_selected = nullptr; if (ui_child) ui_widget_list.append(ui_child); } @@ -1721,7 +1721,7 @@ DomUI *QDesignerResource::copy(const FormBuilderClipboard &selection) if (!hasItems) { delete ui_widget; - return 0; + return nullptr; } // UI DomUI *ui = new DomUI(); @@ -1816,7 +1816,7 @@ void QDesignerResource::layoutInfo(DomLayout *layout, QObject *parent, int *marg DomCustomWidgets *QDesignerResource::saveCustomWidgets() { if (m_usedCustomWidgets.isEmpty()) - return 0; + return nullptr; // We would like the list to be in order of the widget database indexes // to ensure that base classes come first (nice optics) @@ -1928,7 +1928,7 @@ QList QDesignerResource::computeProperties(QObject *object) DomProperty *QDesignerResource::applyProperStdSetAttribute(QObject *object, const QString &propertyName, DomProperty *property) { if (!property) - return 0; + return nullptr; QExtensionManager *mgr = core()->extensionManager(); if (const QDesignerPropertySheetExtension *sheet = qt_extension(mgr, object)) { @@ -1954,14 +1954,14 @@ static inline bool hasSetter(QDesignerFormEditorInterface *core, QObject *object DomProperty *QDesignerResource::createProperty(QObject *object, const QString &propertyName, const QVariant &value) { if (!checkProperty(object, propertyName)) { - return 0; + return nullptr; } if (value.canConvert()) { const PropertySheetFlagValue f = qvariant_cast(value); const QString flagString = f.metaFlags.toString(f.value, DesignerMetaFlags::FullyQualified); if (flagString.isEmpty()) - return 0; + return nullptr; DomProperty *p = new DomProperty; // check if we have a standard cpp set function @@ -1978,7 +1978,7 @@ DomProperty *QDesignerResource::createProperty(QObject *object, const QString &p if (!ok) designerWarning(e.metaEnum.messageToStringFailed(e.value)); if (id.isEmpty()) - return 0; + return nullptr; DomProperty *p = new DomProperty; // check if we have a standard cpp set function @@ -2040,7 +2040,7 @@ QStringList QDesignerResource::mergeWithLoadedPaths(const QStringList &paths) co void QDesignerResource::createResources(DomResources *resources) { QStringList paths; - if (resources != 0) { + if (resources != nullptr) { const auto &dom_include = resources->elementInclude(); for (DomResource *res : dom_include) { QString path = QDir::cleanPath(m_formWindow->absoluteDir().absoluteFilePath(res->attributeLocation())); @@ -2132,18 +2132,18 @@ DomResources *QDesignerResource::saveResources(const QStringList &qrcPaths) DomAction *QDesignerResource::createDom(QAction *action) { if (!core()->metaDataBase()->item(action) || action->menu()) - return 0; + return nullptr; return QAbstractFormBuilder::createDom(action); } DomActionGroup *QDesignerResource::createDom(QActionGroup *actionGroup) { - if (core()->metaDataBase()->item(actionGroup) != 0) { + if (core()->metaDataBase()->item(actionGroup) != nullptr) { return QAbstractFormBuilder::createDom(actionGroup); } - return 0; + return nullptr; } QAction *QDesignerResource::create(DomAction *ui_action, QObject *parent) @@ -2153,7 +2153,7 @@ QAction *QDesignerResource::create(DomAction *ui_action, QObject *parent) return action; } - return 0; + return nullptr; } QActionGroup *QDesignerResource::create(DomActionGroup *ui_action_group, QObject *parent) @@ -2163,14 +2163,14 @@ QActionGroup *QDesignerResource::create(DomActionGroup *ui_action_group, QObject return actionGroup; } - return 0; + return nullptr; } DomActionRef *QDesignerResource::createActionRefDom(QAction *action) { if (!core()->metaDataBase()->item(action) || (!action->isSeparator() && !action->menu() && action->objectName().isEmpty())) - return 0; + return nullptr; return QAbstractFormBuilder::createActionRefDom(action); } @@ -2187,7 +2187,7 @@ QAction *QDesignerResource::createAction(QObject *parent, const QString &name) return action; } - return 0; + return nullptr; } QActionGroup *QDesignerResource::createActionGroup(QObject *parent, const QString &name) @@ -2197,7 +2197,7 @@ QActionGroup *QDesignerResource::createActionGroup(QObject *parent, const QStrin return actionGroup; } - return 0; + return nullptr; } /* Apply the attributes to a widget via property sheet where appropriate, diff --git a/src/designer/src/components/formeditor/qdesigner_resource.h b/src/designer/src/components/formeditor/qdesigner_resource.h index 0df515355..c0e925f87 100644 --- a/src/designer/src/components/formeditor/qdesigner_resource.h +++ b/src/designer/src/components/formeditor/qdesigner_resource.h @@ -70,8 +70,8 @@ public: bool copy(QIODevice *dev, const FormBuilderClipboard &selection) override; DomUI *copy(const FormBuilderClipboard &selection) override; - FormBuilderClipboard paste(DomUI *ui, QWidget *widgetParent, QObject *actionParent = 0) override; - FormBuilderClipboard paste(QIODevice *dev, QWidget *widgetParent, QObject *actionParent = 0) override; + FormBuilderClipboard paste(DomUI *ui, QWidget *widgetParent, QObject *actionParent = nullptr) override; + FormBuilderClipboard paste(QIODevice *dev, QWidget *widgetParent, QObject *actionParent = nullptr) override; bool saveRelative() const; void setSaveRelative(bool relative); diff --git a/src/designer/src/components/formeditor/qlayoutwidget_propertysheet.h b/src/designer/src/components/formeditor/qlayoutwidget_propertysheet.h index b57e6a7cd..e50df88f4 100644 --- a/src/designer/src/components/formeditor/qlayoutwidget_propertysheet.h +++ b/src/designer/src/components/formeditor/qlayoutwidget_propertysheet.h @@ -42,7 +42,7 @@ class QLayoutWidgetPropertySheet: public QDesignerPropertySheet Q_OBJECT Q_INTERFACES(QDesignerPropertySheetExtension) public: - explicit QLayoutWidgetPropertySheet(QLayoutWidget *object, QObject *parent = 0); + explicit QLayoutWidgetPropertySheet(QLayoutWidget *object, QObject *parent = nullptr); ~QLayoutWidgetPropertySheet() override; void setProperty(int index, const QVariant &value) override; diff --git a/src/designer/src/components/formeditor/qmainwindow_container.cpp b/src/designer/src/components/formeditor/qmainwindow_container.cpp index 71f608fa2..cf0cbdaa1 100644 --- a/src/designer/src/components/formeditor/qmainwindow_container.cpp +++ b/src/designer/src/components/formeditor/qmainwindow_container.cpp @@ -56,7 +56,7 @@ int QMainWindowContainer::count() const QWidget *QMainWindowContainer::widget(int index) const { if (index == -1) - return 0; + return nullptr; return m_widgets.at(index); } @@ -174,12 +174,12 @@ void QMainWindowContainer::remove(int index) m_mainWindow->removeToolBar(toolBar); } else if (QMenuBar *menuBar = qobject_cast(widget)) { menuBar->hide(); - menuBar->setParent(0); - m_mainWindow->setMenuBar(0); + menuBar->setParent(nullptr); + m_mainWindow->setMenuBar(nullptr); } else if (QStatusBar *statusBar = qobject_cast(widget)) { statusBar->hide(); - statusBar->setParent(0); - m_mainWindow->setStatusBar(0); + statusBar->setParent(nullptr); + m_mainWindow->setStatusBar(nullptr); } else if (QDockWidget *dockWidget = qobject_cast(widget)) { m_mainWindow->removeDockWidget(dockWidget); } diff --git a/src/designer/src/components/formeditor/qmainwindow_container.h b/src/designer/src/components/formeditor/qmainwindow_container.h index 3673cb665..96991f411 100644 --- a/src/designer/src/components/formeditor/qmainwindow_container.h +++ b/src/designer/src/components/formeditor/qmainwindow_container.h @@ -45,7 +45,7 @@ class QMainWindowContainer: public QObject, public QDesignerContainerExtension Q_OBJECT Q_INTERFACES(QDesignerContainerExtension) public: - explicit QMainWindowContainer(QMainWindow *widget, QObject *parent = 0); + explicit QMainWindowContainer(QMainWindow *widget, QObject *parent = nullptr); int count() const override; QWidget *widget(int index) const override; diff --git a/src/designer/src/components/formeditor/qmdiarea_container.cpp b/src/designer/src/components/formeditor/qmdiarea_container.cpp index 01cf0d598..2726cfcee 100644 --- a/src/designer/src/components/formeditor/qmdiarea_container.cpp +++ b/src/designer/src/components/formeditor/qmdiarea_container.cpp @@ -55,7 +55,7 @@ int QMdiAreaContainer::count() const QWidget *QMdiAreaContainer::widget(int index) const { if (index < 0) - return 0; + return nullptr; return m_mdiArea->subWindowList(QMdiArea::CreationOrder).at(index)->widget(); } @@ -214,7 +214,7 @@ bool QMdiAreaPropertySheet::isEnabled(int index) const switch (mdiAreaProperty(propertyName(index))) { case MdiAreaSubWindowName: case MdiAreaSubWindowTitle: - return currentWindow() != 0; + return currentWindow() != nullptr; case MdiAreaNone: break; } @@ -226,7 +226,7 @@ bool QMdiAreaPropertySheet::isChanged(int index) const bool rc = false; switch (mdiAreaProperty(propertyName(index))) { case MdiAreaSubWindowName: - rc = currentWindow() != 0; + rc = currentWindow() != nullptr; break; case MdiAreaSubWindowTitle: if (QDesignerPropertySheetExtension *cws = currentWindowSheet()) { @@ -246,17 +246,17 @@ QWidget *QMdiAreaPropertySheet::currentWindow() const if (const QDesignerContainerExtension *c = qt_extension(core()->extensionManager(), object())) { const int ci = c->currentIndex(); if (ci < 0) - return 0; + return nullptr; return c->widget(ci); } - return 0; + return nullptr; } QDesignerPropertySheetExtension *QMdiAreaPropertySheet::currentWindowSheet() const { QWidget *cw = currentWindow(); - if (cw == 0) - return 0; + if (cw == nullptr) + return nullptr; return qt_extension(core()->extensionManager(), cw); } diff --git a/src/designer/src/components/formeditor/qmdiarea_container.h b/src/designer/src/components/formeditor/qmdiarea_container.h index 9506e0de8..47669af3a 100644 --- a/src/designer/src/components/formeditor/qmdiarea_container.h +++ b/src/designer/src/components/formeditor/qmdiarea_container.h @@ -47,7 +47,7 @@ class QMdiAreaContainer: public QObject, public QDesignerContainerExtension Q_OBJECT Q_INTERFACES(QDesignerContainerExtension) public: - explicit QMdiAreaContainer(QMdiArea *widget, QObject *parent = 0); + explicit QMdiAreaContainer(QMdiArea *widget, QObject *parent = nullptr); int count() const override; QWidget *widget(int index) const override; @@ -71,7 +71,7 @@ class QMdiAreaPropertySheet: public QDesignerPropertySheet Q_OBJECT Q_INTERFACES(QDesignerPropertySheetExtension) public: - explicit QMdiAreaPropertySheet(QWidget *mdiArea, QObject *parent = 0); + explicit QMdiAreaPropertySheet(QWidget *mdiArea, QObject *parent = nullptr); void setProperty(int index, const QVariant &value) override; bool reset(int index) override; diff --git a/src/designer/src/components/formeditor/qwizard_container.cpp b/src/designer/src/components/formeditor/qwizard_container.cpp index 9339a1a90..36e73c6ea 100644 --- a/src/designer/src/components/formeditor/qwizard_container.cpp +++ b/src/designer/src/components/formeditor/qwizard_container.cpp @@ -54,7 +54,7 @@ int QWizardContainer::count() const QWidget *QWizardContainer::widget(int index) const { - QWidget *rc = 0; + QWidget *rc = nullptr; if (index >= 0) { const IdList idList = m_wizard->pageIds(); if (index < idList.size()) diff --git a/src/designer/src/components/formeditor/qwizard_container.h b/src/designer/src/components/formeditor/qwizard_container.h index 7a8c3624a..fe7cdbc2f 100644 --- a/src/designer/src/components/formeditor/qwizard_container.h +++ b/src/designer/src/components/formeditor/qwizard_container.h @@ -50,7 +50,7 @@ class QWizardContainer: public QObject, public QDesignerContainerExtension Q_OBJECT Q_INTERFACES(QDesignerContainerExtension) public: - explicit QWizardContainer(QWizard *widget, QObject *parent = 0); + explicit QWizardContainer(QWizard *widget, QObject *parent = nullptr); int count() const override; QWidget *widget(int index) const override; @@ -73,7 +73,7 @@ class QWizardPagePropertySheet: public QDesignerPropertySheet { Q_OBJECT public: - explicit QWizardPagePropertySheet(QWizardPage *object, QObject *parent = 0); + explicit QWizardPagePropertySheet(QWizardPage *object, QObject *parent = nullptr); bool reset(int index) override; @@ -91,7 +91,7 @@ class QWizardPropertySheet: public QDesignerPropertySheet { Q_OBJECT public: - explicit QWizardPropertySheet(QWizard *object, QObject *parent = 0); + explicit QWizardPropertySheet(QWizard *object, QObject *parent = nullptr); bool isVisible(int index) const override; private: diff --git a/src/designer/src/components/formeditor/spacer_propertysheet.h b/src/designer/src/components/formeditor/spacer_propertysheet.h index 8395df208..05dfb7d32 100644 --- a/src/designer/src/components/formeditor/spacer_propertysheet.h +++ b/src/designer/src/components/formeditor/spacer_propertysheet.h @@ -42,7 +42,7 @@ class SpacerPropertySheet: public QDesignerPropertySheet Q_OBJECT Q_INTERFACES(QDesignerPropertySheetExtension) public: - explicit SpacerPropertySheet(Spacer *object, QObject *parent = 0); + explicit SpacerPropertySheet(Spacer *object, QObject *parent = nullptr); ~SpacerPropertySheet() override; void setProperty(int index, const QVariant &value) override; diff --git a/src/designer/src/components/formeditor/templateoptionspage.h b/src/designer/src/components/formeditor/templateoptionspage.h index 204b805e9..660e41268 100644 --- a/src/designer/src/components/formeditor/templateoptionspage.h +++ b/src/designer/src/components/formeditor/templateoptionspage.h @@ -54,7 +54,7 @@ class TemplateOptionsWidget : public QWidget Q_DISABLE_COPY(TemplateOptionsWidget) public: explicit TemplateOptionsWidget(QDesignerFormEditorInterface *core, - QWidget *parent = 0); + QWidget *parent = nullptr); ~TemplateOptionsWidget(); diff --git a/src/designer/src/components/formeditor/tool_widgeteditor.cpp b/src/designer/src/components/formeditor/tool_widgeteditor.cpp index 0f41f74bf..d3ecf8087 100644 --- a/src/designer/src/components/formeditor/tool_widgeteditor.cpp +++ b/src/designer/src/components/formeditor/tool_widgeteditor.cpp @@ -76,7 +76,7 @@ QDesignerFormWindowInterface *WidgetEditorTool::formWindow() const bool WidgetEditorTool::mainWindowSeparatorEvent(QWidget *widget, QEvent *event) { QMainWindow *mw = qobject_cast(widget); - if (mw == 0) + if (mw == nullptr) return false; if (event->type() != QEvent::MouseButtonPress @@ -100,7 +100,7 @@ bool WidgetEditorTool::mainWindowSeparatorEvent(QWidget *widget, QEvent *event) if (event->type() == QEvent::MouseButtonRelease) { if (m_separator_drag_mw != mw) return false; - m_separator_drag_mw = 0; + m_separator_drag_mw = nullptr; return true; } @@ -248,7 +248,7 @@ bool WidgetEditorTool::handleDragEnterMoveEvent(QWidget *widget, QWidget * /*man QPoint globalPos = QPoint(0, 0); if (m_specialDockDrag) { - m_lastDropTarget = 0; + m_lastDropTarget = nullptr; QMainWindow *mw = qobject_cast(m_formWindow->mainContainer()); if (mw) m_lastDropTarget = mw->centralWidget(); @@ -306,7 +306,7 @@ bool WidgetEditorTool::restoreDropHighlighting() return false; m_formWindow->highlightWidget(m_lastDropTarget, m_lastDropTarget->mapFromGlobal(QCursor::pos()), FormWindow::Restore); - m_lastDropTarget = 0; + m_lastDropTarget = nullptr; return true; } @@ -321,7 +321,7 @@ bool WidgetEditorTool::handleDragLeaveEvent(QWidget *, QWidget *, QDragLeaveEven QWidget *WidgetEditorTool::editor() const { - Q_ASSERT(formWindow() != 0); + Q_ASSERT(formWindow() != nullptr); return formWindow()->mainContainer(); } @@ -330,7 +330,7 @@ void WidgetEditorTool::activated() if (core()->widgetBox()) core()->widgetBox()->setEnabled(true); - if (m_formWindow == 0) + if (m_formWindow == nullptr) return; const QWidgetList &sel = m_formWindow->selectedWidgets(); @@ -343,7 +343,7 @@ void WidgetEditorTool::deactivated() if (core()->widgetBox()) core()->widgetBox()->setEnabled(false); - if (m_formWindow == 0) + if (m_formWindow == nullptr) return; m_formWindow->clearSelection(); diff --git a/src/designer/src/components/formeditor/widgetselection.cpp b/src/designer/src/components/formeditor/widgetselection.cpp index 608428554..c871063b5 100644 --- a/src/designer/src/components/formeditor/widgetselection.cpp +++ b/src/designer/src/components/formeditor/widgetselection.cpp @@ -65,18 +65,18 @@ enum { debugWidgetSelection = 0 }; template static inline Layout *managedLayoutOf(const QDesignerFormEditorInterface *core, QWidget *w, - const Layout * /* vs6dummy */ = 0) + const Layout * /* vs6dummy */ = nullptr) { if (QWidget *p = w->parentWidget()) if (QLayout *l = LayoutInfo::managedLayout(core, p)) return qobject_cast(l); - return 0; + return nullptr; } // ----------- WidgetHandle WidgetHandle::WidgetHandle(FormWindow *parent, WidgetHandle::Type t, WidgetSelection *s) : InvisibleWidget(parent->formContainer()), - m_widget(0), + m_widget(nullptr), m_type(t), m_formWindow( parent), m_sel(s), @@ -135,7 +135,7 @@ QDesignerFormEditorInterface *WidgetHandle::core() const if (m_formWindow) return m_formWindow->core(); - return 0; + return nullptr; } void WidgetHandle::setActive(bool a) @@ -396,7 +396,7 @@ static inline int formLayoutRightHandleOperation(int dx, unsigned possibleOperat // Change form layout item horizontal span void WidgetHandle::changeFormLayoutItemSpan() { - QUndoCommand *cmd = 0; + QUndoCommand *cmd = nullptr; // Figure out command according to the movement const int dx = m_widget->geometry().center().x() - m_origGeom.center().x(); if (qAbs(dx) >= QApplication::startDragDistance()) { @@ -450,7 +450,7 @@ void WidgetHandle::changeGridLayoutItemSpan() const QPoint pt = m_origGeom.center() - m_widget->geometry().center(); - ChangeLayoutItemGeometry *cmd = 0; + ChangeLayoutItemGeometry *cmd = nullptr; switch (m_type) { default: @@ -501,7 +501,7 @@ void WidgetHandle::changeGridLayoutItemSpan() break; } - if (cmd != 0) { + if (cmd != nullptr) { m_formWindow->commandHistory()->push(cmd); } else { grid->invalidate(); @@ -568,7 +568,7 @@ WidgetSelection::WidgetState WidgetSelection::widgetState(const QDesignerFormEdi } WidgetSelection::WidgetSelection(FormWindow *parent) : - m_widget(0), + m_widget(nullptr), m_formWindow(parent) { for (int i = WidgetHandle::LeftTop; i < WidgetHandle::TypeCount; ++i) @@ -578,12 +578,12 @@ WidgetSelection::WidgetSelection(FormWindow *parent) : void WidgetSelection::setWidget(QWidget *w) { - if (m_widget != 0) + if (m_widget != nullptr) m_widget->removeEventFilter(this); - if (w == 0) { + if (w == nullptr) { hide(); - m_widget = 0; + m_widget = nullptr; return; } @@ -629,7 +629,7 @@ void WidgetSelection::updateActive() bool WidgetSelection::isUsed() const { - return m_widget != 0; + return m_widget != nullptr; } void WidgetSelection::updateGeometry() @@ -715,7 +715,7 @@ QDesignerFormEditorInterface *WidgetSelection::core() const if (m_formWindow) return m_formWindow->core(); - return 0; + return nullptr; } bool WidgetSelection::eventFilter(QObject *object, QEvent *event) diff --git a/src/designer/src/components/lib/qdesigner_components.cpp b/src/designer/src/components/lib/qdesigner_components.cpp index a69bf8a66..29226f95a 100644 --- a/src/designer/src/components/lib/qdesigner_components.cpp +++ b/src/designer/src/components/lib/qdesigner_components.cpp @@ -143,7 +143,7 @@ static inline void setMinorVersion(int minorVersion, int *qtVersion) } // Build the version-dependent name of the user widget box file, '$HOME.designer/widgetbox4.4.xml' -static inline QString widgetBoxFileName(int qtVersion, const QDesignerLanguageExtension *lang = 0) +static inline QString widgetBoxFileName(int qtVersion, const QDesignerLanguageExtension *lang = nullptr) { QString rc; { const QChar dot = QLatin1Char('.'); diff --git a/src/designer/src/components/objectinspector/objectinspector.cpp b/src/designer/src/components/objectinspector/objectinspector.cpp index f8a004e51..07b973185 100644 --- a/src/designer/src/components/objectinspector/objectinspector.cpp +++ b/src/designer/src/components/objectinspector/objectinspector.cpp @@ -117,16 +117,11 @@ namespace qdesigner_internal { // Delegate with object name validator for the object name column class ObjectInspectorDelegate : public QStyledItemDelegate { public: - explicit ObjectInspectorDelegate(QObject *parent = 0); + using QStyledItemDelegate::QStyledItemDelegate; QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override; }; -ObjectInspectorDelegate::ObjectInspectorDelegate(QObject *parent) : - QStyledItemDelegate(parent) -{ -} - QWidget *ObjectInspectorDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem & option, const QModelIndex &index) const { if (index.column() != ObjectInspectorModel::ObjectNameColumn) @@ -144,7 +139,7 @@ QWidget *ObjectInspectorDelegate::createEditor(QWidget *parent, const QStyleOpti class ObjectInspectorTreeView : public QTreeView { public: - ObjectInspectorTreeView(QWidget *parent = 0) : QTreeView(parent) {} + using QTreeView::QTreeView; protected: void mouseMoveEvent (QMouseEvent * event) override; @@ -286,17 +281,17 @@ void ObjectInspector::ObjectInspectorPrivate::clearSelection() QWidget *ObjectInspector::ObjectInspectorPrivate::managedWidgetAt(const QPoint &global_mouse_pos) { if (!m_formWindow) - return 0; + return nullptr; const QPoint pos = m_treeView->viewport()->mapFromGlobal(global_mouse_pos); QObject *o = objectAt(m_treeView->indexAt(pos)); if (!o || !o->isWidgetType()) - return 0; + return nullptr; QWidget *rc = qobject_cast(o); if (!m_formWindow->isManaged(rc)) - return 0; + return nullptr; return rc; } @@ -312,7 +307,7 @@ void ObjectInspector::ObjectInspectorPrivate::showContainersCurrentPage(QWidget QWidget *w = widget->parentWidget(); bool macroStarted = false; // Find a multipage container (tab widgets, etc.) in the hierarchy and set the right page. - while (w != 0) { + while (w != nullptr) { if (fw->isManaged(w) && !qobject_cast(w)) { // Rule out unmanaged internal scroll areas, for example, on QToolBoxes. if (QDesignerContainerExtension *c = qt_extension(m_core->extensionManager(), w)) { const int count = c->count(); @@ -343,7 +338,7 @@ void ObjectInspector::ObjectInspectorPrivate::restoreDropHighlighting() if (m_formWindow) { m_formWindow->highlightWidget(m_formFakeDropTarget, QPoint(5, 5), FormWindow::Restore); } - m_formFakeDropTarget = 0; + m_formFakeDropTarget = nullptr; } } @@ -360,7 +355,7 @@ void ObjectInspector::ObjectInspectorPrivate::handleDragEnterMoveEvent(const QWi return; } - QWidget *dropTarget = 0; + QWidget *dropTarget = nullptr; QPoint fakeDropTargetOffset = QPoint(0, 0); if (QWidget *managedWidget = managedWidgetAt(objectInspectorWidget->mapToGlobal(event->pos()))) { fakeDropTargetOffset = dropPointOffset(m_formWindow, managedWidget); @@ -469,8 +464,8 @@ void ObjectInspector::ObjectInspectorPrivate::selectIndexRange(const QModelIndex void ObjectInspector::ObjectInspectorPrivate::clear() { - m_formFakeDropTarget = 0; - m_formWindow = 0; + m_formFakeDropTarget = nullptr; + m_formWindow = nullptr; } // Form window cursor is in state 'main container only' @@ -507,7 +502,7 @@ void ObjectInspector::ObjectInspectorPrivate::setFormWindowBlocked(QDesignerForm const int yoffset = m_treeView->verticalScrollBar()->value(); if (formWindowChanged) - m_formFakeDropTarget = 0; + m_formFakeDropTarget = nullptr; switch (m_model->update(m_formWindow)) { case ObjectInspectorModel::NoForm: @@ -737,12 +732,12 @@ static inline QMenu *createTaskMenu(QObject *object, QDesignerFormWindowInterfac // 3) Mananaged widgets if (qdesigner_internal::FormWindowBase *fwb = qobject_cast(fw)) return fwb->initializePopupMenu(w); - return 0; + return nullptr; } void ObjectInspector::ObjectInspectorPrivate::slotPopupContextMenu(QWidget * /*parent*/, const QPoint &pos) { - if (m_formWindow == 0 || m_formWindow->currentTool() != 0) + if (m_formWindow == nullptr || m_formWindow->currentTool() != 0) return; if (QObject *object = objectAt(m_treeView->indexAt(pos))) { @@ -825,7 +820,7 @@ void ObjectInspector::mainContainerChanged() { // Invalidate references to objects kept in items if (sender() == m_impl->formWindow()) - setFormWindow(0); + setFormWindow(nullptr); } void ObjectInspector::dragEnterEvent (QDragEnterEvent * event) diff --git a/src/designer/src/components/objectinspector/objectinspector.h b/src/designer/src/components/objectinspector/objectinspector.h index 23406313f..2aa53cdb9 100644 --- a/src/designer/src/components/objectinspector/objectinspector.h +++ b/src/designer/src/components/objectinspector/objectinspector.h @@ -45,7 +45,7 @@ class QT_OBJECTINSPECTOR_EXPORT ObjectInspector: public QDesignerObjectInspector { Q_OBJECT public: - explicit ObjectInspector(QDesignerFormEditorInterface *core, QWidget *parent = 0); + explicit ObjectInspector(QDesignerFormEditorInterface *core, QWidget *parent = nullptr); ~ObjectInspector() override; QDesignerFormEditorInterface *core() const override; diff --git a/src/designer/src/components/objectinspector/objectinspectormodel.cpp b/src/designer/src/components/objectinspector/objectinspectormodel.cpp index 95a5c6729..72b905ecf 100644 --- a/src/designer/src/components/objectinspector/objectinspectormodel.cpp +++ b/src/designer/src/components/objectinspector/objectinspectormodel.cpp @@ -277,14 +277,14 @@ namespace qdesigner_internal { model.push_back(entry); // 2) recurse over widget children via container extension or children list - const QDesignerContainerExtension *containerExtension = 0; + const QDesignerContainerExtension *containerExtension = nullptr; if (entry.type() == ObjectData::ExtensionContainer) { containerExtension = qt_extension(fwi->core()->extensionManager(), object); Q_ASSERT(containerExtension); const int count = containerExtension->count(); for (int i=0; i < count; ++i) { QObject *page = containerExtension->widget(i); - Q_ASSERT(page != 0); + Q_ASSERT(page != nullptr); createModelRecursion(fwi, object, page, model, ctx); } } @@ -364,10 +364,10 @@ namespace qdesigner_internal { ObjectInspectorModel::UpdateResult ObjectInspectorModel::update(QDesignerFormWindowInterface *fw) { - QWidget *mainContainer = fw ? fw->mainContainer() : static_cast(0); + QWidget *mainContainer = fw ? fw->mainContainer() : nullptr; if (!mainContainer) { clearItems(); - m_formWindow = 0; + m_formWindow = nullptr; return NoForm; } m_formWindow = fw; @@ -377,7 +377,7 @@ namespace qdesigner_internal { static const QString separator = QCoreApplication::translate("ObjectInspectorModel", "separator"); const ModelRecursionContext ctx(fw->core(), separator); - createModelRecursion(fw, 0, mainContainer, newModel, ctx); + createModelRecursion(fw, nullptr, mainContainer, newModel, ctx); if (newModel == m_model) { updateItemContents(m_model, newModel); @@ -394,7 +394,7 @@ namespace qdesigner_internal { if (index.isValid()) if (const QStandardItem *item = itemFromIndex(index)) return objectOfItem(item); - return 0; + return nullptr; } // Missing Qt API: get a row diff --git a/src/designer/src/components/propertyeditor/designerpropertymanager.cpp b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp index 06fbb42c9..2f1a65940 100644 --- a/src/designer/src/components/propertyeditor/designerpropertymanager.cpp +++ b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp @@ -391,7 +391,7 @@ void TextEditor::setTextPropertyValidationMode(TextPropertyValidationMode vm) m_button->setFixedWidth(30); m_button->setPopupMode(QToolButton::MenuButtonPopup); } else { - m_button->setMenu(0); + m_button->setMenu(nullptr); m_button->setFixedWidth(20); m_button->setPopupMode(QToolButton::DelayedPopup); } @@ -588,7 +588,7 @@ PixmapEditor::PixmapEditor(QDesignerFormEditorInterface *core, QWidget *parent) m_copyAction(new QAction(createIconSet(QStringLiteral("editcopy.png")), tr("Copy Path"), this)), m_pasteAction(new QAction(createIconSet(QStringLiteral("editpaste.png")), tr("Paste Path"), this)), m_layout(new QHBoxLayout(this)), - m_pixmapCache(0) + m_pixmapCache(nullptr) { m_layout->addWidget(m_pixmapLabel); m_layout->addWidget(m_pathLabel); @@ -794,7 +794,7 @@ class ResetWidget : public QWidget { Q_OBJECT public: - ResetWidget(QtProperty *property, QWidget *parent = 0); + ResetWidget(QtProperty *property, QWidget *parent = nullptr); void setWidget(QWidget *widget); void setResetEnabled(bool enabled); @@ -848,11 +848,11 @@ void ResetWidget::setWidget(QWidget *widget) { if (m_textLabel) { delete m_textLabel; - m_textLabel = 0; + m_textLabel = nullptr; } if (m_iconLabel) { delete m_iconLabel; - m_iconLabel = 0; + m_iconLabel = nullptr; } delete layout(); QLayout *layout = new QHBoxLayout(this); @@ -896,7 +896,7 @@ DesignerPropertyManager::DesignerPropertyManager(QDesignerFormEditorInterface *c m_changingSubValue(false), m_core(core), m_object(nullptr), - m_sourceOfChange(0) + m_sourceOfChange(nullptr) { connect(this, &QtVariantPropertyManager::valueChanged, this, &DesignerPropertyManager::slotValueChanged); @@ -1538,7 +1538,7 @@ QString DesignerPropertyManager::valueText(const QtProperty *property) const const PaletteData data = m_paletteValues.value(const_cast(property)); const uint mask = data.val.resolve(); if (mask) - return tr("Customized (%n roles)", 0, bitCount(mask)); + return tr("Customized (%n roles)", nullptr, bitCount(mask)); static const QString inherited = tr("Inherited"); return inherited; } @@ -1600,7 +1600,7 @@ QString DesignerPropertyManager::valueText(const QtProperty *property) const void DesignerPropertyManager::reloadResourceProperties() { - DesignerIconCache *iconCache = 0; + DesignerIconCache *iconCache = nullptr; for (auto itIcon = m_iconValues.cbegin(), end = m_iconValues.cend(); itIcon!= end; ++itIcon) { QtProperty *property = itIcon.key(); const PropertySheetIconValue &icon = itIcon.value(); @@ -1919,7 +1919,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val if (value.type() != QVariant::UInt && !value.canConvert(QVariant::UInt)) return; - const uint v = value.toUInt(0); + const uint v = value.toUInt(nullptr); const uint oldValue = m_uintValues.value(property); if (v == oldValue) @@ -1936,7 +1936,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val if (value.type() != QVariant::LongLong && !value.canConvert(QVariant::LongLong)) return; - const qlonglong v = value.toLongLong(0); + const qlonglong v = value.toLongLong(nullptr); const qlonglong oldValue = m_longLongValues.value(property); if (v == oldValue) @@ -1953,7 +1953,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val if (value.type() != QVariant::ULongLong && !value.canConvert(QVariant::ULongLong)) return; - qulonglong v = value.toULongLong(0); + qulonglong v = value.toULongLong(nullptr); qulonglong oldValue = m_uLongLongValues.value(property); if (v == oldValue) @@ -2034,7 +2034,7 @@ void DesignerPropertyManager::initializeProperty(QtProperty *property) m_urlValues[property] = QUrl(); break; case QVariant::ByteArray: - m_byteArrayValues[property] = 0; + m_byteArrayValues[property] = nullptr; break; case QVariant::Brush: m_brushManager.initializeProperty(this, property, enumTypeId()); @@ -2234,7 +2234,7 @@ void DesignerEditorFactory::setSpacing(int spacing) void DesignerEditorFactory::setFormWindowBase(qdesigner_internal::FormWindowBase *fwb) { m_fwb = fwb; - DesignerPixmapCache *cache = 0; + DesignerPixmapCache *cache = nullptr; if (fwb) cache = fwb->pixmapCache(); for (auto it = m_editorToPixmapProperty.cbegin(), end = m_editorToPixmapProperty.cend(); it != end; ++it) @@ -2386,7 +2386,7 @@ TextEditor *DesignerEditorFactory::createTextEditor(QWidget *parent, TextPropert QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager, QtProperty *property, QWidget *parent) { - QWidget *editor = 0; + QWidget *editor = nullptr; const int type = manager->propertyType(property); switch (type) { case QVariant::Bool: { @@ -2646,7 +2646,7 @@ QtProperty *findPropertyForEditor(const QMap &editorMap, for (auto it = editorMap.constBegin(), cend = editorMap.constEnd(); it != cend; ++it) if (it.key() == sender) return it.value(); - return 0; + return nullptr; } void DesignerEditorFactory::slotStringTextChanged(const QString &value) @@ -2793,7 +2793,7 @@ QWidget *ResetDecorator::editor(QWidget *subEditor, bool resettable, QtAbstractP { Q_UNUSED(manager); - ResetWidget *resetWidget = 0; + ResetWidget *resetWidget = nullptr; if (resettable) { resetWidget = new ResetWidget(property, parent); resetWidget->setSpacing(m_spacing); diff --git a/src/designer/src/components/propertyeditor/designerpropertymanager.h b/src/designer/src/components/propertyeditor/designerpropertymanager.h index 04c0fcf47..ee3652c69 100644 --- a/src/designer/src/components/propertyeditor/designerpropertymanager.h +++ b/src/designer/src/components/propertyeditor/designerpropertymanager.h @@ -122,7 +122,7 @@ class DesignerPropertyManager : public QtVariantPropertyManager public: enum ValueChangedResult { NoMatch, Unchanged, Changed }; - explicit DesignerPropertyManager(QDesignerFormEditorInterface *core, QObject *parent = 0); + explicit DesignerPropertyManager(QDesignerFormEditorInterface *core, QObject *parent = nullptr); ~DesignerPropertyManager(); QStringList attributes(int propertyType) const override; @@ -252,7 +252,7 @@ class DesignerEditorFactory : public QtVariantEditorFactory { Q_OBJECT public: - explicit DesignerEditorFactory(QDesignerFormEditorInterface *core, QObject *parent = 0); + explicit DesignerEditorFactory(QDesignerFormEditorInterface *core, QObject *parent = nullptr); ~DesignerEditorFactory(); void setSpacing(int spacing); void setFormWindowBase(FormWindowBase *fwb); diff --git a/src/designer/src/components/propertyeditor/fontpropertymanager.cpp b/src/designer/src/components/propertyeditor/fontpropertymanager.cpp index 68e95f325..a29867011 100644 --- a/src/designer/src/components/propertyeditor/fontpropertymanager.cpp +++ b/src/designer/src/components/propertyeditor/fontpropertymanager.cpp @@ -128,7 +128,7 @@ namespace qdesigner_internal { familyProperty->setAttribute(enumNamesAttribute, m_designerFamilyNames); } // Next - m_createdFontProperty = 0; + m_createdFontProperty = nullptr; } bool FontPropertyManager::uninitializeProperty(QtProperty *property) diff --git a/src/designer/src/components/propertyeditor/newdynamicpropertydialog.h b/src/designer/src/components/propertyeditor/newdynamicpropertydialog.h index 270e147ef..17daee4c3 100644 --- a/src/designer/src/components/propertyeditor/newdynamicpropertydialog.h +++ b/src/designer/src/components/propertyeditor/newdynamicpropertydialog.h @@ -60,7 +60,7 @@ class QT_PROPERTYEDITOR_EXPORT NewDynamicPropertyDialog: public QDialog { Q_OBJECT public: - explicit NewDynamicPropertyDialog(QDesignerDialogGuiInterface *dialogGui, QWidget *parent = 0); + explicit NewDynamicPropertyDialog(QDesignerDialogGuiInterface *dialogGui, QWidget *parent = nullptr); ~NewDynamicPropertyDialog(); void setReservedNames(const QStringList &names); diff --git a/src/designer/src/components/propertyeditor/paletteeditor.cpp b/src/designer/src/components/propertyeditor/paletteeditor.cpp index 0945ffa6c..89a3a4a19 100644 --- a/src/designer/src/components/propertyeditor/paletteeditor.cpp +++ b/src/designer/src/components/propertyeditor/paletteeditor.cpp @@ -492,7 +492,7 @@ ColorDelegate::ColorDelegate(QDesignerFormEditorInterface *core, QObject *parent QWidget *ColorDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &index) const { - QWidget *ed = 0; + QWidget *ed = nullptr; if (index.column() == 0) { RoleEditor *editor = new RoleEditor(parent); connect(editor, &RoleEditor::changed, this, &ColorDelegate::commitData); diff --git a/src/designer/src/components/propertyeditor/paletteeditor.h b/src/designer/src/components/propertyeditor/paletteeditor.h index 5f3d28ee8..1c45d1e54 100644 --- a/src/designer/src/components/propertyeditor/paletteeditor.h +++ b/src/designer/src/components/propertyeditor/paletteeditor.h @@ -49,7 +49,7 @@ public: static QPalette getPalette(QDesignerFormEditorInterface *core, QWidget* parent, const QPalette &init = QPalette(), - const QPalette &parentPal = QPalette(), int *result = 0); + const QPalette &parentPal = QPalette(), int *result = nullptr); QPalette palette() const; void setPalette(const QPalette &palette); @@ -95,7 +95,7 @@ class PaletteModel : public QAbstractTableModel Q_OBJECT Q_PROPERTY(QPalette::ColorRole colorRole READ colorRole) public: - explicit PaletteModel(QObject *parent = 0); + explicit PaletteModel(QObject *parent = nullptr); int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; @@ -127,7 +127,7 @@ class BrushEditor : public QWidget { Q_OBJECT public: - explicit BrushEditor(QDesignerFormEditorInterface *core, QWidget *parent = 0); + explicit BrushEditor(QDesignerFormEditorInterface *core, QWidget *parent = nullptr); void setBrush(const QBrush &brush); QBrush brush() const; @@ -146,7 +146,7 @@ class RoleEditor : public QWidget { Q_OBJECT public: - explicit RoleEditor(QWidget *parent = 0); + explicit RoleEditor(QWidget *parent = nullptr); void setLabel(const QString &label); void setEdited(bool on); @@ -165,7 +165,7 @@ class ColorDelegate : public QItemDelegate Q_OBJECT public: - explicit ColorDelegate(QDesignerFormEditorInterface *core, QObject *parent = 0); + explicit ColorDelegate(QDesignerFormEditorInterface *core, QObject *parent = nullptr); QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override; diff --git a/src/designer/src/components/propertyeditor/paletteeditorbutton.cpp b/src/designer/src/components/propertyeditor/paletteeditorbutton.cpp index a31260d9f..f3370a4aa 100644 --- a/src/designer/src/components/propertyeditor/paletteeditorbutton.cpp +++ b/src/designer/src/components/propertyeditor/paletteeditorbutton.cpp @@ -62,7 +62,7 @@ void PaletteEditorButton::setSuperPalette(const QPalette &palette) void PaletteEditorButton::showPaletteEditor() { int result; - QPalette pal = PaletteEditor::getPalette(m_core, 0, m_palette, m_superPalette, &result); + QPalette pal = PaletteEditor::getPalette(m_core, nullptr, m_palette, m_superPalette, &result); if (result == QDialog::Accepted) { m_palette = pal; emit paletteChanged(m_palette); diff --git a/src/designer/src/components/propertyeditor/paletteeditorbutton.h b/src/designer/src/components/propertyeditor/paletteeditorbutton.h index 64c461316..947d80edb 100644 --- a/src/designer/src/components/propertyeditor/paletteeditorbutton.h +++ b/src/designer/src/components/propertyeditor/paletteeditorbutton.h @@ -44,7 +44,7 @@ class QT_PROPERTYEDITOR_EXPORT PaletteEditorButton: public QToolButton { Q_OBJECT public: - PaletteEditorButton(QDesignerFormEditorInterface *core, const QPalette &palette, QWidget *parent = 0); + PaletteEditorButton(QDesignerFormEditorInterface *core, const QPalette &palette, QWidget *parent = nullptr); ~PaletteEditorButton() override; void setSuperPalette(const QPalette &palette); diff --git a/src/designer/src/components/propertyeditor/previewframe.cpp b/src/designer/src/components/propertyeditor/previewframe.cpp index f4f391583..a97e46877 100644 --- a/src/designer/src/components/propertyeditor/previewframe.cpp +++ b/src/designer/src/components/propertyeditor/previewframe.cpp @@ -42,7 +42,7 @@ namespace qdesigner_internal { class PreviewMdiArea: public QMdiArea { public: - PreviewMdiArea(QWidget *parent = 0) : QMdiArea(parent) {} + PreviewMdiArea(QWidget *parent = nullptr) : QMdiArea(parent) {} protected: bool viewportEvent(QEvent *event) override; }; @@ -83,7 +83,7 @@ void PreviewFrame::setPreviewPalette(const QPalette &pal) void PreviewFrame::setSubWindowActive(bool active) { - m_mdiArea->setActiveSubWindow (active ? ensureMdiSubWindow() : static_cast(0)); + m_mdiArea->setActiveSubWindow (active ? ensureMdiSubWindow() : nullptr); } QMdiSubWindow *PreviewFrame::ensureMdiSubWindow() diff --git a/src/designer/src/components/propertyeditor/propertyeditor.cpp b/src/designer/src/components/propertyeditor/propertyeditor.cpp index 29401e93b..3f1e97981 100644 --- a/src/designer/src/components/propertyeditor/propertyeditor.cpp +++ b/src/designer/src/components/propertyeditor/propertyeditor.cpp @@ -156,10 +156,10 @@ QDesignerMetaDataBaseItemInterface* PropertyEditor::metaDataBaseItem() const { QObject *o = object(); if (!o) - return 0; + return nullptr; QDesignerMetaDataBaseInterface *db = core()->metaDataBase(); if (!db) - return 0; + return nullptr; return db->item(o); } @@ -191,7 +191,7 @@ void PropertyEditor::setupPaletteProperty(QtVariantProperty *property) m_updatingBrowser = false; } -static inline QToolButton *createDropDownButton(QAction *defaultAction, QWidget *parent = 0) +static inline QToolButton *createDropDownButton(QAction *defaultAction, QWidget *parent = nullptr) { QToolButton *rc = new QToolButton(parent); rc->setDefaultAction(defaultAction); @@ -763,7 +763,7 @@ static inline QLayout *layoutOfQLayoutWidget(QObject *o) { if (o->isWidgetType() && !qstrcmp(o->metaObject()->className(), "QLayoutWidget")) return static_cast(o)->layout(); - return 0; + return nullptr; } void PropertyEditor::updateToolBarLabel() @@ -899,7 +899,7 @@ void PropertyEditor::setObject(QObject *object) { QDesignerFormWindowInterface *oldFormWindow = QDesignerFormWindowInterface::findFormWindow(m_object); // In the first setObject() call following the addition of a dynamic property, focus and edit it. - const bool editNewDynamicProperty = object != 0 && m_object == object && !m_recentlyAddedDynamicProperty.isEmpty(); + const bool editNewDynamicProperty = object != nullptr && m_object == object && !m_recentlyAddedDynamicProperty.isEmpty(); m_object = object; m_propertyManager->setObject(object); QDesignerFormWindowInterface *formWindow = QDesignerFormWindowInterface::findFormWindow(m_object); @@ -984,8 +984,8 @@ void PropertyEditor::setObject(QObject *object) const QString className = WidgetFactory::classNameOf(formWindow->core(), m_object); const QDesignerCustomWidgetData customData = formWindow->core()->pluginManager()->customWidgetData(className); - QtProperty *lastProperty = 0; - QtProperty *lastGroup = 0; + QtProperty *lastProperty = nullptr; + QtProperty *lastGroup = nullptr; const int propertyCount = m_propertySheet->count(); for (int i = 0; i < propertyCount; ++i) { if (!m_propertySheet->isVisible(i)) @@ -999,7 +999,7 @@ void PropertyEditor::setObject(QObject *object) const int type = toBrowserType(value, propertyName); QtVariantProperty *property = m_nameToProperty.value(propertyName, 0); - bool newProperty = property == 0; + bool newProperty = property == nullptr; if (newProperty) { property = m_propertyManager->addProperty(type, propertyName); if (property) { @@ -1025,7 +1025,7 @@ void PropertyEditor::setObject(QObject *object) } } - if (property != 0) { + if (property != nullptr) { const bool dynamicProperty = (dynamicSheet && dynamicSheet->isDynamicProperty(i)) || (sheet && sheet->isDefaultDynamicProperty(i)); QString descriptionToolTip; @@ -1054,13 +1054,13 @@ void PropertyEditor::setObject(QObject *object) property->setAttribute(m_strings.m_resettableAttribute, m_propertySheet->hasReset(i)); const QString groupName = m_propertySheet->propertyGroup(i); - QtVariantProperty *groupProperty = 0; + QtVariantProperty *groupProperty = nullptr; if (newProperty) { QMap::const_iterator itPrev = m_nameToProperty.insert(propertyName, property); m_propertyToGroup[property] = groupName; if (m_sorting) { - QtProperty *previous = 0; + QtProperty *previous = nullptr; if (itPrev != m_nameToProperty.constBegin()) previous = (--itPrev).value(); m_currentBrowser->insertProperty(property, previous); @@ -1071,7 +1071,7 @@ void PropertyEditor::setObject(QObject *object) groupProperty = gnit.value(); } else { groupProperty = m_propertyManager->addProperty(QtVariantPropertyManager::groupTypeId(), groupName); - QtBrowserItem *item = 0; + QtBrowserItem *item = nullptr; if (!m_sorting) item = m_currentBrowser->insertProperty(groupProperty, lastGroup); m_nameToGroup[groupName] = groupProperty; @@ -1091,7 +1091,7 @@ void PropertyEditor::setObject(QObject *object) * actual class group, goto last element. */ if (lastGroup != groupProperty) { lastGroup = groupProperty; - lastProperty = 0; // Append at end + lastProperty = nullptr; // Append at end const QList subProperties = lastGroup->subProperties(); if (!subProperties.empty()) lastProperty = subProperties.back(); @@ -1125,7 +1125,7 @@ void PropertyEditor::setObject(QObject *object) QtVariantProperty *groupProperty = itGroup.value(); if (groupProperty->subProperties().empty()) { if (groupProperty == m_dynamicGroup) - m_dynamicGroup = 0; + m_dynamicGroup = nullptr; delete groupProperty; m_nameToGroup.remove(itGroup.key()); } @@ -1163,7 +1163,7 @@ QtBrowserItem *PropertyEditor::nonFakePropertyBrowserItem(QtBrowserItem *item) c return item; item = item->parent(); } while (item); - return 0; + return nullptr; } QString PropertyEditor::currentPropertyName() const @@ -1243,13 +1243,13 @@ bool PropertyEditor::isDynamicProperty(const QtBrowserItem* item) const void PropertyEditor::editProperty(const QString &name) { // find the browser item belonging to the property, make it current and edit it - QtBrowserItem *browserItem = 0; + QtBrowserItem *browserItem = nullptr; if (QtVariantProperty *property = m_nameToProperty.value(name, 0)) { const QList items = m_currentBrowser->items(property); if (items.size() == 1) browserItem = items.front(); } - if (browserItem == 0) + if (browserItem == nullptr) return; m_currentBrowser->setFocus(Qt::OtherFocusReason); if (m_currentBrowser == m_treeBrowser) { // edit is currently only supported in tree view diff --git a/src/designer/src/components/propertyeditor/propertyeditor.h b/src/designer/src/components/propertyeditor/propertyeditor.h index cc32b2fde..993c4418d 100644 --- a/src/designer/src/components/propertyeditor/propertyeditor.h +++ b/src/designer/src/components/propertyeditor/propertyeditor.h @@ -63,7 +63,7 @@ class QT_PROPERTYEDITOR_EXPORT PropertyEditor: public QDesignerPropertyEditor { Q_OBJECT public: - explicit PropertyEditor(QDesignerFormEditorInterface *core, QWidget *parent = 0, Qt::WindowFlags flags = 0); + explicit PropertyEditor(QDesignerFormEditorInterface *core, QWidget *parent = nullptr, Qt::WindowFlags flags = {}); ~PropertyEditor() override; QDesignerFormEditorInterface *core() const override; diff --git a/src/designer/src/components/propertyeditor/stringlisteditor.h b/src/designer/src/components/propertyeditor/stringlisteditor.h index 9b092bb0e..bb623d900 100644 --- a/src/designer/src/components/propertyeditor/stringlisteditor.h +++ b/src/designer/src/components/propertyeditor/stringlisteditor.h @@ -46,7 +46,7 @@ public: QStringList stringList() const; static QStringList getStringList( - QWidget *parent, const QStringList &init = QStringList(), int *result = 0); + QWidget *parent, const QStringList &init = QStringList(), int *result = nullptr); private slots: void on_upButton_clicked(); @@ -58,7 +58,7 @@ private slots: void currentValueChanged(); private: - StringListEditor(QWidget *parent = 0); + StringListEditor(QWidget *parent = nullptr); void updateUi(); int currentIndex() const; void setCurrentIndex(int index); diff --git a/src/designer/src/components/propertyeditor/stringlisteditorbutton.cpp b/src/designer/src/components/propertyeditor/stringlisteditorbutton.cpp index 29487f119..110990b51 100644 --- a/src/designer/src/components/propertyeditor/stringlisteditorbutton.cpp +++ b/src/designer/src/components/propertyeditor/stringlisteditorbutton.cpp @@ -56,7 +56,7 @@ void StringListEditorButton::setStringList(const QStringList &stringList) void StringListEditorButton::showStringListEditor() { int result; - QStringList lst = StringListEditor::getStringList(0, m_stringList, &result); + QStringList lst = StringListEditor::getStringList(nullptr, m_stringList, &result); if (result == QDialog::Accepted) { m_stringList = lst; emit stringListChanged(m_stringList); diff --git a/src/designer/src/components/propertyeditor/stringlisteditorbutton.h b/src/designer/src/components/propertyeditor/stringlisteditorbutton.h index 4a823b726..f2e28f4bf 100644 --- a/src/designer/src/components/propertyeditor/stringlisteditorbutton.h +++ b/src/designer/src/components/propertyeditor/stringlisteditorbutton.h @@ -42,7 +42,7 @@ class QT_PROPERTYEDITOR_EXPORT StringListEditorButton: public QToolButton { Q_OBJECT public: - explicit StringListEditorButton(const QStringList &stringList, QWidget *parent = 0); + explicit StringListEditorButton(const QStringList &stringList, QWidget *parent = nullptr); ~StringListEditorButton() override; inline QStringList stringList() const diff --git a/src/designer/src/components/signalsloteditor/connectdialog.cpp b/src/designer/src/components/signalsloteditor/connectdialog.cpp index 62d790c34..34c7d9e68 100644 --- a/src/designer/src/components/signalsloteditor/connectdialog.cpp +++ b/src/designer/src/components/signalsloteditor/connectdialog.cpp @@ -223,7 +223,7 @@ void ConnectDialog::populateSlotList(const QString &signal) font.setItalic(true); QVariant variantFont = QVariant::fromValue(font); - QListWidgetItem *curr = 0; + QListWidgetItem *curr = nullptr; QMap::ConstIterator itMember = memberToClassName.constBegin(); const QMap::ConstIterator itMemberEnd = memberToClassName.constEnd(); while (itMember != itMemberEnd) { @@ -265,7 +265,7 @@ void ConnectDialog::populateSignalList() font.setItalic(true); QVariant variantFont = QVariant::fromValue(font); - QListWidgetItem *curr = 0; + QListWidgetItem *curr = nullptr; QMap::ConstIterator itMember = memberToClassName.constBegin(); const QMap::ConstIterator itMemberEnd = memberToClassName.constEnd(); while (itMember != itMemberEnd) { diff --git a/src/designer/src/components/signalsloteditor/connectdialog_p.h b/src/designer/src/components/signalsloteditor/connectdialog_p.h index 9bc1d83f0..0cd600557 100644 --- a/src/designer/src/components/signalsloteditor/connectdialog_p.h +++ b/src/designer/src/components/signalsloteditor/connectdialog_p.h @@ -54,7 +54,7 @@ class ConnectDialog : public QDialog { Q_OBJECT public: - ConnectDialog(QDesignerFormWindowInterface *formWindow, QWidget *sender, QWidget *receiver, QWidget *parent = 0); + ConnectDialog(QDesignerFormWindowInterface *formWindow, QWidget *sender, QWidget *receiver, QWidget *parent = nullptr); QString signal() const; QString slot() const; diff --git a/src/designer/src/components/signalsloteditor/signalslot_utils.cpp b/src/designer/src/components/signalsloteditor/signalslot_utils.cpp index 0def07552..72cd292b8 100644 --- a/src/designer/src/components/signalsloteditor/signalslot_utils.cpp +++ b/src/designer/src/components/signalsloteditor/signalslot_utils.cpp @@ -61,7 +61,7 @@ static void memberList(QDesignerFormEditorInterface *core, return; // 1) member sheet const QDesignerMemberSheetExtension *members = qt_extension(core->extensionManager(), object); - Q_ASSERT(members != 0); + Q_ASSERT(members != nullptr); const int count = members->count(); for (int i = 0; i < count; ++i) { if (!members->isVisible(i)) @@ -177,7 +177,7 @@ namespace { ReverseClassesMemberIterator::ReverseClassesMemberIterator(qdesigner_internal::ClassesMemberFunctions *result) : m_result(result), - m_memberList(0) + m_memberList(nullptr) { } @@ -232,7 +232,7 @@ namespace qdesigner_internal { ClassesMemberFunctions reverseClassesMemberFunctions(const QString &obj_name, MemberType member_type, const QString &peer, QDesignerFormWindowInterface *form) { - QObject *object = 0; + QObject *object = nullptr; if (obj_name == form->mainContainer()->objectName()) { object = form->mainContainer(); } else { diff --git a/src/designer/src/components/signalsloteditor/signalsloteditor.cpp b/src/designer/src/components/signalsloteditor/signalsloteditor.cpp index cc0a7ad84..a510acdb5 100644 --- a/src/designer/src/components/signalsloteditor/signalsloteditor.cpp +++ b/src/designer/src/components/signalsloteditor/signalsloteditor.cpp @@ -111,7 +111,7 @@ QString SignalSlotConnection::sender() const return QString(); SignalSlotEditor *edit = qobject_cast(this->edit()); - Q_ASSERT(edit != 0); + Q_ASSERT(edit != nullptr); return realObjectName(edit->formWindow()->core(), source); } @@ -123,7 +123,7 @@ QString SignalSlotConnection::receiver() const return QString(); SignalSlotEditor *edit = qobject_cast(this->edit()); - Q_ASSERT(edit != 0); + Q_ASSERT(edit != nullptr); return realObjectName(edit->formWindow()->core(), sink); } @@ -299,10 +299,10 @@ void SignalSlotEditor::modifyConnection(Connection *con) Connection *SignalSlotEditor::createConnection(QWidget *source, QWidget *destination) { - SignalSlotConnection *con = 0; + SignalSlotConnection *con = nullptr; - Q_ASSERT(source != 0); - Q_ASSERT(destination != 0); + Q_ASSERT(source != nullptr); + Q_ASSERT(destination != nullptr); ConnectDialog dialog(m_form_window, source, destination, m_form_window->core()->topLevel()); dialog.setShowAllSignalsSlots(m_showAllSignalsSlots); @@ -327,7 +327,7 @@ DomConnections *SignalSlotEditor::toUi() const list.reserve(count); for (int i = 0; i < count; ++i) { const SignalSlotConnection *con = static_cast(connection(i)); - Q_ASSERT(con != 0); + Q_ASSERT(con != nullptr); // If a widget's parent has been removed or moved to a different form, // and the parent was not a managed widget @@ -353,10 +353,10 @@ DomConnections *SignalSlotEditor::toUi() const QObject *SignalSlotEditor::objectByName(QWidget *topLevel, const QString &name) const { if (name.isEmpty()) - return 0; + return nullptr; Q_ASSERT(topLevel); - QObject *object = 0; + QObject *object = nullptr; if (topLevel->objectName() == name) object = topLevel; else @@ -364,12 +364,12 @@ QObject *SignalSlotEditor::objectByName(QWidget *topLevel, const QString &name) const QDesignerMetaDataBaseInterface *mdb = formWindow()->core()->metaDataBase(); if (mdb->item(object)) return object; - return 0; + return nullptr; } void SignalSlotEditor::fromUi(const DomConnections *connections, QWidget *parent) { - if (connections == 0) + if (connections == nullptr) return; setBackground(parent); @@ -377,13 +377,13 @@ void SignalSlotEditor::fromUi(const DomConnections *connections, QWidget *parent const auto &list = connections->elementConnection(); for (const DomConnection *dom_con : list) { QObject *source = objectByName(parent, dom_con->elementSender()); - if (source == 0) { + if (source == nullptr) { qDebug("SignalSlotEditor::fromUi(): no source widget called \"%s\"", dom_con->elementSender().toUtf8().constData()); continue; } QObject *destination = objectByName(parent, dom_con->elementReceiver()); - if (destination == 0) { + if (destination == nullptr) { qDebug("SignalSlotEditor::fromUi(): no destination widget called \"%s\"", dom_con->elementReceiver().toUtf8().constData()); continue; @@ -391,7 +391,7 @@ void SignalSlotEditor::fromUi(const DomConnections *connections, QWidget *parent QPoint sp = QPoint(20, 20), tp = QPoint(20, 20); const DomConnectionHints *dom_hints = dom_con->elementHints(); - if (dom_hints != 0) { + if (dom_hints != nullptr) { const auto &hints = dom_hints->elementHint(); for (DomConnectionHint *hint : hints) { QString attr_type = hint->attributeType(); @@ -434,9 +434,9 @@ QWidget *SignalSlotEditor::widgetAt(const QPoint &pos) const if (widget == m_form_window->mainContainer()) return widget; - for (; widget != 0; widget = widget->parentWidget()) { + for (; widget != nullptr; widget = widget->parentWidget()) { QDesignerMetaDataBaseItemInterface *item = m_form_window->core()->metaDataBase()->item(widget); - if (item == 0) + if (item == nullptr) continue; if (skipWidget(widget)) continue; diff --git a/src/designer/src/components/signalsloteditor/signalsloteditor_p.h b/src/designer/src/components/signalsloteditor/signalsloteditor_p.h index b2274a8dd..15d0563cf 100644 --- a/src/designer/src/components/signalsloteditor/signalsloteditor_p.h +++ b/src/designer/src/components/signalsloteditor/signalsloteditor_p.h @@ -61,7 +61,7 @@ class SignalSlotEditor; class SignalSlotConnection : public Connection { public: - explicit SignalSlotConnection(ConnectionEdit *edit, QWidget *source = 0, QWidget *target = 0); + explicit SignalSlotConnection(ConnectionEdit *edit, QWidget *source = nullptr, QWidget *target = nullptr); void setSignal(const QString &signal); void setSlot(const QString &slot); @@ -89,8 +89,8 @@ class ConnectionModel : public QAbstractItemModel { Q_OBJECT public: - explicit ConnectionModel(QObject *parent = 0); - void setEditor(SignalSlotEditor *editor = 0); + explicit ConnectionModel(QObject *parent = nullptr); + void setEditor(SignalSlotEditor *editor = nullptr); QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; QModelIndex parent(const QModelIndex &child) const override; diff --git a/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp b/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp index a3e9a5de5..95aad3f0b 100644 --- a/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp +++ b/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp @@ -80,7 +80,7 @@ QDesignerFormEditorInterface *SignalSlotEditorPlugin::core() const void SignalSlotEditorPlugin::addFormWindow(QDesignerFormWindowInterface *formWindow) { - Q_ASSERT(formWindow != 0); + Q_ASSERT(formWindow != nullptr); Q_ASSERT(m_tools.contains(formWindow) == false); SignalSlotEditorTool *tool = new SignalSlotEditorTool(formWindow, this); @@ -91,7 +91,7 @@ void SignalSlotEditorPlugin::addFormWindow(QDesignerFormWindowInterface *formWin void SignalSlotEditorPlugin::removeFormWindow(QDesignerFormWindowInterface *formWindow) { - Q_ASSERT(formWindow != 0); + Q_ASSERT(formWindow != nullptr); Q_ASSERT(m_tools.contains(formWindow) == true); SignalSlotEditorTool *tool = m_tools.value(formWindow); @@ -109,7 +109,7 @@ QAction *SignalSlotEditorPlugin::action() const void SignalSlotEditorPlugin::activeFormWindowChanged(QDesignerFormWindowInterface *formWindow) { - m_action->setEnabled(formWindow != 0); + m_action->setEnabled(formWindow != nullptr); } QT_END_NAMESPACE diff --git a/src/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp b/src/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp index 29f00a453..f322c90cb 100644 --- a/src/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp +++ b/src/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp @@ -70,8 +70,8 @@ bool SignalSlotEditorTool::handleEvent(QWidget *widget, QWidget *managedWidget, QWidget *SignalSlotEditorTool::editor() const { if (!m_editor) { - Q_ASSERT(formWindow() != 0); - m_editor = new qdesigner_internal::SignalSlotEditor(formWindow(), 0); + Q_ASSERT(formWindow() != nullptr); + m_editor = new qdesigner_internal::SignalSlotEditor(formWindow(), nullptr); connect(formWindow(), &QDesignerFormWindowInterface::mainContainerChanged, m_editor.data(), &SignalSlotEditor::setBackground); connect(formWindow(), &QDesignerFormWindowInterface::changed, diff --git a/src/designer/src/components/signalsloteditor/signalsloteditor_tool.h b/src/designer/src/components/signalsloteditor/signalsloteditor_tool.h index c0ba92316..acd71f479 100644 --- a/src/designer/src/components/signalsloteditor/signalsloteditor_tool.h +++ b/src/designer/src/components/signalsloteditor/signalsloteditor_tool.h @@ -49,7 +49,7 @@ class QT_SIGNALSLOTEDITOR_EXPORT SignalSlotEditorTool: public QDesignerFormWindo { Q_OBJECT public: - explicit SignalSlotEditorTool(QDesignerFormWindowInterface *formWindow, QObject *parent = 0); + explicit SignalSlotEditorTool(QDesignerFormWindowInterface *formWindow, QObject *parent = nullptr); ~SignalSlotEditorTool() override; QDesignerFormEditorInterface *core() const override; diff --git a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp index 1bcf3bf8f..2ec519261 100644 --- a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp +++ b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp @@ -216,9 +216,9 @@ QModelIndex ConnectionModel::index(int row, int column, Connection *ConnectionModel::indexToConnection(const QModelIndex &index) const { if (!index.isValid() || !m_editor) - return 0; + return nullptr; if (index.row() < 0 || index.row() >= m_editor->connectionCount()) - return 0; + return nullptr; return m_editor->connection(index.row()); } @@ -259,7 +259,7 @@ QVariant ConnectionModel::data(const QModelIndex &index, int role) const } const SignalSlotConnection *con = static_cast(m_editor->connection(index.row())); - Q_ASSERT(con != 0); + Q_ASSERT(con != nullptr); // Mark deprecated slots red/italic. Not currently in use (historically for Qt 3 slots in Qt 4), // but may be used again in the future. @@ -375,7 +375,7 @@ void ConnectionModel::connectionChanged(Connection *con) Q_ASSERT(m_editor); const int idx = m_editor->indexOfConnection(con); SignalSlotConnection *changedCon = static_cast(m_editor->connection(idx)); - SignalSlotConnection *c = 0; + SignalSlotConnection *c = nullptr; for (int i=0; iconnectionCount(); ++i) { if (i == idx) continue; @@ -406,7 +406,7 @@ class InlineEditorModel : public QStandardItemModel public: enum { TitleItem = 1 }; - InlineEditorModel(int rows, int cols, QObject *parent = 0); + InlineEditorModel(int rows, int cols, QObject *parent = nullptr); void addTitle(const QString &title); void addTextList(const QMap &text_list); @@ -496,7 +496,7 @@ class InlineEditor : public QComboBox Q_OBJECT Q_PROPERTY(QString text READ text WRITE setText USER true) public: - InlineEditor(QWidget *parent = 0); + InlineEditor(QWidget *parent = nullptr); QString text() const; void setText(const QString &text); @@ -568,7 +568,7 @@ class ConnectionDelegate : public QItemDelegate { Q_OBJECT public: - ConnectionDelegate(QWidget *parent = 0); + ConnectionDelegate(QWidget *parent = nullptr); void setForm(QDesignerFormWindowInterface *form); @@ -586,10 +586,10 @@ private: ConnectionDelegate::ConnectionDelegate(QWidget *parent) : QItemDelegate(parent) { - m_form = 0; + m_form = nullptr; - static QItemEditorFactory *factory = 0; - if (factory == 0) { + static QItemEditorFactory *factory = nullptr; + if (factory == nullptr) { factory = new QItemEditorFactory; QItemEditorCreatorBase *creator = new QItemEditorCreator("text"); @@ -608,12 +608,12 @@ QWidget *ConnectionDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const { - if (m_form == 0) - return 0; + if (m_form == nullptr) + return nullptr; QWidget *w = QItemDelegate::createEditor(parent, option, index); InlineEditor *inline_editor = qobject_cast(w); - Q_ASSERT(inline_editor != 0); + Q_ASSERT(inline_editor != nullptr); const QAbstractItemModel *model = index.model(); const QModelIndex obj_name_idx = model->index(index.row(), index.column() <= 1 ? 0 : 2); @@ -681,7 +681,7 @@ SignalSlotEditorWindow::SignalSlotEditorWindow(QDesignerFormEditorInterface *cor QWidget *parent) : QWidget(parent), m_view(new QTreeView), - m_editor(0), + m_editor(nullptr), m_add_button(new QToolButton), m_remove_button(new QToolButton), m_core(core), @@ -747,7 +747,7 @@ void SignalSlotEditorWindow::setActiveFormWindow(QDesignerFormWindowInterface *f if (!m_editor.isNull()) { ConnectionDelegate *delegate = qobject_cast(m_view->itemDelegate()); - if (delegate != 0) + if (delegate != nullptr) delegate->setForm(form); connect(m_view->selectionModel(), @@ -766,7 +766,7 @@ void SignalSlotEditorWindow::setActiveFormWindow(QDesignerFormWindowInterface *f void SignalSlotEditorWindow::updateDialogSelection(Connection *con) { - if (m_handling_selection_change || m_editor == 0) + if (m_handling_selection_change || m_editor == nullptr) return; QModelIndex index = m_proxy_model->mapFromSource(m_model->connectionToIndex(con)); @@ -781,10 +781,10 @@ void SignalSlotEditorWindow::updateDialogSelection(Connection *con) void SignalSlotEditorWindow::updateEditorSelection(const QModelIndex &index) { - if (m_handling_selection_change || m_editor == 0) + if (m_handling_selection_change || m_editor == nullptr) return; - if (m_editor == 0) + if (m_editor == nullptr) return; Connection *con = m_model->indexToConnection(m_proxy_model->mapToSource(index)); diff --git a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.h b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.h index c7023a553..8a51a8ca0 100644 --- a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.h +++ b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.h @@ -51,7 +51,7 @@ class SignalSlotEditorWindow : public QWidget { Q_OBJECT public: - explicit SignalSlotEditorWindow(QDesignerFormEditorInterface *core, QWidget *parent = 0); + explicit SignalSlotEditorWindow(QDesignerFormEditorInterface *core, QWidget *parent = nullptr); public slots: void setActiveFormWindow(QDesignerFormWindowInterface *form); diff --git a/src/designer/src/components/tabordereditor/tabordereditor.cpp b/src/designer/src/components/tabordereditor/tabordereditor.cpp index 1353be5d1..bb8a01137 100644 --- a/src/designer/src/components/tabordereditor/tabordereditor.cpp +++ b/src/designer/src/components/tabordereditor/tabordereditor.cpp @@ -64,7 +64,7 @@ namespace qdesigner_internal { TabOrderEditor::TabOrderEditor(QDesignerFormWindowInterface *form, QWidget *parent) : QWidget(parent), m_form_window(form), - m_bg_widget(0), + m_bg_widget(nullptr), m_undo_stack(form->commandHistory()), m_font_metrics(font()), m_current_index(0), @@ -97,7 +97,7 @@ void TabOrderEditor::setBackground(QWidget *background) void TabOrderEditor::updateBackground() { - if (m_bg_widget == 0) { + if (m_bg_widget == nullptr) { // nothing to do return; } diff --git a/src/designer/src/components/tabordereditor/tabordereditor_plugin.cpp b/src/designer/src/components/tabordereditor/tabordereditor_plugin.cpp index 8e54a484d..0927bc870 100644 --- a/src/designer/src/components/tabordereditor/tabordereditor_plugin.cpp +++ b/src/designer/src/components/tabordereditor/tabordereditor_plugin.cpp @@ -75,7 +75,7 @@ void TabOrderEditorPlugin::initialize(QDesignerFormEditorInterface *core) void TabOrderEditorPlugin::activeFormWindowChanged(QDesignerFormWindowInterface *formWindow) { - m_action->setEnabled(formWindow != 0); + m_action->setEnabled(formWindow != nullptr); } QDesignerFormEditorInterface *TabOrderEditorPlugin::core() const @@ -85,7 +85,7 @@ QDesignerFormEditorInterface *TabOrderEditorPlugin::core() const void TabOrderEditorPlugin::addFormWindow(QDesignerFormWindowInterface *formWindow) { - Q_ASSERT(formWindow != 0); + Q_ASSERT(formWindow != nullptr); Q_ASSERT(m_tools.contains(formWindow) == false); TabOrderEditorTool *tool = new TabOrderEditorTool(formWindow, this); @@ -96,7 +96,7 @@ void TabOrderEditorPlugin::addFormWindow(QDesignerFormWindowInterface *formWindo void TabOrderEditorPlugin::removeFormWindow(QDesignerFormWindowInterface *formWindow) { - Q_ASSERT(formWindow != 0); + Q_ASSERT(formWindow != nullptr); Q_ASSERT(m_tools.contains(formWindow) == true); TabOrderEditorTool *tool = m_tools.value(formWindow); diff --git a/src/designer/src/components/tabordereditor/tabordereditor_tool.cpp b/src/designer/src/components/tabordereditor/tabordereditor_tool.cpp index fb7eab92b..c70f3032c 100644 --- a/src/designer/src/components/tabordereditor/tabordereditor_tool.cpp +++ b/src/designer/src/components/tabordereditor/tabordereditor_tool.cpp @@ -68,8 +68,8 @@ bool TabOrderEditorTool::handleEvent(QWidget *widget, QWidget *managedWidget, QE QWidget *TabOrderEditorTool::editor() const { if (!m_editor) { - Q_ASSERT(formWindow() != 0); - m_editor = new TabOrderEditor(formWindow(), 0); + Q_ASSERT(formWindow() != nullptr); + m_editor = new TabOrderEditor(formWindow(), nullptr); connect(formWindow(), &QDesignerFormWindowInterface::mainContainerChanged, m_editor.data(), &TabOrderEditor::setBackground); } diff --git a/src/designer/src/components/tabordereditor/tabordereditor_tool.h b/src/designer/src/components/tabordereditor/tabordereditor_tool.h index 43b41feaf..73792de43 100644 --- a/src/designer/src/components/tabordereditor/tabordereditor_tool.h +++ b/src/designer/src/components/tabordereditor/tabordereditor_tool.h @@ -49,7 +49,7 @@ class QT_TABORDEREDITOR_EXPORT TabOrderEditorTool: public QDesignerFormWindowToo { Q_OBJECT public: - explicit TabOrderEditorTool(QDesignerFormWindowInterface *formWindow, QObject *parent = 0); + explicit TabOrderEditorTool(QDesignerFormWindowInterface *formWindow, QObject *parent = nullptr); ~TabOrderEditorTool() override; QDesignerFormEditorInterface *core() const override; diff --git a/src/designer/src/components/taskmenu/button_taskmenu.cpp b/src/designer/src/components/taskmenu/button_taskmenu.cpp index 01dca2a63..b9860f67b 100644 --- a/src/designer/src/components/taskmenu/button_taskmenu.cpp +++ b/src/designer/src/components/taskmenu/button_taskmenu.cpp @@ -95,7 +95,7 @@ private: ButtonGroupCommand::ButtonGroupCommand(const QString &description, QDesignerFormWindowInterface *formWindow) : QDesignerFormWindowCommand(description, formWindow), - m_buttonGroup(0) + m_buttonGroup(nullptr) { } @@ -316,7 +316,7 @@ void ButtonGroupMenu::initialize(QDesignerFormWindowInterface *formWindow, QButt m_formWindow = formWindow; Q_ASSERT(m_formWindow); - const bool canBreak = buttonGroup != 0; + const bool canBreak = buttonGroup != nullptr; m_breakGroupAction->setEnabled(canBreak); m_selectGroupAction->setEnabled(canBreak); } @@ -420,7 +420,7 @@ QRect LinkDescriptionTaskMenuInlineEditor::editRectangle() const ButtonTaskMenu::ButtonTaskMenu(QAbstractButton *button, QObject *parent) : QDesignerTaskMenu(button, parent), m_assignGroupSubMenu(new QMenu), - m_assignActionGroup(0), + m_assignActionGroup(nullptr), m_assignToGroupSubMenuAction(new QAction(tr("Assign to button group"), this)), m_currentGroupSubMenu(new QMenu), m_currentGroupSubMenuAction(new QAction(tr("Button group"), this)), @@ -462,7 +462,7 @@ bool ButtonTaskMenu::refreshAssignMenu(const QDesignerFormWindowInterface *fw, i // clear if (m_assignActionGroup) { delete m_assignActionGroup; - m_assignActionGroup = 0; + m_assignActionGroup = nullptr; } m_assignGroupSubMenu->clear(); if (st == OtherSelection) @@ -512,7 +512,7 @@ bool ButtonTaskMenu::refreshAssignMenu(const QDesignerFormWindowInterface *fw, i QList ButtonTaskMenu::taskActions() const { ButtonTaskMenu *ncThis = const_cast(this); - QButtonGroup *buttonGroup = 0; + QButtonGroup *buttonGroup = nullptr; QDesignerFormWindowInterface *fw = formWindow(); const SelectionType st = selectionType(fw->cursor(), &buttonGroup); @@ -567,7 +567,7 @@ static QUndoCommand *createRemoveButtonsCommand(QDesignerFormWindowInterface *fw if (!breakCmd->init(bg)) { qWarning("** WARNING Failed to initialize BreakButtonGroupCommand!"); delete breakCmd; - return 0; + return nullptr; } return breakCmd; } @@ -577,7 +577,7 @@ static QUndoCommand *createRemoveButtonsCommand(QDesignerFormWindowInterface *fw if (!removeCmd->init(bl)) { qWarning("** WARNING Failed to initialize RemoveButtonsFromGroupCommand!"); delete removeCmd; - return 0; + return nullptr; } return removeCmd; } @@ -587,7 +587,7 @@ void ButtonTaskMenu::createGroup() QDesignerFormWindowInterface *fw = formWindow(); const ButtonList bl = buttonList(fw->cursor()); // Do we need to remove the buttons from an existing group? - QUndoCommand *removeCmd = 0; + QUndoCommand *removeCmd = nullptr; if (bl.front()->group()) { removeCmd = createRemoveButtonsCommand(fw, bl); if (!removeCmd) @@ -621,7 +621,7 @@ ButtonTaskMenu::SelectionType ButtonTaskMenu::selectionType(const QDesignerFormW if (!selectionCount) return OtherSelection; - QButtonGroup *commonGroup = 0; + QButtonGroup *commonGroup = nullptr; for (int i = 0; i < selectionCount; i++) { if (const QAbstractButton *ab = qobject_cast(cursor->selectedWidget(i))) { QButtonGroup *buttonGroup = ab->group(); @@ -650,7 +650,7 @@ void ButtonTaskMenu::addToGroup(QAction *a) QDesignerFormWindowInterface *fw = formWindow(); const ButtonList bl = buttonList(fw->cursor()); // Do we need to remove the buttons from an existing group? - QUndoCommand *removeCmd = 0; + QUndoCommand *removeCmd = nullptr; if (bl.front()->group()) { removeCmd = createRemoveButtonsCommand(fw, bl); if (!removeCmd) diff --git a/src/designer/src/components/taskmenu/button_taskmenu.h b/src/designer/src/components/taskmenu/button_taskmenu.h index dcdecfade..d198f524a 100644 --- a/src/designer/src/components/taskmenu/button_taskmenu.h +++ b/src/designer/src/components/taskmenu/button_taskmenu.h @@ -51,12 +51,12 @@ class ButtonGroupMenu : public QObject Q_OBJECT Q_DISABLE_COPY(ButtonGroupMenu) public: - ButtonGroupMenu(QObject *parent = 0); + ButtonGroupMenu(QObject *parent = nullptr); void initialize(QDesignerFormWindowInterface *formWindow, - QButtonGroup *buttonGroup = 0, + QButtonGroup *buttonGroup = nullptr, /* Current button for selection in ButtonMode */ - QAbstractButton *currentButton = 0); + QAbstractButton *currentButton = nullptr); QAction *selectGroupAction() const { return m_selectGroupAction; } QAction *breakGroupAction() const { return m_breakGroupAction; } @@ -81,7 +81,7 @@ class ButtonGroupTaskMenu : public QObject, public QDesignerTaskMenuExtension Q_DISABLE_COPY(ButtonGroupTaskMenu) Q_INTERFACES(QDesignerTaskMenuExtension) public: - explicit ButtonGroupTaskMenu(QButtonGroup *buttonGroup, QObject *parent = 0); + explicit ButtonGroupTaskMenu(QButtonGroup *buttonGroup, QObject *parent = nullptr); QAction *preferredEditAction() const override; QList taskActions() const override; @@ -98,7 +98,7 @@ class ButtonTaskMenu: public QDesignerTaskMenu Q_OBJECT Q_DISABLE_COPY(ButtonTaskMenu) public: - explicit ButtonTaskMenu(QAbstractButton *button, QObject *parent = 0); + explicit ButtonTaskMenu(QAbstractButton *button, QObject *parent = nullptr); ~ButtonTaskMenu() override; QAction *preferredEditAction() const override; @@ -121,7 +121,7 @@ private: GroupedButtonSelection }; - SelectionType selectionType(const QDesignerFormWindowCursorInterface *cursor, QButtonGroup ** ptrToGroup = 0) const; + SelectionType selectionType(const QDesignerFormWindowCursorInterface *cursor, QButtonGroup ** ptrToGroup = nullptr) const; bool refreshAssignMenu(const QDesignerFormWindowInterface *fw, int buttonCount, SelectionType st, QButtonGroup *currentGroup); QMenu *createGroupSelectionMenu(const QDesignerFormWindowInterface *fw); @@ -144,7 +144,7 @@ class CommandLinkButtonTaskMenu: public ButtonTaskMenu Q_OBJECT Q_DISABLE_COPY(CommandLinkButtonTaskMenu) public: - explicit CommandLinkButtonTaskMenu(QCommandLinkButton *button, QObject *parent = 0); + explicit CommandLinkButtonTaskMenu(QCommandLinkButton *button, QObject *parent = nullptr); }; typedef ExtensionFactory ButtonGroupTaskMenuFactory; diff --git a/src/designer/src/components/taskmenu/combobox_taskmenu.cpp b/src/designer/src/components/taskmenu/combobox_taskmenu.cpp index 89b180a65..6d96e9795 100644 --- a/src/designer/src/components/taskmenu/combobox_taskmenu.cpp +++ b/src/designer/src/components/taskmenu/combobox_taskmenu.cpp @@ -79,7 +79,7 @@ void ComboBoxTaskMenu::editItems() if (m_formWindow.isNull()) return; - Q_ASSERT(m_comboBox != 0); + Q_ASSERT(m_comboBox != nullptr); ListWidgetEditor dlg(m_formWindow, m_comboBox->window()); ListContents oldItems = dlg.fillContentsFromComboBox(m_comboBox); @@ -103,9 +103,9 @@ QComboBox *ComboBoxTaskMenuFactory::checkObject(QObject *qObject) const { QComboBox *combo = qobject_cast(qObject); if (!combo) - return 0; + return nullptr; if (qobject_cast(combo)) - return 0; + return nullptr; return combo; } diff --git a/src/designer/src/components/taskmenu/combobox_taskmenu.h b/src/designer/src/components/taskmenu/combobox_taskmenu.h index b8eefd5ef..8ff36c1a8 100644 --- a/src/designer/src/components/taskmenu/combobox_taskmenu.h +++ b/src/designer/src/components/taskmenu/combobox_taskmenu.h @@ -47,7 +47,7 @@ class ComboBoxTaskMenu: public QDesignerTaskMenu Q_OBJECT public: explicit ComboBoxTaskMenu(QComboBox *button, - QObject *parent = 0); + QObject *parent = nullptr); ~ComboBoxTaskMenu() override; QAction *preferredEditAction() const override; diff --git a/src/designer/src/components/taskmenu/containerwidget_taskmenu.cpp b/src/designer/src/components/taskmenu/containerwidget_taskmenu.cpp index b5ba82e0e..1df9e4bbb 100644 --- a/src/designer/src/components/taskmenu/containerwidget_taskmenu.cpp +++ b/src/designer/src/components/taskmenu/containerwidget_taskmenu.cpp @@ -59,11 +59,11 @@ ContainerWidgetTaskMenu::ContainerWidgetTaskMenu(QWidget *widget, ContainerType m_type(type), m_containerWidget(widget), m_core(formWindow()->core()), - m_pagePromotionTaskMenu(new PromotionTaskMenu(0, PromotionTaskMenu::ModeSingleWidget, this)), + m_pagePromotionTaskMenu(new PromotionTaskMenu(nullptr, PromotionTaskMenu::ModeSingleWidget, this)), m_pageMenuAction(new QAction(this)), m_pageMenu(new QMenu), m_actionInsertPageAfter(new QAction(this)), - m_actionInsertPage(0), + m_actionInsertPage(nullptr), m_actionDeletePage(new QAction(tr("Delete"), this)) { Q_ASSERT(m_core); @@ -113,7 +113,7 @@ ContainerWidgetTaskMenu::~ContainerWidgetTaskMenu() = default; QAction *ContainerWidgetTaskMenu::preferredEditAction() const { - return 0; + return nullptr; } bool ContainerWidgetTaskMenu::canDeletePage() const @@ -292,7 +292,7 @@ ContainerWidgetTaskMenuFactory::ContainerWidgetTaskMenuFactory(QDesignerFormEdit QObject *ContainerWidgetTaskMenuFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const { if (iid != QStringLiteral("QDesignerInternalTaskMenuExtension") || !object->isWidgetType()) - return 0; + return nullptr; QWidget *widget = qobject_cast(object); @@ -306,12 +306,12 @@ QObject *ContainerWidgetTaskMenuFactory::createExtension(QObject *object, const const int idx = wb->indexOfObject(widget); const WidgetDataBaseItem *item = static_cast(wb->item(idx)); if (item->addPageMethod().isEmpty()) - return 0; + return nullptr; } } - if (qt_extension(extensionManager(), object) == 0) - return 0; + if (qt_extension(extensionManager(), object) == nullptr) + return nullptr; if (QMdiArea* ma = qobject_cast(widget)) return new MdiContainerWidgetTaskMenu(ma, parent); diff --git a/src/designer/src/components/taskmenu/containerwidget_taskmenu.h b/src/designer/src/components/taskmenu/containerwidget_taskmenu.h index 907e6e66d..b0f4127ee 100644 --- a/src/designer/src/components/taskmenu/containerwidget_taskmenu.h +++ b/src/designer/src/components/taskmenu/containerwidget_taskmenu.h @@ -56,7 +56,7 @@ class ContainerWidgetTaskMenu: public QDesignerTaskMenu { Q_OBJECT public: - explicit ContainerWidgetTaskMenu(QWidget *widget, ContainerType type, QObject *parent = 0); + explicit ContainerWidgetTaskMenu(QWidget *widget, ContainerType type, QObject *parent = nullptr); ~ContainerWidgetTaskMenu() override; QAction *preferredEditAction() const override; @@ -97,7 +97,7 @@ private: class WizardContainerWidgetTaskMenu : public ContainerWidgetTaskMenu { Q_OBJECT public: - explicit WizardContainerWidgetTaskMenu(QWizard *w, QObject *parent = 0); + explicit WizardContainerWidgetTaskMenu(QWizard *w, QObject *parent = nullptr); QList taskActions() const override; @@ -112,7 +112,7 @@ private: class MdiContainerWidgetTaskMenu : public ContainerWidgetTaskMenu { Q_OBJECT public: - explicit MdiContainerWidgetTaskMenu(QMdiArea *m, QObject *parent = 0); + explicit MdiContainerWidgetTaskMenu(QMdiArea *m, QObject *parent = nullptr); QList taskActions() const override; private: @@ -128,7 +128,7 @@ class ContainerWidgetTaskMenuFactory: public QExtensionFactory { Q_OBJECT public: - explicit ContainerWidgetTaskMenuFactory(QDesignerFormEditorInterface *core, QExtensionManager *extensionManager = 0); + explicit ContainerWidgetTaskMenuFactory(QDesignerFormEditorInterface *core, QExtensionManager *extensionManager = nullptr); protected: QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const override; diff --git a/src/designer/src/components/taskmenu/groupbox_taskmenu.h b/src/designer/src/components/taskmenu/groupbox_taskmenu.h index c664a5a81..e09a883a0 100644 --- a/src/designer/src/components/taskmenu/groupbox_taskmenu.h +++ b/src/designer/src/components/taskmenu/groupbox_taskmenu.h @@ -46,7 +46,7 @@ class GroupBoxTaskMenu: public QDesignerTaskMenu { Q_OBJECT public: - explicit GroupBoxTaskMenu(QGroupBox *groupbox, QObject *parent = 0); + explicit GroupBoxTaskMenu(QGroupBox *groupbox, QObject *parent = nullptr); QAction *preferredEditAction() const override; QList taskActions() const override; diff --git a/src/designer/src/components/taskmenu/inplace_widget_helper.cpp b/src/designer/src/components/taskmenu/inplace_widget_helper.cpp index d78e26b84..d96fd915b 100644 --- a/src/designer/src/components/taskmenu/inplace_widget_helper.cpp +++ b/src/designer/src/components/taskmenu/inplace_widget_helper.cpp @@ -38,7 +38,7 @@ QT_BEGIN_NAMESPACE namespace qdesigner_internal { InPlaceWidgetHelper::InPlaceWidgetHelper(QWidget *editorWidget, QWidget *parentWidget, QDesignerFormWindowInterface *fw) - : QObject(0), + : QObject(nullptr), m_editorWidget(editorWidget), m_parentWidget(parentWidget), m_noChildEvent(m_parentWidget->testAttribute(Qt::WA_NoChildEventsForParent)) diff --git a/src/designer/src/components/taskmenu/itemlisteditor.cpp b/src/designer/src/components/taskmenu/itemlisteditor.cpp index c8aaf9e29..8aca0916d 100644 --- a/src/designer/src/components/taskmenu/itemlisteditor.cpp +++ b/src/designer/src/components/taskmenu/itemlisteditor.cpp @@ -98,14 +98,14 @@ static const char * const itemFlagNames[] = { QT_TRANSLATE_NOOP("AbstractItemEditor", "UserCheckable"), QT_TRANSLATE_NOOP("AbstractItemEditor", "Enabled"), QT_TRANSLATE_NOOP("AbstractItemEditor", "Tristate"), - 0 + nullptr }; static const char * const checkStateNames[] = { QT_TRANSLATE_NOOP("AbstractItemEditor", "Unchecked"), QT_TRANSLATE_NOOP("AbstractItemEditor", "PartiallyChecked"), QT_TRANSLATE_NOOP("AbstractItemEditor", "Checked"), - 0 + nullptr }; static QStringList c2qStringList(const char * const in[]) diff --git a/src/designer/src/components/taskmenu/label_taskmenu.h b/src/designer/src/components/taskmenu/label_taskmenu.h index 64e6423d7..a47cc7e6b 100644 --- a/src/designer/src/components/taskmenu/label_taskmenu.h +++ b/src/designer/src/components/taskmenu/label_taskmenu.h @@ -45,7 +45,7 @@ class LabelTaskMenu: public QDesignerTaskMenu { Q_OBJECT public: - explicit LabelTaskMenu(QLabel *button, QObject *parent = 0); + explicit LabelTaskMenu(QLabel *button, QObject *parent = nullptr); QAction *preferredEditAction() const override; QList taskActions() const override; diff --git a/src/designer/src/components/taskmenu/layouttaskmenu.cpp b/src/designer/src/components/taskmenu/layouttaskmenu.cpp index 3326ca965..94c2095c4 100644 --- a/src/designer/src/components/taskmenu/layouttaskmenu.cpp +++ b/src/designer/src/components/taskmenu/layouttaskmenu.cpp @@ -68,7 +68,7 @@ SpacerTaskMenu::SpacerTaskMenu(Spacer *, QObject *parent) : QAction *SpacerTaskMenu::preferredEditAction() const { - return 0; + return nullptr; } QList SpacerTaskMenu::taskActions() const diff --git a/src/designer/src/components/taskmenu/layouttaskmenu.h b/src/designer/src/components/taskmenu/layouttaskmenu.h index d14b3ebac..f7ccc2c73 100644 --- a/src/designer/src/components/taskmenu/layouttaskmenu.h +++ b/src/designer/src/components/taskmenu/layouttaskmenu.h @@ -48,7 +48,7 @@ class LayoutWidgetTaskMenu : public QObject, public QDesignerTaskMenuExtension Q_OBJECT Q_INTERFACES(QDesignerTaskMenuExtension) public: - explicit LayoutWidgetTaskMenu(QLayoutWidget *w, QObject *parent = 0); + explicit LayoutWidgetTaskMenu(QLayoutWidget *w, QObject *parent = nullptr); QAction *preferredEditAction() const override; QList taskActions() const override; @@ -65,7 +65,7 @@ class SpacerTaskMenu : public QObject, public QDesignerTaskMenuExtension Q_OBJECT Q_INTERFACES(QDesignerTaskMenuExtension) public: - explicit SpacerTaskMenu(Spacer *bar, QObject *parent = 0); + explicit SpacerTaskMenu(Spacer *bar, QObject *parent = nullptr); QAction *preferredEditAction() const override; QList taskActions() const override; diff --git a/src/designer/src/components/taskmenu/lineedit_taskmenu.h b/src/designer/src/components/taskmenu/lineedit_taskmenu.h index 08e0c15fd..fb7aae81f 100644 --- a/src/designer/src/components/taskmenu/lineedit_taskmenu.h +++ b/src/designer/src/components/taskmenu/lineedit_taskmenu.h @@ -43,7 +43,7 @@ class LineEditTaskMenu: public QDesignerTaskMenu { Q_OBJECT public: - explicit LineEditTaskMenu(QLineEdit *button, QObject *parent = 0); + explicit LineEditTaskMenu(QLineEdit *button, QObject *parent = nullptr); QAction *preferredEditAction() const override; QList taskActions() const override; diff --git a/src/designer/src/components/taskmenu/listwidget_taskmenu.cpp b/src/designer/src/components/taskmenu/listwidget_taskmenu.cpp index 46a8afda8..5ea24f98a 100644 --- a/src/designer/src/components/taskmenu/listwidget_taskmenu.cpp +++ b/src/designer/src/components/taskmenu/listwidget_taskmenu.cpp @@ -80,7 +80,7 @@ void ListWidgetTaskMenu::editItems() if (m_formWindow.isNull()) return; - Q_ASSERT(m_listWidget != 0); + Q_ASSERT(m_listWidget != nullptr); ListWidgetEditor dlg(m_formWindow, m_listWidget->window()); ListContents oldItems = dlg.fillContentsFromListWidget(m_listWidget); diff --git a/src/designer/src/components/taskmenu/listwidget_taskmenu.h b/src/designer/src/components/taskmenu/listwidget_taskmenu.h index 6e853673f..799710f11 100644 --- a/src/designer/src/components/taskmenu/listwidget_taskmenu.h +++ b/src/designer/src/components/taskmenu/listwidget_taskmenu.h @@ -46,7 +46,7 @@ class ListWidgetTaskMenu: public QDesignerTaskMenu { Q_OBJECT public: - explicit ListWidgetTaskMenu(QListWidget *button, QObject *parent = 0); + explicit ListWidgetTaskMenu(QListWidget *button, QObject *parent = nullptr); ~ListWidgetTaskMenu() override; QAction *preferredEditAction() const override; diff --git a/src/designer/src/components/taskmenu/listwidgeteditor.cpp b/src/designer/src/components/taskmenu/listwidgeteditor.cpp index 337f9ea46..098dac2cd 100644 --- a/src/designer/src/components/taskmenu/listwidgeteditor.cpp +++ b/src/designer/src/components/taskmenu/listwidgeteditor.cpp @@ -51,7 +51,7 @@ ListWidgetEditor::ListWidgetEditor(QDesignerFormWindowInterface *form, connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); - m_itemsEditor = new ItemListEditor(form, 0); + m_itemsEditor = new ItemListEditor(form, nullptr); m_itemsEditor->layout()->setContentsMargins(QMargins()); m_itemsEditor->setNewItemText(tr("New Item")); @@ -74,13 +74,13 @@ static AbstractItemEditor::PropertyDefinition listBoxPropList[] = { { Qt::ToolTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "toolTip" }, { Qt::StatusTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "statusTip" }, { Qt::WhatsThisPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "whatsThis" }, - { Qt::FontRole, QVariant::Font, 0, "font" }, + { Qt::FontRole, QVariant::Font, nullptr, "font" }, { Qt::TextAlignmentRole, 0, DesignerPropertyManager::designerAlignmentTypeId, "textAlignment" }, - { Qt::BackgroundRole, QVariant::Brush, 0, "background" }, - { Qt::ForegroundRole, QVariant::Brush, 0, "foreground" }, + { Qt::BackgroundRole, QVariant::Brush, nullptr, "background" }, + { Qt::ForegroundRole, QVariant::Brush, nullptr, "foreground" }, { ItemFlagsShadowRole, 0, QtVariantPropertyManager::flagTypeId, "flags" }, { Qt::CheckStateRole, 0, QtVariantPropertyManager::enumTypeId, "checkState" }, - { 0, 0, 0, 0 } + { 0, 0, nullptr, nullptr } }; ListContents ListWidgetEditor::fillContentsFromListWidget(QListWidget *listWidget) @@ -99,7 +99,7 @@ ListContents ListWidgetEditor::fillContentsFromListWidget(QListWidget *listWidge static AbstractItemEditor::PropertyDefinition comboBoxPropList[] = { { Qt::DisplayPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "text" }, { Qt::DecorationPropertyRole, 0, DesignerPropertyManager::designerIconTypeId, "icon" }, - { 0, 0, 0, 0 } + { 0, 0, nullptr, nullptr } }; ListContents ListWidgetEditor::fillContentsFromComboBox(QComboBox *comboBox) diff --git a/src/designer/src/components/taskmenu/menutaskmenu.cpp b/src/designer/src/components/taskmenu/menutaskmenu.cpp index a06c0a7f9..105c3eabd 100644 --- a/src/designer/src/components/taskmenu/menutaskmenu.cpp +++ b/src/designer/src/components/taskmenu/menutaskmenu.cpp @@ -48,7 +48,7 @@ namespace qdesigner_internal { QAction *MenuTaskMenu::preferredEditAction() const { - return 0; + return nullptr; } QList MenuTaskMenu::taskActions() const @@ -81,7 +81,7 @@ namespace qdesigner_internal { QAction *MenuBarTaskMenu::preferredEditAction() const { - return 0; + return nullptr; } QList MenuBarTaskMenu::taskActions() const diff --git a/src/designer/src/components/taskmenu/menutaskmenu.h b/src/designer/src/components/taskmenu/menutaskmenu.h index d08081b30..fa272f515 100644 --- a/src/designer/src/components/taskmenu/menutaskmenu.h +++ b/src/designer/src/components/taskmenu/menutaskmenu.h @@ -52,7 +52,7 @@ class MenuTaskMenu : public QObject, public QDesignerTaskMenuExtension Q_OBJECT Q_INTERFACES(QDesignerTaskMenuExtension) public: - explicit MenuTaskMenu(QDesignerMenu *menu, QObject *parent = 0); + explicit MenuTaskMenu(QDesignerMenu *menu, QObject *parent = nullptr); QAction *preferredEditAction() const override; QList taskActions() const override; @@ -74,7 +74,7 @@ class MenuBarTaskMenu : public QObject, public QDesignerTaskMenuExtension Q_OBJECT Q_INTERFACES(QDesignerTaskMenuExtension) public: - explicit MenuBarTaskMenu(QDesignerMenuBar *bar, QObject *parent = 0); + explicit MenuBarTaskMenu(QDesignerMenuBar *bar, QObject *parent = nullptr); QAction *preferredEditAction() const override; QList taskActions() const override; diff --git a/src/designer/src/components/taskmenu/tablewidget_taskmenu.cpp b/src/designer/src/components/taskmenu/tablewidget_taskmenu.cpp index e7944a59c..bb002380e 100644 --- a/src/designer/src/components/taskmenu/tablewidget_taskmenu.cpp +++ b/src/designer/src/components/taskmenu/tablewidget_taskmenu.cpp @@ -79,7 +79,7 @@ void TableWidgetTaskMenu::editItems() if (m_formWindow.isNull()) return; - Q_ASSERT(m_tableWidget != 0); + Q_ASSERT(m_tableWidget != nullptr); TableWidgetEditorDialog dlg(m_formWindow, m_tableWidget->window()); TableWidgetContents oldCont = dlg.fillContentsFromTableWidget(m_tableWidget); diff --git a/src/designer/src/components/taskmenu/tablewidget_taskmenu.h b/src/designer/src/components/taskmenu/tablewidget_taskmenu.h index 636ab4f0d..1d76ad5f9 100644 --- a/src/designer/src/components/taskmenu/tablewidget_taskmenu.h +++ b/src/designer/src/components/taskmenu/tablewidget_taskmenu.h @@ -46,7 +46,7 @@ class TableWidgetTaskMenu: public QDesignerTaskMenu { Q_OBJECT public: - explicit TableWidgetTaskMenu(QTableWidget *button, QObject *parent = 0); + explicit TableWidgetTaskMenu(QTableWidget *button, QObject *parent = nullptr); ~TableWidgetTaskMenu() override; QAction *preferredEditAction() const override; diff --git a/src/designer/src/components/taskmenu/tablewidgeteditor.cpp b/src/designer/src/components/taskmenu/tablewidgeteditor.cpp index b1a7adf12..b5f41626c 100644 --- a/src/designer/src/components/taskmenu/tablewidgeteditor.cpp +++ b/src/designer/src/components/taskmenu/tablewidgeteditor.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE namespace qdesigner_internal { TableWidgetEditor::TableWidgetEditor(QDesignerFormWindowInterface *form, QDialog *dialog) - : AbstractItemEditor(form, 0), m_updatingBrowser(false) + : AbstractItemEditor(form, nullptr), m_updatingBrowser(false) { m_columnEditor = new ItemListEditor(form, this); m_columnEditor->setObjectName(QStringLiteral("columnEditor")); @@ -108,11 +108,11 @@ static AbstractItemEditor::PropertyDefinition tableHeaderPropList[] = { { Qt::ToolTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "toolTip" }, // { Qt::StatusTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "statusTip" }, { Qt::WhatsThisPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "whatsThis" }, - { Qt::FontRole, QVariant::Font, 0, "font" }, + { Qt::FontRole, QVariant::Font, nullptr, "font" }, { Qt::TextAlignmentRole, 0, DesignerPropertyManager::designerAlignmentTypeId, "textAlignment" }, - { Qt::BackgroundRole, QVariant::Color, 0, "background" }, - { Qt::ForegroundRole, QVariant::Brush, 0, "foreground" }, - { 0, 0, 0, 0 } + { Qt::BackgroundRole, QVariant::Color, nullptr, "background" }, + { Qt::ForegroundRole, QVariant::Brush, nullptr, "foreground" }, + { 0, 0, nullptr, nullptr } }; static AbstractItemEditor::PropertyDefinition tableItemPropList[] = { @@ -121,13 +121,13 @@ static AbstractItemEditor::PropertyDefinition tableItemPropList[] = { { Qt::ToolTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "toolTip" }, // { Qt::StatusTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "statusTip" }, { Qt::WhatsThisPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "whatsThis" }, - { Qt::FontRole, QVariant::Font, 0, "font" }, + { Qt::FontRole, QVariant::Font, nullptr, "font" }, { Qt::TextAlignmentRole, 0, DesignerPropertyManager::designerAlignmentTypeId, "textAlignment" }, - { Qt::BackgroundRole, QVariant::Brush, 0, "background" }, - { Qt::ForegroundRole, QVariant::Brush, 0, "foreground" }, + { Qt::BackgroundRole, QVariant::Brush, nullptr, "background" }, + { Qt::ForegroundRole, QVariant::Brush, nullptr, "foreground" }, { ItemFlagsShadowRole, 0, QtVariantPropertyManager::flagTypeId, "flags" }, { Qt::CheckStateRole, 0, QtVariantPropertyManager::enumTypeId, "checkState" }, - { 0, 0, 0, 0 } + { 0, 0, nullptr, nullptr } }; TableWidgetContents TableWidgetEditor::fillContentsFromTableWidget(QTableWidget *tableWidget) diff --git a/src/designer/src/components/taskmenu/taskmenu_component.cpp b/src/designer/src/components/taskmenu/taskmenu_component.cpp index 5cd4e3030..39ac4bc90 100644 --- a/src/designer/src/components/taskmenu/taskmenu_component.cpp +++ b/src/designer/src/components/taskmenu/taskmenu_component.cpp @@ -52,7 +52,7 @@ TaskMenuComponent::TaskMenuComponent(QDesignerFormEditorInterface *core, QObject : QObject(parent), m_core(core) { - Q_ASSERT(m_core != 0); + Q_ASSERT(m_core != nullptr); QExtensionManager *mgr = core->extensionManager(); const QString taskMenuId = QStringLiteral("QDesignerInternalTaskMenuExtension"); diff --git a/src/designer/src/components/taskmenu/taskmenu_component.h b/src/designer/src/components/taskmenu/taskmenu_component.h index adc794cb9..f57d19848 100644 --- a/src/designer/src/components/taskmenu/taskmenu_component.h +++ b/src/designer/src/components/taskmenu/taskmenu_component.h @@ -44,7 +44,7 @@ class QT_TASKMENU_EXPORT TaskMenuComponent: public QObject { Q_OBJECT public: - explicit TaskMenuComponent(QDesignerFormEditorInterface *core, QObject *parent = 0); + explicit TaskMenuComponent(QDesignerFormEditorInterface *core, QObject *parent = nullptr); ~TaskMenuComponent() override; QDesignerFormEditorInterface *core() const; diff --git a/src/designer/src/components/taskmenu/textedit_taskmenu.h b/src/designer/src/components/taskmenu/textedit_taskmenu.h index 98b9402d6..fdc206be9 100644 --- a/src/designer/src/components/taskmenu/textedit_taskmenu.h +++ b/src/designer/src/components/taskmenu/textedit_taskmenu.h @@ -45,8 +45,8 @@ class TextEditTaskMenu: public QDesignerTaskMenu { Q_OBJECT public: - explicit TextEditTaskMenu(QTextEdit *button, QObject *parent = 0); - explicit TextEditTaskMenu(QPlainTextEdit *button, QObject *parent = 0); + explicit TextEditTaskMenu(QTextEdit *button, QObject *parent = nullptr); + explicit TextEditTaskMenu(QPlainTextEdit *button, QObject *parent = nullptr); ~TextEditTaskMenu() override; diff --git a/src/designer/src/components/taskmenu/toolbar_taskmenu.cpp b/src/designer/src/components/taskmenu/toolbar_taskmenu.cpp index e868e3645..158917e24 100644 --- a/src/designer/src/components/taskmenu/toolbar_taskmenu.cpp +++ b/src/designer/src/components/taskmenu/toolbar_taskmenu.cpp @@ -51,7 +51,7 @@ namespace qdesigner_internal { QAction *ToolBarTaskMenu::preferredEditAction() const { - return 0; + return nullptr; } QList ToolBarTaskMenu::taskActions() const @@ -73,7 +73,7 @@ namespace qdesigner_internal { QAction *StatusBarTaskMenu::preferredEditAction() const { - return 0; + return nullptr; } QList StatusBarTaskMenu::taskActions() const diff --git a/src/designer/src/components/taskmenu/toolbar_taskmenu.h b/src/designer/src/components/taskmenu/toolbar_taskmenu.h index eeee0bc4a..e81997f5e 100644 --- a/src/designer/src/components/taskmenu/toolbar_taskmenu.h +++ b/src/designer/src/components/taskmenu/toolbar_taskmenu.h @@ -47,7 +47,7 @@ class ToolBarTaskMenu : public QObject, public QDesignerTaskMenuExtension Q_OBJECT Q_INTERFACES(QDesignerTaskMenuExtension) public: - explicit ToolBarTaskMenu(QToolBar *tb, QObject *parent = 0); + explicit ToolBarTaskMenu(QToolBar *tb, QObject *parent = nullptr); QAction *preferredEditAction() const override; QList taskActions() const override; @@ -62,7 +62,7 @@ class StatusBarTaskMenu : public QObject, public QDesignerTaskMenuExtension Q_OBJECT Q_INTERFACES(QDesignerTaskMenuExtension) public: - explicit StatusBarTaskMenu(QStatusBar *tb, QObject *parent = 0); + explicit StatusBarTaskMenu(QStatusBar *tb, QObject *parent = nullptr); QAction *preferredEditAction() const override; QList taskActions() const override; diff --git a/src/designer/src/components/taskmenu/treewidget_taskmenu.cpp b/src/designer/src/components/taskmenu/treewidget_taskmenu.cpp index fe78399cd..9584be1a3 100644 --- a/src/designer/src/components/taskmenu/treewidget_taskmenu.cpp +++ b/src/designer/src/components/taskmenu/treewidget_taskmenu.cpp @@ -78,7 +78,7 @@ void TreeWidgetTaskMenu::editItems() if (m_formWindow.isNull()) return; - Q_ASSERT(m_treeWidget != 0); + Q_ASSERT(m_treeWidget != nullptr); TreeWidgetEditorDialog dlg(m_formWindow, m_treeWidget->window()); TreeWidgetContents oldCont = dlg.fillContentsFromTreeWidget(m_treeWidget); diff --git a/src/designer/src/components/taskmenu/treewidget_taskmenu.h b/src/designer/src/components/taskmenu/treewidget_taskmenu.h index 3622f420e..9a9c882df 100644 --- a/src/designer/src/components/taskmenu/treewidget_taskmenu.h +++ b/src/designer/src/components/taskmenu/treewidget_taskmenu.h @@ -46,7 +46,7 @@ class TreeWidgetTaskMenu: public QDesignerTaskMenu { Q_OBJECT public: - explicit TreeWidgetTaskMenu(QTreeWidget *button, QObject *parent = 0); + explicit TreeWidgetTaskMenu(QTreeWidget *button, QObject *parent = nullptr); ~TreeWidgetTaskMenu() override; QAction *preferredEditAction() const override; diff --git a/src/designer/src/components/taskmenu/treewidgeteditor.cpp b/src/designer/src/components/taskmenu/treewidgeteditor.cpp index 20c7bd0a5..5e77939e5 100644 --- a/src/designer/src/components/taskmenu/treewidgeteditor.cpp +++ b/src/designer/src/components/taskmenu/treewidgeteditor.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE namespace qdesigner_internal { TreeWidgetEditor::TreeWidgetEditor(QDesignerFormWindowInterface *form, QDialog *dialog) - : AbstractItemEditor(form, 0), m_updatingBrowser(false) + : AbstractItemEditor(form, nullptr), m_updatingBrowser(false) { m_columnEditor = new ItemListEditor(form, this); m_columnEditor->setObjectName(QStringLiteral("columnEditor")); @@ -108,11 +108,11 @@ static AbstractItemEditor::PropertyDefinition treeHeaderPropList[] = { { Qt::ToolTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "toolTip" }, { Qt::StatusTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "statusTip" }, { Qt::WhatsThisPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "whatsThis" }, - { Qt::FontRole, QVariant::Font, 0, "font" }, + { Qt::FontRole, QVariant::Font, nullptr, "font" }, { Qt::TextAlignmentRole, 0, DesignerPropertyManager::designerAlignmentTypeId, "textAlignment" }, - { Qt::BackgroundRole, QVariant::Color, 0, "background" }, - { Qt::ForegroundRole, QVariant::Brush, 0, "foreground" }, - { 0, 0, 0, 0 } + { Qt::BackgroundRole, QVariant::Color, nullptr, "background" }, + { Qt::ForegroundRole, QVariant::Brush, nullptr, "foreground" }, + { 0, 0, nullptr, nullptr } }; static AbstractItemEditor::PropertyDefinition treeItemColumnPropList[] = { @@ -121,17 +121,17 @@ static AbstractItemEditor::PropertyDefinition treeItemColumnPropList[] = { { Qt::ToolTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "toolTip" }, { Qt::StatusTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "statusTip" }, { Qt::WhatsThisPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "whatsThis" }, - { Qt::FontRole, QVariant::Font, 0, "font" }, + { Qt::FontRole, QVariant::Font, nullptr, "font" }, { Qt::TextAlignmentRole, 0, DesignerPropertyManager::designerAlignmentTypeId, "textAlignment" }, - { Qt::BackgroundRole, QVariant::Brush, 0, "background" }, - { Qt::ForegroundRole, QVariant::Brush, 0, "foreground" }, + { Qt::BackgroundRole, QVariant::Brush, nullptr, "background" }, + { Qt::ForegroundRole, QVariant::Brush, nullptr, "foreground" }, { Qt::CheckStateRole, 0, QtVariantPropertyManager::enumTypeId, "checkState" }, - { 0, 0, 0, 0 } + { 0, 0, nullptr, nullptr } }; static AbstractItemEditor::PropertyDefinition treeItemCommonPropList[] = { { ItemFlagsShadowRole, 0, QtVariantPropertyManager::flagTypeId, "flags" }, - { 0, 0, 0, 0 } + { 0, 0, nullptr, nullptr } }; QtVariantProperty *TreeWidgetEditor::setupPropertyGroup(const QString &title, PropertyDefinition *propDefs) @@ -205,7 +205,7 @@ int TreeWidgetEditor::defaultItemFlags() const void TreeWidgetEditor::on_newItemButton_clicked() { QTreeWidgetItem *curItem = ui.treeWidget->currentItem(); - QTreeWidgetItem *newItem = 0; + QTreeWidgetItem *newItem = nullptr; ui.treeWidget->blockSignals(true); if (curItem) { if (curItem->parent()) @@ -250,7 +250,7 @@ void TreeWidgetEditor::on_deleteItemButton_clicked() if (!curItem) return; - QTreeWidgetItem *nextCurrent = 0; + QTreeWidgetItem *nextCurrent = nullptr; if (curItem->parent()) { int idx = curItem->parent()->indexOfChild(curItem); if (idx == curItem->parent()->childCount() - 1) diff --git a/src/designer/src/components/widgetbox/widgetbox.cpp b/src/designer/src/components/widgetbox/widgetbox.cpp index bb602b0c2..4415c4dbe 100644 --- a/src/designer/src/components/widgetbox/widgetbox.cpp +++ b/src/designer/src/components/widgetbox/widgetbox.cpp @@ -55,7 +55,7 @@ namespace qdesigner_internal { class WidgetBoxFilterLineEdit : public QLineEdit { public: - explicit WidgetBoxFilterLineEdit(QWidget *parent = 0) : QLineEdit(parent), m_defaultFocusPolicy(focusPolicy()) + explicit WidgetBoxFilterLineEdit(QWidget *parent = nullptr) : QLineEdit(parent), m_defaultFocusPolicy(focusPolicy()) { setFocusPolicy(Qt::NoFocus); } protected: @@ -130,7 +130,7 @@ void WidgetBox::handleMousePress(const QString &name, const QString &xml, const return; DomUI *ui = xmlToUi(name, xml, true); - if (ui == 0) + if (ui == nullptr) return; QList item_list; item_list.append(new WidgetBoxDnDItem(core(), ui, global_mouse_pos)); @@ -213,14 +213,14 @@ static const QDesignerMimeData *checkDragEvent(QDropEvent * event, const QDesignerMimeData *mimeData = qobject_cast(event->mimeData()); if (!mimeData) { event->ignore(); - return 0; + return nullptr; } // If desired, ignore a widget box drag and drop, where widget==0. if (!acceptEventsFromWidgetBox) { const bool fromWidgetBox = !mimeData->items().first()->widget(); if (fromWidgetBox) { event->ignore(); - return 0; + return nullptr; } } diff --git a/src/designer/src/components/widgetbox/widgetbox.h b/src/designer/src/components/widgetbox/widgetbox.h index a9389e154..27e1b461a 100644 --- a/src/designer/src/components/widgetbox/widgetbox.h +++ b/src/designer/src/components/widgetbox/widgetbox.h @@ -45,7 +45,8 @@ class QT_WIDGETBOX_EXPORT WidgetBox : public QDesignerWidgetBox { Q_OBJECT public: - explicit WidgetBox(QDesignerFormEditorInterface *core, QWidget *parent = 0, Qt::WindowFlags flags = 0); + explicit WidgetBox(QDesignerFormEditorInterface *core, QWidget *parent = nullptr, + Qt::WindowFlags flags = {}); ~WidgetBox() override; QDesignerFormEditorInterface *core() const; diff --git a/src/designer/src/components/widgetbox/widgetbox_dnditem.cpp b/src/designer/src/components/widgetbox/widgetbox_dnditem.cpp index c0c96b5b2..30fbc2337 100644 --- a/src/designer/src/components/widgetbox/widgetbox_dnditem.cpp +++ b/src/designer/src/components/widgetbox/widgetbox_dnditem.cpp @@ -129,7 +129,7 @@ static QSize geometryProp(const DomWidget *dw) if (prop->attributeName() != geometry) continue; DomRect *dr = prop->elementRect(); - if (dr == 0) + if (dr == nullptr) continue; return QSize(dr->elementWidth(), dr->elementHeight()); } @@ -154,7 +154,7 @@ static QSize domWidgetSize(const DomWidget *dw) const auto &elementItems = dl->elementItem(); for (DomLayoutItem *item : elementItems) { const DomWidget *child = item->elementWidget(); - if (child == 0) + if (child == nullptr) continue; size = geometryProp(child); if (size.isValid()) @@ -171,8 +171,8 @@ static QWidget *decorationFromDomWidget(DomUI *dom_ui, QDesignerFormEditorInterf // We have the builder create the articial QWidget fake top level as a tooltip // because the size algorithm works better at weird DPI settings // if the actual widget is created as a child of a container - QWidget *fakeTopLevel = builder.createUI(dom_ui, static_cast(0)); - fakeTopLevel->setParent(0, Qt::ToolTip); // Container + QWidget *fakeTopLevel = builder.createUI(dom_ui, nullptr); + fakeTopLevel->setParent(nullptr, Qt::ToolTip); // Container // Actual widget const DomWidget *domW = dom_ui->elementWidget()->elementWidget().front(); QWidget *w = fakeTopLevel->findChildren().constFirst(); @@ -208,7 +208,7 @@ WidgetBoxDnDItem::WidgetBoxDnDItem(QDesignerFormEditorInterface *core, QWidget *decoration = decorationFromDomWidget(dom_ui, core); decoration->move(global_mouse_pos - QPoint(5, 5)); - init(dom_ui, 0, decoration, global_mouse_pos); + init(dom_ui, nullptr, decoration, global_mouse_pos); } } diff --git a/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp b/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp index e27c82d63..f103cb006 100644 --- a/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp +++ b/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp @@ -105,7 +105,7 @@ WidgetBoxCategoryEntry::WidgetBoxCategoryEntry(const QDesignerWidgetBoxInterface class WidgetBoxCategoryModel : public QAbstractListModel { public: - explicit WidgetBoxCategoryModel(QDesignerFormEditorInterface *core, QObject *parent = 0); + explicit WidgetBoxCategoryModel(QDesignerFormEditorInterface *core, QObject *parent = nullptr); // QAbstractListModel QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; @@ -336,7 +336,7 @@ QDesignerWidgetBoxInterface::Widget WidgetBoxCategoryModel::widgetAt(int row) co class WidgetBoxCategoryEntryDelegate : public QItemDelegate { public: - explicit WidgetBoxCategoryEntryDelegate(QWidget *parent = 0) : QItemDelegate(parent) {} + explicit WidgetBoxCategoryEntryDelegate(QWidget *parent = nullptr) : QItemDelegate(parent) {} QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override; diff --git a/src/designer/src/components/widgetbox/widgetboxcategorylistview.h b/src/designer/src/components/widgetbox/widgetboxcategorylistview.h index 8f97d3005..657dad148 100644 --- a/src/designer/src/components/widgetbox/widgetboxcategorylistview.h +++ b/src/designer/src/components/widgetbox/widgetboxcategorylistview.h @@ -55,7 +55,7 @@ public: // Whether to access the filtered or unfiltered view enum AccessMode { FilteredAccess, UnfilteredAccess }; - explicit WidgetBoxCategoryListView(QDesignerFormEditorInterface *core, QWidget *parent = 0); + explicit WidgetBoxCategoryListView(QDesignerFormEditorInterface *core, QWidget *parent = nullptr); void setViewMode(ViewMode vm); void dropWidgets(const QList &item_list); diff --git a/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp b/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp index 9ee316e18..df59c392c 100644 --- a/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp +++ b/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp @@ -89,7 +89,7 @@ WidgetBoxTreeWidget::WidgetBoxTreeWidget(QDesignerFormEditorInterface *core, QWi QTreeWidget(parent), m_core(core), m_iconMode(false), - m_scratchPadDeleteTimer(0) + m_scratchPadDeleteTimer(nullptr) { setFocusPolicy(Qt::NoFocus); setIndentation(0); @@ -121,7 +121,7 @@ QIcon WidgetBoxTreeWidget::iconForWidget(const QString &iconName) const WidgetBoxCategoryListView *WidgetBoxTreeWidget::categoryViewAt(int idx) const { - WidgetBoxCategoryListView *rc = 0; + WidgetBoxCategoryListView *rc = nullptr; if (QTreeWidgetItem *cat_item = topLevelItem(idx)) if (QTreeWidgetItem *embedItem = cat_item->child(0)) rc = qobject_cast(itemWidget(embedItem, 0)); @@ -218,13 +218,13 @@ void WidgetBoxTreeWidget::slotSave() void WidgetBoxTreeWidget::handleMousePress(QTreeWidgetItem *item) { - if (item == 0) + if (item == nullptr) return; if (QApplication::mouseButtons() != Qt::LeftButton) return; - if (item->parent() == 0) { + if (item->parent() == nullptr) { item->setExpanded(!item->isExpanded()); return; } @@ -656,7 +656,7 @@ WidgetBoxTreeWidget::CategoryList WidgetBoxTreeWidget::loadCustomCategoryList() void WidgetBoxTreeWidget::adjustSubListSize(QTreeWidgetItem *cat_item) { QTreeWidgetItem *embedItem = cat_item->child(0); - if (embedItem == 0) + if (embedItem == nullptr) return; WidgetBoxCategoryListView *list_widget = static_cast(itemWidget(embedItem, 0)); @@ -866,8 +866,8 @@ void WidgetBoxTreeWidget::contextMenuEvent(QContextMenuEvent *e) { QTreeWidgetItem *item = itemAt(e->pos()); - const bool scratchpad_menu = item != 0 - && item->parent() != 0 + const bool scratchpad_menu = item != nullptr + && item->parent() != nullptr && topLevelRole(item->parent()) == SCRATCHPAD_ITEM; QMenu menu; @@ -903,17 +903,17 @@ void WidgetBoxTreeWidget::contextMenuEvent(QContextMenuEvent *e) void WidgetBoxTreeWidget::dropWidgets(const QList &item_list) { - QTreeWidgetItem *scratch_item = 0; - WidgetBoxCategoryListView *categoryView = 0; + QTreeWidgetItem *scratch_item = nullptr; + WidgetBoxCategoryListView *categoryView = nullptr; bool added = false; for (QDesignerDnDItemInterface *item : item_list) { QWidget *w = item->widget(); - if (w == 0) + if (w == nullptr) continue; DomUI *dom_ui = item->domUi(); - if (dom_ui == 0) + if (dom_ui == nullptr) continue; const int scratch_idx = ensureScratchpad(); @@ -922,7 +922,7 @@ void WidgetBoxTreeWidget::dropWidgets(const QList &i // Temporarily remove the fake toplevel in-between DomWidget *fakeTopLevel = dom_ui->takeElementWidget(); - DomWidget *firstWidget = 0; + DomWidget *firstWidget = nullptr; if (fakeTopLevel && !fakeTopLevel->elementWidget().isEmpty()) { firstWidget = fakeTopLevel->elementWidget().constFirst(); dom_ui->setElementWidget(firstWidget); diff --git a/src/designer/src/components/widgetbox/widgetboxtreewidget.h b/src/designer/src/components/widgetbox/widgetboxtreewidget.h index 47204897e..a770a19e7 100644 --- a/src/designer/src/components/widgetbox/widgetboxtreewidget.h +++ b/src/designer/src/components/widgetbox/widgetboxtreewidget.h @@ -59,7 +59,7 @@ public: typedef QDesignerWidgetBoxInterface::Category Category; typedef QDesignerWidgetBoxInterface::CategoryList CategoryList; - explicit WidgetBoxTreeWidget(QDesignerFormEditorInterface *core, QWidget *parent = 0); + explicit WidgetBoxTreeWidget(QDesignerFormEditorInterface *core, QWidget *parent = nullptr); ~WidgetBoxTreeWidget(); int categoryCount() const; diff --git a/src/designer/src/designer/appfontdialog.cpp b/src/designer/src/designer/appfontdialog.cpp index e5a76033f..42e3ea1ab 100644 --- a/src/designer/src/designer/appfontdialog.cpp +++ b/src/designer/src/designer/appfontdialog.cpp @@ -215,7 +215,7 @@ const AppFontManager::FileNameFontIdPairs &AppFontManager::fonts() const class AppFontModel : public QStandardItemModel { Q_DISABLE_COPY(AppFontModel) public: - AppFontModel(QObject *parent = 0); + AppFontModel(QObject *parent = nullptr); void init(const AppFontManager &mgr); void add(const QString &fontFile, int id); diff --git a/src/designer/src/designer/appfontdialog.h b/src/designer/src/designer/appfontdialog.h index ca5bc3320..959b71a6d 100644 --- a/src/designer/src/designer/appfontdialog.h +++ b/src/designer/src/designer/appfontdialog.h @@ -49,7 +49,7 @@ class AppFontWidget : public QGroupBox Q_DISABLE_COPY(AppFontWidget) Q_OBJECT public: - explicit AppFontWidget(QWidget *parent = 0); + explicit AppFontWidget(QWidget *parent = nullptr); QStringList fontFiles() const; @@ -77,7 +77,7 @@ class AppFontDialog : public QDialog Q_DISABLE_COPY(AppFontDialog) Q_OBJECT public: - explicit AppFontDialog(QWidget *parent = 0); + explicit AppFontDialog(QWidget *parent = nullptr); private: AppFontWidget *m_appFontWidget; diff --git a/src/designer/src/designer/mainwindow.cpp b/src/designer/src/designer/mainwindow.cpp index 1e882cc71..d856e396e 100644 --- a/src/designer/src/designer/mainwindow.cpp +++ b/src/designer/src/designer/mainwindow.cpp @@ -293,7 +293,7 @@ bool ToolBarManager::restoreState(const QByteArray &state, int version) DockedMainWindow::DockedMainWindow(QDesignerWorkbench *wb, QMenu *toolBarMenu, const QVector &toolWindows) : - m_toolBarManager(0) + m_toolBarManager(nullptr) { setObjectName(QStringLiteral("MDIWindow")); setWindowTitle(mainWindowTitle()); diff --git a/src/designer/src/designer/mainwindow.h b/src/designer/src/designer/mainwindow.h index 9c4687ad6..640730f89 100644 --- a/src/designer/src/designer/mainwindow.h +++ b/src/designer/src/designer/mainwindow.h @@ -58,7 +58,7 @@ class MainWindowBase: public QMainWindow Q_DISABLE_COPY(MainWindowBase) Q_OBJECT protected: - explicit MainWindowBase(QWidget *parent = 0, Qt::WindowFlags flags = Qt::Window); + explicit MainWindowBase(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::Window); public: enum CloseEventPolicy { @@ -92,7 +92,7 @@ class DockedMdiArea : public QMdiArea Q_DISABLE_COPY(DockedMdiArea) Q_OBJECT public: - explicit DockedMdiArea(const QString &extension, QWidget *parent = 0); + explicit DockedMdiArea(const QString &extension, QWidget *parent = nullptr); signals: void fileDropped(const QString &); diff --git a/src/designer/src/designer/newform.cpp b/src/designer/src/designer/newform.cpp index b4eb49554..797e60149 100644 --- a/src/designer/src/designer/newform.cpp +++ b/src/designer/src/designer/newform.cpp @@ -59,9 +59,9 @@ NewForm::NewForm(QDesignerWorkbench *workbench, QWidget *parentWidget, const QSt m_newFormWidget(QDesignerNewFormWidgetInterface::createNewFormWidget(workbench->core())), m_workbench(workbench), m_chkShowOnStartup(new QCheckBox(tr("Show this Dialog on Startup"))), - m_createButton(new QPushButton(QApplication::translate("NewForm", "C&reate", 0))), - m_recentButton(new QPushButton(QApplication::translate("NewForm", "Recent", 0))), - m_buttonBox(0) + m_createButton(new QPushButton(QApplication::translate("NewForm", "C&reate", nullptr))), + m_recentButton(new QPushButton(QApplication::translate("NewForm", "Recent", nullptr))), + m_buttonBox(nullptr) { setWindowTitle(tr("New Form")); QDesignerSettings settings(m_workbench->core()); @@ -94,10 +94,10 @@ QDialogButtonBox *NewForm::createButtonBox() { // Dialog buttons with 'recent files' QDialogButtonBox *buttonBox = new QDialogButtonBox; - buttonBox->addButton(QApplication::translate("NewForm", "&Close", 0), + buttonBox->addButton(QApplication::translate("NewForm", "&Close", nullptr), QDialogButtonBox::RejectRole); buttonBox->addButton(m_createButton, QDialogButtonBox::AcceptRole); - buttonBox->addButton(QApplication::translate("NewForm", "&Open...", 0), + buttonBox->addButton(QApplication::translate("NewForm", "&Open...", nullptr), QDialogButtonBox::ActionRole); buttonBox->addButton(m_recentButton, QDialogButtonBox::ActionRole); QDesignerActions *da = m_workbench->actionManager(); diff --git a/src/designer/src/designer/preferencesdialog.h b/src/designer/src/designer/preferencesdialog.h index 16b625314..654e93388 100644 --- a/src/designer/src/designer/preferencesdialog.h +++ b/src/designer/src/designer/preferencesdialog.h @@ -45,7 +45,7 @@ class PreferencesDialog: public QDialog { Q_OBJECT public: - explicit PreferencesDialog(QDesignerFormEditorInterface *core, QWidget *parentWidget = 0); + explicit PreferencesDialog(QDesignerFormEditorInterface *core, QWidget *parentWidget = nullptr); ~PreferencesDialog(); diff --git a/src/designer/src/designer/qdesigner.cpp b/src/designer/src/designer/qdesigner.cpp index daec73b08..ff244ec29 100644 --- a/src/designer/src/designer/qdesigner.cpp +++ b/src/designer/src/designer/qdesigner.cpp @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE static const char *designerApplicationName = "Designer"; static const char designerDisplayName[] = "Qt Designer"; static const char *designerWarningPrefix = "Designer: "; -static QtMessageHandler previousMessageHandler = 0; +static QtMessageHandler previousMessageHandler = nullptr; static void designerMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) { @@ -73,8 +73,8 @@ static void designerMessageHandler(QtMsgType type, const QMessageLogContext &con QDesigner::QDesigner(int &argc, char **argv) : QApplication(argc, argv), - m_server(0), - m_client(0), + m_server(nullptr), + m_client(nullptr), m_workbench(0), m_suppressNewFormShow(false) { setOrganizationName(QStringLiteral("QtProject")); diff --git a/src/designer/src/designer/qdesigner_actions.cpp b/src/designer/src/designer/qdesigner_actions.cpp index c221262da..5ac2c565c 100644 --- a/src/designer/src/designer/qdesigner_actions.cpp +++ b/src/designer/src/designer/qdesigner_actions.cpp @@ -138,7 +138,7 @@ static QString getSaveFileNameWithExtension(QWidget *parent, const QString &titl QString saveFile; while (true) { - saveFile = QFileDialog::getSaveFileName(parent, title, dir, filter, 0, QFileDialog::DontConfirmOverwrite); + saveFile = QFileDialog::getSaveFileName(parent, title, dir, filter, nullptr, QFileDialog::DontConfirmOverwrite); if (saveFile.isEmpty()) return saveFile; @@ -206,7 +206,7 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench) m_quitAction->setIcon(QIcon::fromTheme(QStringLiteral("application-exit"), m_quitAction->icon())); #endif - Q_ASSERT(m_core != 0); + Q_ASSERT(m_core != nullptr); qdesigner_internal::QDesignerFormWindowManager *ifwm = qobject_cast(m_core->formWindowManager()); Q_ASSERT(ifwm); m_previewManager = ifwm->previewManager(); @@ -238,7 +238,7 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench) m_saveFormAction->setProperty(QDesignerActions::defaultToolbarPropertyName, true); QDesignerFormWindowManagerInterface *formWindowManager = m_core->formWindowManager(); - Q_ASSERT(formWindowManager != 0); + Q_ASSERT(formWindowManager != nullptr); // // file actions @@ -939,7 +939,7 @@ void QDesignerActions::shutdown() void QDesignerActions::activeFormWindowChanged(QDesignerFormWindowInterface *formWindow) { - const bool enable = formWindow != 0; + const bool enable = formWindow != nullptr; m_saveFormAction->setEnabled(enable); m_saveFormAsAction->setEnabled(enable); m_saveAllFormsAction->setEnabled(enable); diff --git a/src/designer/src/designer/qdesigner_appearanceoptions.h b/src/designer/src/designer/qdesigner_appearanceoptions.h index f6936252c..b0b87c796 100644 --- a/src/designer/src/designer/qdesigner_appearanceoptions.h +++ b/src/designer/src/designer/qdesigner_appearanceoptions.h @@ -72,7 +72,7 @@ class QDesignerAppearanceOptionsWidget : public QWidget { Q_OBJECT public: - explicit QDesignerAppearanceOptionsWidget(QWidget *parent = 0); + explicit QDesignerAppearanceOptionsWidget(QWidget *parent = nullptr); ~QDesignerAppearanceOptionsWidget(); AppearanceOptions appearanceOptions() const; diff --git a/src/designer/src/designer/qdesigner_formwindow.cpp b/src/designer/src/designer/qdesigner_formwindow.cpp index da2324eca..77223e416 100644 --- a/src/designer/src/designer/qdesigner_formwindow.cpp +++ b/src/designer/src/designer/qdesigner_formwindow.cpp @@ -267,7 +267,7 @@ void QDesignerFormWindow::slotGeometryChanged() // so, do not do it for the main container only const QDesignerFormEditorInterface *core = m_editor->core(); QObject *object = core->propertyEditor()->object(); - if (object == 0 || !object->isWidgetType()) + if (object == nullptr || !object->isWidgetType()) return; static const QString geometryProperty = QStringLiteral("geometry"); const QDesignerPropertySheetExtension *sheet = qt_extension(core->extensionManager(), object); diff --git a/src/designer/src/designer/qdesigner_formwindow.h b/src/designer/src/designer/qdesigner_formwindow.h index e5dfb13b7..da82f2495 100644 --- a/src/designer/src/designer/qdesigner_formwindow.h +++ b/src/designer/src/designer/qdesigner_formwindow.h @@ -42,7 +42,7 @@ class QDesignerFormWindow: public QWidget Q_OBJECT public: QDesignerFormWindow(QDesignerFormWindowInterface *formWindow, QDesignerWorkbench *workbench, - QWidget *parent = 0, Qt::WindowFlags flags = 0); + QWidget *parent = nullptr, Qt::WindowFlags flags = {}); void firstShow(); diff --git a/src/designer/src/designer/qdesigner_server.cpp b/src/designer/src/designer/qdesigner_server.cpp index 42026a5f0..e223f0b2c 100644 --- a/src/designer/src/designer/qdesigner_server.cpp +++ b/src/designer/src/designer/qdesigner_server.cpp @@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE QDesignerServer::QDesignerServer(QObject *parent) : QObject(parent) { - m_socket = 0; + m_socket = nullptr; m_server = new QTcpServer(this); if (m_server->listen(QHostAddress::LocalHost, 0)) { connect(m_server, &QTcpServer::newConnection, @@ -90,13 +90,13 @@ void QDesignerServer::readFromClient() void QDesignerServer::socketClosed() { - m_socket = 0; + m_socket = nullptr; } void QDesignerServer::handleNewConnection() { // no need for more than one connection - if (m_socket == 0) { + if (m_socket == nullptr) { m_socket = m_server->nextPendingConnection(); connect(m_socket, &QTcpSocket::readyRead, this, &QDesignerServer::readFromClient); diff --git a/src/designer/src/designer/qdesigner_server.h b/src/designer/src/designer/qdesigner_server.h index 2ad451b50..28eec7887 100644 --- a/src/designer/src/designer/qdesigner_server.h +++ b/src/designer/src/designer/qdesigner_server.h @@ -40,7 +40,7 @@ class QDesignerServer: public QObject { Q_OBJECT public: - explicit QDesignerServer(QObject *parent = 0); + explicit QDesignerServer(QObject *parent = nullptr); ~QDesignerServer() override; quint16 serverPort() const; @@ -61,7 +61,7 @@ class QDesignerClient: public QObject { Q_OBJECT public: - explicit QDesignerClient(quint16 port, QObject *parent = 0); + explicit QDesignerClient(quint16 port, QObject *parent = nullptr); ~QDesignerClient() override; private slots: diff --git a/src/designer/src/designer/qdesigner_toolwindow.cpp b/src/designer/src/designer/qdesigner_toolwindow.cpp index 0c77b1dbd..e71edcb0c 100644 --- a/src/designer/src/designer/qdesigner_toolwindow.cpp +++ b/src/designer/src/designer/qdesigner_toolwindow.cpp @@ -145,7 +145,7 @@ QRect QDesignerToolWindow::availableToolWindowGeometry() const // ---------------------- PropertyEditorToolWindow -static inline QWidget *createPropertyEditor(QDesignerFormEditorInterface *core, QWidget *parent = 0) +static inline QWidget *createPropertyEditor(QDesignerFormEditorInterface *core, QWidget *parent = nullptr) { QDesignerPropertyEditorInterface *widget = QDesignerComponents::createPropertyEditor(core, parent); core->setPropertyEditor(widget); @@ -202,7 +202,7 @@ void PropertyEditorToolWindow::showEvent(QShowEvent *event) // ---------------------- ActionEditorToolWindow -static inline QWidget *createActionEditor(QDesignerFormEditorInterface *core, QWidget *parent = 0) +static inline QWidget *createActionEditor(QDesignerFormEditorInterface *core, QWidget *parent = nullptr) { QDesignerActionEditorInterface *widget = QDesignerComponents::createActionEditor(core, parent); core->setActionEditor(widget); @@ -244,7 +244,7 @@ QRect ActionEditorToolWindow::geometryHint() const // ---------------------- ObjectInspectorToolWindow -static inline QWidget *createObjectInspector(QDesignerFormEditorInterface *core, QWidget *parent = 0) +static inline QWidget *createObjectInspector(QDesignerFormEditorInterface *core, QWidget *parent = nullptr) { QDesignerObjectInspectorInterface *widget = QDesignerComponents::createObjectInspector(core, parent); core->setObjectInspector(widget); @@ -296,7 +296,7 @@ public: ResourceEditorToolWindow::ResourceEditorToolWindow(QDesignerWorkbench *workbench) : QDesignerToolWindow(workbench, - QDesignerComponents::createResourceEditor(workbench->core(), 0), + QDesignerComponents::createResourceEditor(workbench->core(), nullptr), QStringLiteral("qt_designer_resourceeditor"), QDesignerToolWindow::tr("Resource Browser"), QStringLiteral("__qt_resource_editor_tool_action"), @@ -330,7 +330,7 @@ public: SignalSlotEditorToolWindow::SignalSlotEditorToolWindow(QDesignerWorkbench *workbench) : QDesignerToolWindow(workbench, - QDesignerComponents::createSignalSlotEditor(workbench->core(), 0), + QDesignerComponents::createSignalSlotEditor(workbench->core(), nullptr), QStringLiteral("qt_designer_signalsloteditor"), QDesignerToolWindow::tr("Signal/Slot Editor"), QStringLiteral("__qt_signal_slot_editor_tool_action"), @@ -354,7 +354,7 @@ QRect SignalSlotEditorToolWindow::geometryHint() const // ---------------------- WidgetBoxToolWindow -static inline QWidget *createWidgetBox(QDesignerFormEditorInterface *core, QWidget *parent = 0) +static inline QWidget *createWidgetBox(QDesignerFormEditorInterface *core, QWidget *parent = nullptr) { QDesignerWidgetBoxInterface *widget = QDesignerComponents::createWidgetBox(core, parent); core->setWidgetBox(widget); @@ -411,7 +411,7 @@ QDesignerToolWindow *QDesignerToolWindow::createStandardToolWindow(StandardToolW default: break; } - return 0; + return nullptr; } diff --git a/src/designer/src/designer/qdesigner_toolwindow.h b/src/designer/src/designer/qdesigner_toolwindow.h index 1049d6dcc..88ea6bb00 100644 --- a/src/designer/src/designer/qdesigner_toolwindow.h +++ b/src/designer/src/designer/qdesigner_toolwindow.h @@ -71,7 +71,7 @@ protected: const QString &title, const QString &actionObjectName, Qt::DockWidgetArea dockAreaHint, - QWidget *parent = 0, + QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::Window); public: diff --git a/src/designer/src/designer/qdesigner_workbench.cpp b/src/designer/src/designer/qdesigner_workbench.cpp index 7ca7155f9..2de61bea1 100644 --- a/src/designer/src/designer/qdesigner_workbench.cpp +++ b/src/designer/src/designer/qdesigner_workbench.cpp @@ -90,7 +90,7 @@ static QDockWidget *dockWidgetOf(const QWidget *w) } } Q_ASSERT("Dock widget not found"); - return 0; + return nullptr; } // ------------ QDesignerWorkbench::Position @@ -330,7 +330,7 @@ Qt::WindowFlags QDesignerWorkbench::magicalWindowFlags(const QWidget *widgetForF return Qt::Window; default: Q_ASSERT(0); - return 0; + return nullptr; } } @@ -341,12 +341,12 @@ QWidget *QDesignerWorkbench::magicalParent(const QWidget *w) const // Use widget box as parent for all windows except self. This will // result in having just one entry in the MS Windows task bar. QWidget *widgetBoxWrapper = widgetBoxToolWindow(); - return w == widgetBoxWrapper ? 0 : widgetBoxWrapper; + return w == widgetBoxWrapper ? nullptr : widgetBoxWrapper; } case DockedMode: return m_dockedMainWindow->mdiArea(); case NeutralMode: - return 0; + return nullptr; default: Q_ASSERT(0); return 0; @@ -361,7 +361,7 @@ void QDesignerWorkbench::switchToNeutralMode() if (m_mode == TopLevelMode) { delete m_topLevelData.toolbarManager; - m_topLevelData.toolbarManager = 0; + m_topLevelData.toolbarManager = nullptr; qDeleteAll(m_topLevelData.toolbars); m_topLevelData.toolbars.clear(); } @@ -370,23 +370,23 @@ void QDesignerWorkbench::switchToNeutralMode() for (QDesignerToolWindow *tw : qAsConst(m_toolWindows)) { tw->setCloseEventPolicy(MainWindowBase::AcceptCloseEvents); - tw->setParent(0); + tw->setParent(nullptr); } for (QDesignerFormWindow *fw : qAsConst(m_formWindows)) { - fw->setParent(0); + fw->setParent(nullptr); fw->setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); } #ifndef Q_OS_MACOS - m_globalMenuBar->setParent(0); + m_globalMenuBar->setParent(nullptr); #endif - m_core->setTopLevel(0); - qDesigner->setMainWindow(0); + m_core->setTopLevel(nullptr); + qDesigner->setMainWindow(nullptr); delete m_dockedMainWindow; - m_dockedMainWindow = 0; + m_dockedMainWindow = nullptr; } void QDesignerWorkbench::switchToDockedMode() @@ -558,7 +558,7 @@ QDesignerFormWindow *QDesignerWorkbench::formWindow(int index) const QRect QDesignerWorkbench::desktopGeometry() const { // Return geometry of the desktop designer is running in. - QWidget *widget = 0; + QWidget *widget = nullptr; switch (m_mode) { case DockedMode: widget = m_dockedMainWindow; @@ -683,7 +683,7 @@ QDesignerFormWindow *QDesignerWorkbench::findFormWindow(QWidget *widget) const return formWindow; } - return 0; + return nullptr; } bool QDesignerWorkbench::handleClose() @@ -750,7 +750,7 @@ void QDesignerWorkbench::updateWindowMenu(QDesignerFormWindowInterface *fwi) { bool minimizeChecked = false; bool minimizeEnabled = false; - QDesignerFormWindow *activeFormWindow = 0; + QDesignerFormWindow *activeFormWindow = nullptr; do { if (!fwi) break; @@ -800,7 +800,7 @@ bool QDesignerWorkbench::readInBackup() return false; const QMessageBox::StandardButton answer = - QMessageBox::question(0, tr("Backup Information"), + QMessageBox::question(nullptr, tr("Backup Information"), tr("The last session of Designer was not terminated correctly. " "Backup files were left behind. Do you want to load them?"), QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes); @@ -908,13 +908,13 @@ QDesignerFormWindow * QDesignerWorkbench::loadForm(const QString &fileName, if (!file.open(QFile::ReadOnly|QFile::Text)) { *errorMessage = tr("The file %1 could not be opened: %2").arg(file.fileName(), file.errorString()); - return 0; + return nullptr; } // Create a form QDesignerFormWindowManagerInterface *formWindowManager = m_core->formWindowManager(); - QDesignerFormWindow *formWindow = new QDesignerFormWindow(/*formWindow=*/ 0, this); + QDesignerFormWindow *formWindow = new QDesignerFormWindow(/*formWindow=*/ nullptr, this); addFormWindow(formWindow); QDesignerFormWindowInterface *editor = formWindow->editor(); Q_ASSERT(editor); @@ -927,7 +927,7 @@ QDesignerFormWindow * QDesignerWorkbench::loadForm(const QString &fileName, removeFormWindow(formWindow); formWindowManager->removeFormWindow(editor); m_core->metaDataBase()->remove(editor); - return 0; + return nullptr; } if (qdesigner_internal::FormWindowBase *fwb = qobject_cast(editor)) @@ -967,7 +967,7 @@ QDesignerFormWindow * QDesignerWorkbench::openForm(const QString &fileName, QStr { QDesignerFormWindow *rc = loadForm(fileName, true, errorMessage); if (!rc) - return 0; + return nullptr; rc->editor()->setFileName(fileName); rc->firstShow(); return rc; @@ -979,7 +979,7 @@ QDesignerFormWindow * QDesignerWorkbench::openTemplate(const QString &templateFi { QDesignerFormWindow *rc = loadForm(templateFileName, false, errorMessage); if (!rc) - return 0; + return nullptr; rc->editor()->setFileName(editorFileName); rc->firstShow(); diff --git a/src/designer/src/designer/saveformastemplate.h b/src/designer/src/designer/saveformastemplate.h index 14bf4ecfa..7b8f8b8da 100644 --- a/src/designer/src/designer/saveformastemplate.h +++ b/src/designer/src/designer/saveformastemplate.h @@ -42,7 +42,7 @@ class SaveFormAsTemplate: public QDialog public: explicit SaveFormAsTemplate(QDesignerFormEditorInterface *m_core, QDesignerFormWindowInterface *formWindow, - QWidget *parent = 0); + QWidget *parent = nullptr); ~SaveFormAsTemplate() override; private slots: diff --git a/src/designer/src/designer/versiondialog.cpp b/src/designer/src/designer/versiondialog.cpp index 7ae440664..9350fa397 100644 --- a/src/designer/src/designer/versiondialog.cpp +++ b/src/designer/src/designer/versiondialog.cpp @@ -43,7 +43,7 @@ class VersionLabel : public QLabel { Q_OBJECT public: - VersionLabel(QWidget *parent = 0); + VersionLabel(QWidget *parent = nullptr); signals: void triggered(); 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 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(QAbstractExtensionManager *manager, QObject *object) \ -{ QObject *extension = manager->extension(object, Q_TYPEID(IFace)); return extension ? static_cast(extension->qt_metacast(IFace##_iid)) : static_cast(Q_NULLPTR); } +{ QObject *extension = manager->extension(object, Q_TYPEID(IFace)); return extension ? static_cast(extension->qt_metacast(IFace##_iid)) : static_cast(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(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(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 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(); 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(); 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(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(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(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(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 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 QObject *ExtensionFactory::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(core->extensionManager(), core) == 0) { + if (qt_extension(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(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(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(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(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( fw->core()->extensionManager(), widget->parentWidget()); - if (c != 0) { + if (c != nullptr) { for (int i = 0; icount(); ++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(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(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(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(0)); + std::fill(formCells, formCells + FormLayoutColumns * formNRows, nullptr); QWidget **formPtr = formCells; const int matchingColumns = qMin(m_ncols, static_cast(FormLayoutColumns)); for (int r = 0; r < m_nrows; r++) { @@ -1104,7 +1104,7 @@ void GridLayout::doLayout() if (needReparent) reparentToLayoutBase(w); - Qt::Alignment alignment = Qt::Alignment(0); + Qt::Alignment alignment = Qt::Alignment(nullptr); if (const Spacer *spacer = qobject_cast(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(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(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(); 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 LabelList; const LabelList labelList = fw->findChildren(); 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(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 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 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 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(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(lb) || qobject_cast(lb))) { + if (!m_layoutBase && lb != nullptr && !(qobject_cast(lb) || qobject_cast(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(core()->extensionManager(), m_mainWindow); - Q_ASSERT(c != 0); + Q_ASSERT(c != nullptr); for (int i=0; icount(); ++i) { if (c->widget(i) == m_menuBar) { c->remove(i); @@ -1579,7 +1579,7 @@ void DeleteStatusBarCommand::redo() { if (m_mainWindow) { QDesignerContainerExtension *c = qt_extension(core()->extensionManager(), m_mainWindow); - Q_ASSERT(c != 0); + Q_ASSERT(c != nullptr); for (int i=0; icount(); ++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(wf->createWidget(QStringLiteral("QToolBar"), 0)); + m_toolBar = qobject_cast(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(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(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(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(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(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(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(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(core()->extensionManager(), m_mainWindow); - Q_ASSERT(c != 0); + Q_ASSERT(c != nullptr); for (int i=0; icount(); ++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(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(target); QDesignerMenu *menu = qobject_cast(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(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(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(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(fw->core()->objectInspector()); @@ -1001,9 +1001,9 @@ void QDesignerMenu::createRealMenuAction(QAction *action) void QDesignerMenu::removeRealMenu(QAction *action) { QDesignerMenu *menu = qobject_cast(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(action->menu()); @@ -700,13 +700,13 @@ QDesignerActionProviderExtension *QDesignerMenuBar::actionProvider() return qt_extension(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(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(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 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 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 . typedef QPair 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(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(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(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 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::createPropertyShe { Object *object = qobject_cast(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(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(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(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(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 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(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(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(0)); + QAction *newSeperatorAct = new QAction(tr("Append Separator"), nullptr); + itemData.setValue(static_cast(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(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(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(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()) { 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(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(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 &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 &cell) override; @@ -1786,7 +1786,7 @@ class QGridLayoutSupport: public GridLikeLayoutSupportBase { 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 { 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 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 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 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 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 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 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 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 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 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 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 > pathToParentItemQueue; - pathToParentItemQueue.enqueue(qMakePair(root, static_cast(0))); + pathToParentItemQueue.enqueue(qMakePair(root, static_cast(nullptr))); while (!pathToParentItemQueue.isEmpty()) { QPair 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, //