summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf4
-rw-r--r--src/assistant/assistant/helpviewer_qtb.cpp2
-rw-r--r--src/assistant/assistant/preferencesdialog.cpp34
-rw-r--r--src/assistant/assistant/preferencesdialog.h2
-rw-r--r--src/assistant/assistant/topicchooser.cpp25
-rw-r--r--src/assistant/qcollectiongenerator/main.c1
-rw-r--r--src/assistant/qhelpgenerator/helpgenerator.cpp10
-rw-r--r--src/designer/data/ui4.xsd1
-rw-r--r--src/designer/src/components/buddyeditor/buddyeditor.cpp36
-rw-r--r--src/designer/src/components/buddyeditor/buddyeditor_plugin.cpp11
-rw-r--r--src/designer/src/components/buddyeditor/buddyeditor_plugin.h4
-rw-r--r--src/designer/src/components/buddyeditor/buddyeditor_tool.cpp4
-rw-r--r--src/designer/src/components/buddyeditor/buddyeditor_tool.h2
-rw-r--r--src/designer/src/components/formeditor/default_actionprovider.cpp2
-rw-r--r--src/designer/src/components/formeditor/default_actionprovider.h12
-rw-r--r--src/designer/src/components/formeditor/default_container.cpp4
-rw-r--r--src/designer/src/components/formeditor/default_container.h22
-rw-r--r--src/designer/src/components/formeditor/default_layoutdecoration.cpp4
-rw-r--r--src/designer/src/components/formeditor/default_layoutdecoration.h2
-rw-r--r--src/designer/src/components/formeditor/deviceprofiledialog.h4
-rw-r--r--src/designer/src/components/formeditor/dpi_chooser.cpp6
-rw-r--r--src/designer/src/components/formeditor/dpi_chooser.h4
-rw-r--r--src/designer/src/components/formeditor/embeddedoptionspage.cpp16
-rw-r--r--src/designer/src/components/formeditor/embeddedoptionspage.h6
-rw-r--r--src/designer/src/components/formeditor/formeditor.h2
-rw-r--r--src/designer/src/components/formeditor/formeditor_optionspage.cpp4
-rw-r--r--src/designer/src/components/formeditor/formwindow.cpp144
-rw-r--r--src/designer/src/components/formeditor/formwindow.h26
-rw-r--r--src/designer/src/components/formeditor/formwindow_dnditem.cpp10
-rw-r--r--src/designer/src/components/formeditor/formwindow_widgetstack.cpp13
-rw-r--r--src/designer/src/components/formeditor/formwindow_widgetstack.h4
-rw-r--r--src/designer/src/components/formeditor/formwindowcursor.cpp2
-rw-r--r--src/designer/src/components/formeditor/formwindowcursor.h2
-rw-r--r--src/designer/src/components/formeditor/formwindowmanager.cpp48
-rw-r--r--src/designer/src/components/formeditor/formwindowmanager.h48
-rw-r--r--src/designer/src/components/formeditor/formwindowsettings.cpp13
-rw-r--r--src/designer/src/components/formeditor/formwindowsettings.h2
-rw-r--r--src/designer/src/components/formeditor/formwindowsettings.ui341
-rw-r--r--src/designer/src/components/formeditor/itemview_propertysheet.cpp2
-rw-r--r--src/designer/src/components/formeditor/itemview_propertysheet.h10
-rw-r--r--src/designer/src/components/formeditor/layout_propertysheet.h2
-rw-r--r--src/designer/src/components/formeditor/line_propertysheet.h4
-rw-r--r--src/designer/src/components/formeditor/previewactiongroup.cpp4
-rw-r--r--src/designer/src/components/formeditor/previewactiongroup.h4
-rw-r--r--src/designer/src/components/formeditor/qdesigner_resource.cpp152
-rw-r--r--src/designer/src/components/formeditor/qdesigner_resource.h6
-rw-r--r--src/designer/src/components/formeditor/qlayoutwidget_propertysheet.h4
-rw-r--r--src/designer/src/components/formeditor/qmainwindow_container.cpp20
-rw-r--r--src/designer/src/components/formeditor/qmainwindow_container.h4
-rw-r--r--src/designer/src/components/formeditor/qmdiarea_container.cpp16
-rw-r--r--src/designer/src/components/formeditor/qmdiarea_container.h8
-rw-r--r--src/designer/src/components/formeditor/qwizard_container.cpp6
-rw-r--r--src/designer/src/components/formeditor/qwizard_container.h12
-rw-r--r--src/designer/src/components/formeditor/spacer_propertysheet.h4
-rw-r--r--src/designer/src/components/formeditor/templateoptionspage.h6
-rw-r--r--src/designer/src/components/formeditor/tool_widgeteditor.cpp14
-rw-r--r--src/designer/src/components/formeditor/widgetselection.cpp26
-rw-r--r--src/designer/src/components/lib/lib.pro2
-rw-r--r--src/designer/src/components/lib/qdesigner_components.cpp2
-rw-r--r--src/designer/src/components/objectinspector/objectinspector.cpp44
-rw-r--r--src/designer/src/components/objectinspector/objectinspector.h2
-rw-r--r--src/designer/src/components/objectinspector/objectinspectormodel.cpp32
-rw-r--r--src/designer/src/components/objectinspector/objectinspectormodel_p.h14
-rw-r--r--src/designer/src/components/propertyeditor/brushpropertymanager.cpp2
-rw-r--r--src/designer/src/components/propertyeditor/designerpropertymanager.cpp32
-rw-r--r--src/designer/src/components/propertyeditor/designerpropertymanager.h12
-rw-r--r--src/designer/src/components/propertyeditor/fontpropertymanager.cpp5
-rw-r--r--src/designer/src/components/propertyeditor/fontpropertymanager.h14
-rw-r--r--src/designer/src/components/propertyeditor/newdynamicpropertydialog.h2
-rw-r--r--src/designer/src/components/propertyeditor/paletteeditor.cpp13
-rw-r--r--src/designer/src/components/propertyeditor/paletteeditor.h28
-rw-r--r--src/designer/src/components/propertyeditor/paletteeditorbutton.cpp2
-rw-r--r--src/designer/src/components/propertyeditor/paletteeditorbutton.h2
-rw-r--r--src/designer/src/components/propertyeditor/previewframe.cpp4
-rw-r--r--src/designer/src/components/propertyeditor/propertyeditor.cpp50
-rw-r--r--src/designer/src/components/propertyeditor/propertyeditor.h22
-rw-r--r--src/designer/src/components/propertyeditor/qlonglongvalidator.h4
-rw-r--r--src/designer/src/components/propertyeditor/stringlisteditor.cpp4
-rw-r--r--src/designer/src/components/propertyeditor/stringlisteditor.h4
-rw-r--r--src/designer/src/components/propertyeditor/stringlisteditorbutton.cpp2
-rw-r--r--src/designer/src/components/propertyeditor/stringlisteditorbutton.h2
-rw-r--r--src/designer/src/components/signalsloteditor/connectdialog.cpp6
-rw-r--r--src/designer/src/components/signalsloteditor/connectdialog_p.h2
-rw-r--r--src/designer/src/components/signalsloteditor/signalslot_utils.cpp8
-rw-r--r--src/designer/src/components/signalsloteditor/signalslot_utils_p.h4
-rw-r--r--src/designer/src/components/signalsloteditor/signalsloteditor.cpp30
-rw-r--r--src/designer/src/components/signalsloteditor/signalsloteditor_p.h6
-rw-r--r--src/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp11
-rw-r--r--src/designer/src/components/signalsloteditor/signalsloteditor_plugin.h4
-rw-r--r--src/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp4
-rw-r--r--src/designer/src/components/signalsloteditor/signalsloteditor_tool.h2
-rw-r--r--src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp64
-rw-r--r--src/designer/src/components/signalsloteditor/signalsloteditorwindow.h3
-rw-r--r--src/designer/src/components/tabordereditor/tabordereditor.cpp4
-rw-r--r--src/designer/src/components/tabordereditor/tabordereditor_plugin.cpp15
-rw-r--r--src/designer/src/components/tabordereditor/tabordereditor_plugin.h4
-rw-r--r--src/designer/src/components/tabordereditor/tabordereditor_tool.cpp4
-rw-r--r--src/designer/src/components/tabordereditor/tabordereditor_tool.h2
-rw-r--r--src/designer/src/components/taskmenu/button_taskmenu.cpp29
-rw-r--r--src/designer/src/components/taskmenu/button_taskmenu.h34
-rw-r--r--src/designer/src/components/taskmenu/combobox_taskmenu.cpp6
-rw-r--r--src/designer/src/components/taskmenu/combobox_taskmenu.h2
-rw-r--r--src/designer/src/components/taskmenu/containerwidget_taskmenu.cpp14
-rw-r--r--src/designer/src/components/taskmenu/containerwidget_taskmenu.h16
-rw-r--r--src/designer/src/components/taskmenu/groupbox_taskmenu.h2
-rw-r--r--src/designer/src/components/taskmenu/inplace_widget_helper.cpp6
-rw-r--r--src/designer/src/components/taskmenu/itemlisteditor.cpp7
-rw-r--r--src/designer/src/components/taskmenu/itemlisteditor.h4
-rw-r--r--src/designer/src/components/taskmenu/label_taskmenu.h4
-rw-r--r--src/designer/src/components/taskmenu/layouttaskmenu.cpp2
-rw-r--r--src/designer/src/components/taskmenu/layouttaskmenu.h8
-rw-r--r--src/designer/src/components/taskmenu/lineedit_taskmenu.h4
-rw-r--r--src/designer/src/components/taskmenu/listwidget_taskmenu.cpp6
-rw-r--r--src/designer/src/components/taskmenu/listwidget_taskmenu.h4
-rw-r--r--src/designer/src/components/taskmenu/listwidgeteditor.cpp12
-rw-r--r--src/designer/src/components/taskmenu/menutaskmenu.cpp4
-rw-r--r--src/designer/src/components/taskmenu/menutaskmenu.h8
-rw-r--r--src/designer/src/components/taskmenu/tablewidget_taskmenu.cpp6
-rw-r--r--src/designer/src/components/taskmenu/tablewidget_taskmenu.h4
-rw-r--r--src/designer/src/components/taskmenu/tablewidgeteditor.cpp18
-rw-r--r--src/designer/src/components/taskmenu/tablewidgeteditor.h2
-rw-r--r--src/designer/src/components/taskmenu/taskmenu_component.cpp2
-rw-r--r--src/designer/src/components/taskmenu/taskmenu_component.h2
-rw-r--r--src/designer/src/components/taskmenu/textedit_taskmenu.h8
-rw-r--r--src/designer/src/components/taskmenu/toolbar_taskmenu.cpp4
-rw-r--r--src/designer/src/components/taskmenu/toolbar_taskmenu.h8
-rw-r--r--src/designer/src/components/taskmenu/treewidget_taskmenu.cpp6
-rw-r--r--src/designer/src/components/taskmenu/treewidget_taskmenu.h2
-rw-r--r--src/designer/src/components/taskmenu/treewidgeteditor.cpp24
-rw-r--r--src/designer/src/components/widgetbox/widgetbox.cpp8
-rw-r--r--src/designer/src/components/widgetbox/widgetbox.h3
-rw-r--r--src/designer/src/components/widgetbox/widgetbox_dnditem.cpp10
-rw-r--r--src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp6
-rw-r--r--src/designer/src/components/widgetbox/widgetboxcategorylistview.h2
-rw-r--r--src/designer/src/components/widgetbox/widgetboxtreewidget.cpp29
-rw-r--r--src/designer/src/components/widgetbox/widgetboxtreewidget.h16
-rw-r--r--src/designer/src/designer/appfontdialog.cpp16
-rw-r--r--src/designer/src/designer/appfontdialog.h8
-rw-r--r--src/designer/src/designer/assistantclient.cpp5
-rw-r--r--src/designer/src/designer/assistantclient.h2
-rw-r--r--src/designer/src/designer/mainwindow.cpp7
-rw-r--r--src/designer/src/designer/mainwindow.h18
-rw-r--r--src/designer/src/designer/newform.cpp10
-rw-r--r--src/designer/src/designer/newform.h2
-rw-r--r--src/designer/src/designer/preferencesdialog.h2
-rw-r--r--src/designer/src/designer/qdesigner.cpp6
-rw-r--r--src/designer/src/designer/qdesigner_actions.cpp180
-rw-r--r--src/designer/src/designer/qdesigner_actions.h6
-rw-r--r--src/designer/src/designer/qdesigner_appearanceoptions.cpp3
-rw-r--r--src/designer/src/designer/qdesigner_appearanceoptions.h4
-rw-r--r--src/designer/src/designer/qdesigner_formwindow.cpp2
-rw-r--r--src/designer/src/designer/qdesigner_formwindow.h2
-rw-r--r--src/designer/src/designer/qdesigner_server.cpp6
-rw-r--r--src/designer/src/designer/qdesigner_server.h4
-rw-r--r--src/designer/src/designer/qdesigner_toolwindow.cpp14
-rw-r--r--src/designer/src/designer/qdesigner_toolwindow.h2
-rw-r--r--src/designer/src/designer/qdesigner_workbench.cpp48
-rw-r--r--src/designer/src/designer/qdesigner_workbench.h10
-rw-r--r--src/designer/src/designer/saveformastemplate.cpp4
-rw-r--r--src/designer/src/designer/saveformastemplate.h2
-rw-r--r--src/designer/src/designer/versiondialog.cpp16
-rw-r--r--src/designer/src/lib/extension/default_extensionfactory.cpp6
-rw-r--r--src/designer/src/lib/extension/default_extensionfactory.h2
-rw-r--r--src/designer/src/lib/extension/extension.h4
-rw-r--r--src/designer/src/lib/extension/qextensionmanager.cpp6
-rw-r--r--src/designer/src/lib/extension/qextensionmanager.h4
-rw-r--r--src/designer/src/lib/sdk/abstractactioneditor.cpp6
-rw-r--r--src/designer/src/lib/sdk/abstractdialoggui.cpp8
-rw-r--r--src/designer/src/lib/sdk/abstractdialoggui_p.h14
-rw-r--r--src/designer/src/lib/sdk/abstractformeditor.cpp31
-rw-r--r--src/designer/src/lib/sdk/abstractformeditor.h2
-rw-r--r--src/designer/src/lib/sdk/abstractformwindow.cpp40
-rw-r--r--src/designer/src/lib/sdk/abstractformwindow.h6
-rw-r--r--src/designer/src/lib/sdk/abstractformwindowmanager.cpp4
-rw-r--r--src/designer/src/lib/sdk/abstractformwindowmanager.h4
-rw-r--r--src/designer/src/lib/sdk/abstractformwindowtool.cpp4
-rw-r--r--src/designer/src/lib/sdk/abstractformwindowtool.h2
-rw-r--r--src/designer/src/lib/sdk/abstractintegration.cpp16
-rw-r--r--src/designer/src/lib/sdk/abstractintegration.h48
-rw-r--r--src/designer/src/lib/sdk/abstractintrospection.cpp32
-rw-r--r--src/designer/src/lib/sdk/abstractintrospection_p.h2
-rw-r--r--src/designer/src/lib/sdk/abstractlanguage.h4
-rw-r--r--src/designer/src/lib/sdk/abstractmetadatabase.cpp4
-rw-r--r--src/designer/src/lib/sdk/abstractmetadatabase.h2
-rw-r--r--src/designer/src/lib/sdk/abstractnewformwidget.cpp4
-rw-r--r--src/designer/src/lib/sdk/abstractnewformwidget.h6
-rw-r--r--src/designer/src/lib/sdk/abstractobjectinspector.cpp6
-rw-r--r--src/designer/src/lib/sdk/abstractpromotioninterface.h2
-rw-r--r--src/designer/src/lib/sdk/abstractpropertyeditor.cpp6
-rw-r--r--src/designer/src/lib/sdk/abstractresourcebrowser.cpp5
-rw-r--r--src/designer/src/lib/sdk/abstractresourcebrowser.h2
-rw-r--r--src/designer/src/lib/sdk/abstractwidgetbox.h8
-rw-r--r--src/designer/src/lib/sdk/abstractwidgetdatabase.cpp2
-rw-r--r--src/designer/src/lib/sdk/abstractwidgetdatabase.h2
-rw-r--r--src/designer/src/lib/sdk/abstractwidgetfactory.cpp4
-rw-r--r--src/designer/src/lib/sdk/abstractwidgetfactory.h4
-rw-r--r--src/designer/src/lib/sdk/taskmenu.h2
-rw-r--r--src/designer/src/lib/shared/actioneditor.cpp30
-rw-r--r--src/designer/src/lib/shared/actioneditor_p.h5
-rw-r--r--src/designer/src/lib/shared/actionrepository.cpp9
-rw-r--r--src/designer/src/lib/shared/actionrepository_p.h16
-rw-r--r--src/designer/src/lib/shared/codedialog.cpp63
-rw-r--r--src/designer/src/lib/shared/codedialog_p.h8
-rw-r--r--src/designer/src/lib/shared/connectionedit.cpp103
-rw-r--r--src/designer/src/lib/shared/connectionedit_p.h10
-rw-r--r--src/designer/src/lib/shared/csshighlighter_p.h2
-rw-r--r--src/designer/src/lib/shared/deviceprofile.cpp15
-rw-r--r--src/designer/src/lib/shared/dialoggui.cpp7
-rw-r--r--src/designer/src/lib/shared/dialoggui_p.h14
-rw-r--r--src/designer/src/lib/shared/extensionfactory_p.h6
-rw-r--r--src/designer/src/lib/shared/formlayoutmenu.cpp30
-rw-r--r--src/designer/src/lib/shared/formlayoutmenu_p.h4
-rw-r--r--src/designer/src/lib/shared/formwindowbase.cpp55
-rw-r--r--src/designer/src/lib/shared/formwindowbase_p.h6
-rw-r--r--src/designer/src/lib/shared/grid.cpp2
-rw-r--r--src/designer/src/lib/shared/gridpanel_p.h2
-rw-r--r--src/designer/src/lib/shared/htmlhighlighter_p.h2
-rw-r--r--src/designer/src/lib/shared/iconselector.cpp45
-rw-r--r--src/designer/src/lib/shared/iconselector_p.h12
-rw-r--r--src/designer/src/lib/shared/invisible_widget_p.h2
-rw-r--r--src/designer/src/lib/shared/layout.cpp42
-rw-r--r--src/designer/src/lib/shared/layout_p.h4
-rw-r--r--src/designer/src/lib/shared/layoutinfo.cpp27
-rw-r--r--src/designer/src/lib/shared/layoutinfo_p.h6
-rw-r--r--src/designer/src/lib/shared/metadatabase.cpp6
-rw-r--r--src/designer/src/lib/shared/metadatabase_p.h2
-rw-r--r--src/designer/src/lib/shared/morphmenu.cpp30
-rw-r--r--src/designer/src/lib/shared/morphmenu_p.h14
-rw-r--r--src/designer/src/lib/shared/newformwidget.cpp24
-rw-r--r--src/designer/src/lib/shared/newformwidget_p.h12
-rw-r--r--src/designer/src/lib/shared/plaintexteditor_p.h2
-rw-r--r--src/designer/src/lib/shared/plugindialog_p.h2
-rw-r--r--src/designer/src/lib/shared/pluginmanager.cpp14
-rw-r--r--src/designer/src/lib/shared/pluginmanager_p.h2
-rw-r--r--src/designer/src/lib/shared/previewconfigurationwidget.cpp6
-rw-r--r--src/designer/src/lib/shared/previewconfigurationwidget_p.h2
-rw-r--r--src/designer/src/lib/shared/previewmanager.cpp56
-rw-r--r--src/designer/src/lib/shared/promotionmodel.cpp10
-rw-r--r--src/designer/src/lib/shared/promotiontaskmenu.cpp6
-rw-r--r--src/designer/src/lib/shared/promotiontaskmenu_p.h6
-rw-r--r--src/designer/src/lib/shared/propertylineedit_p.h4
-rw-r--r--src/designer/src/lib/shared/qdesigner_command.cpp126
-rw-r--r--src/designer/src/lib/shared/qdesigner_command2.cpp8
-rw-r--r--src/designer/src/lib/shared/qdesigner_command2_p.h8
-rw-r--r--src/designer/src/lib/shared/qdesigner_command_p.h46
-rw-r--r--src/designer/src/lib/shared/qdesigner_dnditem.cpp12
-rw-r--r--src/designer/src/lib/shared/qdesigner_dnditem_p.h6
-rw-r--r--src/designer/src/lib/shared/qdesigner_dockwidget.cpp4
-rw-r--r--src/designer/src/lib/shared/qdesigner_dockwidget_p.h2
-rw-r--r--src/designer/src/lib/shared/qdesigner_formbuilder.cpp22
-rw-r--r--src/designer/src/lib/shared/qdesigner_formbuilder_p.h4
-rw-r--r--src/designer/src/lib/shared/qdesigner_formwindowcommand.cpp4
-rw-r--r--src/designer/src/lib/shared/qdesigner_formwindowcommand_p.h2
-rw-r--r--src/designer/src/lib/shared/qdesigner_formwindowmanager.cpp6
-rw-r--r--src/designer/src/lib/shared/qdesigner_formwindowmanager_p.h4
-rw-r--r--src/designer/src/lib/shared/qdesigner_introspection.cpp14
-rw-r--r--src/designer/src/lib/shared/qdesigner_introspection_p.h2
-rw-r--r--src/designer/src/lib/shared/qdesigner_membersheet.cpp11
-rw-r--r--src/designer/src/lib/shared/qdesigner_membersheet_p.h4
-rw-r--r--src/designer/src/lib/shared/qdesigner_menu.cpp60
-rw-r--r--src/designer/src/lib/shared/qdesigner_menu_p.h10
-rw-r--r--src/designer/src/lib/shared/qdesigner_menubar.cpp37
-rw-r--r--src/designer/src/lib/shared/qdesigner_menubar_p.h12
-rw-r--r--src/designer/src/lib/shared/qdesigner_objectinspector_p.h2
-rw-r--r--src/designer/src/lib/shared/qdesigner_promotion.cpp8
-rw-r--r--src/designer/src/lib/shared/qdesigner_promotiondialog.cpp8
-rw-r--r--src/designer/src/lib/shared/qdesigner_promotiondialog_p.h6
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertycommand.cpp22
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertycommand_p.h42
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertyeditor.cpp7
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertyeditor_p.h6
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertysheet.cpp95
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertysheet_p.h8
-rw-r--r--src/designer/src/lib/shared/qdesigner_stackedbox.cpp10
-rw-r--r--src/designer/src/lib/shared/qdesigner_stackedbox_p.h4
-rw-r--r--src/designer/src/lib/shared/qdesigner_tabwidget.cpp14
-rw-r--r--src/designer/src/lib/shared/qdesigner_tabwidget_p.h4
-rw-r--r--src/designer/src/lib/shared/qdesigner_taskmenu.cpp34
-rw-r--r--src/designer/src/lib/shared/qdesigner_taskmenu_p.h4
-rw-r--r--src/designer/src/lib/shared/qdesigner_toolbar.cpp28
-rw-r--r--src/designer/src/lib/shared/qdesigner_toolbox.cpp10
-rw-r--r--src/designer/src/lib/shared/qdesigner_toolbox_p.h6
-rw-r--r--src/designer/src/lib/shared/qdesigner_utils.cpp26
-rw-r--r--src/designer/src/lib/shared/qdesigner_utils_p.h43
-rw-r--r--src/designer/src/lib/shared/qdesigner_widget_p.h2
-rw-r--r--src/designer/src/lib/shared/qdesigner_widgetbox.cpp9
-rw-r--r--src/designer/src/lib/shared/qdesigner_widgetbox_p.h4
-rw-r--r--src/designer/src/lib/shared/qdesigner_widgetitem.cpp10
-rw-r--r--src/designer/src/lib/shared/qdesigner_widgetitem_p.h6
-rw-r--r--src/designer/src/lib/shared/qlayout_widget.cpp80
-rw-r--r--src/designer/src/lib/shared/qlayout_widget_p.h8
-rw-r--r--src/designer/src/lib/shared/qsimpleresource.cpp2
-rw-r--r--src/designer/src/lib/shared/qsimpleresource_p.h8
-rw-r--r--src/designer/src/lib/shared/qtresourceeditordialog.cpp148
-rw-r--r--src/designer/src/lib/shared/qtresourceeditordialog_p.h8
-rw-r--r--src/designer/src/lib/shared/qtresourcemodel.cpp30
-rw-r--r--src/designer/src/lib/shared/qtresourcemodel_p.h14
-rw-r--r--src/designer/src/lib/shared/qtresourceview.cpp36
-rw-r--r--src/designer/src/lib/shared/qtresourceview_p.h14
-rw-r--r--src/designer/src/lib/shared/rcc.cpp10
-rw-r--r--src/designer/src/lib/shared/richtexteditor.cpp34
-rw-r--r--src/designer/src/lib/shared/richtexteditor_p.h2
-rw-r--r--src/designer/src/lib/shared/selectsignaldialog.cpp6
-rw-r--r--src/designer/src/lib/shared/selectsignaldialog_p.h2
-rw-r--r--src/designer/src/lib/shared/shared_settings_p.h2
-rw-r--r--src/designer/src/lib/shared/sheet_delegate.cpp1
-rw-r--r--src/designer/src/lib/shared/signalslotdialog.cpp8
-rw-r--r--src/designer/src/lib/shared/signalslotdialog_p.h10
-rw-r--r--src/designer/src/lib/shared/spacer_widget.cpp9
-rw-r--r--src/designer/src/lib/shared/spacer_widget_p.h12
-rw-r--r--src/designer/src/lib/shared/stylesheeteditor.cpp8
-rw-r--r--src/designer/src/lib/shared/stylesheeteditor_p.h2
-rw-r--r--src/designer/src/lib/shared/textpropertyeditor.cpp15
-rw-r--r--src/designer/src/lib/shared/textpropertyeditor_p.h8
-rw-r--r--src/designer/src/lib/shared/widgetdatabase.cpp52
-rw-r--r--src/designer/src/lib/shared/widgetdatabase_p.h58
-rw-r--r--src/designer/src/lib/shared/widgetfactory.cpp56
-rw-r--r--src/designer/src/lib/shared/widgetfactory_p.h6
-rw-r--r--src/designer/src/lib/shared/zoomwidget.cpp20
-rw-r--r--src/designer/src/lib/shared/zoomwidget_p.h42
-rw-r--r--src/designer/src/lib/uilib/abstractformbuilder.cpp123
-rw-r--r--src/designer/src/lib/uilib/abstractformbuilder.h11
-rw-r--r--src/designer/src/lib/uilib/formbuilder.cpp32
-rw-r--r--src/designer/src/lib/uilib/formbuilderextra.cpp22
-rw-r--r--src/designer/src/lib/uilib/formbuilderextra_p.h20
-rw-r--r--src/designer/src/lib/uilib/properties.cpp14
-rw-r--r--src/designer/src/lib/uilib/properties_p.h8
-rw-r--r--src/designer/src/lib/uilib/resourcebuilder.cpp4
-rw-r--r--src/designer/src/lib/uilib/textbuilder.cpp2
-rw-r--r--src/designer/src/lib/uilib/ui4.cpp7
-rw-r--r--src/designer/src/lib/uilib/ui4_p.h124
-rw-r--r--src/designer/src/plugins/activeqt/qdesigneraxwidget.h2
-rw-r--r--src/designer/src/plugins/qquickwidget/qquickwidget_plugin.cpp1
-rw-r--r--src/designer/src/plugins/qquickwidget/qquickwidget_plugin.h4
-rw-r--r--src/designer/src/uitools/quiloader.cpp38
-rw-r--r--src/designer/src/uitools/quiloader.h2
-rw-r--r--src/kmap2qmap/main.cpp12
-rw-r--r--src/linguist/linguist/main.cpp19
-rw-r--r--src/linguist/linguist/mainwindow.cpp2
-rw-r--r--src/linguist/linguist/messagemodel.cpp4
-rw-r--r--src/linguist/lupdate/cpp.cpp106
-rw-r--r--src/linguist/lupdate/cpp.h129
-rw-r--r--src/linguist/lupdate/java.cpp20
-rw-r--r--src/linguist/lupdate/lupdate.h14
-rw-r--r--src/linguist/lupdate/lupdate.pro1
-rw-r--r--src/linguist/lupdate/main.cpp10
-rw-r--r--src/linguist/lupdate/merge.cpp4
-rw-r--r--src/linguist/lupdate/qdeclarative.cpp37
-rw-r--r--src/linguist/lupdate/ui.cpp4
-rw-r--r--src/linguist/shared/profileevaluator.cpp2
-rw-r--r--src/linguist/shared/projectdescriptionreader.cpp8
-rw-r--r--src/linguist/shared/qmakebuiltins.cpp15
-rw-r--r--src/linguist/shared/qmakeevaluator.cpp26
-rw-r--r--src/linguist/shared/qmakeevaluator.h15
-rw-r--r--src/linguist/shared/ts.cpp2
-rw-r--r--src/linguist/shared/xliff.cpp7
-rw-r--r--src/macdeployqt/shared/shared.cpp11
-rw-r--r--src/makeqpf/mainwindow.cpp2
-rw-r--r--src/pixeltool/qpixeltool.cpp67
-rw-r--r--src/pixeltool/qpixeltool.h17
-rw-r--r--src/qdoc/Qt5DocToolsConfig.cmake.in56
-rw-r--r--src/qdoc/atom.cpp45
-rw-r--r--src/qdoc/atom.h65
-rw-r--r--src/qdoc/clangcodeparser.cpp102
-rw-r--r--src/qdoc/clangcodeparser.h14
-rw-r--r--src/qdoc/codechunk.cpp18
-rw-r--r--src/qdoc/codechunk.h26
-rw-r--r--src/qdoc/codemarker.cpp40
-rw-r--r--src/qdoc/codemarker.h61
-rw-r--r--src/qdoc/codeparser.cpp74
-rw-r--r--src/qdoc/codeparser.h35
-rw-r--r--src/qdoc/config.cpp277
-rw-r--r--src/qdoc/config.h130
-rw-r--r--src/qdoc/cppcodemarker.cpp36
-rw-r--r--src/qdoc/cppcodemarker.h20
-rw-r--r--src/qdoc/cppcodeparser.cpp168
-rw-r--r--src/qdoc/cppcodeparser.h31
-rw-r--r--src/qdoc/doc.cpp160
-rw-r--r--src/qdoc/doc.h69
-rw-r--r--src/qdoc/doc/examples/cpp.qdoc.sample2
-rw-r--r--src/qdoc/editdistance.cpp22
-rw-r--r--src/qdoc/editdistance.h10
-rw-r--r--src/qdoc/generator.cpp217
-rw-r--r--src/qdoc/generator.h122
-rw-r--r--src/qdoc/helpprojectwriter.cpp106
-rw-r--r--src/qdoc/helpprojectwriter.h20
-rw-r--r--src/qdoc/htmlgenerator.cpp413
-rw-r--r--src/qdoc/htmlgenerator.h67
-rw-r--r--src/qdoc/jscodemarker.cpp4
-rw-r--r--src/qdoc/jscodemarker.h4
-rw-r--r--src/qdoc/location.cpp50
-rw-r--r--src/qdoc/location.h46
-rw-r--r--src/qdoc/main.cpp211
-rw-r--r--src/qdoc/node.cpp3015
-rw-r--r--src/qdoc/node.h500
-rw-r--r--src/qdoc/openedlist.cpp79
-rw-r--r--src/qdoc/openedlist.h20
-rw-r--r--src/qdoc/parameters.cpp15
-rw-r--r--src/qdoc/parameters.h8
-rw-r--r--src/qdoc/puredocparser.cpp16
-rw-r--r--src/qdoc/puredocparser.h4
-rw-r--r--src/qdoc/qdoc.pro48
-rw-r--r--src/qdoc/qdoccommandlineparser.cpp125
-rw-r--r--src/qdoc/qdoccommandlineparser.h10
-rw-r--r--src/qdoc/qdocdatabase.cpp428
-rw-r--r--src/qdoc/qdocdatabase.h345
-rw-r--r--src/qdoc/qdocglobals.cpp172
-rw-r--r--src/qdoc/qdocglobals.h106
-rw-r--r--src/qdoc/qdocindexfiles.cpp193
-rw-r--r--src/qdoc/qdocindexfiles.h15
-rw-r--r--src/qdoc/qdoctagfiles.cpp39
-rw-r--r--src/qdoc/qdoctagfiles.h18
-rw-r--r--src/qdoc/qmlcodemarker.cpp8
-rw-r--r--src/qdoc/qmlcodemarker.h4
-rw-r--r--src/qdoc/qmlcodeparser.cpp18
-rw-r--r--src/qdoc/qmlcodeparser.h13
-rw-r--r--src/qdoc/qmlmarkupvisitor.cpp11
-rw-r--r--src/qdoc/qmlmarkupvisitor.h5
-rw-r--r--src/qdoc/qmlvisitor.cpp88
-rw-r--r--src/qdoc/qmlvisitor.h13
-rw-r--r--src/qdoc/quoter.cpp114
-rw-r--r--src/qdoc/quoter.h30
-rw-r--r--src/qdoc/sections.cpp161
-rw-r--r--src/qdoc/sections.h55
-rw-r--r--src/qdoc/separator.cpp5
-rw-r--r--src/qdoc/separator.h8
-rw-r--r--src/qdoc/text.cpp56
-rw-r--r--src/qdoc/text.h18
-rw-r--r--src/qdoc/tokenizer.cpp34
-rw-r--r--src/qdoc/tokenizer.h18
-rw-r--r--src/qdoc/tree.cpp156
-rw-r--r--src/qdoc/tree.h187
-rw-r--r--src/qdoc/utilities.cpp59
-rw-r--r--src/qdoc/utilities.h41
-rw-r--r--src/qdoc/webxmlgenerator.cpp16
-rw-r--r--src/qdoc/webxmlgenerator.h5
-rw-r--r--src/qdoc/yyindent.cpp324
-rw-r--r--src/qtattributionsscanner/Qt5AttributionsScannerTools.cmake.in56
-rw-r--r--src/qtattributionsscanner/qtattributionsscanner.pro35
-rw-r--r--src/qtdiag/qtdiag.cpp2
-rw-r--r--src/shared/qtgradienteditor/qtcolorbutton.h2
-rw-r--r--src/shared/qtgradienteditor/qtcolorline.h2
-rw-r--r--src/shared/qtgradienteditor/qtgradientdialog.h2
-rw-r--r--src/shared/qtgradienteditor/qtgradienteditor.h2
-rw-r--r--src/shared/qtgradienteditor/qtgradientstopscontroller.h2
-rw-r--r--src/shared/qtgradienteditor/qtgradientstopsmodel.cpp18
-rw-r--r--src/shared/qtgradienteditor/qtgradientstopsmodel.h2
-rw-r--r--src/shared/qtgradienteditor/qtgradientstopswidget.cpp2
-rw-r--r--src/shared/qtgradienteditor/qtgradientstopswidget.h2
-rw-r--r--src/shared/qtgradienteditor/qtgradientwidget.cpp10
-rw-r--r--src/shared/qtgradienteditor/qtgradientwidget.h2
-rw-r--r--src/shared/qtpropertybrowser/qtbuttonpropertybrowser.h2
-rw-r--r--src/shared/qtpropertybrowser/qteditorfactory.h30
-rw-r--r--src/shared/qtpropertybrowser/qtgroupboxpropertybrowser.h2
-rw-r--r--src/shared/qtpropertybrowser/qtpropertybrowser.h4
-rw-r--r--src/shared/qtpropertybrowser/qtpropertymanager.h44
-rw-r--r--src/shared/qtpropertybrowser/qttreepropertybrowser.h2
-rw-r--r--src/shared/qtpropertybrowser/qtvariantproperty.h4
-rw-r--r--src/shared/qttoolbardialog/qttoolbardialog.cpp2
-rw-r--r--src/shared/qttoolbardialog/qttoolbardialog.h4
-rw-r--r--src/windeployqt/main.cpp9
-rw-r--r--src/windeployqt/windeployqt.pro3
-rw-r--r--src/winrtrunner/main.cpp2
-rw-r--r--tests/auto/auto.pro3
-rw-r--r--tests/auto/linguist/lconvert/tst_lconvert.cpp2
-rw-r--r--tests/auto/linguist/lupdate/tst_lupdate.cpp9
-rw-r--r--tests/auto/qdoc/generatedoutput/TestCPP1
-rw-r--r--tests/auto/qdoc/generatedoutput/componentset/ProgressBar.qml (renamed from tests/auto/qdoc/qmlcomponentoutput/componentset/ProgressBar.qml)0
-rw-r--r--tests/auto/qdoc/generatedoutput/componentset/Switch.qml (renamed from tests/auto/qdoc/qmlcomponentoutput/componentset/Switch.qml)0
-rw-r--r--tests/auto/qdoc/generatedoutput/componentset/TabWidget.qml (renamed from tests/auto/qdoc/qmlcomponentoutput/componentset/TabWidget.qml)0
-rw-r--r--tests/auto/qdoc/generatedoutput/componentset/componentset.pro (renamed from tests/auto/qdoc/qmlcomponentoutput/componentset/componentset.pro)0
-rw-r--r--tests/auto/qdoc/generatedoutput/componentset/uicomponents.qdoc.sample (renamed from tests/auto/qdoc/qmlcomponentoutput/componentset/uicomponents.qdoc.sample)0
-rw-r--r--tests/auto/qdoc/generatedoutput/examples.qdoc (renamed from tests/auto/qdoc/qmlcomponentoutput/examples.qdoc)0
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/qdoctests-qdocfileoutput-linking.html28
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/qdoctests-qdocfileoutput.html (renamed from tests/auto/qdoc/qdocfileoutput/expected_output/qdoctests-qdocfileoutput.html)10
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/test-componentset-example.html49
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/testcpp-module.html43
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test-members.html21
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test-obsolete.html37
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html80
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/testqdoc-testderived-members.html22
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/testqdoc-testderived.html49
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/testqdoc.html65
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/uicomponents-qmlmodule.html20
-rw-r--r--tests/auto/qdoc/generatedoutput/generatedoutput.pro (renamed from tests/auto/qdoc/qdocfileoutput/qdocfileoutput.pro)4
-rw-r--r--tests/auto/qdoc/generatedoutput/qdoctests-outputfromqdocfiles.qdoc (renamed from tests/auto/qdoc/qdocfileoutput/qdoctests-outputfromqdocfiles.qdoc)25
-rw-r--r--tests/auto/qdoc/generatedoutput/test.qdocconf (renamed from tests/auto/qdoc/qdocfileoutput/test.qdocconf)5
-rw-r--r--tests/auto/qdoc/generatedoutput/testcpp.cpp142
-rw-r--r--tests/auto/qdoc/generatedoutput/testcpp.h50
-rw-r--r--tests/auto/qdoc/generatedoutput/testcpp.qdocconf7
-rw-r--r--tests/auto/qdoc/generatedoutput/testqml.qdocconf10
-rw-r--r--tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp162
-rw-r--r--tests/auto/qdoc/qdoc.pro4
-rw-r--r--tests/auto/qdoc/qdocfileoutput/tst_qdocfileoutput.cpp111
-rw-r--r--tests/auto/qdoc/qdocglobals/qdocglobals.pro9
-rw-r--r--tests/auto/qdoc/qdocglobals/tst_qdocglobals.cpp233
-rw-r--r--tests/auto/qhelpenginecore/tst_qhelpenginecore.cpp21
-rw-r--r--tests/auto/qhelpindexmodel/tst_qhelpindexmodel.cpp5
-rw-r--r--tests/auto/qhelpprojectdata/tst_qhelpprojectdata.cpp30
499 files changed, 9192 insertions, 7511 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 543d0a842..2c781f2ea 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -1,3 +1,5 @@
load(qt_build_config)
-MODULE_VERSION = 5.13.2
+DEFINES += QT_NO_JAVA_STYLE_ITERATORS QT_NO_LINKED_LIST
+
+MODULE_VERSION = 5.14.0
diff --git a/src/assistant/assistant/helpviewer_qtb.cpp b/src/assistant/assistant/helpviewer_qtb.cpp
index b522e1ba2..f9bdddb52 100644
--- a/src/assistant/assistant/helpviewer_qtb.cpp
+++ b/src/assistant/assistant/helpviewer_qtb.cpp
@@ -277,7 +277,7 @@ void HelpViewer::wheelEvent(QWheelEvent *e)
TRACE_OBJ
if (e->modifiers() == Qt::ControlModifier) {
e->accept();
- e->delta() > 0 ? scaleUp() : scaleDown();
+ e->angleDelta().y() > 0 ? scaleUp() : scaleDown();
} else {
QTextBrowser::wheelEvent(e);
}
diff --git a/src/assistant/assistant/preferencesdialog.cpp b/src/assistant/assistant/preferencesdialog.cpp
index 67f91326c..66d6381d3 100644
--- a/src/assistant/assistant/preferencesdialog.cpp
+++ b/src/assistant/assistant/preferencesdialog.cpp
@@ -103,6 +103,16 @@ PreferencesDialog::PreferencesDialog(QWidget *parent)
this, &PreferencesDialog::addDocumentation);
connect(m_ui.docRemoveButton, &QAbstractButton::clicked,
this, &PreferencesDialog::removeDocumentation);
+ connect(m_ui.registeredDocsFilterLineEdit, &QLineEdit::textChanged,
+ this, [this](const QString &) {
+ for (const auto item : m_namespaceToItem)
+ applyDocListFilter(item);
+ });
+ connect(m_ui.registeredDocsListWidget, &QListWidget::itemSelectionChanged,
+ this, [this](){
+ m_ui.docRemoveButton->setEnabled(
+ !m_ui.registeredDocsListWidget->selectedItems().isEmpty());
+ });
updateDocumentationPage();
}
@@ -234,8 +244,23 @@ void PreferencesDialog::updateDocumentationPage()
QListWidgetItem *item = new QListWidgetItem(namespaceName);
m_namespaceToItem.insert(namespaceName, item);
m_itemToNamespace.insert(item, namespaceName);
+ applyDocListFilter(item);
m_ui.registeredDocsListWidget->addItem(item);
}
+ m_ui.docRemoveButton->setEnabled(
+ !m_ui.registeredDocsListWidget->selectedItems().isEmpty());
+}
+
+void PreferencesDialog::applyDocListFilter(QListWidgetItem *item)
+{
+ const QString namespaceName = m_itemToNamespace.value(item);
+ const QString nameFilter = m_ui.registeredDocsFilterLineEdit->text();
+
+ const bool matches = nameFilter.isEmpty() || namespaceName.contains(nameFilter);
+
+ if (!matches)
+ item->setSelected(false);
+ item->setHidden(!matches);
}
void PreferencesDialog::filterSelected(QListWidgetItem *item)
@@ -405,12 +430,17 @@ void PreferencesDialog::addDocumentation()
m_currentSetup.m_namespaceToVersion.insert(namespaceName, version);
m_currentSetup.m_versionToNamespace[version].append(namespaceName);
+ if (!added) {
+ added = true;
+ m_ui.registeredDocsListWidget->clearSelection();
+ }
+
QListWidgetItem *item = new QListWidgetItem(namespaceName);
m_namespaceToItem.insert(namespaceName, item);
m_itemToNamespace.insert(item, namespaceName);
m_ui.registeredDocsListWidget->insertItem(m_namespaceToItem.keys().indexOf(namespaceName), item);
-
- added = true;
+ item->setSelected(true);
+ applyDocListFilter(item);
}
if (added)
diff --git a/src/assistant/assistant/preferencesdialog.h b/src/assistant/assistant/preferencesdialog.h
index 1ff39e326..b0601e280 100644
--- a/src/assistant/assistant/preferencesdialog.h
+++ b/src/assistant/assistant/preferencesdialog.h
@@ -95,6 +95,8 @@ private:
QString suggestedNewFilterName(const QString &initialFilterName) const;
QString getUniqueFilterName(const QString &windowTitle,
const QString &initialFilterName = QString());
+ void applyDocListFilter(QListWidgetItem *item);
+
void updateFilterPage();
void updateCurrentFilter();
void updateDocumentationPage();
diff --git a/src/assistant/assistant/topicchooser.cpp b/src/assistant/assistant/topicchooser.cpp
index 478ca65ed..d058646c5 100644
--- a/src/assistant/assistant/topicchooser.cpp
+++ b/src/assistant/assistant/topicchooser.cpp
@@ -120,23 +120,14 @@ bool TopicChooser::eventFilter(QObject *object, QEvent *event)
{
TRACE_OBJ
if (object == ui.lineEdit && event->type() == QEvent::KeyPress) {
- QModelIndex idx = ui.listWidget->currentIndex();
- switch ((static_cast<QKeyEvent*>(event)->key())) {
- case Qt::Key_Up:
- idx = m_filterModel->index(idx.row() - 1, idx.column(),
- idx.parent());
- if (idx.isValid())
- ui.listWidget->setCurrentIndex(idx);
- break;
-
- case Qt::Key_Down:
- idx = m_filterModel->index(idx.row() + 1, idx.column(),
- idx.parent());
- if (idx.isValid())
- ui.listWidget->setCurrentIndex(idx);
- break;
-
- default: ;
+ QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
+ switch (keyEvent->key()) {
+ case Qt::Key_Up:
+ case Qt::Key_Down:
+ case Qt::Key_PageUp:
+ case Qt::Key_PageDown:
+ QCoreApplication::sendEvent(ui.listWidget, event);
+ break;
}
} else if (ui.lineEdit && event->type() == QEvent::FocusIn
&& static_cast<QFocusEvent *>(event)->reason() != Qt::MouseFocusReason) {
diff --git a/src/assistant/qcollectiongenerator/main.c b/src/assistant/qcollectiongenerator/main.c
index 5e4e02630..783a799a1 100644
--- a/src/assistant/qcollectiongenerator/main.c
+++ b/src/assistant/qcollectiongenerator/main.c
@@ -48,6 +48,7 @@ static const char separator = '/';
int main(int argc, char *argv[])
{
+ (void)argc;
printf("The \"%s\" tool is deprecated, use \"%s\" instead.\n\n",
collectionGeneratorName, helpGeneratorName);
diff --git a/src/assistant/qhelpgenerator/helpgenerator.cpp b/src/assistant/qhelpgenerator/helpgenerator.cpp
index f5493a59b..feab1e2d5 100644
--- a/src/assistant/qhelpgenerator/helpgenerator.cpp
+++ b/src/assistant/qhelpgenerator/helpgenerator.cpp
@@ -428,14 +428,14 @@ bool HelpGeneratorPrivate::insertFiles(const QStringList &files, const QString &
return false;
emit statusChanged(tr("Insert files..."));
- QList<int> filterAtts;
+ QSet<int> filterAtts;
for (const QString &filterAtt : filterAttributes) {
m_query->prepare(QLatin1String("SELECT Id FROM FilterAttributeTable "
"WHERE Name=?"));
m_query->bindValue(0, filterAtt);
m_query->exec();
if (m_query->next())
- filterAtts.append(m_query->value(0).toInt());
+ filterAtts.insert(m_query->value(0).toInt());
}
int filterSetId = -1;
@@ -504,8 +504,8 @@ bool HelpGeneratorPrivate::insertFiles(const QStringList &files, const QString &
fileNameDataList.append(fileNameData);
m_fileMap.insert(fileName, tableFileId);
- m_fileFilterMap.insert(tableFileId, filterAtts.toSet());
- tmpFileFilterMap.insert(tableFileId, filterAtts.toSet());
+ m_fileFilterMap.insert(tableFileId, filterAtts);
+ tmpFileFilterMap.insert(tableFileId, filterAtts);
++tableFileId;
} else {
@@ -525,7 +525,7 @@ bool HelpGeneratorPrivate::insertFiles(const QStringList &files, const QString &
if (!tmpFileFilterMap.isEmpty()) {
m_query->exec(QLatin1String("BEGIN"));
for (auto it = tmpFileFilterMap.cbegin(), end = tmpFileFilterMap.cend(); it != end; ++it) {
- QList<int> filterValues = it.value().toList();
+ QList<int> filterValues = it.value().values();
std::sort(filterValues.begin(), filterValues.end());
for (int fv : qAsConst(filterValues)) {
m_query->prepare(QLatin1String("INSERT INTO FileFilterTable "
diff --git a/src/designer/data/ui4.xsd b/src/designer/data/ui4.xsd
index 8448a62b4..e1dc35d49 100644
--- a/src/designer/data/ui4.xsd
+++ b/src/designer/data/ui4.xsd
@@ -27,6 +27,7 @@
<xs:attribute name="language" type="xs:string" />
<xs:attribute name="displayname" type="xs:string" />
<xs:attribute name="idbasedtr" type="xs:boolean" />
+ <xs:attribute name="connectslotsbyname" type="xs:boolean" />
<!-- Legacy attribute generated by uic3 -->
<xs:attribute name="stdsetdef" type="xs:integer" />
<!-- Legacy attribute generated by the VS integration -->
diff --git a/src/designer/src/components/buddyeditor/buddyeditor.cpp b/src/designer/src/components/buddyeditor/buddyeditor.cpp
index d5a779580..7593326db 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<QDesignerPropertySheetExtension*>(core->extensionManager(), label);
- if (sheet == 0)
+ if (sheet == nullptr)
return QString();
const int prop_idx = sheet->indexOf(QLatin1String(buddyPropertyC));
if (prop_idx == -1)
@@ -83,7 +83,7 @@ static QString buddy(QLabel *label, QDesignerFormEditorInterface *core)
return sheet->property(prop_idx).toString();
}
-typedef QList<QLabel*> LabelList;
+using LabelList = QList<QLabel *>;
namespace qdesigner_internal {
@@ -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<QLabel*>(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<QWidget*>(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 3c1479ba8..ec7a13941 100644
--- a/src/designer/src/components/buddyeditor/buddyeditor_plugin.cpp
+++ b/src/designer/src/components/buddyeditor/buddyeditor_plugin.cpp
@@ -39,10 +39,7 @@ QT_BEGIN_NAMESPACE
using namespace qdesigner_internal;
-BuddyEditorPlugin::BuddyEditorPlugin()
- : m_initialized(false)
-{
-}
+BuddyEditorPlugin::BuddyEditorPlugin() = default;
BuddyEditorPlugin::~BuddyEditorPlugin() = default;
@@ -83,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);
@@ -94,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);
@@ -112,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_plugin.h b/src/designer/src/components/buddyeditor/buddyeditor_plugin.h
index 316d5f0d7..340c239b0 100644
--- a/src/designer/src/components/buddyeditor/buddyeditor_plugin.h
+++ b/src/designer/src/components/buddyeditor/buddyeditor_plugin.h
@@ -70,8 +70,8 @@ private slots:
private:
QPointer<QDesignerFormEditorInterface> m_core;
QHash<QDesignerFormWindowInterface*, BuddyEditorTool*> m_tools;
- bool m_initialized;
- QAction *m_action;
+ bool m_initialized = false;
+ QAction *m_action = nullptr;
};
} // namespace qdesigner_internal
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..15e5683bd 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;
@@ -107,9 +107,9 @@ private:
QMenu *m_widget;
};
-typedef ExtensionFactory<QDesignerActionProviderExtension, QToolBar, QToolBarActionProvider> QToolBarActionProviderFactory;
-typedef ExtensionFactory<QDesignerActionProviderExtension, QMenuBar, QMenuBarActionProvider> QMenuBarActionProviderFactory;
-typedef ExtensionFactory<QDesignerActionProviderExtension, QMenu, QMenuActionProvider> QMenuActionProviderFactory;
+using QToolBarActionProviderFactory = ExtensionFactory<QDesignerActionProviderExtension, QToolBar, QToolBarActionProvider>;
+using QMenuBarActionProviderFactory = ExtensionFactory<QDesignerActionProviderExtension, QMenuBar, QMenuBarActionProvider>;
+using QMenuActionProviderFactory = ExtensionFactory<QDesignerActionProviderExtension, QMenu, QMenuActionProvider>;
} // namespace qdesigner_internal
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<QScrollArea>(widget, widget->widget() == 0)
+ SingleChildContainer<QScrollArea>(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..f79fbd6e5 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<Container>::currentIndex() const
template <class Container>
void SingleChildContainer<Container>::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<QScrollA
Q_OBJECT
Q_INTERFACES(QDesignerContainerExtension)
public:
- explicit QScrollAreaContainer(QScrollArea *widget, QObject *parent = 0);
+ explicit QScrollAreaContainer(QScrollArea *widget, QObject *parent = nullptr);
};
// --------------- QDockWidgetContainer
@@ -188,14 +188,14 @@ class QDockWidgetContainer: public QObject, public SingleChildContainer<QDockWid
Q_OBJECT
Q_INTERFACES(QDesignerContainerExtension)
public:
- explicit QDockWidgetContainer(QDockWidget *widget, QObject *parent = 0);
+ explicit QDockWidgetContainer(QDockWidget *widget, QObject *parent = nullptr);
};
-typedef ExtensionFactory<QDesignerContainerExtension, QStackedWidget, QStackedWidgetContainer> QDesignerStackedWidgetContainerFactory;
-typedef ExtensionFactory<QDesignerContainerExtension, QTabWidget, QTabWidgetContainer> QDesignerTabWidgetContainerFactory;
-typedef ExtensionFactory<QDesignerContainerExtension, QToolBox, QToolBoxContainer> QDesignerToolBoxContainerFactory;
-typedef ExtensionFactory<QDesignerContainerExtension, QScrollArea, QScrollAreaContainer> QScrollAreaContainerFactory;
-typedef ExtensionFactory<QDesignerContainerExtension, QDockWidget, QDockWidgetContainer> QDockWidgetContainerFactory;
+using QDesignerStackedWidgetContainerFactory = ExtensionFactory<QDesignerContainerExtension, QStackedWidget, QStackedWidgetContainer>;
+using QDesignerTabWidgetContainerFactory = ExtensionFactory<QDesignerContainerExtension, QTabWidget, QTabWidgetContainer>;
+using QDesignerToolBoxContainerFactory = ExtensionFactory<QDesignerContainerExtension, QToolBox, QToolBoxContainer>;
+using QScrollAreaContainerFactory = ExtensionFactory<QDesignerContainerExtension, QScrollArea, QScrollAreaContainer>;
+using QDockWidgetContainerFactory = ExtensionFactory<QDesignerContainerExtension, QDockWidget, QDockWidgetContainer>;
} // namespace qdesigner_internal
QT_END_NAMESPACE
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<QWidget*>(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..e44ba0663 100644
--- a/src/designer/src/components/formeditor/deviceprofiledialog.h
+++ b/src/designer/src/components/formeditor/deviceprofiledialog.h
@@ -61,10 +61,10 @@ class DeviceProfile;
class DeviceProfileDialog : public QDialog
{
- Q_DISABLE_COPY(DeviceProfileDialog)
+ Q_DISABLE_COPY_MOVE(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..5e2f9f605 100644
--- a/src/designer/src/components/formeditor/dpi_chooser.cpp
+++ b/src/designer/src/components/formeditor/dpi_chooser.cpp
@@ -78,11 +78,9 @@ DPI_Chooser::DPI_Chooser(QWidget *parent) :
m_dpiXSpinBox(new QSpinBox),
m_dpiYSpinBox(new QSpinBox)
{
- typedef void (QComboBox::*QComboIntSignal)(int);
-
// 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));
@@ -96,7 +94,7 @@ DPI_Chooser::DPI_Chooser(QWidget *parent) :
setFocusProxy(m_predefinedCombo);
m_predefinedCombo->setEditable(false);
m_predefinedCombo->setCurrentIndex(0);
- connect(m_predefinedCombo, static_cast<QComboIntSignal>(&QComboBox::currentIndexChanged),
+ connect(m_predefinedCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &DPI_Chooser::syncSpinBoxes);
// top row with predefined settings
QVBoxLayout *vBoxLayout = new QVBoxLayout;
diff --git a/src/designer/src/components/formeditor/dpi_chooser.h b/src/designer/src/components/formeditor/dpi_chooser.h
index a04b2bdb0..0efa2cdd0 100644
--- a/src/designer/src/components/formeditor/dpi_chooser.h
+++ b/src/designer/src/components/formeditor/dpi_chooser.h
@@ -53,11 +53,11 @@ struct DPI_Entry;
/* Let the user choose a DPI settings */
class DPI_Chooser : public QWidget {
- Q_DISABLE_COPY(DPI_Chooser)
+ Q_DISABLE_COPY_MOVE(DPI_Chooser)
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.cpp b/src/designer/src/components/formeditor/embeddedoptionspage.cpp
index e17b2b6df..96a6c7c4a 100644
--- a/src/designer/src/components/formeditor/embeddedoptionspage.cpp
+++ b/src/designer/src/components/formeditor/embeddedoptionspage.cpp
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
namespace qdesigner_internal {
-typedef QList<DeviceProfile> DeviceProfileList;
+using DeviceProfileList = QList<DeviceProfile>;
enum { profileComboIndexOffset = 1 };
@@ -81,7 +81,7 @@ static bool ask(QWidget *parent,
// ------------ EmbeddedOptionsControlPrivate
class EmbeddedOptionsControlPrivate {
- Q_DISABLE_COPY(EmbeddedOptionsControlPrivate)
+ Q_DISABLE_COPY_MOVE(EmbeddedOptionsControlPrivate)
public:
EmbeddedOptionsControlPrivate(QDesignerFormEditorInterface *core);
void init(EmbeddedOptionsControl *q);
@@ -109,9 +109,9 @@ private:
QLabel *m_descriptionLabel;
DeviceProfileList m_sortedProfiles;
- EmbeddedOptionsControl *m_q;
- bool m_dirty;
+ EmbeddedOptionsControl *m_q = nullptr;
QSet<QString> m_usedProfiles;
+ bool m_dirty = false;
};
EmbeddedOptionsControlPrivate::EmbeddedOptionsControlPrivate(QDesignerFormEditorInterface *core) :
@@ -120,9 +120,7 @@ EmbeddedOptionsControlPrivate::EmbeddedOptionsControlPrivate(QDesignerFormEditor
m_addButton(new QToolButton),
m_editButton(new QToolButton),
m_deleteButton(new QToolButton),
- m_descriptionLabel(new QLabel),
- m_q(0),
- m_dirty(false)
+ m_descriptionLabel(new QLabel)
{
m_descriptionLabel->setMinimumHeight(80);
// Determine used profiles to lock them
@@ -139,8 +137,6 @@ EmbeddedOptionsControlPrivate::EmbeddedOptionsControlPrivate(QDesignerFormEditor
void EmbeddedOptionsControlPrivate::init(EmbeddedOptionsControl *q)
{
- typedef void (QComboBox::*QComboIntSignal)(int);
-
m_q = q;
QVBoxLayout *vLayout = new QVBoxLayout;
QHBoxLayout *hLayout = new QHBoxLayout;
@@ -148,7 +144,7 @@ void EmbeddedOptionsControlPrivate::init(EmbeddedOptionsControl *q)
m_profileCombo->setEditable(false);
hLayout->addWidget(m_profileCombo);
m_profileCombo->addItem(EmbeddedOptionsControl::tr("None"));
- EmbeddedOptionsControl::connect(m_profileCombo, static_cast<QComboIntSignal>(&QComboBox::currentIndexChanged),
+ EmbeddedOptionsControl::connect(m_profileCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
m_q, &EmbeddedOptionsControl::slotProfileIndexChanged);
m_addButton->setIcon(createIconSet(QString::fromUtf8("plus.png")));
diff --git a/src/designer/src/components/formeditor/embeddedoptionspage.h b/src/designer/src/components/formeditor/embeddedoptionspage.h
index f0d8b96ff..8a412ed4c 100644
--- a/src/designer/src/components/formeditor/embeddedoptionspage.h
+++ b/src/designer/src/components/formeditor/embeddedoptionspage.h
@@ -44,10 +44,10 @@ class EmbeddedOptionsControlPrivate;
/* EmbeddedOptions Control. Presents the user with a list of embedded
* device profiles he can modify/add/delete. */
class EmbeddedOptionsControl : public QWidget {
- Q_DISABLE_COPY(EmbeddedOptionsControl)
+ Q_DISABLE_COPY_MOVE(EmbeddedOptionsControl)
Q_OBJECT
public:
- explicit EmbeddedOptionsControl(QDesignerFormEditorInterface *core, QWidget *parent = 0);
+ explicit EmbeddedOptionsControl(QDesignerFormEditorInterface *core, QWidget *parent = nullptr);
~EmbeddedOptionsControl();
bool isDirty() const;
@@ -71,7 +71,7 @@ private:
// EmbeddedOptionsPage
class EmbeddedOptionsPage : public QDesignerOptionsPageInterface
{
- Q_DISABLE_COPY(EmbeddedOptionsPage)
+ Q_DISABLE_COPY_MOVE(EmbeddedOptionsPage)
public:
explicit EmbeddedOptionsPage(QDesignerFormEditorInterface *core);
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..03bc44d15 100644
--- a/src/designer/src/components/formeditor/formeditor_optionspage.cpp
+++ b/src/designer/src/components/formeditor/formeditor_optionspage.cpp
@@ -54,9 +54,9 @@ namespace qdesigner_internal {
// Zoom, currently for preview only
class ZoomSettingsWidget : public QGroupBox {
- Q_DISABLE_COPY(ZoomSettingsWidget)
+ Q_DISABLE_COPY_MOVE(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 0ebb5b14a..464d7f618 100644
--- a/src/designer/src/components/formeditor/formwindow.cpp
+++ b/src/designer/src/components/formeditor/formwindow.cpp
@@ -102,7 +102,7 @@ QT_BEGIN_NAMESPACE
namespace {
class BlockSelection
{
- Q_DISABLE_COPY(BlockSelection)
+ Q_DISABLE_COPY_MOVE(BlockSelection)
public:
BlockSelection(qdesigner_internal::FormWindow *fw)
: m_formWindow(fw),
@@ -131,7 +131,7 @@ namespace qdesigner_internal {
class FormWindow::Selection
{
- Q_DISABLE_COPY(Selection)
+ Q_DISABLE_COPY_MOVE(Selection)
public:
Selection();
~Selection();
@@ -162,7 +162,7 @@ public:
private:
- typedef QList<WidgetSelection *> SelectionPool;
+ using SelectionPool = QList<WidgetSelection *>;
SelectionPool m_selectionPool;
typedef QHash<QWidget *, WidgetSelection *> SelectionHash;
@@ -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))
@@ -713,7 +713,7 @@ bool FormWindow::handleMouseMoveEvent(QWidget *, QWidget *, QMouseEvent *e)
widget_set.insert(current);
}
- sel = widget_set.toList();
+ sel = widget_set.values();
QDesignerFormWindowCursorInterface *c = cursor();
QWidget *current = c->current();
if (sel.contains(current)) {
@@ -838,7 +838,7 @@ void FormWindow::endRectDraw()
{
if (m_rubberBand) {
delete m_rubberBand;
- m_rubberBand = 0;
+ m_rubberBand = nullptr;
}
}
@@ -1137,7 +1137,7 @@ static QSet<QString> languageKeywords()
bool FormWindow::unify(QObject *w, QString &s, bool changeIt)
{
- typedef QSet<QString> StringSet;
+ using StringSet = QSet<QString>;
QWidget *main = mainContainer();
if (!main)
@@ -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<QMainWindow*>(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<QDesignerContainerExtension*>(m_core->extensionManager(), outerContainer)) {
const int currentIndex = container->currentIndex();
- return currentIndex >= 0 ?
- container->widget(currentIndex) :
- static_cast<QWidget *>(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<const QWidget *>(w) == this)
- return 0;
+ return nullptr;
QDesignerWidgetFactoryInterface *widgetFactory = core()->widgetFactory();
QDesignerWidgetDataBaseInterface *widgetDataBase = core()->widgetDataBase();
@@ -2415,7 +2413,7 @@ void FormWindow::simplifySelection(QWidgetList *sel) const
sel->push_back(mainC);
return;
}
- typedef QVector<QWidget *> WidgetVector;
+ using WidgetVector = QVector<QWidget *>;
WidgetVector toBeRemoved;
toBeRemoved.reserve(sel->size());
const QWidgetList::const_iterator scend = sel->constEnd();
@@ -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<WidgetHandle*>(child_obj) != 0)
+ if (qobject_cast<WidgetHandle*>(child_obj) != nullptr)
continue;
QWidget *child = qobject_cast<QWidget*>(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<const WidgetHandle*>(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<QDesignerActionProviderExtension*>(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<QDesignerLayoutDecorationExtension*>(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<QDesignerDnDItemInterface*> &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<QDesignerDnDItemInterface*> &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<QDesignerDnDItemInterface*> &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<QDesignerDnDItemInterface*> &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<QDesignerDnDItemInterface*> &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<FormWindow*>(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 9edfa5d53..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);
@@ -320,10 +320,10 @@ private:
FormEditor *m_core;
FormWindowCursor *m_cursor;
- QWidget *m_mainContainer;
- QWidget *m_currentWidget;
+ QWidget *m_mainContainer = nullptr;
+ QWidget *m_currentWidget = nullptr;
- bool m_blockSelectionChanged;
+ bool m_blockSelectionChanged = false;
QPoint m_rectAnchor;
QRect m_currRect;
@@ -340,18 +340,18 @@ private:
QString m_fileName;
- typedef QPair<QPalette ,bool> PaletteAndFill;
- typedef QMap<QWidget*, PaletteAndFill> WidgetPaletteMap;
+ using PaletteAndFill = QPair<QPalette ,bool>;
+ using WidgetPaletteMap = QMap<QWidget*, PaletteAndFill>;
WidgetPaletteMap m_palettesBeforeHighlight;
- QRubberBand *m_rubberBand;
+ QRubberBand *m_rubberBand = nullptr;
- QTimer *m_selectionChangedTimer;
- QTimer *m_checkSelectionTimer;
- QTimer *m_geometryChangedTimer;
+ QTimer *m_selectionChangedTimer = nullptr;
+ QTimer *m_checkSelectionTimer = nullptr;
+ QTimer *m_geometryChangedTimer = nullptr;
FormWindowWidgetStack *m_widgetStack;
- WidgetEditorTool *m_widgetEditor;
+ WidgetEditorTool *m_widgetEditor = nullptr;
QStringList m_resourceFiles;
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<FormWindow*>(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<QAction*>(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<QWidget*>(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.cpp b/src/designer/src/components/formeditor/formwindowcursor.cpp
index 0e83de8e8..31dcdfebb 100644
--- a/src/designer/src/components/formeditor/formwindowcursor.cpp
+++ b/src/designer/src/components/formeditor/formwindowcursor.cpp
@@ -155,7 +155,7 @@ void FormWindowCursor::setProperty(const QString &name, const QVariant &value)
const int N = selectedWidgetCount();
Q_ASSERT(N);
- SetPropertyCommand::ObjectList selection;
+ QObjectList selection;
for (int i=0; i<N; ++i)
selection.push_back(selectedWidget(i));
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<QMdiSubWindow *>(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<QDesignerLanguageExtension*>(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<FormWindowManager*>(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 16fa319f4..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;
@@ -133,38 +133,38 @@ private:
// edit actions
#if QT_CONFIG(clipboard)
- QAction *m_actionCut;
- QAction *m_actionCopy;
- QAction *m_actionPaste;
+ QAction *m_actionCut = nullptr;
+ QAction *m_actionCopy = nullptr;
+ QAction *m_actionPaste = nullptr;
#endif
- QAction *m_actionSelectAll;
- QAction *m_actionDelete;
- QAction *m_actionLower;
- QAction *m_actionRaise;
+ QAction *m_actionSelectAll = nullptr;
+ QAction *m_actionDelete = nullptr;
+ QAction *m_actionLower = nullptr;
+ QAction *m_actionRaise = nullptr;
// layout actions
- QAction *m_actionHorizontalLayout;
- QAction *m_actionVerticalLayout;
- QAction *m_actionFormLayout;
- QAction *m_actionSplitHorizontal;
- QAction *m_actionSplitVertical;
- QAction *m_actionGridLayout;
- QAction *m_actionBreakLayout;
- QAction *m_actionSimplifyLayout;
- QAction *m_actionAdjustSize;
+ QAction *m_actionHorizontalLayout = nullptr;
+ QAction *m_actionVerticalLayout = nullptr;
+ QAction *m_actionFormLayout = nullptr;
+ QAction *m_actionSplitHorizontal = nullptr;
+ QAction *m_actionSplitVertical = nullptr;
+ QAction *m_actionGridLayout = nullptr;
+ QAction *m_actionBreakLayout = nullptr;
+ QAction *m_actionSimplifyLayout = nullptr;
+ QAction *m_actionAdjustSize = nullptr;
// preview actions
- QAction *m_actionDefaultPreview;
- mutable PreviewActionGroup *m_actionGroupPreviewInStyle;
- QAction *m_actionShowFormWindowSettingsDialog;
+ QAction *m_actionDefaultPreview = nullptr;
+ mutable PreviewActionGroup *m_actionGroupPreviewInStyle = nullptr;
+ QAction *m_actionShowFormWindowSettingsDialog = nullptr;
- QAction *m_actionUndo;
- QAction *m_actionRedo;
+ QAction *m_actionUndo = nullptr;
+ QAction *m_actionRedo = nullptr;
QSet<QWidget *> getUnsortedLayoutsToBeBroken(bool firstOnly) const;
bool hasLayoutsToBeBroken() const;
QWidgetList layoutsToBeBroken(QWidget *w) const;
QWidgetList layoutsToBeBroken() const;
- QUndoGroup *m_undoGroup;
+ QUndoGroup *m_undoGroup = nullptr;
};
diff --git a/src/designer/src/components/formeditor/formwindowsettings.cpp b/src/designer/src/components/formeditor/formwindowsettings.cpp
index 63fabf615..4ccd7210b 100644
--- a/src/designer/src/components/formeditor/formwindowsettings.cpp
+++ b/src/designer/src/components/formeditor/formwindowsettings.cpp
@@ -67,6 +67,7 @@ struct FormWindowData {
bool hasFormGrid{false};
Grid grid;
bool idBasedTranslations{false};
+ bool connectSlotsByName{true};
};
inline bool operator==(const FormWindowData &fd1, const FormWindowData &fd2) { return fd1.equals(fd2); }
@@ -80,6 +81,7 @@ QDebug operator<<(QDebug str, const FormWindowData &d)
<< d.pixFunction << " Author=" << d.author << " Hints=" << d.includeHints
<< " Grid=" << d.hasFormGrid << d.grid.deltaX() << d.grid.deltaY()
<< " ID-based translations" << d.idBasedTranslations
+ << " Connect slots by name" << d.connectSlotsByName
<< '\n';
return str;
}
@@ -97,7 +99,8 @@ bool FormWindowData::equals(const FormWindowData &rhs) const
includeHints == rhs.includeHints &&
hasFormGrid == rhs.hasFormGrid &&
grid == rhs.grid &&
- idBasedTranslations == rhs.idBasedTranslations;
+ idBasedTranslations == rhs.idBasedTranslations &&
+ connectSlotsByName == rhs.connectSlotsByName;
}
void FormWindowData::fromFormWindow(FormWindowBase* fw)
@@ -108,9 +111,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();
@@ -128,6 +131,7 @@ void FormWindowData::fromFormWindow(FormWindowBase* fw)
hasFormGrid = fw->hasFormGrid();
grid = hasFormGrid ? fw->designerGrid() : FormWindowBase::defaultDesignerGrid();
idBasedTranslations = fw->useIdBasedTranslations();
+ connectSlotsByName = fw->connectSlotsByName();
}
void FormWindowData::applyToFormWindow(FormWindowBase* fw) const
@@ -154,6 +158,7 @@ void FormWindowData::applyToFormWindow(FormWindowBase* fw) const
if (hasFormGrid || hadFormGrid != hasFormGrid)
fw->setDesignerGrid(hasFormGrid ? grid : FormWindowBase::defaultDesignerGrid());
fw->setUseIdBasedTranslations(idBasedTranslations);
+ fw->setConnectSlotsByName(connectSlotsByName);
}
// -------------------------- FormWindowSettings
@@ -220,6 +225,7 @@ FormWindowData FormWindowSettings::data() const
rc.hasFormGrid = m_ui->gridPanel->isChecked();
rc.grid = m_ui->gridPanel->grid();
rc.idBasedTranslations = m_ui->idBasedTranslationsCheckBox->isChecked();
+ rc.connectSlotsByName = m_ui->connectSlotsByNameCheckBox->isChecked();
return rc;
}
@@ -247,6 +253,7 @@ void FormWindowSettings::setData(const FormWindowData &data)
m_ui->gridPanel->setChecked(data.hasFormGrid);
m_ui->gridPanel->setGrid(data.grid);
m_ui->idBasedTranslationsCheckBox->setChecked(data.idBasedTranslations);
+ m_ui->connectSlotsByNameCheckBox->setChecked(data.connectSlotsByName);
}
void FormWindowSettings::accept()
diff --git a/src/designer/src/components/formeditor/formwindowsettings.h b/src/designer/src/components/formeditor/formwindowsettings.h
index 04bac0be4..8d06097a6 100644
--- a/src/designer/src/components/formeditor/formwindowsettings.h
+++ b/src/designer/src/components/formeditor/formwindowsettings.h
@@ -49,7 +49,7 @@ class FormWindowBase;
class FormWindowSettings: public QDialog
{
- Q_DISABLE_COPY(FormWindowSettings)
+ Q_DISABLE_COPY_MOVE(FormWindowSettings)
Q_OBJECT
public:
explicit FormWindowSettings(QDesignerFormWindowInterface *formWindow);
diff --git a/src/designer/src/components/formeditor/formwindowsettings.ui b/src/designer/src/components/formeditor/formwindowsettings.ui
index 6bb092078..a71ae3542 100644
--- a/src/designer/src/components/formeditor/formwindowsettings.ui
+++ b/src/designer/src/components/formeditor/formwindowsettings.ui
@@ -33,20 +33,201 @@
<rect>
<x>0</x>
<y>0</y>
- <width>470</width>
- <height>466</height>
+ <width>463</width>
+ <height>654</height>
</rect>
</property>
<property name="windowTitle">
<string>Form Settings</string>
</property>
<layout class="QGridLayout">
+ <item row="9" column="0" colspan="2">
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <widget class="qdesigner_internal::GridPanel" name="gridPanel">
+ <property name="title">
+ <string>Grid</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0" rowspan="3">
+ <widget class="QGroupBox" name="includeHintsGroupBox">
+ <property name="title">
+ <string>&amp;Include Hints</string>
+ </property>
+ <layout class="QVBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="leftMargin">
+ <number>8</number>
+ </property>
+ <property name="topMargin">
+ <number>8</number>
+ </property>
+ <property name="rightMargin">
+ <number>8</number>
+ </property>
+ <property name="bottomMargin">
+ <number>8</number>
+ </property>
+ <item>
+ <widget class="QTextEdit" name="includeHintsTextEdit"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="6" column="1">
+ <widget class="QGroupBox" name="translationsGroupBox">
+ <property name="title">
+ <string>Translations</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QCheckBox" name="idBasedTranslationsCheckBox">
+ <property name="text">
+ <string>ID-based</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <layout class="QHBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QGroupBox" name="pixmapFunctionGroupBox">
+ <property name="title">
+ <string>&amp;Pixmap Function</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <layout class="QVBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="leftMargin">
+ <number>8</number>
+ </property>
+ <property name="topMargin">
+ <number>8</number>
+ </property>
+ <property name="rightMargin">
+ <number>8</number>
+ </property>
+ <property name="bottomMargin">
+ <number>8</number>
+ </property>
+ <item>
+ <widget class="QLineEdit" name="pixmapFunctionLineEdit"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="8" column="0" colspan="2">
+ <widget class="Line" name="line">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2">
+ <widget class="QGroupBox" name="pixmapFunctionGroupBox_2">
+ <property name="title">
+ <string>&amp;Author</string>
+ </property>
+ <layout class="QVBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="leftMargin">
+ <number>8</number>
+ </property>
+ <property name="topMargin">
+ <number>8</number>
+ </property>
+ <property name="rightMargin">
+ <number>8</number>
+ </property>
+ <property name="bottomMargin">
+ <number>8</number>
+ </property>
+ <item>
+ <widget class="QLineEdit" name="authorLineEdit"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="7" column="1">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>111</width>
+ <height>115</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="0" colspan="2">
+ <widget class="QGroupBox" name="embeddedGroupBox">
+ <property name="title">
+ <string>Embedded Design</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="deviceProfileLabel">
+ <property name="text">
+ <string notr="true">TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
- <property name="margin">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
<number>0</number>
</property>
<item>
@@ -58,7 +239,16 @@
<bool>true</bool>
</property>
<layout class="QGridLayout">
- <property name="margin">
+ <property name="leftMargin">
+ <number>8</number>
+ </property>
+ <property name="topMargin">
+ <number>8</number>
+ </property>
+ <property name="rightMargin">
+ <number>8</number>
+ </property>
+ <property name="bottomMargin">
<number>8</number>
</property>
<property name="spacing">
@@ -102,7 +292,16 @@
<bool>true</bool>
</property>
<layout class="QGridLayout">
- <property name="margin">
+ <property name="leftMargin">
+ <number>8</number>
+ </property>
+ <property name="topMargin">
+ <number>8</number>
+ </property>
+ <property name="rightMargin">
+ <number>8</number>
+ </property>
+ <property name="bottomMargin">
<number>8</number>
</property>
<property name="spacing">
@@ -139,142 +338,22 @@
</item>
</layout>
</item>
- <item row="4" column="1">
- <layout class="QHBoxLayout">
- <property name="spacing">
- <number>6</number>
- </property>
- <property name="margin">
- <number>0</number>
- </property>
- <item>
- <widget class="QGroupBox" name="pixmapFunctionGroupBox">
- <property name="title">
- <string>&amp;Pixmap Function</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- <layout class="QVBoxLayout">
- <property name="spacing">
- <number>6</number>
- </property>
- <property name="margin">
- <number>8</number>
- </property>
- <item>
- <widget class="QLineEdit" name="pixmapFunctionLineEdit"/>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </item>
- <item row="8" column="0" colspan="2">
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- <item row="7" column="0" colspan="2">
- <widget class="Line" name="line">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item row="4" column="0" rowspan="3">
- <widget class="QGroupBox" name="includeHintsGroupBox">
+ <item row="4" column="0" colspan="2">
+ <widget class="QGroupBox" name="connectionsGroupBox">
<property name="title">
- <string>&amp;Include Hints</string>
+ <string>Connections</string>
</property>
- <layout class="QVBoxLayout">
- <property name="spacing">
- <number>6</number>
- </property>
- <property name="margin">
- <number>8</number>
- </property>
- <item>
- <widget class="QTextEdit" name="includeHintsTextEdit"/>
- </item>
- </layout>
- </widget>
- </item>
- <item row="2" column="0" colspan="2">
- <widget class="qdesigner_internal::GridPanel" name="gridPanel">
- <property name="title">
- <string>Grid</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0" colspan="2">
- <widget class="QGroupBox" name="embeddedGroupBox">
- <property name="title">
- <string>Embedded Design</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QLabel" name="deviceProfileLabel">
- <property name="text">
- <string notr="true">TextLabel</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="1" column="0" colspan="2">
- <widget class="QGroupBox" name="pixmapFunctionGroupBox_2">
- <property name="title">
- <string>&amp;Author</string>
- </property>
- <layout class="QVBoxLayout">
- <property name="spacing">
- <number>6</number>
- </property>
- <property name="margin">
- <number>8</number>
- </property>
- <item>
- <widget class="QLineEdit" name="authorLineEdit"/>
- </item>
- </layout>
- </widget>
- </item>
- <item row="5" column="1">
- <widget class="QGroupBox" name="translationsGroupBox">
- <property name="title">
- <string>Translations</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
<item>
- <widget class="QCheckBox" name="idBasedTranslationsCheckBox">
+ <widget class="QCheckBox" name="connectSlotsByNameCheckBox">
<property name="text">
- <string>ID-based</string>
+ <string>Connect slots by name</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
- <item row="6" column="1">
- <spacer>
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>111</width>
- <height>115</height>
- </size>
- </property>
- </spacer>
- </item>
</layout>
</widget>
<customwidgets>
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..5a72095d2 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<QString,QString> propertyNameMap() const;
@@ -68,10 +68,8 @@ private:
ItemViewPropertySheetPrivate *d;
};
-typedef QDesignerPropertySheetFactory<QTreeView, ItemViewPropertySheet>
- QTreeViewPropertySheetFactory;
-typedef QDesignerPropertySheetFactory<QTableView, ItemViewPropertySheet>
- QTableViewPropertySheetFactory;
+using QTreeViewPropertySheetFactory = QDesignerPropertySheetFactory<QTreeView, ItemViewPropertySheet>;
+using QTableViewPropertySheetFactory = QDesignerPropertySheetFactory<QTableView, ItemViewPropertySheet>;
} // namespace qdesigner_internal
QT_END_NAMESPACE
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..6d0ef613a 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;
@@ -50,7 +50,7 @@ public:
QString propertyGroup(int index) const override;
};
-typedef QDesignerPropertySheetFactory<Line, LinePropertySheet> LinePropertySheetFactory;
+using LinePropertySheetFactory = QDesignerPropertySheetFactory<Line, LinePropertySheet>;
} // namespace qdesigner_internal
QT_END_NAMESPACE
diff --git a/src/designer/src/components/formeditor/previewactiongroup.cpp b/src/designer/src/components/formeditor/previewactiongroup.cpp
index cc6e2dc1e..89c3a0ae7 100644
--- a/src/designer/src/components/formeditor/previewactiongroup.cpp
+++ b/src/designer/src/components/formeditor/previewactiongroup.cpp
@@ -91,8 +91,8 @@ PreviewActionGroup::PreviewActionGroup(QDesignerFormEditorInterface *core, QObje
void PreviewActionGroup::updateDeviceProfiles()
{
- typedef QList<DeviceProfile> DeviceProfileList;
- typedef QList<QAction *> ActionList;
+ using DeviceProfileList = QList<DeviceProfile>;
+ using ActionList = QList<QAction *>;
const QDesignerSharedSettings settings(m_core);
const DeviceProfileList profiles = settings.deviceProfiles();
diff --git a/src/designer/src/components/formeditor/previewactiongroup.h b/src/designer/src/components/formeditor/previewactiongroup.h
index ed639319a..2e5d77dca 100644
--- a/src/designer/src/components/formeditor/previewactiongroup.h
+++ b/src/designer/src/components/formeditor/previewactiongroup.h
@@ -53,10 +53,10 @@ namespace qdesigner_internal {
class PreviewActionGroup : public QActionGroup
{
- Q_DISABLE_COPY(PreviewActionGroup)
+ Q_DISABLE_COPY_MOVE(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 c840bf35f..dd1144d7c 100644
--- a/src/designer/src/components/formeditor/qdesigner_resource.cpp
+++ b/src/designer/src/components/formeditor/qdesigner_resource.cpp
@@ -108,7 +108,7 @@ Q_DECLARE_METATYPE(QWidgetList)
QT_BEGIN_NAMESPACE
namespace {
- typedef QList<DomProperty*> DomPropertyList;
+ using DomPropertyList = QList<DomProperty *>;
}
static const char *currentUiVersion = "4.0";
@@ -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());
@@ -278,7 +278,7 @@ DomProperty *QDesignerResourceBuilder::saveResource(const QDir &workingDirectory
const QIcon::Mode mode = itPix.key().first;
const QIcon::State state = itPix.key().second;
DomResourcePixmap *rp = new DomResourcePixmap;
- const PropertySheetPixmapValue pix = itPix.value();
+ const PropertySheetPixmapValue &pix = itPix.value();
const PropertySheetPixmapValue::PixmapSource ps = pix.pixmapSource(m_core);
const QString pixPath = pix.path();
rp->setText(ps == PropertySheetPixmapValue::FilePixmap && m_saveRelative ? workingDirectory.relativeFilePath(pixPath) : pixPath);
@@ -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<QString>())
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<QDesignerPropertySheetExtension*>(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);
}
@@ -512,6 +512,8 @@ void QDesignerResource::saveDom(DomUI *ui, QWidget *widget)
if (m_formWindow->useIdBasedTranslations())
ui->setAttributeIdbasedtr(true);
+ if (!m_formWindow->connectSlotsByName()) // Don't write out if true (default)
+ ui->setAttributeConnectslotsbyname(false);
const QVariantMap designerFormData = m_formWindow->formData();
if (!designerFormData.empty()) {
@@ -633,12 +635,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<qdesigner_internal::WidgetFactory*>(core()->widgetFactory());
- Q_ASSERT(factory != 0);
+ Q_ASSERT(factory != nullptr);
QDesignerFormWindowInterface *previousFormWindow = factory->currentFormWindow(m_formWindow);
@@ -646,8 +648,12 @@ QWidget *QDesignerResource::create(DomUI *ui, QWidget *parentWidget)
QDesignerWidgetItemInstaller wii; // Make sure we use QDesignerWidgetItem.
QWidget *mainWidget = QAbstractFormBuilder::create(ui, parentWidget);
- if (m_formWindow)
+ if (m_formWindow) {
m_formWindow->setUseIdBasedTranslations(ui->attributeIdbasedtr());
+ // Default to true unless set.
+ const bool connectSlotsByName = !ui->hasAttributeConnectslotsbyname() || ui->attributeConnectslotsbyname();
+ m_formWindow->setConnectSlotsByName(connectSlotsByName);
+ }
if (mainWidget && m_formWindow) {
m_formWindow->setAuthor(ui->elementAuthor());
@@ -712,7 +718,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 +792,7 @@ QWidget *QDesignerResource::create(DomWidget *ui_widget, QWidget *parentWidget)
QDesignerContainerExtension *container = qt_extension<QDesignerContainerExtension*>(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,19 +807,15 @@ 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<QDesignerMenu*>(w);
QDesignerMenuBar *menuBar = qobject_cast<QDesignerMenuBar*>(w);
- if (menu) {
- menu->interactive(false);
+ if (menu)
menu->hide();
- } else if (menuBar) {
- menuBar->interactive(false);
- }
for (DomActionRef *ui_action_ref : actionRefs) {
const QString name = ui_action_ref->attributeName();
@@ -832,13 +834,10 @@ QWidget *QDesignerResource::create(DomWidget *ui_widget, QWidget *parentWidget)
}
}
- if (menu) {
- menu->interactive(true);
+ if (menu)
menu->adjustSpecialActions();
- } else if (menuBar) {
- menuBar->interactive(true);
+ else if (menuBar)
menuBar->adjustSpecialActions();
- }
ui_widget->setAttributeClass(className); // fix the class name
applyExtensionDataFromDOM(this, core(), ui_widget, w);
@@ -889,7 +888,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);
@@ -1032,7 +1031,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();
@@ -1066,13 +1065,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<QLayout*>(parent);
if (parent->isWidgetType())
layoutBase = static_cast<QWidget*>(parent);
else {
- Q_ASSERT( layout != 0 );
+ Q_ASSERT( layout != nullptr );
layoutBase = layout->parentWidget();
}
@@ -1082,7 +1081,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;
@@ -1093,13 +1092,13 @@ DomWidget *QDesignerResource::createDom(QWidget *widget, DomWidget *ui_parentWid
{
QDesignerMetaDataBaseItemInterface *item = core()->metaDataBase()->item(widget);
if (!item)
- return 0;
+ return nullptr;
if (qobject_cast<Spacer*>(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);
@@ -1108,16 +1107,14 @@ DomWidget *QDesignerResource::createDom(QWidget *widget, DomWidget *ui_parentWid
while (customInfo && customInfo->isCustom()) {
m_usedCustomWidgets.insert(customInfo, true);
const QString extends = customInfo->extends();
- if (extends == customInfo->name()) {
+ if (extends == customInfo->name())
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<QDesignerWidgetDataBaseItemInterface *>(0);
- }
+ const int extendsIndex = wdb->indexOfClassName(customInfo->extends());
+ customInfo = extendsIndex != -1 ? wdb->item(extendsIndex) : nullptr;
}
}
- DomWidget *w = 0;
+ DomWidget *w = nullptr;
if (QTabWidget *tabWidget = qobject_cast<QTabWidget*>(widget))
w = saveWidget(tabWidget, ui_parentWidget);
@@ -1136,7 +1133,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<QLayoutWidget*>(widget) && w->attributeClass() == QStringLiteral("QWidget")) {
w->setAttributeNative(true);
@@ -1149,7 +1146,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());
@@ -1164,7 +1161,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());
}
@@ -1176,26 +1173,26 @@ DomLayout *QDesignerResource::createDom(QLayout *layout, DomLayout *ui_parentLay
{
QDesignerMetaDataBaseItemInterface *item = core()->metaDataBase()->item(layout);
- if (item == 0) {
+ if (item == nullptr) {
layout = layout->findChild<QLayout*>();
// 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<QSplitter*>(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();
@@ -1205,11 +1202,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<Spacer*>(item->widget())) {
if (!core()->metaDataBase()->item(s))
- return 0;
+ return nullptr;
DomSpacer *spacer = new DomSpacer();
const QString objectName = s->objectName();
@@ -1231,7 +1228,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;
}
@@ -1259,7 +1256,7 @@ DomTabStops *QDesignerResource::saveTabStops()
return dom;
}
- return 0;
+ return nullptr;
}
void QDesignerResource::applyTabStops(QWidget *widget, DomTabStops *tabStops)
@@ -1543,7 +1540,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<QWidget*>(obj);
@@ -1577,19 +1574,20 @@ 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<QGridLayout*>(layout);
QBoxLayout *box = qobject_cast<QBoxLayout*>(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) {
+ }
+ if (box != nullptr) {
box->addItem(item);
return true;
}
@@ -1686,7 +1684,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;
@@ -1701,7 +1699,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);
}
@@ -1728,7 +1726,7 @@ DomUI *QDesignerResource::copy(const FormBuilderClipboard &selection)
if (!hasItems) {
delete ui_widget;
- return 0;
+ return nullptr;
}
// UI
DomUI *ui = new DomUI();
@@ -1823,7 +1821,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)
@@ -1935,7 +1933,7 @@ QList<DomProperty*> 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<QDesignerPropertySheetExtension*>(mgr, object)) {
@@ -1961,14 +1959,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<PropertySheetFlagValue>()) {
const PropertySheetFlagValue f = qvariant_cast<PropertySheetFlagValue>(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
@@ -1985,7 +1983,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
@@ -2004,7 +2002,8 @@ DomProperty *QDesignerResource::createProperty(QObject *object, const QString &p
p->setAttributeName(propertyName);
return applyProperStdSetAttribute(object, propertyName, p);
- } else if (value.canConvert<PropertySheetStringListValue>()) {
+ }
+ if (value.canConvert<PropertySheetStringListValue>()) {
const PropertySheetStringListValue listValue = qvariant_cast<PropertySheetStringListValue>(value);
DomProperty *p = new DomProperty;
if (!hasSetter(core(), object, propertyName))
@@ -2017,7 +2016,8 @@ DomProperty *QDesignerResource::createProperty(QObject *object, const QString &p
translationParametersToDom(listValue, domStringList);
p->setElementStringList(domStringList);
return applyProperStdSetAttribute(object, propertyName, p);
- } else if (value.canConvert<PropertySheetKeySequenceValue>()) {
+ }
+ if (value.canConvert<PropertySheetKeySequenceValue>()) {
const PropertySheetKeySequenceValue keyVal = qvariant_cast<PropertySheetKeySequenceValue>(value);
DomProperty *p = stringToDomProperty(keyVal.value().toString(), keyVal);
if (!hasSetter(core(), object, propertyName))
@@ -2047,7 +2047,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()));
@@ -2139,18 +2139,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)
@@ -2160,7 +2160,7 @@ QAction *QDesignerResource::create(DomAction *ui_action, QObject *parent)
return action;
}
- return 0;
+ return nullptr;
}
QActionGroup *QDesignerResource::create(DomActionGroup *ui_action_group, QObject *parent)
@@ -2170,14 +2170,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);
}
@@ -2194,7 +2194,7 @@ QAction *QDesignerResource::createAction(QObject *parent, const QString &name)
return action;
}
- return 0;
+ return nullptr;
}
QActionGroup *QDesignerResource::createActionGroup(QObject *parent, const QString &name)
@@ -2204,7 +2204,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..d667f1372 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);
@@ -145,7 +145,7 @@ private:
QStringList mergeWithLoadedPaths(const QStringList &paths) const;
void applyAttributesToPropertySheet(const DomWidget *ui_widget, QWidget *widget);
- typedef QList<DomCustomWidget*> DomCustomWidgetList;
+ using DomCustomWidgetList = QList<DomCustomWidget *>;
void addCustomWidgetsToWidgetDatabase(DomCustomWidgetList& list);
FormWindow *m_formWindow;
bool m_isMainWidget;
diff --git a/src/designer/src/components/formeditor/qlayoutwidget_propertysheet.h b/src/designer/src/components/formeditor/qlayoutwidget_propertysheet.h
index b57e6a7cd..f0a66787e 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;
@@ -51,7 +51,7 @@ public:
bool dynamicPropertiesAllowed() const override;
};
-typedef QDesignerPropertySheetFactory<QLayoutWidget, QLayoutWidgetPropertySheet> QLayoutWidgetPropertySheetFactory;
+using QLayoutWidgetPropertySheetFactory = QDesignerPropertySheetFactory<QLayoutWidget, QLayoutWidgetPropertySheet>;
} // namespace qdesigner_internal
QT_END_NAMESPACE
diff --git a/src/designer/src/components/formeditor/qmainwindow_container.cpp b/src/designer/src/components/formeditor/qmainwindow_container.cpp
index 40d57b35b..180c38e79 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);
}
@@ -74,12 +74,16 @@ void QMainWindowContainer::setCurrentIndex(int index)
namespace {
// Pair of <area,break_before>
- typedef QPair<Qt::ToolBarArea,bool> ToolBarData;
+ using ToolBarData = QPair<Qt::ToolBarArea,bool> ;
ToolBarData toolBarData(QToolBar *me) {
const QMainWindow *mw = qobject_cast<const QMainWindow*>(me->parentWidget());
- if (!mw || !mw->layout() || mw->layout()->indexOf(me) == -1)
- return ToolBarData(Qt::TopToolBarArea,false);
+ if (!mw || !mw->layout() || mw->layout()->indexOf(me) == -1) {
+ const QVariant desiredAreaV = me->property("_q_desiredArea");
+ const Qt::ToolBarArea desiredArea = desiredAreaV.canConvert<Qt::ToolBarArea>()
+ ? desiredAreaV.value<Qt::ToolBarArea>() : Qt::TopToolBarArea;
+ return {desiredArea, false};
+ }
return ToolBarData(mw->toolBarArea(me), mw->toolBarBreak(me));
}
@@ -170,12 +174,12 @@ void QMainWindowContainer::remove(int index)
m_mainWindow->removeToolBar(toolBar);
} else if (QMenuBar *menuBar = qobject_cast<QMenuBar*>(widget)) {
menuBar->hide();
- menuBar->setParent(0);
- m_mainWindow->setMenuBar(0);
+ menuBar->setParent(nullptr);
+ m_mainWindow->setMenuBar(nullptr);
} else if (QStatusBar *statusBar = qobject_cast<QStatusBar*>(widget)) {
statusBar->hide();
- statusBar->setParent(0);
- m_mainWindow->setStatusBar(0);
+ statusBar->setParent(nullptr);
+ m_mainWindow->setStatusBar(nullptr);
} else if (QDockWidget *dockWidget = qobject_cast<QDockWidget*>(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..9551d8ffa 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;
@@ -60,7 +60,7 @@ private:
QWidgetList m_widgets;
};
-typedef ExtensionFactory<QDesignerContainerExtension, QMainWindow, QMainWindowContainer> QMainWindowContainerFactory;
+using QMainWindowContainerFactory = ExtensionFactory<QDesignerContainerExtension, QMainWindow, QMainWindowContainer>;
} // namespace qdesigner_internal
QT_END_NAMESPACE
diff --git a/src/designer/src/components/formeditor/qmdiarea_container.cpp b/src/designer/src/components/formeditor/qmdiarea_container.cpp
index 01cf0d598..e33c99367 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();
}
@@ -142,7 +142,7 @@ QMdiAreaPropertySheet::QMdiAreaPropertySheet(QWidget *mdiArea, QObject *parent)
QMdiAreaPropertySheet::MdiAreaProperty QMdiAreaPropertySheet::mdiAreaProperty(const QString &name)
{
- typedef QHash<QString, MdiAreaProperty> MdiAreaPropertyHash;
+ using MdiAreaPropertyHash = QHash<QString, MdiAreaProperty>;
static MdiAreaPropertyHash mdiAreaPropertyHash;
if (mdiAreaPropertyHash.empty()) {
mdiAreaPropertyHash.insert(QLatin1String(subWindowNameC), MdiAreaSubWindowName);
@@ -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<QDesignerContainerExtension*>(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<QDesignerPropertySheetExtension*>(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..6bca44840 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;
@@ -94,8 +94,8 @@ private:
// Factories
-typedef ExtensionFactory<QDesignerContainerExtension, QMdiArea, QMdiAreaContainer> QMdiAreaContainerFactory;
-typedef QDesignerPropertySheetFactory<QMdiArea, QMdiAreaPropertySheet> QMdiAreaPropertySheetFactory;
+using QMdiAreaContainerFactory = ExtensionFactory<QDesignerContainerExtension, QMdiArea, QMdiAreaContainer>;
+using QMdiAreaPropertySheetFactory = QDesignerPropertySheetFactory<QMdiArea, QMdiAreaPropertySheet>;
} // namespace qdesigner_internal
QT_END_NAMESPACE
diff --git a/src/designer/src/components/formeditor/qwizard_container.cpp b/src/designer/src/components/formeditor/qwizard_container.cpp
index 9339a1a90..dbc7084eb 100644
--- a/src/designer/src/components/formeditor/qwizard_container.cpp
+++ b/src/designer/src/components/formeditor/qwizard_container.cpp
@@ -36,8 +36,8 @@
QT_BEGIN_NAMESPACE
-typedef QList<int> IdList;
-typedef QList<QWizardPage *> WizardPageList;
+using IdList = QList<int>;
+using WizardPageList = QList<QWizardPage *>;
namespace qdesigner_internal {
@@ -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..0c4241ea0 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:
@@ -99,9 +99,9 @@ private:
};
// Factories
-typedef QDesignerPropertySheetFactory<QWizard, QWizardPropertySheet> QWizardPropertySheetFactory;
-typedef QDesignerPropertySheetFactory<QWizardPage, QWizardPagePropertySheet> QWizardPagePropertySheetFactory;
-typedef ExtensionFactory<QDesignerContainerExtension, QWizard, QWizardContainer> QWizardContainerFactory;
+using QWizardPropertySheetFactory = QDesignerPropertySheetFactory<QWizard, QWizardPropertySheet>;
+using QWizardPagePropertySheetFactory = QDesignerPropertySheetFactory<QWizardPage, QWizardPagePropertySheet>;
+using QWizardContainerFactory = ExtensionFactory<QDesignerContainerExtension, QWizard, QWizardContainer>;
} // namespace qdesigner_internal
QT_END_NAMESPACE
diff --git a/src/designer/src/components/formeditor/spacer_propertysheet.h b/src/designer/src/components/formeditor/spacer_propertysheet.h
index 8395df208..a2b00dbdb 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;
@@ -51,7 +51,7 @@ public:
bool dynamicPropertiesAllowed() const override;
};
-typedef QDesignerPropertySheetFactory<Spacer, SpacerPropertySheet> SpacerPropertySheetFactory;
+using SpacerPropertySheetFactory = QDesignerPropertySheetFactory<Spacer, SpacerPropertySheet>;
} // namespace qdesigner_internal
QT_END_NAMESPACE
diff --git a/src/designer/src/components/formeditor/templateoptionspage.h b/src/designer/src/components/formeditor/templateoptionspage.h
index 204b805e9..374713fed 100644
--- a/src/designer/src/components/formeditor/templateoptionspage.h
+++ b/src/designer/src/components/formeditor/templateoptionspage.h
@@ -51,10 +51,10 @@ namespace Ui {
class TemplateOptionsWidget : public QWidget
{
Q_OBJECT
- Q_DISABLE_COPY(TemplateOptionsWidget)
+ Q_DISABLE_COPY_MOVE(TemplateOptionsWidget)
public:
explicit TemplateOptionsWidget(QDesignerFormEditorInterface *core,
- QWidget *parent = 0);
+ QWidget *parent = nullptr);
~TemplateOptionsWidget();
@@ -75,7 +75,7 @@ private:
class TemplateOptionsPage : public QDesignerOptionsPageInterface
{
- Q_DISABLE_COPY(TemplateOptionsPage)
+ Q_DISABLE_COPY_MOVE(TemplateOptionsPage)
public:
explicit TemplateOptionsPage(QDesignerFormEditorInterface *core);
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<QMainWindow*>(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<QMainWindow*>(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 <class Layout>
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<Layout*>(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/lib.pro b/src/designer/src/components/lib/lib.pro
index 5a4690e80..3f6fae950 100644
--- a/src/designer/src/components/lib/lib.pro
+++ b/src/designer/src/components/lib/lib.pro
@@ -3,7 +3,7 @@ MODULE = designercomponents
QT = core gui-private widgets-private designer-private
QT_PRIVATE = xml
-CONFIG += internal_module
+CONFIG += internal_module create_cmake
# QtDesignerComponents uses
DEFINES += QT_STATICPLUGIN
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 c74b2110f..4267fea22 100644
--- a/src/designer/src/components/objectinspector/objectinspector.cpp
+++ b/src/designer/src/components/objectinspector/objectinspector.cpp
@@ -90,7 +90,7 @@ namespace {
// A widget managed by the form window cursor
ManagedWidgetSelection };
- typedef QVector<QObject*> QObjectVector;
+ using QObjectVector = QVector<QObject *>;
}
static inline SelectionType selectionType(const QDesignerFormWindowInterface *fw, QObject *o)
@@ -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;
@@ -187,7 +182,7 @@ void ObjectInspectorTreeView::keyPressEvent(QKeyEvent *event)
// ------------ ObjectInspectorPrivate
class ObjectInspector::ObjectInspectorPrivate {
- Q_DISABLE_COPY(ObjectInspectorPrivate)
+ Q_DISABLE_COPY_MOVE(ObjectInspectorPrivate)
public:
ObjectInspectorPrivate(QDesignerFormEditorInterface *core);
~ObjectInspectorPrivate();
@@ -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<QWidget *>(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<QMainWindow *>(w)) { // Rule out unmanaged internal scroll areas, for example, on QToolBoxes.
if (QDesignerContainerExtension *c = qt_extension<QDesignerContainerExtension*>(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);
@@ -426,17 +421,18 @@ bool ObjectInspector::ObjectInspectorPrivate::selectObject(QObject *o)
if (!m_core->metaDataBase()->item(o))
return false;
- typedef QSet<QModelIndex> ModelIndexSet;
+ using ModelIndexSet = QSet<QModelIndex>;
const QModelIndexList objectIndexes = indexesOf(o);
if (objectIndexes.empty())
return false;
QItemSelectionModel *selectionModel = m_treeView->selectionModel();
- const ModelIndexSet currentSelectedItems = selectionModel->selectedRows(0).toSet();
+ const auto currentSelectedItemList = selectionModel->selectedRows(0);
+ const ModelIndexSet currentSelectedItems(currentSelectedItemList.cbegin(), currentSelectedItemList.cend());
// Change in selection?
- if (!currentSelectedItems.empty() && currentSelectedItems == objectIndexes.toSet())
+ if (!currentSelectedItems.empty() && currentSelectedItems == ModelIndexSet(objectIndexes.cbegin(), objectIndexes.cend()))
return true;
// do select and update
@@ -468,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'
@@ -506,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:
@@ -736,12 +732,12 @@ static inline QMenu *createTaskMenu(QObject *object, QDesignerFormWindowInterfac
// 3) Mananaged widgets
if (qdesigner_internal::FormWindowBase *fwb = qobject_cast<qdesigner_internal::FormWindowBase*>(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))) {
@@ -824,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 46a8ee405..6baf4bcdc 100644
--- a/src/designer/src/components/objectinspector/objectinspectormodel.cpp
+++ b/src/designer/src/components/objectinspector/objectinspectormodel.cpp
@@ -134,21 +134,13 @@ namespace qdesigner_internal {
// comparing the lists of ObjectData. If it is the same, only the item data (class name [changed by promotion],
// object name and icon) are checked and the existing items are updated.
- ObjectData::ObjectData() :
- m_parent(0),
- m_object(0),
- m_type(Object),
- m_managedLayoutType(LayoutInfo::NoLayout)
- {
- }
+ ObjectData::ObjectData() = default;
ObjectData::ObjectData(QObject *parent, QObject *object, const ModelRecursionContext &ctx) :
m_parent(parent),
m_object(object),
- m_type(Object),
m_className(QLatin1String(object->metaObject()->className())),
- m_objectName(object->objectName()),
- m_managedLayoutType(LayoutInfo::NoLayout)
+ m_objectName(object->objectName())
{
// 1) set entry
@@ -268,7 +260,7 @@ namespace qdesigner_internal {
setItemsDisplayData(row, icons, ClassNameChanged|ObjectNameChanged|ClassIconChanged|TypeChanged|LayoutTypeChanged);
}
- typedef QList<ObjectData> ObjectModel;
+ using ObjectModel = QList<ObjectData>;
// Recursive routine that creates the model by traversing the form window object tree.
void createModelRecursion(const QDesignerFormWindowInterface *fwi,
@@ -277,22 +269,22 @@ namespace qdesigner_internal {
ObjectModel &model,
const ModelRecursionContext &ctx)
{
- typedef QList<QButtonGroup *> ButtonGroupList;
- typedef QList<QAction *> ActionList;
+ using ButtonGroupList = QList<QButtonGroup *>;
+ using ActionList = QList<QAction *>;
// 1) Create entry
const ObjectData entry(parent, object, ctx);
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<QDesignerContainerExtension*>(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);
}
}
@@ -372,10 +364,10 @@ namespace qdesigner_internal {
ObjectInspectorModel::UpdateResult ObjectInspectorModel::update(QDesignerFormWindowInterface *fw)
{
- QWidget *mainContainer = fw ? fw->mainContainer() : static_cast<QWidget*>(0);
+ QWidget *mainContainer = fw ? fw->mainContainer() : nullptr;
if (!mainContainer) {
clearItems();
- m_formWindow = 0;
+ m_formWindow = nullptr;
return NoForm;
}
m_formWindow = fw;
@@ -385,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);
@@ -402,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
@@ -450,7 +442,7 @@ namespace qdesigner_internal {
{
// Change text and icon. Keep a set of changed object
// as for example actions might occur several times in the tree.
- typedef QSet<QObject *> QObjectSet;
+ using QObjectSet = QSet<QObject *>;
QObjectSet changedObjects;
diff --git a/src/designer/src/components/objectinspector/objectinspectormodel_p.h b/src/designer/src/components/objectinspector/objectinspectormodel_p.h
index 67d2bfd07..f138253a5 100644
--- a/src/designer/src/components/objectinspector/objectinspectormodel_p.h
+++ b/src/designer/src/components/objectinspector/objectinspectormodel_p.h
@@ -75,7 +75,7 @@ namespace qdesigner_internal {
ExtensionContainer // QTabWidget and the like, container extension
};
- typedef QList<QStandardItem *> StandardItemList;
+ using StandardItemList = QList<QStandardItem *>;
explicit ObjectData(QObject *parent, QObject *object, const ModelRecursionContext &ctx);
ObjectData();
@@ -102,25 +102,25 @@ namespace qdesigner_internal {
void initObject(const ModelRecursionContext &ctx);
void initWidget(QWidget *w, const ModelRecursionContext &ctx);
- QObject *m_parent;
- QObject *m_object;
- Type m_type;
+ QObject *m_parent = nullptr;
+ QObject *m_object = nullptr;
+ Type m_type = Object;
QString m_className;
QString m_objectName;
QIcon m_classIcon;
- LayoutInfo::Type m_managedLayoutType;
+ LayoutInfo::Type m_managedLayoutType = LayoutInfo::NoLayout;
};
inline bool operator==(const ObjectData &e1, const ObjectData &e2) { return e1.equals(e2); }
inline bool operator!=(const ObjectData &e1, const ObjectData &e2) { return !e1.equals(e2); }
- typedef QList<ObjectData> ObjectModel;
+ using ObjectModel = QList<ObjectData>;
// QStandardItemModel for ObjectInspector. Uses ObjectData/ObjectModel
// internally for its updates.
class ObjectInspectorModel : public QStandardItemModel {
public:
- typedef QList<QStandardItem *> StandardItemList;
+ using StandardItemList = QList<QStandardItem *>;
enum { ObjectNameColumn, ClassNameColumn, NumColumns };
explicit ObjectInspectorModel(QObject *parent);
diff --git a/src/designer/src/components/propertyeditor/brushpropertymanager.cpp b/src/designer/src/components/propertyeditor/brushpropertymanager.cpp
index e50dc0451..41887cda2 100644
--- a/src/designer/src/components/propertyeditor/brushpropertymanager.cpp
+++ b/src/designer/src/components/propertyeditor/brushpropertymanager.cpp
@@ -283,7 +283,7 @@ bool BrushPropertyManager::value(const QtProperty *property, QVariant *v) const
const PropertyBrushMap::const_iterator brit = m_brushValues.constFind(const_cast<QtProperty *>(property));
if (brit == m_brushValues.constEnd())
return false;
- qVariantSetValue(*v, brit.value());
+ v->setValue(brit.value());
return true;
}
}
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<QtProperty *>(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<Editor *, QtProperty *> &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..abc6e385c 100644
--- a/src/designer/src/components/propertyeditor/designerpropertymanager.h
+++ b/src/designer/src/components/propertyeditor/designerpropertymanager.h
@@ -44,7 +44,7 @@
QT_BEGIN_NAMESPACE
typedef QPair<QString, uint> DesignerIntPair;
-typedef QList<DesignerIntPair> DesignerFlagList;
+using DesignerFlagList = QList<DesignerIntPair>;
class QDesignerFormEditorInterface;
class QLineEdit;
@@ -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,17 +252,17 @@ 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);
signals:
void resetProperty(QtProperty *property);
protected:
- void connectPropertyManager(QtVariantPropertyManager *manager);
+ void connectPropertyManager(QtVariantPropertyManager *manager) override;
QWidget *createEditor(QtVariantPropertyManager *manager, QtProperty *property,
- QWidget *parent);
- void disconnectPropertyManager(QtVariantPropertyManager *manager);
+ QWidget *parent) override;
+ void disconnectPropertyManager(QtVariantPropertyManager *manager) override;
private slots:
void slotEditorDestroyed(QObject *object);
void slotAttributeChanged(QtProperty *property, const QString &attribute, const QVariant &value);
diff --git a/src/designer/src/components/propertyeditor/fontpropertymanager.cpp b/src/designer/src/components/propertyeditor/fontpropertymanager.cpp
index a57c5c4d2..a29867011 100644
--- a/src/designer/src/components/propertyeditor/fontpropertymanager.cpp
+++ b/src/designer/src/components/propertyeditor/fontpropertymanager.cpp
@@ -51,8 +51,7 @@ namespace qdesigner_internal {
QT_TRANSLATE_NOOP("FontPropertyManager", "PreferAntialias")
};
- FontPropertyManager::FontPropertyManager() :
- m_createdFontProperty(0)
+ FontPropertyManager::FontPropertyManager()
{
const int nameCount = sizeof(aliasingC)/sizeof(const char *);
for (int i = 0; i < nameCount; i++)
@@ -129,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/fontpropertymanager.h b/src/designer/src/components/propertyeditor/fontpropertymanager.h
index 0d191ac77..1041cd357 100644
--- a/src/designer/src/components/propertyeditor/fontpropertymanager.h
+++ b/src/designer/src/components/propertyeditor/fontpropertymanager.h
@@ -50,13 +50,13 @@ namespace qdesigner_internal {
* contains annotations indicating the platform the font is available on. */
class FontPropertyManager {
- Q_DISABLE_COPY(FontPropertyManager)
+ Q_DISABLE_COPY_MOVE(FontPropertyManager)
public:
FontPropertyManager();
- typedef QMap<QtProperty *, bool> ResetMap;
- typedef QMap<QString, QString> NameMap;
+ using ResetMap = QMap<QtProperty *, bool>;
+ using NameMap = QMap<QString, QString>;
// Call before QtVariantPropertyManager::initializeProperty.
void preInitializeProperty(QtProperty *property, int type, ResetMap &resetMap);
@@ -80,9 +80,9 @@ public:
static bool readFamilyMapping(NameMap *rc, QString *errorMessage);
private:
- typedef QMap<QtProperty *, QtProperty *> PropertyToPropertyMap;
- typedef QList<QtProperty *> PropertyList;
- typedef QMap<QtProperty *, PropertyList> PropertyToSubPropertiesMap;
+ using PropertyToPropertyMap = QMap<QtProperty *, QtProperty *>;
+ using PropertyList = QList<QtProperty *>;
+ using PropertyToSubPropertiesMap = QMap<QtProperty *, PropertyList>;
void removeAntialiasingProperty(QtProperty *);
void updateModifiedState(QtProperty *property, const QVariant &value);
@@ -96,7 +96,7 @@ private:
PropertyToSubPropertiesMap m_propertyToFontSubProperties;
QMap<QtProperty *, int> m_fontSubPropertyToFlag;
PropertyToPropertyMap m_fontSubPropertyToProperty;
- QtProperty *m_createdFontProperty;
+ QtProperty *m_createdFontProperty = nullptr;
QStringList m_aliasingEnumNames;
// Font families with Designer annotations
QStringList m_designerFamilyNames;
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 6cfb5e41c..4bb1bf450 100644
--- a/src/designer/src/components/propertyeditor/paletteeditor.cpp
+++ b/src/designer/src/components/propertyeditor/paletteeditor.cpp
@@ -224,8 +224,7 @@ QPalette PaletteEditor::getPalette(QDesignerFormEditorInterface *core, QWidget*
//////////////////////
PaletteModel::PaletteModel(QObject *parent) :
- QAbstractTableModel(parent),
- m_compute(true)
+ QAbstractTableModel(parent)
{
const QMetaObject *meta = metaObject();
const int index = meta->indexOfProperty("colorRole");
@@ -403,7 +402,6 @@ int PaletteModel::groupToColumn(QPalette::ColorGroup group) const
BrushEditor::BrushEditor(QDesignerFormEditorInterface *core, QWidget *parent) :
QWidget(parent),
m_button(new QtColorButton(this)),
- m_changed(false),
m_core(core)
{
QLayout *layout = new QHBoxLayout(this);
@@ -439,8 +437,7 @@ bool BrushEditor::changed() const
RoleEditor::RoleEditor(QWidget *parent) :
QWidget(parent),
- m_label(new QLabel(this)),
- m_edited(false)
+ m_label(new QLabel(this))
{
QHBoxLayout *layout = new QHBoxLayout(this);
layout->setContentsMargins(QMargins());
@@ -495,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);
@@ -503,10 +500,8 @@ QWidget *ColorDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem
//editor->installEventFilter(const_cast<ColorDelegate *>(this));
ed = editor;
} else {
- typedef void (BrushEditor::*BrushEditorWidgetSignal)(QWidget *);
-
BrushEditor *editor = new BrushEditor(m_core, parent);
- connect(editor, static_cast<BrushEditorWidgetSignal>(&BrushEditor::changed),
+ connect(editor, QOverload<QWidget *>::of(&BrushEditor::changed),
this, &ColorDelegate::commitData);
editor->setFocusPolicy(Qt::NoFocus);
editor->installEventFilter(const_cast<ColorDelegate *>(this));
diff --git a/src/designer/src/components/propertyeditor/paletteeditor.h b/src/designer/src/components/propertyeditor/paletteeditor.h
index 77785bc69..6124340dc 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,15 +95,15 @@ 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;
- QVariant data(const QModelIndex &index, int role) const;
- bool setData(const QModelIndex &index, const QVariant &value, int role);
- Qt::ItemFlags flags(const QModelIndex &index) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex &index, int role) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role) override;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
QVariant headerData(int section, Qt::Orientation orientation,
- int role = Qt::DisplayRole) const;
+ int role = Qt::DisplayRole) const override;
QPalette getPalette() const;
void setPalette(const QPalette &palette, const QPalette &parentPalette);
@@ -120,14 +120,14 @@ private:
QPalette m_palette;
QPalette m_parentPalette;
QMap<QPalette::ColorRole, QString> m_roleNames;
- bool m_compute;
+ bool m_compute = true;
};
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;
@@ -138,7 +138,7 @@ private slots:
void brushChanged();
private:
QtColorButton *m_button;
- bool m_changed;
+ bool m_changed = false;
QDesignerFormEditorInterface *m_core;
};
@@ -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);
@@ -157,7 +157,7 @@ private slots:
void emitResetProperty();
private:
QLabel *m_label;
- bool m_edited;
+ bool m_edited = false;
};
class ColorDelegate : public QItemDelegate
@@ -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<QMdiSubWindow *>(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 486e7c202..af590a7d5 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);
@@ -202,26 +202,16 @@ static inline QToolButton *createDropDownButton(QAction *defaultAction, QWidget
PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *parent, Qt::WindowFlags flags) :
QDesignerPropertyEditor(parent, flags),
m_core(core),
- m_propertySheet(0),
- m_currentBrowser(0),
- m_treeBrowser(0),
m_propertyManager(new DesignerPropertyManager(m_core, this)),
- m_dynamicGroup(0),
- m_updatingBrowser(false),
m_stackedWidget(new QStackedWidget),
m_filterWidget(new QLineEdit),
- m_buttonIndex(-1),
- m_treeIndex(-1),
m_addDynamicAction(new QAction(createIconSet(QStringLiteral("plus.png")), tr("Add Dynamic Property..."), this)),
m_removeDynamicAction(new QAction(createIconSet(QStringLiteral("minus.png")), tr("Remove Dynamic Property"), this)),
m_sortingAction(new QAction(createIconSet(QStringLiteral("sort.png")), tr("Sorting"), this)),
m_coloringAction(new QAction(createIconSet(QStringLiteral("color.png")), tr("Color Groups"), this)),
m_treeAction(new QAction(tr("Tree View"), this)),
m_buttonAction(new QAction(tr("Drop Down Button View"), this)),
- m_classLabel(new ElidingLabel),
- m_sorting(false),
- m_coloring(false),
- m_brightness(false)
+ m_classLabel(new ElidingLabel)
{
QVector<QColor> colors;
colors.reserve(6);
@@ -234,7 +224,7 @@ PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *pare
m_colors.reserve(colors.count());
const int darknessFactor = 250;
for (int i = 0; i < colors.count(); i++) {
- QColor c = colors.at(i);
+ const QColor &c = colors.at(i);
m_colors.push_back(qMakePair(c, c.darker(darknessFactor)));
}
QColor dynamicColor(191, 207, 255);
@@ -773,7 +763,7 @@ static inline QLayout *layoutOfQLayoutWidget(QObject *o)
{
if (o->isWidgetType() && !qstrcmp(o->metaObject()->className(), "QLayoutWidget"))
return static_cast<QWidget*>(o)->layout();
- return 0;
+ return nullptr;
}
void PropertyEditor::updateToolBarLabel()
@@ -909,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);
@@ -994,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))
@@ -1009,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) {
@@ -1035,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;
@@ -1064,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<QString, QtVariantProperty*>::const_iterator itPrev = m_nameToProperty.insert(propertyName, property);
+ QMap<QString, QtVariantProperty*>::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);
@@ -1081,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;
@@ -1101,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<QtProperty*> subProperties = lastGroup->subProperties();
if (!subProperties.empty())
lastProperty = subProperties.back();
@@ -1135,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());
}
@@ -1173,7 +1163,7 @@ QtBrowserItem *PropertyEditor::nonFakePropertyBrowserItem(QtBrowserItem *item) c
return item;
item = item->parent();
} while (item);
- return 0;
+ return nullptr;
}
QString PropertyEditor::currentPropertyName() const
@@ -1253,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<QtBrowserItem *> 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 819e65108..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;
@@ -146,10 +146,10 @@ private:
const Strings m_strings;
QDesignerFormEditorInterface *m_core;
- QDesignerPropertySheetExtension *m_propertySheet;
- QtAbstractPropertyBrowser *m_currentBrowser;
+ QDesignerPropertySheetExtension *m_propertySheet = nullptr;
+ QtAbstractPropertyBrowser *m_currentBrowser = nullptr;
QtButtonPropertyBrowser *m_buttonBrowser;
- QtTreePropertyBrowser *m_treeBrowser;
+ QtTreePropertyBrowser *m_treeBrowser = nullptr;
DesignerPropertyManager *m_propertyManager;
DesignerEditorFactory *m_treeFactory;
DesignerEditorFactory *m_groupFactory;
@@ -158,14 +158,14 @@ private:
QMap<QtProperty*, QString> m_propertyToGroup;
QMap<QString, QtVariantProperty*> m_nameToGroup;
QList<QtProperty *> m_groups;
- QtProperty *m_dynamicGroup;
+ QtProperty *m_dynamicGroup = nullptr;
QString m_recentlyAddedDynamicProperty;
- bool m_updatingBrowser;
+ bool m_updatingBrowser = false;
QStackedWidget *m_stackedWidget;
QLineEdit *m_filterWidget;
- int m_buttonIndex;
- int m_treeIndex;
+ int m_buttonIndex = -1;
+ int m_treeIndex = -1;
QAction *m_addDynamicAction;
QAction *m_removeDynamicAction;
QAction *m_sortingAction;
@@ -174,8 +174,8 @@ private:
QAction *m_buttonAction;
ElidingLabel *m_classLabel;
- bool m_sorting;
- bool m_coloring;
+ bool m_sorting = false;
+ bool m_coloring = false;
QMap<QString, bool> m_expansionState;
@@ -184,7 +184,7 @@ private:
QPair<QColor, QColor> m_dynamicColor;
QPair<QColor, QColor> m_layoutColor;
- bool m_brightness;
+ bool m_brightness = false;
};
} // namespace qdesigner_internal
diff --git a/src/designer/src/components/propertyeditor/qlonglongvalidator.h b/src/designer/src/components/propertyeditor/qlonglongvalidator.h
index b67482cd2..ccc28b42e 100644
--- a/src/designer/src/components/propertyeditor/qlonglongvalidator.h
+++ b/src/designer/src/components/propertyeditor/qlonglongvalidator.h
@@ -56,7 +56,7 @@ public:
qlonglong top() const { return t; }
private:
- Q_DISABLE_COPY(QLongLongValidator)
+ Q_DISABLE_COPY_MOVE(QLongLongValidator)
qlonglong b;
qlonglong t;
@@ -84,7 +84,7 @@ public:
qulonglong top() const { return t; }
private:
- Q_DISABLE_COPY(QULongLongValidator)
+ Q_DISABLE_COPY_MOVE(QULongLongValidator)
qulonglong b;
qulonglong t;
diff --git a/src/designer/src/components/propertyeditor/stringlisteditor.cpp b/src/designer/src/components/propertyeditor/stringlisteditor.cpp
index 4ab3dad19..1cfdb1f3c 100644
--- a/src/designer/src/components/propertyeditor/stringlisteditor.cpp
+++ b/src/designer/src/components/propertyeditor/stringlisteditor.cpp
@@ -60,9 +60,7 @@ StringListEditor::StringListEditor(QWidget *parent)
updateUi();
}
-StringListEditor::~StringListEditor()
-{
-}
+StringListEditor::~StringListEditor() = default;
QStringList StringListEditor::getStringList(QWidget *parent, const QStringList &init, int *result)
{
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..571ddba12 100644
--- a/src/designer/src/components/signalsloteditor/connectdialog.cpp
+++ b/src/designer/src/components/signalsloteditor/connectdialog.cpp
@@ -43,7 +43,7 @@
QT_BEGIN_NAMESPACE
namespace {
- typedef QList<QListWidgetItem*> ListWidgetItems;
+ using ListWidgetItems = QList<QListWidgetItem *>;
}
static QString realClassName(QDesignerFormEditorInterface *core, QWidget *widget)
@@ -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<QString, QString>::ConstIterator itMember = memberToClassName.constBegin();
const QMap<QString, QString>::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<QString, QString>::ConstIterator itMember = memberToClassName.constBegin();
const QMap<QString, QString>::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..f913b5bdf 100644
--- a/src/designer/src/components/signalsloteditor/signalslot_utils.cpp
+++ b/src/designer/src/components/signalsloteditor/signalslot_utils.cpp
@@ -42,7 +42,7 @@
QT_BEGIN_NAMESPACE
-typedef QPair<QString, QString> ClassNameSignaturePair;
+using ClassNameSignaturePair = QPair<QString, QString>;
// Find all member functions that match a predicate on the signature string
// using the member sheet and the fake methods stored in the widget
@@ -61,7 +61,7 @@ static void memberList(QDesignerFormEditorInterface *core,
return;
// 1) member sheet
const QDesignerMemberSheetExtension *members = qt_extension<QDesignerMemberSheetExtension*>(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/signalslot_utils_p.h b/src/designer/src/components/signalsloteditor/signalslot_utils_p.h
index 7fb6166d5..7ab98c3d4 100644
--- a/src/designer/src/components/signalsloteditor/signalslot_utils_p.h
+++ b/src/designer/src/components/signalsloteditor/signalslot_utils_p.h
@@ -64,14 +64,14 @@ bool memberFunctionListContains(QDesignerFormEditorInterface *core, QObject *obj
// Members functions listed by class they were inherited from
struct ClassMemberFunctions
{
- ClassMemberFunctions() {}
+ ClassMemberFunctions() = default;
ClassMemberFunctions(const QString &_class_name);
QString m_className;
QStringList m_memberList;
};
-typedef QList<ClassMemberFunctions> ClassesMemberFunctions;
+using ClassesMemberFunctions = QList<ClassMemberFunctions>;
// Return classes and members in reverse class order to
// populate of the combo of the ToolWindow.
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<SignalSlotEditor*>(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<SignalSlotEditor*>(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<const SignalSlotConnection*>(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 eb78db640..95aad3f0b 100644
--- a/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp
+++ b/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp
@@ -38,10 +38,7 @@ QT_BEGIN_NAMESPACE
using namespace qdesigner_internal;
-SignalSlotEditorPlugin::SignalSlotEditorPlugin()
- : m_initialized(false), m_action(0)
-{
-}
+SignalSlotEditorPlugin::SignalSlotEditorPlugin() = default;
SignalSlotEditorPlugin::~SignalSlotEditorPlugin() = default;
@@ -83,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);
@@ -94,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);
@@ -112,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_plugin.h b/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.h
index 4b27b5102..fc4cabdcd 100644
--- a/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.h
+++ b/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.h
@@ -69,8 +69,8 @@ private slots:
private:
QPointer<QDesignerFormEditorInterface> m_core;
QHash<QDesignerFormWindowInterface*, SignalSlotEditorTool*> m_tools;
- bool m_initialized;
- QAction *m_action;
+ bool m_initialized = false;
+ QAction *m_action = nullptr;
};
} // namespace qdesigner_internal
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 2b7ba45b8..c2f53a46e 100644
--- a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
+++ b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
@@ -65,8 +65,6 @@
QT_BEGIN_NAMESPACE
-typedef void (QComboBox::*QComboIntSignal)(int);
-
// Add suitable form widgets to a list of objects for the signal slot
// editor. Prevent special widgets from showing up there.
static void addWidgetToObjectList(const QWidget *w, QStringList &r)
@@ -81,8 +79,8 @@ static void addWidgetToObjectList(const QWidget *w, QStringList &r)
static QStringList objectNameList(QDesignerFormWindowInterface *form)
{
- typedef QList<QAction*> ActionList;
- typedef QList<QButtonGroup *> ButtonGroupList;
+ using ActionList = QList<QAction *>;
+ using ButtonGroupList = QList<QButtonGroup *>;
QStringList result;
@@ -216,9 +214,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 +257,7 @@ QVariant ConnectionModel::data(const QModelIndex &index, int role) const
}
const SignalSlotConnection *con = static_cast<SignalSlotConnection*>(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 +373,7 @@ void ConnectionModel::connectionChanged(Connection *con)
Q_ASSERT(m_editor);
const int idx = m_editor->indexOfConnection(con);
SignalSlotConnection *changedCon = static_cast<SignalSlotConnection*>(m_editor->connection(idx));
- SignalSlotConnection *c = 0;
+ SignalSlotConnection *c = nullptr;
for (int i=0; i<m_editor->connectionCount(); ++i) {
if (i == idx)
continue;
@@ -393,7 +391,7 @@ void ConnectionModel::connectionChanged(Connection *con)
void ConnectionModel::updateAll()
{
- emit dataChanged(index(0, 0), index(rowCount(), columnCount()));
+ emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
}
}
@@ -406,7 +404,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<QString, bool> &text_list);
@@ -496,7 +494,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);
@@ -510,17 +508,16 @@ private slots:
private:
InlineEditorModel *m_model;
- int m_idx;
+ int m_idx = -1;
};
InlineEditor::InlineEditor(QWidget *parent) :
- QComboBox(parent),
- m_idx(-1)
+ QComboBox(parent)
{
setModel(m_model = new InlineEditorModel(0, 4, this));
setFrame(false);
m_idx = -1;
- connect(this, static_cast<QComboIntSignal>(&QComboBox::activated),
+ connect(this, QOverload<int>::of(&QComboBox::activated),
this, &InlineEditor::checkSelection);
}
@@ -569,7 +566,7 @@ class ConnectionDelegate : public QItemDelegate
{
Q_OBJECT
public:
- ConnectionDelegate(QWidget *parent = 0);
+ ConnectionDelegate(QWidget *parent = nullptr);
void setForm(QDesignerFormWindowInterface *form);
@@ -587,10 +584,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<InlineEditor>("text");
@@ -609,12 +606,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<InlineEditor*>(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);
@@ -658,7 +655,7 @@ QWidget *ConnectionDelegate::createEditor(QWidget *parent,
break;
}
- connect(inline_editor, static_cast<QComboIntSignal>(&QComboBox::activated),
+ connect(inline_editor, QOverload<int>::of(&QComboBox::activated),
this, &ConnectionDelegate::emitCommitData);
return inline_editor;
@@ -682,7 +679,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),
@@ -737,6 +734,8 @@ void SignalSlotEditorWindow::setActiveFormWindow(QDesignerFormWindowInterface *f
this, &SignalSlotEditorWindow::updateEditorSelection);
disconnect(m_editor.data(), &SignalSlotEditor::connectionSelected,
this, &SignalSlotEditorWindow::updateDialogSelection);
+ disconnect(m_editor.data(), &SignalSlotEditor::connectionAdded,
+ this, &SignalSlotEditorWindow::resizeColumns);
if (integration) {
disconnect(integration, &QDesignerIntegrationInterface::objectNameChanged,
this, &SignalSlotEditorWindow::objectNameChanged);
@@ -748,7 +747,7 @@ void SignalSlotEditorWindow::setActiveFormWindow(QDesignerFormWindowInterface *f
if (!m_editor.isNull()) {
ConnectionDelegate *delegate
= qobject_cast<ConnectionDelegate*>(m_view->itemDelegate());
- if (delegate != 0)
+ if (delegate != nullptr)
delegate->setForm(form);
connect(m_view->selectionModel(),
@@ -756,18 +755,21 @@ void SignalSlotEditorWindow::setActiveFormWindow(QDesignerFormWindowInterface *f
this, &SignalSlotEditorWindow::updateEditorSelection);
connect(m_editor.data(), &SignalSlotEditor::connectionSelected,
this, &SignalSlotEditorWindow::updateDialogSelection);
+ connect(m_editor.data(), &SignalSlotEditor::connectionAdded,
+ this, &SignalSlotEditorWindow::resizeColumns);
if (integration) {
connect(integration, &QDesignerIntegrationInterface::objectNameChanged,
this, &SignalSlotEditorWindow::objectNameChanged);
}
}
+ resizeColumns();
updateUi();
}
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));
@@ -782,10 +784,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));
@@ -829,6 +831,12 @@ void SignalSlotEditorWindow::updateUi()
m_remove_button->setEnabled(!m_editor.isNull() && m_view->currentIndex().isValid());
}
+void SignalSlotEditorWindow::resizeColumns()
+{
+ for (int c = 0, count = m_model->columnCount(); c < count; ++c)
+ m_view->resizeColumnToContents(c);
+}
+
} // namespace qdesigner_internal
QT_END_NAMESPACE
diff --git a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.h b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.h
index c7023a553..4d7af91f8 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);
@@ -65,6 +65,7 @@ private slots:
void addConnection();
void removeConnection();
void updateUi();
+ void resizeColumns();
private:
QTreeView *m_view;
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 813109232..0927bc870 100644
--- a/src/designer/src/components/tabordereditor/tabordereditor_plugin.cpp
+++ b/src/designer/src/components/tabordereditor/tabordereditor_plugin.cpp
@@ -39,14 +39,9 @@ QT_BEGIN_NAMESPACE
using namespace qdesigner_internal;
-TabOrderEditorPlugin::TabOrderEditorPlugin()
- : m_initialized(false)
-{
-}
+TabOrderEditorPlugin::TabOrderEditorPlugin() = default;
-TabOrderEditorPlugin::~TabOrderEditorPlugin()
-{
-}
+TabOrderEditorPlugin::~TabOrderEditorPlugin() = default;
bool TabOrderEditorPlugin::isInitialized() const
{
@@ -80,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
@@ -90,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);
@@ -101,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_plugin.h b/src/designer/src/components/tabordereditor/tabordereditor_plugin.h
index 9322a4480..cf7b28d56 100644
--- a/src/designer/src/components/tabordereditor/tabordereditor_plugin.h
+++ b/src/designer/src/components/tabordereditor/tabordereditor_plugin.h
@@ -70,8 +70,8 @@ private slots:
private:
QPointer<QDesignerFormEditorInterface> m_core;
QHash<QDesignerFormWindowInterface*, TabOrderEditorTool*> m_tools;
- bool m_initialized;
- QAction *m_action;
+ bool m_initialized = false;
+ QAction *m_action = nullptr;
};
} // namespace qdesigner_internal
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 899c1c474..5791c6991 100644
--- a/src/designer/src/components/taskmenu/button_taskmenu.cpp
+++ b/src/designer/src/components/taskmenu/button_taskmenu.cpp
@@ -56,8 +56,8 @@ namespace qdesigner_internal {
enum { debugButtonMenu = 0 };
-typedef QList<QAbstractButton *> ButtonList;
-typedef QList<QButtonGroup *> ButtonGroupList;
+using ButtonList = QList<QAbstractButton *>;
+using ButtonGroupList = QList<QButtonGroup *>;
// ButtonGroupCommand: Base for commands handling button groups and button lists
// addButtonsToGroup() and removeButtonsFromGroup() are low-level helpers for
@@ -95,7 +95,7 @@ private:
ButtonGroupCommand::ButtonGroupCommand(const QString &description, QDesignerFormWindowInterface *formWindow) :
QDesignerFormWindowCommand(description, formWindow),
- m_buttonGroup(0)
+ m_buttonGroup(nullptr)
{
}
@@ -303,10 +303,7 @@ bool RemoveButtonsFromGroupCommand::init(const ButtonList &bl)
ButtonGroupMenu::ButtonGroupMenu(QObject *parent) :
QObject(parent),
m_selectGroupAction(new QAction(tr("Select members"), this)),
- m_breakGroupAction(new QAction(tr("Break"), this)),
- m_formWindow(0),
- m_buttonGroup(0),
- m_currentButton(0)
+ m_breakGroupAction(new QAction(tr("Break"), this))
{
connect(m_breakGroupAction, &QAction::triggered, this, &ButtonGroupMenu::breakGroup);
connect(m_selectGroupAction, &QAction::triggered, this, &ButtonGroupMenu::selectGroup);
@@ -319,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);
}
@@ -423,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)),
@@ -465,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)
@@ -515,7 +512,7 @@ bool ButtonTaskMenu::refreshAssignMenu(const QDesignerFormWindowInterface *fw, i
QList<QAction*> ButtonTaskMenu::taskActions() const
{
ButtonTaskMenu *ncThis = const_cast<ButtonTaskMenu*>(this);
- QButtonGroup *buttonGroup = 0;
+ QButtonGroup *buttonGroup = nullptr;
QDesignerFormWindowInterface *fw = formWindow();
const SelectionType st = selectionType(fw->cursor(), &buttonGroup);
@@ -570,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;
}
@@ -580,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;
}
@@ -590,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)
@@ -624,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<const QAbstractButton *>(cursor->selectedWidget(i))) {
QButtonGroup *buttonGroup = ab->group();
@@ -653,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 f15e6b0e3..ab58c0630 100644
--- a/src/designer/src/components/taskmenu/button_taskmenu.h
+++ b/src/designer/src/components/taskmenu/button_taskmenu.h
@@ -49,14 +49,14 @@ namespace qdesigner_internal {
class ButtonGroupMenu : public QObject
{
Q_OBJECT
- Q_DISABLE_COPY(ButtonGroupMenu)
+ Q_DISABLE_COPY_MOVE(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; }
@@ -69,19 +69,19 @@ private:
QAction *m_selectGroupAction;
QAction *m_breakGroupAction;
- QDesignerFormWindowInterface *m_formWindow;
- QButtonGroup *m_buttonGroup;
- QAbstractButton *m_currentButton;
+ QDesignerFormWindowInterface *m_formWindow = nullptr;
+ QButtonGroup *m_buttonGroup = nullptr;
+ QAbstractButton *m_currentButton = nullptr;
};
// Task menu extension of a QButtonGroup
class ButtonGroupTaskMenu : public QObject, public QDesignerTaskMenuExtension
{
Q_OBJECT
- Q_DISABLE_COPY(ButtonGroupTaskMenu)
+ Q_DISABLE_COPY_MOVE(ButtonGroupTaskMenu)
Q_INTERFACES(QDesignerTaskMenuExtension)
public:
- explicit ButtonGroupTaskMenu(QButtonGroup *buttonGroup, QObject *parent = 0);
+ explicit ButtonGroupTaskMenu(QButtonGroup *buttonGroup, QObject *parent = nullptr);
QAction *preferredEditAction() const override;
QList<QAction*> taskActions() const override;
@@ -96,9 +96,9 @@ private:
class ButtonTaskMenu: public QDesignerTaskMenu
{
Q_OBJECT
- Q_DISABLE_COPY(ButtonTaskMenu)
+ Q_DISABLE_COPY_MOVE(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);
@@ -142,14 +142,14 @@ private:
class CommandLinkButtonTaskMenu: public ButtonTaskMenu
{
Q_OBJECT
- Q_DISABLE_COPY(CommandLinkButtonTaskMenu)
+ Q_DISABLE_COPY_MOVE(CommandLinkButtonTaskMenu)
public:
- explicit CommandLinkButtonTaskMenu(QCommandLinkButton *button, QObject *parent = 0);
+ explicit CommandLinkButtonTaskMenu(QCommandLinkButton *button, QObject *parent = nullptr);
};
-typedef ExtensionFactory<QDesignerTaskMenuExtension, QButtonGroup, ButtonGroupTaskMenu> ButtonGroupTaskMenuFactory;
-typedef ExtensionFactory<QDesignerTaskMenuExtension, QCommandLinkButton, CommandLinkButtonTaskMenu> CommandLinkButtonTaskMenuFactory;
-typedef ExtensionFactory<QDesignerTaskMenuExtension, QAbstractButton, ButtonTaskMenu> ButtonTaskMenuFactory;
+using ButtonGroupTaskMenuFactory = ExtensionFactory<QDesignerTaskMenuExtension, QButtonGroup, ButtonGroupTaskMenu>;
+using CommandLinkButtonTaskMenuFactory = ExtensionFactory<QDesignerTaskMenuExtension, QCommandLinkButton, CommandLinkButtonTaskMenu>;
+using ButtonTaskMenuFactory = ExtensionFactory<QDesignerTaskMenuExtension, QAbstractButton, ButtonTaskMenu>;
} // namespace qdesigner_internal
QT_END_NAMESPACE
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<QComboBox*>(qObject);
if (!combo)
- return 0;
+ return nullptr;
if (qobject_cast<QFontComboBox*>(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<QWidget*>(object);
@@ -306,12 +306,12 @@ QObject *ContainerWidgetTaskMenuFactory::createExtension(QObject *object, const
const int idx = wb->indexOfObject(widget);
const WidgetDataBaseItem *item = static_cast<const WidgetDataBaseItem *>(wb->item(idx));
if (item->addPageMethod().isEmpty())
- return 0;
+ return nullptr;
}
}
- if (qt_extension<QDesignerContainerExtension*>(extensionManager(), object) == 0)
- return 0;
+ if (qt_extension<QDesignerContainerExtension*>(extensionManager(), object) == nullptr)
+ return nullptr;
if (QMdiArea* ma = qobject_cast<QMdiArea*>(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 7074137d1..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<QAction*> taskActions() const override;
@@ -112,23 +112,23 @@ private:
class MdiContainerWidgetTaskMenu : public ContainerWidgetTaskMenu {
Q_OBJECT
public:
- explicit MdiContainerWidgetTaskMenu(QMdiArea *m, QObject *parent = 0);
+ explicit MdiContainerWidgetTaskMenu(QMdiArea *m, QObject *parent = nullptr);
QList<QAction*> taskActions() const override;
private:
void initializeActions();
- QAction *m_nextAction;
- QAction *m_previousAction;
- QAction *m_tileAction;
- QAction *m_cascadeAction;
+ QAction *m_nextAction = nullptr;
+ QAction *m_previousAction = nullptr;
+ QAction *m_tileAction = nullptr;
+ QAction *m_cascadeAction = nullptr;
};
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<QAction*> 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..44145bdba 100644
--- a/src/designer/src/components/taskmenu/inplace_widget_helper.cpp
+++ b/src/designer/src/components/taskmenu/inplace_widget_helper.cpp
@@ -38,19 +38,17 @@ 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))
{
- typedef void (QWidget::*QWidgetVoidSlot)();
-
m_editorWidget->setAttribute(Qt::WA_DeleteOnClose);
m_editorWidget->setParent(m_parentWidget->window());
m_parentWidget->installEventFilter(this);
m_editorWidget->installEventFilter(this);
connect(m_editorWidget, &QObject::destroyed,
- fw->mainContainer(), static_cast<QWidgetVoidSlot>(&QWidget::setFocus));
+ fw->mainContainer(), QOverload<>::of(&QWidget::setFocus));
}
InPlaceWidgetHelper::~InPlaceWidgetHelper()
diff --git a/src/designer/src/components/taskmenu/itemlisteditor.cpp b/src/designer/src/components/taskmenu/itemlisteditor.cpp
index a5ec15e48..8aca0916d 100644
--- a/src/designer/src/components/taskmenu/itemlisteditor.cpp
+++ b/src/designer/src/components/taskmenu/itemlisteditor.cpp
@@ -68,8 +68,7 @@ private:
////////////////// Item editor ///////////////
AbstractItemEditor::AbstractItemEditor(QDesignerFormWindowInterface *form, QWidget *parent)
: QWidget(parent),
- m_iconCache(qobject_cast<FormWindowBase *>(form)->iconCache()),
- m_updatingBrowser(false)
+ m_iconCache(qobject_cast<FormWindowBase *>(form)->iconCache())
{
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_propertyManager = new DesignerPropertyManager(form->core(), this);
@@ -99,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/itemlisteditor.h b/src/designer/src/components/taskmenu/itemlisteditor.h
index e9b292446..97bcb19d9 100644
--- a/src/designer/src/components/taskmenu/itemlisteditor.h
+++ b/src/designer/src/components/taskmenu/itemlisteditor.h
@@ -97,12 +97,12 @@ protected:
DesignerIconCache *m_iconCache;
DesignerPropertyManager *m_propertyManager;
DesignerEditorFactory *m_editorFactory;
- QSplitter *m_propertySplitter;
+ QSplitter *m_propertySplitter = nullptr;
QtTreePropertyBrowser *m_propertyBrowser;
QList<QtVariantProperty*> m_properties;
QList<QtVariantProperty*> m_rootProperties;
QHash<QtVariantProperty*, int> m_propertyToRole;
- bool m_updatingBrowser;
+ bool m_updatingBrowser = false;
};
class ItemListEditor: public AbstractItemEditor
diff --git a/src/designer/src/components/taskmenu/label_taskmenu.h b/src/designer/src/components/taskmenu/label_taskmenu.h
index 64e6423d7..a1744b583 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<QAction*> taskActions() const override;
@@ -60,7 +60,7 @@ private:
QAction *m_editPlainTextAction;
};
-typedef ExtensionFactory<QDesignerTaskMenuExtension, QLabel, LabelTaskMenu> LabelTaskMenuFactory;
+using LabelTaskMenuFactory = ExtensionFactory<QDesignerTaskMenuExtension, QLabel, LabelTaskMenu>;
} // namespace qdesigner_internal
QT_END_NAMESPACE
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<QAction*> SpacerTaskMenu::taskActions() const
diff --git a/src/designer/src/components/taskmenu/layouttaskmenu.h b/src/designer/src/components/taskmenu/layouttaskmenu.h
index d14b3ebac..afd1afe0f 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<QAction*> taskActions() const override;
@@ -65,15 +65,15 @@ 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<QAction*> taskActions() const override;
};
-typedef qdesigner_internal::ExtensionFactory<QDesignerTaskMenuExtension, QLayoutWidget, LayoutWidgetTaskMenu> LayoutWidgetTaskMenuFactory;
-typedef qdesigner_internal::ExtensionFactory<QDesignerTaskMenuExtension, Spacer, SpacerTaskMenu> SpacerTaskMenuFactory;
+using LayoutWidgetTaskMenuFactory = qdesigner_internal::ExtensionFactory<QDesignerTaskMenuExtension, QLayoutWidget, LayoutWidgetTaskMenu>;
+using SpacerTaskMenuFactory = qdesigner_internal::ExtensionFactory<QDesignerTaskMenuExtension, Spacer, SpacerTaskMenu>;
QT_END_NAMESPACE
diff --git a/src/designer/src/components/taskmenu/lineedit_taskmenu.h b/src/designer/src/components/taskmenu/lineedit_taskmenu.h
index 08e0c15fd..e28ab7336 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<QAction*> taskActions() const override;
@@ -53,7 +53,7 @@ private:
QAction *m_editTextAction;
};
-typedef ExtensionFactory<QDesignerTaskMenuExtension, QLineEdit, LineEditTaskMenu> LineEditTaskMenuFactory;
+using LineEditTaskMenuFactory = ExtensionFactory<QDesignerTaskMenuExtension, QLineEdit, LineEditTaskMenu>;
} // namespace qdesigner_internal
QT_END_NAMESPACE
diff --git a/src/designer/src/components/taskmenu/listwidget_taskmenu.cpp b/src/designer/src/components/taskmenu/listwidget_taskmenu.cpp
index 46a8afda8..74bff711d 100644
--- a/src/designer/src/components/taskmenu/listwidget_taskmenu.cpp
+++ b/src/designer/src/components/taskmenu/listwidget_taskmenu.cpp
@@ -60,9 +60,7 @@ ListWidgetTaskMenu::ListWidgetTaskMenu(QListWidget *button, QObject *parent)
m_taskActions.append(sep);
}
-ListWidgetTaskMenu::~ListWidgetTaskMenu()
-{
-}
+ListWidgetTaskMenu::~ListWidgetTaskMenu() = default;
QAction *ListWidgetTaskMenu::preferredEditAction() const
{
@@ -80,7 +78,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..63708be61 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;
@@ -64,7 +64,7 @@ private:
QAction *m_editItemsAction;
};
-typedef ExtensionFactory<QDesignerTaskMenuExtension, QListWidget, ListWidgetTaskMenu> ListWidgetTaskMenuFactory;
+using ListWidgetTaskMenuFactory = ExtensionFactory<QDesignerTaskMenuExtension, QListWidget, ListWidgetTaskMenu>;
} // namespace qdesigner_internal
QT_END_NAMESPACE
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<QAction*> MenuTaskMenu::taskActions() const
@@ -81,7 +81,7 @@ namespace qdesigner_internal {
QAction *MenuBarTaskMenu::preferredEditAction() const
{
- return 0;
+ return nullptr;
}
QList<QAction*> MenuBarTaskMenu::taskActions() const
diff --git a/src/designer/src/components/taskmenu/menutaskmenu.h b/src/designer/src/components/taskmenu/menutaskmenu.h
index d08081b30..935836896 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<QAction*> 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<QAction*> taskActions() const override;
@@ -83,8 +83,8 @@ private:
QDesignerMenuBar *m_bar;
};
-typedef ExtensionFactory<QDesignerTaskMenuExtension, QDesignerMenu, MenuTaskMenu> MenuTaskMenuFactory;
-typedef ExtensionFactory<QDesignerTaskMenuExtension, QDesignerMenuBar, MenuBarTaskMenu> MenuBarTaskMenuFactory;
+using MenuTaskMenuFactory = ExtensionFactory<QDesignerTaskMenuExtension, QDesignerMenu, MenuTaskMenu>;
+using MenuBarTaskMenuFactory = ExtensionFactory<QDesignerTaskMenuExtension, QDesignerMenuBar, MenuBarTaskMenu>;
} // namespace qdesigner_internal
diff --git a/src/designer/src/components/taskmenu/tablewidget_taskmenu.cpp b/src/designer/src/components/taskmenu/tablewidget_taskmenu.cpp
index e7944a59c..25bc6ce40 100644
--- a/src/designer/src/components/taskmenu/tablewidget_taskmenu.cpp
+++ b/src/designer/src/components/taskmenu/tablewidget_taskmenu.cpp
@@ -59,9 +59,7 @@ TableWidgetTaskMenu::TableWidgetTaskMenu(QTableWidget *button, QObject *parent)
}
-TableWidgetTaskMenu::~TableWidgetTaskMenu()
-{
-}
+TableWidgetTaskMenu::~TableWidgetTaskMenu() = default;
QAction *TableWidgetTaskMenu::preferredEditAction() const
{
@@ -79,7 +77,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..b4d5462f2 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;
@@ -64,7 +64,7 @@ private:
QAction *m_editItemsAction;
};
-typedef ExtensionFactory<QDesignerTaskMenuExtension, QTableWidget, TableWidgetTaskMenu> TableWidgetTaskMenuFactory;
+using TableWidgetTaskMenuFactory = ExtensionFactory<QDesignerTaskMenuExtension, QTableWidget, TableWidgetTaskMenu>;
} // namespace qdesigner_internal
QT_END_NAMESPACE
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/tablewidgeteditor.h b/src/designer/src/components/taskmenu/tablewidgeteditor.h
index 72dbb58da..cedea521d 100644
--- a/src/designer/src/components/taskmenu/tablewidgeteditor.h
+++ b/src/designer/src/components/taskmenu/tablewidgeteditor.h
@@ -56,7 +56,7 @@ public:
private slots:
- void on_tableWidget_currentCellChanged(int currentRow, int currnetCol, int, int);
+ void on_tableWidget_currentCellChanged(int currentRow, int currentCol, int, int);
void on_tableWidget_itemChanged(QTableWidgetItem *item);
void on_columnEditor_indexChanged(int idx);
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..2e50b8ca1 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;
@@ -67,8 +67,8 @@ private:
QAction *m_editTextAction;
};
-typedef ExtensionFactory<QDesignerTaskMenuExtension, QTextEdit, TextEditTaskMenu> TextEditTaskMenuFactory;
-typedef ExtensionFactory<QDesignerTaskMenuExtension, QPlainTextEdit, TextEditTaskMenu> PlainTextEditTaskMenuFactory;
+using TextEditTaskMenuFactory = ExtensionFactory<QDesignerTaskMenuExtension, QTextEdit, TextEditTaskMenu>;
+using PlainTextEditTaskMenuFactory = ExtensionFactory<QDesignerTaskMenuExtension, QPlainTextEdit, TextEditTaskMenu>;
} // namespace qdesigner_internal
QT_END_NAMESPACE
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<QAction*> ToolBarTaskMenu::taskActions() const
@@ -73,7 +73,7 @@ namespace qdesigner_internal {
QAction *StatusBarTaskMenu::preferredEditAction() const
{
- return 0;
+ return nullptr;
}
QList<QAction*> 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..3e8d5909b 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<QAction*> 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<QAction*> taskActions() const override;
@@ -76,8 +76,8 @@ private:
PromotionTaskMenu *m_promotionTaskMenu;
};
-typedef ExtensionFactory<QDesignerTaskMenuExtension, QToolBar, ToolBarTaskMenu> ToolBarTaskMenuFactory;
-typedef ExtensionFactory<QDesignerTaskMenuExtension, QStatusBar, StatusBarTaskMenu> StatusBarTaskMenuFactory;
+using ToolBarTaskMenuFactory = ExtensionFactory<QDesignerTaskMenuExtension, QToolBar, ToolBarTaskMenu>;
+using StatusBarTaskMenuFactory = ExtensionFactory<QDesignerTaskMenuExtension, QStatusBar, StatusBarTaskMenu>;
} // namespace qdesigner_internal
diff --git a/src/designer/src/components/taskmenu/treewidget_taskmenu.cpp b/src/designer/src/components/taskmenu/treewidget_taskmenu.cpp
index fe78399cd..c4ffd4ca5 100644
--- a/src/designer/src/components/taskmenu/treewidget_taskmenu.cpp
+++ b/src/designer/src/components/taskmenu/treewidget_taskmenu.cpp
@@ -58,9 +58,7 @@ TreeWidgetTaskMenu::TreeWidgetTaskMenu(QTreeWidget *button, QObject *parent)
}
-TreeWidgetTaskMenu::~TreeWidgetTaskMenu()
-{
-}
+TreeWidgetTaskMenu::~TreeWidgetTaskMenu() = default;
QAction *TreeWidgetTaskMenu::preferredEditAction() const
{
@@ -78,7 +76,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<QDesignerDnDItemInterface*> 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<const QDesignerMimeData *>(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<QWidget*>(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<QWidget*>().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..5b00ea68f 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;
@@ -129,7 +129,7 @@ public:
bool removeCustomWidgets();
private:
- typedef QList<WidgetBoxCategoryEntry> WidgetBoxCategoryEntrys;
+ using WidgetBoxCategoryEntrys = QList<WidgetBoxCategoryEntry>;
QDesignerFormEditorInterface *m_core;
WidgetBoxCategoryEntrys m_items;
@@ -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<QDesignerDnDItemInterface*> &item_list);
diff --git a/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp b/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp
index f12302ba1..dd17b3a4e 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<WidgetBoxCategoryListView*>(itemWidget(embedItem, 0));
@@ -152,12 +152,13 @@ void WidgetBoxTreeWidget::saveExpandedState() const
void WidgetBoxTreeWidget::restoreExpandedState()
{
- typedef QSet<QString> StringSet;
+ using StringSet = QSet<QString>;
QDesignerSettingsInterface *settings = m_core->settingsManager();
const QString groupKey = QLatin1String(widgetBoxSettingsGroupC) + QLatin1Char('/');
m_iconMode = settings->value(groupKey + QLatin1String(widgetBoxViewModeKeyC)).toBool();
updateViewMode();
- const StringSet closedCategories = settings->value(groupKey + QLatin1String(widgetBoxExpandedKeyC), QStringList()).toStringList().toSet();
+ const auto &closedCategoryList = settings->value(groupKey + QLatin1String(widgetBoxExpandedKeyC), QStringList()).toStringList();
+ const StringSet closedCategories(closedCategoryList.cbegin(), closedCategoryList.cend());
expandAll();
if (closedCategories.empty())
return;
@@ -217,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;
}
@@ -655,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<WidgetBoxCategoryListView*>(itemWidget(embedItem, 0));
@@ -865,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;
@@ -902,17 +903,17 @@ void WidgetBoxTreeWidget::contextMenuEvent(QContextMenuEvent *e)
void WidgetBoxTreeWidget::dropWidgets(const QList<QDesignerDnDItemInterface*> &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();
@@ -921,7 +922,7 @@ void WidgetBoxTreeWidget::dropWidgets(const QList<QDesignerDnDItemInterface*> &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..0961e658d 100644
--- a/src/designer/src/components/widgetbox/widgetboxtreewidget.h
+++ b/src/designer/src/components/widgetbox/widgetboxtreewidget.h
@@ -55,11 +55,11 @@ class WidgetBoxTreeWidget : public QTreeWidget
Q_OBJECT
public:
- typedef QDesignerWidgetBoxInterface::Widget Widget;
- typedef QDesignerWidgetBoxInterface::Category Category;
- typedef QDesignerWidgetBoxInterface::CategoryList CategoryList;
+ using Widget = QDesignerWidgetBoxInterface::Widget;
+ using Category = QDesignerWidgetBoxInterface::Category;
+ using CategoryList = QDesignerWidgetBoxInterface::CategoryList;
- explicit WidgetBoxTreeWidget(QDesignerFormEditorInterface *core, QWidget *parent = 0);
+ explicit WidgetBoxTreeWidget(QDesignerFormEditorInterface *core, QWidget *parent = nullptr);
~WidgetBoxTreeWidget();
int categoryCount() const;
@@ -82,14 +82,14 @@ public:
QIcon iconForWidget(const QString &iconName) const;
signals:
- void pressed(const QString name, const QString dom_xml, const QPoint &global_mouse_pos);
+ void pressed(const QString &name, const QString &dom_xml, const QPoint &global_mouse_pos);
public slots:
void filter(const QString &);
protected:
- void contextMenuEvent(QContextMenuEvent *e);
- void resizeEvent(QResizeEvent *e);
+ void contextMenuEvent(QContextMenuEvent *e) override;
+ void resizeEvent(QResizeEvent *e) override;
private slots:
void slotSave();
@@ -123,7 +123,7 @@ private:
QDesignerFormEditorInterface *m_core;
QString m_file_name;
- typedef QHash<QString, QIcon> IconCache;
+ using IconCache = QHash<QString, QIcon>;
mutable IconCache m_pluginIcons;
bool m_iconMode;
QTimer *m_scratchPadDeleteTimer;
diff --git a/src/designer/src/designer/appfontdialog.cpp b/src/designer/src/designer/appfontdialog.cpp
index e5a76033f..b1a3942df 100644
--- a/src/designer/src/designer/appfontdialog.cpp
+++ b/src/designer/src/designer/appfontdialog.cpp
@@ -65,7 +65,7 @@ static const char fontFileKeyC[] = "fontFiles";
class AppFontManager
{
- Q_DISABLE_COPY(AppFontManager)
+ Q_DISABLE_COPY_MOVE(AppFontManager)
AppFontManager();
public:
static AppFontManager &instance();
@@ -81,17 +81,15 @@ public:
bool removeAt(int index, QString *errorMessage);
// Store loaded fonts as pair of file name and Id
- typedef QPair<QString,int> FileNameFontIdPair;
- typedef QList<FileNameFontIdPair> FileNameFontIdPairs;
+ using FileNameFontIdPair = QPair<QString,int>;
+ using FileNameFontIdPairs = QList<FileNameFontIdPair>;
const FileNameFontIdPairs &fonts() const;
private:
FileNameFontIdPairs m_fonts;
};
-AppFontManager::AppFontManager()
-{
-}
+AppFontManager::AppFontManager() = default;
AppFontManager &AppFontManager::instance()
{
@@ -213,9 +211,9 @@ const AppFontManager::FileNameFontIdPairs &AppFontManager::fonts() const
// ------------- AppFontModel
class AppFontModel : public QStandardItemModel {
- Q_DISABLE_COPY(AppFontModel)
+ Q_DISABLE_COPY_MOVE(AppFontModel)
public:
- AppFontModel(QObject *parent = 0);
+ AppFontModel(QObject *parent = nullptr);
void init(const AppFontManager &mgr);
void add(const QString &fontFile, int id);
@@ -230,7 +228,7 @@ AppFontModel::AppFontModel(QObject * parent) :
void AppFontModel::init(const AppFontManager &mgr)
{
- typedef AppFontManager::FileNameFontIdPairs FileNameFontIdPairs;
+ using FileNameFontIdPairs = AppFontManager::FileNameFontIdPairs;
const FileNameFontIdPairs &fonts = mgr.fonts();
const FileNameFontIdPairs::const_iterator cend = fonts.constEnd();
diff --git a/src/designer/src/designer/appfontdialog.h b/src/designer/src/designer/appfontdialog.h
index ca5bc3320..4a5b128af 100644
--- a/src/designer/src/designer/appfontdialog.h
+++ b/src/designer/src/designer/appfontdialog.h
@@ -46,10 +46,10 @@ class QDesignerSettingsInterface;
class AppFontWidget : public QGroupBox
{
- Q_DISABLE_COPY(AppFontWidget)
+ Q_DISABLE_COPY_MOVE(AppFontWidget)
Q_OBJECT
public:
- explicit AppFontWidget(QWidget *parent = 0);
+ explicit AppFontWidget(QWidget *parent = nullptr);
QStringList fontFiles() const;
@@ -74,10 +74,10 @@ private:
class AppFontDialog : public QDialog
{
- Q_DISABLE_COPY(AppFontDialog)
+ Q_DISABLE_COPY_MOVE(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/assistantclient.cpp b/src/designer/src/designer/assistantclient.cpp
index 8181f4963..bf8026c3c 100644
--- a/src/designer/src/designer/assistantclient.cpp
+++ b/src/designer/src/designer/assistantclient.cpp
@@ -42,10 +42,7 @@ QT_BEGIN_NAMESPACE
enum { debugAssistantClient = 0 };
-AssistantClient::AssistantClient() :
- m_process(0)
-{
-}
+AssistantClient::AssistantClient() = default;
AssistantClient::~AssistantClient()
{
diff --git a/src/designer/src/designer/assistantclient.h b/src/designer/src/designer/assistantclient.h
index 9a6a9d6e8..94618662a 100644
--- a/src/designer/src/designer/assistantclient.h
+++ b/src/designer/src/designer/assistantclient.h
@@ -64,7 +64,7 @@ private:
bool sendCommand(const QString &cmd, QString *errorMessage);
bool ensureRunning(QString *errorMessage);
- QProcess *m_process;
+ QProcess *m_process = nullptr;
};
QT_END_NAMESPACE
diff --git a/src/designer/src/designer/mainwindow.cpp b/src/designer/src/designer/mainwindow.cpp
index 2e6d8574e..3a1ae3ce9 100644
--- a/src/designer/src/designer/mainwindow.cpp
+++ b/src/designer/src/designer/mainwindow.cpp
@@ -56,7 +56,7 @@ static const char *uriListMimeFormatC = "text/uri-list";
QT_BEGIN_NAMESPACE
-typedef QList<QAction *> ActionList;
+using ActionList = QList<QAction *>;
// Helpers for creating toolbars and menu
@@ -79,8 +79,7 @@ static QToolBar *createToolBar(const QString &title, const QString &objectName,
// ---------------- MainWindowBase
MainWindowBase::MainWindowBase(QWidget *parent, Qt::WindowFlags flags) :
- QMainWindow(parent, flags),
- m_policy(AcceptCloseEvents)
+ QMainWindow(parent, flags)
{
#ifndef Q_OS_MACOS
setWindowIcon(qDesigner->windowIcon());
@@ -294,7 +293,7 @@ bool ToolBarManager::restoreState(const QByteArray &state, int version)
DockedMainWindow::DockedMainWindow(QDesignerWorkbench *wb,
QMenu *toolBarMenu,
const QVector<QDesignerToolWindow *> &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 79c0ef7ac..3bbfbb7fd 100644
--- a/src/designer/src/designer/mainwindow.h
+++ b/src/designer/src/designer/mainwindow.h
@@ -55,10 +55,10 @@ class QMimeData;
class MainWindowBase: public QMainWindow
{
- Q_DISABLE_COPY(MainWindowBase)
+ Q_DISABLE_COPY_MOVE(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 {
@@ -82,17 +82,17 @@ signals:
protected:
void closeEvent(QCloseEvent *e) override;
private:
- CloseEventPolicy m_policy;
+ CloseEventPolicy m_policy = AcceptCloseEvents;
};
/* An MdiArea that listens for desktop file manager file drop events and emits
* a signal to open a dropped file. */
class DockedMdiArea : public QMdiArea
{
- Q_DISABLE_COPY(DockedMdiArea)
+ Q_DISABLE_COPY_MOVE(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 &);
@@ -111,7 +111,7 @@ private:
class ToolBarManager : public QObject
{
Q_OBJECT
- Q_DISABLE_COPY(ToolBarManager)
+ Q_DISABLE_COPY_MOVE(ToolBarManager)
public:
explicit ToolBarManager(QMainWindow *configureableMainWindow,
QWidget *parent,
@@ -139,10 +139,10 @@ private:
/* Main window to be used for docked mode */
class DockedMainWindow : public MainWindowBase {
Q_OBJECT
- Q_DISABLE_COPY(DockedMainWindow)
+ Q_DISABLE_COPY_MOVE(DockedMainWindow)
public:
- typedef QVector<QDesignerToolWindow *> DesignerToolWindowList;
- typedef QVector<QDockWidget *> DockWidgetList;
+ using DesignerToolWindowList = QVector<QDesignerToolWindow *>;
+ using DockWidgetList = QVector<QDockWidget *>;
explicit DockedMainWindow(QDesignerWorkbench *wb,
QMenu *toolBarMenu,
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/newform.h b/src/designer/src/designer/newform.h
index 50b30cbcd..79b99f7c5 100644
--- a/src/designer/src/designer/newform.h
+++ b/src/designer/src/designer/newform.h
@@ -51,7 +51,7 @@ class QIODevice;
class NewForm: public QDialog
{
Q_OBJECT
- Q_DISABLE_COPY(NewForm)
+ Q_DISABLE_COPY_MOVE(NewForm)
public:
NewForm(QDesignerWorkbench *workbench,
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 a5e357994..71a02f759 100644
--- a/src/designer/src/designer/qdesigner_actions.cpp
+++ b/src/designer/src/designer/qdesigner_actions.cpp
@@ -92,6 +92,8 @@
#include <QtCore/qtimer.h>
#include <QtCore/qmetaobject.h>
#include <QtCore/qfileinfo.h>
+#include <QtCore/qsavefile.h>
+#include <QtCore/qscopedpointer.h>
#include <QtWidgets/qstatusbar.h>
#include <QtWidgets/qdesktopwidget.h>
#include <QtXml/qdom.h>
@@ -129,36 +131,18 @@ static inline QString savedMessage(const QString &fileName)
return QDesignerActions::tr("Saved %1.").arg(fileName);
}
-// Prompt for a file and make sure an extension is added
-// unless the user explicitly specifies another one.
-
-static QString getSaveFileNameWithExtension(QWidget *parent, const QString &title, QString dir, const QString &filter, const QString &extension)
+static QString fileDialogFilters(const QString &extension)
{
- const QChar dot = QLatin1Char('.');
-
- QString saveFile;
- while (true) {
- saveFile = QFileDialog::getSaveFileName(parent, title, dir, filter, 0, QFileDialog::DontConfirmOverwrite);
- if (saveFile.isEmpty())
- return saveFile;
-
- const QFileInfo fInfo(saveFile);
- if (fInfo.suffix().isEmpty() && !fInfo.fileName().endsWith(dot)) {
- saveFile += dot;
- saveFile += extension;
- }
-
- const QFileInfo fi(saveFile);
- if (!fi.exists())
- break;
-
- const QString prompt = QDesignerActions::tr("%1 already exists.\nDo you want to replace it?").arg(fi.fileName());
- if (QMessageBox::warning(parent, title, prompt, QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
- break;
+ return QDesignerActions::tr("Designer UI files (*.%1);;All Files (*)").arg(extension);
+}
- dir = saveFile;
- }
- return saveFile;
+QFileDialog *createSaveAsDialog(QWidget *parent, const QString &dir, const QString &extension)
+{
+ auto result = new QFileDialog(parent, QDesignerActions::tr("Save Form As"),
+ dir, fileDialogFilters(extension));
+ result->setAcceptMode(QFileDialog::AcceptSave);
+ result->setDefaultSuffix(extension);
+ return result;
}
QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
@@ -185,7 +169,8 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
m_savePreviewImageAction(new QAction(tr("Save &Image..."), this)),
m_printPreviewAction(new QAction(tr("&Print..."), this)),
m_quitAction(new QAction(tr("&Quit"), this)),
- m_viewCodeAction(new QAction(tr("View &Code..."), this)),
+ m_viewCppCodeAction(new QAction(tr("View &C++ Code..."), this)),
+ m_viewPythonCodeAction(new QAction(tr("View &Python Code..."), this)),
m_minimizeAction(new QAction(tr("&Minimize"), this)),
m_bringAllToFrontSeparator(createSeparator(this)),
m_bringAllToFrontAction(new QAction(tr("Bring All to Front"), this)),
@@ -193,8 +178,6 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
m_preferencesAction(new QAction(tr("Preferences..."), this)),
m_appFontAction(new QAction(tr("Additional Fonts..."), this))
{
- typedef void (QDesignerActions::*VoidSlot)();
-
#if defined (Q_OS_UNIX) && !defined(Q_OS_MACOS)
m_newFormAction->setIcon(QIcon::fromTheme(QStringLiteral("document-new"), m_newFormAction->icon()));
m_openFormAction->setIcon(QIcon::fromTheme(QStringLiteral("document-open"), m_openFormAction->icon()));
@@ -205,7 +188,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<qdesigner_internal::QDesignerFormWindowManager *>(m_core->formWindowManager());
Q_ASSERT(ifwm);
m_previewManager = ifwm->previewManager();
@@ -224,7 +207,8 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
m_closeFormAction->setObjectName(QStringLiteral("__qt_close_form_action"));
m_quitAction->setObjectName(QStringLiteral("__qt_quit_action"));
m_previewFormAction->setObjectName(QStringLiteral("__qt_preview_form_action"));
- m_viewCodeAction->setObjectName(QStringLiteral("__qt_preview_code_action"));
+ m_viewCppCodeAction->setObjectName(QStringLiteral("__qt_preview_cpp_code_action"));
+ m_viewPythonCodeAction->setObjectName(QStringLiteral("__qt_preview_python_code_action"));
m_minimizeAction->setObjectName(QStringLiteral("__qt_minimize_action"));
m_bringAllToFrontAction->setObjectName(QStringLiteral("__qt_bring_all_to_front_action"));
m_preferencesAction->setObjectName(QStringLiteral("__qt_preferences_action"));
@@ -236,7 +220,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
@@ -253,10 +237,12 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
m_fileActions->addAction(createSeparator(this));
m_saveFormAction->setShortcut(QKeySequence::Save);
- connect(m_saveFormAction, &QAction::triggered, this, static_cast<VoidSlot>(&QDesignerActions::saveForm));
+ connect(m_saveFormAction, &QAction::triggered, this,
+ QOverload<>::of(&QDesignerActions::saveForm));
m_fileActions->addAction(m_saveFormAction);
- connect(m_saveFormAsAction, &QAction::triggered, this, static_cast<VoidSlot>(&QDesignerActions::saveFormAs));
+ connect(m_saveFormAsAction, &QAction::triggered, this,
+ QOverload<>::of(&QDesignerActions::saveFormAs));
m_fileActions->addAction(m_saveFormAsAction);
#ifdef Q_OS_MACOS
@@ -393,10 +379,16 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
connect(m_previewManager, &qdesigner_internal::PreviewManager::lastPreviewClosed,
this, &QDesignerActions::updateCloseAction);
- connect(m_viewCodeAction, &QAction::triggered, this, &QDesignerActions::viewCode);
- // Preview code only in Cpp
- if (qt_extension<QDesignerLanguageExtension *>(m_core->extensionManager(), m_core) == 0)
- m_formActions->addAction(m_viewCodeAction);
+ connect(m_viewCppCodeAction, &QAction::triggered, this,
+ [this] () { this->viewCode(qdesigner_internal::UicLanguage::Cpp); });
+ connect(m_viewPythonCodeAction, &QAction::triggered, this,
+ [this] () { this->viewCode(qdesigner_internal::UicLanguage::Python); });
+
+ // Preview code only in Cpp/Python (uic)
+ if (qt_extension<QDesignerLanguageExtension *>(m_core->extensionManager(), m_core) == nullptr) {
+ m_formActions->addAction(m_viewCppCodeAction);
+ m_formActions->addAction(m_viewPythonCodeAction);
+ }
m_formActions->addAction(createSeparator(this));
@@ -557,7 +549,7 @@ QAction *QDesignerActions::previewFormAction() const
{ return m_previewFormAction; }
QAction *QDesignerActions::viewCodeAction() const
-{ return m_viewCodeAction; }
+{ return m_viewCppCodeAction; }
void QDesignerActions::editWidgetsSlot()
@@ -596,7 +588,7 @@ bool QDesignerActions::openForm(QWidget *parent)
closePreview();
const QString extension = uiExtension();
const QStringList fileNames = QFileDialog::getOpenFileNames(parent, tr("Open Form"),
- m_openDirectory, tr("Designer UI files (*.%1);;All Files (*)").arg(extension), 0, QFileDialog::DontUseSheet);
+ m_openDirectory, fileDialogFilters(extension), nullptr);
if (fileNames.isEmpty())
return false;
@@ -633,10 +625,13 @@ bool QDesignerActions::saveFormAs(QDesignerFormWindowInterface *fw)
dir += extension;
}
- const QString saveFile = getSaveFileNameWithExtension(fw, tr("Save Form As"), dir, tr("Designer UI files (*.%1);;All Files (*)").arg(extension), extension);
- if (saveFile.isEmpty())
+ QScopedPointer<QFileDialog> saveAsDialog(createSaveAsDialog(fw, dir, extension));
+ if (saveAsDialog->exec() != QDialog::Accepted)
return false;
+ const QString saveFile = saveAsDialog->selectedFiles().constFirst();
+ saveAsDialog.reset(); // writeOutForm potentially shows other dialogs
+
fw->setFileName(saveFile);
return writeOutForm(fw, saveFile);
}
@@ -728,13 +723,13 @@ void QDesignerActions::closePreview()
m_previewManager->closeAllPreviews();
}
-void QDesignerActions::viewCode()
+void QDesignerActions::viewCode(qdesigner_internal::UicLanguage language)
{
QDesignerFormWindowInterface *fw = core()->formWindowManager()->activeFormWindow();
if (!fw)
return;
QString errorMessage;
- if (!qdesigner_internal::CodeDialog::showCodeDialog(fw, fw, &errorMessage))
+ if (!qdesigner_internal::CodeDialog::showCodeDialog(fw, language, fw, &errorMessage))
QMessageBox::warning(fw, tr("Code generation failed"), errorMessage);
}
@@ -778,7 +773,7 @@ bool QDesignerActions::readInForm(const QString &fileName)
const QString extension = uiExtension();
fn = QFileDialog::getOpenFileName(core()->topLevel(),
tr("Open Form"), m_openDirectory,
- tr("Designer UI files (*.%1);;All Files (*)").arg(extension), 0, QFileDialog::DontUseSheet);
+ fileDialogFilters(extension), nullptr);
if (fn.isEmpty())
return false;
@@ -804,37 +799,10 @@ bool QDesignerActions::readInForm(const QString &fileName)
return true;
}
-static QString createBackup(const QString &fileName)
-{
- const QString suffix = QStringLiteral(".bak");
- QString backupFile = fileName + suffix;
- QFileInfo fi(backupFile);
- int i = 0;
- while (fi.exists()) {
- backupFile = fileName + suffix + QString::number(++i);
- fi.setFile(backupFile);
- }
-
- if (QFile::copy(fileName, backupFile))
- return backupFile;
- return QString();
-}
-
-static void removeBackup(const QString &backupFile)
-{
- if (!backupFile.isEmpty())
- QFile::remove(backupFile);
-}
-
bool QDesignerActions::writeOutForm(QDesignerFormWindowInterface *fw, const QString &saveFile, bool check)
{
Q_ASSERT(fw && !saveFile.isEmpty());
- QString backupFile;
- QFileInfo fi(saveFile);
- if (fi.exists())
- backupFile = createBackup(saveFile);
-
if (check) {
const QStringList problems = fw->checkContents();
if (!problems.isEmpty())
@@ -846,10 +814,9 @@ bool QDesignerActions::writeOutForm(QDesignerFormWindowInterface *fw, const QStr
if (fwb->lineTerminatorMode() == qdesigner_internal::FormWindowBase::CRLFLineTerminator)
contents.replace(QLatin1Char('\n'), QStringLiteral("\r\n"));
}
- const QByteArray utf8Array = contents.toUtf8();
m_workbench->updateBackup(fw);
- QFile f(saveFile);
+ QSaveFile f(saveFile);
while (!f.open(QFile::WriteOnly)) {
QMessageBox box(QMessageBox::Warning,
tr("Save Form?"),
@@ -867,52 +834,33 @@ bool QDesignerActions::writeOutForm(QDesignerFormWindowInterface *fw, const QStr
QPushButton *cancelButton = box.addButton(QMessageBox::Cancel);
box.exec();
- if (box.clickedButton() == cancelButton) {
- removeBackup(backupFile);
+ if (box.clickedButton() == cancelButton)
return false;
- }
if (box.clickedButton() == switchButton) {
- QString extension = uiExtension();
- const QString fileName = QFileDialog::getSaveFileName(fw, tr("Save Form As"),
- QDir::current().absolutePath(),
- QStringLiteral("*.") + extension);
- if (fileName.isEmpty()) {
- removeBackup(backupFile);
+ QScopedPointer<QFileDialog> saveAsDialog(createSaveAsDialog(fw, QDir::currentPath(), uiExtension()));
+ if (saveAsDialog->exec() != QDialog::Accepted)
return false;
- }
- if (f.fileName() != fileName) {
- removeBackup(backupFile);
- fi.setFile(fileName);
- backupFile.clear();
- if (fi.exists())
- backupFile = createBackup(fileName);
- }
+
+ const QString fileName = saveAsDialog->selectedFiles().constFirst();
f.setFileName(fileName);
fw->setFileName(fileName);
}
// loop back around...
}
- while (f.write(utf8Array, utf8Array.size()) != utf8Array.size()) {
- QMessageBox box(QMessageBox::Warning, tr("Save Form?"),
+ f.write(contents.toUtf8());
+ if (!f.commit()) {
+ QMessageBox box(QMessageBox::Warning, tr("Save Form"),
tr("Could not write file"),
- QMessageBox::Retry|QMessageBox::Cancel, fw);
+ QMessageBox::Cancel, fw);
box.setWindowModality(Qt::WindowModal);
- box.setInformativeText(tr("It was not possible to write the entire file %1 to disk."
- "\nReason:%2\nWould you like to retry?")
+ box.setInformativeText(tr("It was not possible to write the file %1 to disk."
+ "\nReason: %2")
.arg(f.fileName(), f.errorString()));
- box.setDefaultButton(QMessageBox::Retry);
- switch (box.exec()) {
- case QMessageBox::Retry:
- f.resize(0);
- break;
- default:
- return false;
- }
+ box.exec();
+ return false;
}
- f.close();
- removeBackup(backupFile);
addRecentFile(saveFile);
- m_saveDirectory = QFileInfo(f).absolutePath();
+ m_saveDirectory = QFileInfo(f.fileName()).absolutePath();
fw->setDirty(false);
fw->parentWidget()->setWindowModified(false);
@@ -931,7 +879,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);
@@ -943,7 +891,8 @@ void QDesignerActions::activeFormWindowChanged(QDesignerFormWindowInterface *for
m_editWidgetsAction->setEnabled(enable);
m_previewFormAction->setEnabled(enable);
- m_viewCodeAction->setEnabled(enable);
+ m_viewCppCodeAction->setEnabled(enable);
+ m_viewPythonCodeAction->setEnabled(enable);
m_styleActions->setEnabled(enable);
}
@@ -1321,10 +1270,15 @@ void QDesignerActions::savePreviewImage()
suggestion += QLatin1Char('.');
suggestion += extension;
}
+
+ QFileDialog dialog(fw, tr("Save Image"), suggestion, filter);
+ dialog.setAcceptMode(QFileDialog::AcceptSave);
+ dialog.setDefaultSuffix(extension);
+
do {
- const QString fileName = getSaveFileNameWithExtension(fw, tr("Save Image"), suggestion, filter, extension);
- if (fileName.isEmpty())
+ if (dialog.exec() != QDialog::Accepted)
break;
+ const QString fileName = dialog.selectedFiles().constFirst();
if (image.isNull()) {
const QPixmap pixmap = createPreviewPixmap(fw);
diff --git a/src/designer/src/designer/qdesigner_actions.h b/src/designer/src/designer/qdesigner_actions.h
index 95556cffd..4192a002b 100644
--- a/src/designer/src/designer/qdesigner_actions.h
+++ b/src/designer/src/designer/qdesigner_actions.h
@@ -56,6 +56,7 @@ class QMenu;
namespace qdesigner_internal {
class PreviewConfiguration;
class PreviewManager;
+ enum class UicLanguage;
}
class QDesignerActions: public QObject
@@ -118,7 +119,6 @@ private slots:
void saveFormAs();
void saveAllForms();
void saveFormAsTemplate();
- void viewCode();
void notImplementedYet();
void shutdown();
void editWidgetsSlot();
@@ -152,6 +152,7 @@ private:
bool ensureBackupDirectories();
QPixmap createPreviewPixmap(QDesignerFormWindowInterface *fw);
qdesigner_internal::PreviewConfiguration previewConfiguration();
+ void viewCode(qdesigner_internal::UicLanguage language);
enum { MaxRecentFiles = 10 };
QDesignerWorkbench *m_workbench;
@@ -192,7 +193,8 @@ private:
QAction *m_quitAction;
QAction *m_previewFormAction = nullptr;
- QAction *m_viewCodeAction;
+ QAction *m_viewCppCodeAction;
+ QAction *m_viewPythonCodeAction;
QAction *m_minimizeAction;
QAction *m_bringAllToFrontSeparator;
diff --git a/src/designer/src/designer/qdesigner_appearanceoptions.cpp b/src/designer/src/designer/qdesigner_appearanceoptions.cpp
index 04f3ab1d4..66eb49c9f 100644
--- a/src/designer/src/designer/qdesigner_appearanceoptions.cpp
+++ b/src/designer/src/designer/qdesigner_appearanceoptions.cpp
@@ -59,8 +59,7 @@ void AppearanceOptions::fromSettings(const QDesignerSettings &settings)
// ---------------- QDesignerAppearanceOptionsWidget
QDesignerAppearanceOptionsWidget::QDesignerAppearanceOptionsWidget(QWidget *parent) :
QWidget(parent),
- m_ui(new Ui::AppearanceOptionsWidget),
- m_initialUIMode(NeutralMode)
+ m_ui(new Ui::AppearanceOptionsWidget)
{
m_ui->setupUi(this);
diff --git a/src/designer/src/designer/qdesigner_appearanceoptions.h b/src/designer/src/designer/qdesigner_appearanceoptions.h
index 04f5ec3cf..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;
@@ -88,7 +88,7 @@ private:
UIMode uiMode() const;
Ui::AppearanceOptionsWidget *m_ui;
- UIMode m_initialUIMode;
+ UIMode m_initialUIMode = NeutralMode;
};
/* The options page for appearance options. */
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<QDesignerPropertySheetExtension*>(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 623935380..f2a8b5d1c 100644
--- a/src/designer/src/designer/qdesigner_workbench.cpp
+++ b/src/designer/src/designer/qdesigner_workbench.cpp
@@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE
static const char *appFontPrefixC = "AppFonts";
-typedef QList<QAction *> ActionList;
+using ActionList = QList<QAction *>;
static QMdiSubWindow *mdiSubWindowOf(const QWidget *w)
{
@@ -90,7 +90,7 @@ static QDockWidget *dockWidgetOf(const QWidget *w)
}
}
Q_ASSERT("Dock widget not found");
- return 0;
+ return nullptr;
}
// ------------ QDesignerWorkbench::Position
@@ -167,11 +167,7 @@ static inline QMenu *addMenu(QMenuBar *mb, const QString &title, const ActionLis
QDesignerWorkbench::QDesignerWorkbench() :
m_core(QDesignerComponents::createFormEditor(this)),
m_windowActions(new QActionGroup(this)),
- m_globalMenuBar(new QMenuBar),
- m_mode(NeutralMode),
- m_dockedMainWindow(0),
- m_state(StateInitializing),
- m_uiSettingsChanged(false)
+ m_globalMenuBar(new QMenuBar)
{
QDesignerSettings settings(m_core);
@@ -334,7 +330,7 @@ Qt::WindowFlags QDesignerWorkbench::magicalWindowFlags(const QWidget *widgetForF
return Qt::Window;
default:
Q_ASSERT(0);
- return 0;
+ return nullptr;
}
}
@@ -345,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;
@@ -365,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();
}
@@ -374,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()
@@ -562,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;
@@ -687,7 +683,7 @@ QDesignerFormWindow *QDesignerWorkbench::findFormWindow(QWidget *widget) const
return formWindow;
}
- return 0;
+ return nullptr;
}
bool QDesignerWorkbench::handleClose()
@@ -754,7 +750,7 @@ void QDesignerWorkbench::updateWindowMenu(QDesignerFormWindowInterface *fwi)
{
bool minimizeChecked = false;
bool minimizeEnabled = false;
- QDesignerFormWindow *activeFormWindow = 0;
+ QDesignerFormWindow *activeFormWindow = nullptr;
do {
if (!fwi)
break;
@@ -804,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);
@@ -912,13 +908,13 @@ QDesignerFormWindow * QDesignerWorkbench::loadForm(const QString &fileName,
if (!file.open(QFile::ReadOnly|QFile::Text)) {
*errorMessage = tr("The file <b>%1</b> 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);
@@ -931,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<qdesigner_internal::FormWindowBase *>(editor))
@@ -971,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;
@@ -983,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/qdesigner_workbench.h b/src/designer/src/designer/qdesigner_workbench.h
index 826611a95..fea02d59f 100644
--- a/src/designer/src/designer/qdesigner_workbench.h
+++ b/src/designer/src/designer/qdesigner_workbench.h
@@ -162,8 +162,8 @@ private:
};
TopLevelData m_topLevelData;
- UIMode m_mode;
- DockedMainWindow *m_dockedMainWindow;
+ UIMode m_mode = NeutralMode;
+ DockedMainWindow *m_dockedMainWindow = nullptr;
QVector<QDesignerToolWindow *> m_toolWindows;
QVector<QDesignerFormWindow *> m_formWindows;
@@ -189,12 +189,12 @@ private:
// main window in MDI mode)
QPoint m_position;
};
- typedef QHash<QWidget*, Position> PositionMap;
+ using PositionMap = QHash<QWidget*, Position>;
PositionMap m_Positions;
enum State { StateInitializing, StateUp, StateClosing };
- State m_state;
- bool m_uiSettingsChanged; // UI mode changed in preference dialog, trigger delayed slot.
+ State m_state = StateInitializing;
+ bool m_uiSettingsChanged = false; // UI mode changed in preference dialog, trigger delayed slot.
};
QT_END_NAMESPACE
diff --git a/src/designer/src/designer/saveformastemplate.cpp b/src/designer/src/designer/saveformastemplate.cpp
index 637d7a433..4b338308e 100644
--- a/src/designer/src/designer/saveformastemplate.cpp
+++ b/src/designer/src/designer/saveformastemplate.cpp
@@ -46,8 +46,6 @@ SaveFormAsTemplate::SaveFormAsTemplate(QDesignerFormEditorInterface *core,
m_core(core),
m_formWindow(formWindow)
{
- typedef void (QComboBox::*QComboIntSignal)(int);
-
ui.setupUi(this);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
@@ -62,7 +60,7 @@ SaveFormAsTemplate::SaveFormAsTemplate(QDesignerFormEditorInterface *core,
m_addPathIndex = ui.categoryCombo->count() - 1;
connect(ui.templateNameEdit, &QLineEdit::textChanged,
this, &SaveFormAsTemplate::updateOKButton);
- connect(ui.categoryCombo, static_cast<QComboIntSignal>(&QComboBox::activated),
+ connect(ui.categoryCombo, QOverload<int>::of(&QComboBox::activated),
this, &SaveFormAsTemplate::checkToAddPath);
}
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 0e5bb58d1..767d25171 100644
--- a/src/designer/src/designer/versiondialog.cpp
+++ b/src/designer/src/designer/versiondialog.cpp
@@ -43,26 +43,26 @@ class VersionLabel : public QLabel
{
Q_OBJECT
public:
- VersionLabel(QWidget *parent = 0);
+ VersionLabel(QWidget *parent = nullptr);
signals:
void triggered();
protected:
- void mousePressEvent(QMouseEvent *me);
- void mouseMoveEvent(QMouseEvent *me);
- void mouseReleaseEvent(QMouseEvent *me);
- void paintEvent(QPaintEvent *pe);
+ void mousePressEvent(QMouseEvent *me) override;
+ void mouseMoveEvent(QMouseEvent *me) override;
+ void mouseReleaseEvent(QMouseEvent *me) override;
+ void paintEvent(QPaintEvent *pe) override;
private:
QVector<QPoint> hitPoints;
QVector<QPoint> missPoints;
QPainterPath m_path;
- bool secondStage;
- bool m_pushed;
+ bool secondStage = false;
+ bool m_pushed = false;
};
VersionLabel::VersionLabel(QWidget *parent)
- : QLabel(parent), secondStage(false), m_pushed(false)
+ : QLabel(parent)
{
setPixmap(QPixmap(QStringLiteral(":/qt-project.org/designer/images/designer.png")));
hitPoints.append(QPoint(56, 25));
diff --git a/src/designer/src/lib/extension/default_extensionfactory.cpp b/src/designer/src/lib/extension/default_extensionfactory.cpp
index 23d2991e2..af1fe6f21 100644
--- a/src/designer/src/lib/extension/default_extensionfactory.cpp
+++ b/src/designer/src/lib/extension/default_extensionfactory.cpp
@@ -101,7 +101,7 @@ QExtensionFactory::QExtensionFactory(QExtensionManager *parent)
QObject *QExtensionFactory::extension(QObject *object, const QString &iid) const
{
if (!object)
- return 0;
+ return nullptr;
const IdObjectKey key = qMakePair(iid, object);
ExtensionMap::iterator it = m_extensions.find(key);
@@ -118,7 +118,7 @@ QObject *QExtensionFactory::extension(QObject *object, const QString &iid) const
}
if (it == m_extensions.end())
- return 0;
+ return nullptr;
return it.value();
}
@@ -148,7 +148,7 @@ QObject *QExtensionFactory::createExtension(QObject *object, const QString &iid,
Q_UNUSED(iid);
Q_UNUSED(parent);
- return 0;
+ return nullptr;
}
/*!
diff --git a/src/designer/src/lib/extension/default_extensionfactory.h b/src/designer/src/lib/extension/default_extensionfactory.h
index 58ba7a5e8..f14c33361 100644
--- a/src/designer/src/lib/extension/default_extensionfactory.h
+++ b/src/designer/src/lib/extension/default_extensionfactory.h
@@ -45,7 +45,7 @@ class QDESIGNER_EXTENSION_EXPORT QExtensionFactory : public QObject, public QAbs
Q_OBJECT
Q_INTERFACES(QAbstractExtensionFactory)
public:
- explicit QExtensionFactory(QExtensionManager *parent = Q_NULLPTR);
+ explicit QExtensionFactory(QExtensionManager *parent = nullptr);
QObject *extension(QObject *object, const QString &iid) const override;
QExtensionManager *extensionManager() const;
diff --git a/src/designer/src/lib/extension/extension.h b/src/designer/src/lib/extension/extension.h
index 295f8992d..7d9244287 100644
--- a/src/designer/src/lib/extension/extension.h
+++ b/src/designer/src/lib/extension/extension.h
@@ -59,13 +59,13 @@ Q_DECLARE_INTERFACE(QAbstractExtensionManager, "org.qt-project.Qt.QAbstractExten
template <class T>
inline T qt_extension(QAbstractExtensionManager *, QObject *)
-{ return Q_NULLPTR; }
+{ return nullptr; }
#define Q_DECLARE_EXTENSION_INTERFACE(IFace, IId) \
const char * const IFace##_iid = IId; \
Q_DECLARE_INTERFACE(IFace, IId) \
template <> inline IFace *qt_extension<IFace *>(QAbstractExtensionManager *manager, QObject *object) \
-{ QObject *extension = manager->extension(object, Q_TYPEID(IFace)); return extension ? static_cast<IFace *>(extension->qt_metacast(IFace##_iid)) : static_cast<IFace *>(Q_NULLPTR); }
+{ QObject *extension = manager->extension(object, Q_TYPEID(IFace)); return extension ? static_cast<IFace *>(extension->qt_metacast(IFace##_iid)) : static_cast<IFace *>(nullptr); }
QT_END_NAMESPACE
diff --git a/src/designer/src/lib/extension/qextensionmanager.cpp b/src/designer/src/lib/extension/qextensionmanager.cpp
index 4b9e7bd54..e6e0451c2 100644
--- a/src/designer/src/lib/extension/qextensionmanager.cpp
+++ b/src/designer/src/lib/extension/qextensionmanager.cpp
@@ -93,9 +93,7 @@ QExtensionManager::QExtensionManager(QObject *parent)
/*!
Destroys the extension manager
*/
-QExtensionManager::~QExtensionManager()
-{
-}
+QExtensionManager::~QExtensionManager() = default;
/*!
Register the extension specified by the given \a factory and
@@ -155,7 +153,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..49dd56224 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;
@@ -51,7 +51,7 @@ public:
QObject *extension(QObject *object, const QString &iid) const override;
private:
- typedef QList<QAbstractExtensionFactory*> FactoryList;
+ using FactoryList = QList<QAbstractExtensionFactory *>;
typedef QHash<QString, FactoryList> FactoryMap;
FactoryMap m_extensions;
FactoryList m_globalExtension;
diff --git a/src/designer/src/lib/sdk/abstractactioneditor.cpp b/src/designer/src/lib/sdk/abstractactioneditor.cpp
index 76e9a818a..badce0062 100644
--- a/src/designer/src/lib/sdk/abstractactioneditor.cpp
+++ b/src/designer/src/lib/sdk/abstractactioneditor.cpp
@@ -69,9 +69,7 @@ QDesignerActionEditorInterface::QDesignerActionEditorInterface(QWidget *parent,
/*!
Destroys the action editor interface.
*/
-QDesignerActionEditorInterface::~QDesignerActionEditorInterface()
-{
-}
+QDesignerActionEditorInterface::~QDesignerActionEditorInterface() = default;
/*!
Returns a pointer to \QD's current QDesignerFormEditorInterface
@@ -79,7 +77,7 @@ QDesignerActionEditorInterface::~QDesignerActionEditorInterface()
*/
QDesignerFormEditorInterface *QDesignerActionEditorInterface::core() const
{
- return 0;
+ return nullptr;
}
/*!
diff --git a/src/designer/src/lib/sdk/abstractdialoggui.cpp b/src/designer/src/lib/sdk/abstractdialoggui.cpp
index 7427ae0c7..5907999e7 100644
--- a/src/designer/src/lib/sdk/abstractdialoggui.cpp
+++ b/src/designer/src/lib/sdk/abstractdialoggui.cpp
@@ -69,16 +69,12 @@ QT_BEGIN_NAMESPACE
Constructs a QDesignerDialogGuiInterface object.
*/
-QDesignerDialogGuiInterface::QDesignerDialogGuiInterface()
-{
-}
+QDesignerDialogGuiInterface::QDesignerDialogGuiInterface() = default;
/*!
Destroys the QDesignerDialogGuiInterface object.
*/
-QDesignerDialogGuiInterface::~QDesignerDialogGuiInterface()
-{
-}
+QDesignerDialogGuiInterface::~QDesignerDialogGuiInterface() = default;
/*!
\fn QMessageBox::StandardButton QDesignerDialogGuiInterface::message(QWidget *parent, Message context, QMessageBox::Icon icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
diff --git a/src/designer/src/lib/sdk/abstractdialoggui_p.h b/src/designer/src/lib/sdk/abstractdialoggui_p.h
index a4e5918e6..b9c1814fd 100644
--- a/src/designer/src/lib/sdk/abstractdialoggui_p.h
+++ b/src/designer/src/lib/sdk/abstractdialoggui_p.h
@@ -50,7 +50,7 @@ class QWidget;
class QDESIGNER_SDK_EXPORT QDesignerDialogGuiInterface
{
- Q_DISABLE_COPY(QDesignerDialogGuiInterface)
+ Q_DISABLE_COPY_MOVE(QDesignerDialogGuiInterface)
public:
QDesignerDialogGuiInterface();
virtual ~QDesignerDialogGuiInterface();
@@ -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.cpp b/src/designer/src/lib/sdk/abstractformeditor.cpp
index 9afa36832..2d4b20812 100644
--- a/src/designer/src/lib/sdk/abstractformeditor.cpp
+++ b/src/designer/src/lib/sdk/abstractformeditor.cpp
@@ -89,26 +89,17 @@ public:
QPointer<QDesignerObjectInspectorInterface> m_objectInspector;
QPointer<QDesignerIntegrationInterface> m_integration;
QPointer<QDesignerActionEditorInterface> m_actionEditor;
- QDesignerSettingsInterface *m_settingsManager;
- QDesignerPluginManager *m_pluginManager;
- QDesignerPromotionInterface *m_promotion;
- QDesignerIntrospectionInterface *m_introspection;
- QDesignerDialogGuiInterface *m_dialogGui;
+ QDesignerSettingsInterface *m_settingsManager = nullptr;
+ QDesignerPluginManager *m_pluginManager = nullptr;
+ QDesignerPromotionInterface *m_promotion = nullptr;
+ QDesignerIntrospectionInterface *m_introspection = nullptr;
+ QDesignerDialogGuiInterface *m_dialogGui = nullptr;
QPointer<QtResourceModel> m_resourceModel;
QPointer<QtGradientManager> m_gradientManager; // instantiated and deleted by designer_integration
QList<QDesignerOptionsPageInterface*> m_optionsPages;
};
-QDesignerFormEditorInterfacePrivate::QDesignerFormEditorInterfacePrivate() :
- m_settingsManager(0),
- m_pluginManager(0),
- m_promotion(0),
- m_introspection(0),
- m_dialogGui(0),
- m_resourceModel(0),
- m_gradientManager(0)
-{
-}
+QDesignerFormEditorInterfacePrivate::QDesignerFormEditorInterfacePrivate() = default;
QDesignerFormEditorInterfacePrivate::~QDesignerFormEditorInterfacePrivate()
{
@@ -178,9 +169,7 @@ QDesignerFormEditorInterface::QDesignerFormEditorInterface(QObject *parent)
/*!
Destroys the QDesignerFormEditorInterface object.
*/
-QDesignerFormEditorInterface::~QDesignerFormEditorInterface()
-{
-}
+QDesignerFormEditorInterface::~QDesignerFormEditorInterface() = default;
/*!
Returns an interface to \QD's widget box.
@@ -345,8 +334,7 @@ QDesignerPromotionInterface *QDesignerFormEditorInterface::promotion() const
void QDesignerFormEditorInterface::setPromotion(QDesignerPromotionInterface *promotion)
{
- if (d->m_promotion)
- delete d->m_promotion;
+ delete d->m_promotion;
d->m_promotion = promotion;
}
@@ -536,8 +524,7 @@ QDesignerIntrospectionInterface *QDesignerFormEditorInterface::introspection() c
*/
void QDesignerFormEditorInterface::setIntrospection(QDesignerIntrospectionInterface *introspection)
{
- if (d->m_introspection)
- delete d->m_introspection;
+ delete d->m_introspection;
d->m_introspection = introspection;
}
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..0b24920aa 100644
--- a/src/designer/src/lib/sdk/abstractformwindow.cpp
+++ b/src/designer/src/lib/sdk/abstractformwindow.cpp
@@ -161,9 +161,7 @@ QDesignerFormWindowInterface::QDesignerFormWindowInterface(QWidget *parent, Qt::
/*!
Destroys the form window interface.
*/
-QDesignerFormWindowInterface::~QDesignerFormWindowInterface()
-{
-}
+QDesignerFormWindowInterface::~QDesignerFormWindowInterface() = default;
/*!
Returns a pointer to \QD's current QDesignerFormEditorInterface
@@ -171,7 +169,7 @@ QDesignerFormWindowInterface::~QDesignerFormWindowInterface()
*/
QDesignerFormEditorInterface *QDesignerFormWindowInterface::core() const
{
- return 0;
+ return nullptr;
}
/*!
@@ -200,18 +198,16 @@ static inline bool stopFindAtTopLevel(const QObject *w, bool stopAtMenu)
QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QWidget *w)
{
- while (w != 0) {
- if (QDesignerFormWindowInterface *fw = qobject_cast<QDesignerFormWindowInterface*>(w)) {
+ while (w != nullptr) {
+ if (QDesignerFormWindowInterface *fw = qobject_cast<QDesignerFormWindowInterface*>(w))
return fw;
- } else {
- if (w->isWindow() && stopFindAtTopLevel(w, true))
- break;
- }
+ if (w->isWindow() && stopFindAtTopLevel(w, true))
+ break;
w = w->parentWidget();
}
- return 0;
+ return nullptr;
}
/*!
@@ -224,24 +220,22 @@ QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QWidg
QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QObject *object)
{
- while (object != 0) {
- if (QDesignerFormWindowInterface *fw = qobject_cast<QDesignerFormWindowInterface*>(object)) {
+ while (object != nullptr) {
+ if (QDesignerFormWindowInterface *fw = qobject_cast<QDesignerFormWindowInterface*>(object))
return fw;
- } else {
- QWidget *w = qobject_cast<QWidget *>(object);
- // QDesignerMenu is a window, so stopFindAtTopLevel(w) returns 0.
- // However, we want to find the form window for QActions of a menu.
- // If this check is inside stopFindAtTopLevel(w), it will break designer
- // menu editing (e.g. when clicking on items inside an opened menu)
- if (w && w->isWindow() && stopFindAtTopLevel(w, false))
- break;
- }
+ QWidget *w = qobject_cast<QWidget *>(object);
+ // QDesignerMenu is a window, so stopFindAtTopLevel(w) returns 0.
+ // However, we want to find the form window for QActions of a menu.
+ // If this check is inside stopFindAtTopLevel(w), it will break designer
+ // menu editing (e.g. when clicking on items inside an opened menu)
+ if (w && w->isWindow() && stopFindAtTopLevel(w, false))
+ break;
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.cpp b/src/designer/src/lib/sdk/abstractformwindowmanager.cpp
index 0810ddb39..387f0665c 100644
--- a/src/designer/src/lib/sdk/abstractformwindowmanager.cpp
+++ b/src/designer/src/lib/sdk/abstractformwindowmanager.cpp
@@ -136,9 +136,7 @@ QDesignerFormWindowManagerInterface::QDesignerFormWindowManagerInterface(QObject
/*!
Destroys the interface for the form window manager.
*/
-QDesignerFormWindowManagerInterface::~QDesignerFormWindowManagerInterface()
-{
-}
+QDesignerFormWindowManagerInterface::~QDesignerFormWindowManagerInterface() = default;
/*!
Allows you to intervene and control \QD's "cut" action. The function
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.cpp b/src/designer/src/lib/sdk/abstractformwindowtool.cpp
index e596458e0..62ca42375 100644
--- a/src/designer/src/lib/sdk/abstractformwindowtool.cpp
+++ b/src/designer/src/lib/sdk/abstractformwindowtool.cpp
@@ -50,9 +50,7 @@ QDesignerFormWindowToolInterface::QDesignerFormWindowToolInterface(QObject *pare
/*!
*/
-QDesignerFormWindowToolInterface::~QDesignerFormWindowToolInterface()
-{
-}
+QDesignerFormWindowToolInterface::~QDesignerFormWindowToolInterface() = default;
/*!
\fn virtual QDesignerFormEditorInterface *QDesignerFormWindowToolInterface::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..6e6100a79 100644
--- a/src/designer/src/lib/sdk/abstractintegration.cpp
+++ b/src/designer/src/lib/sdk/abstractintegration.cpp
@@ -233,9 +233,7 @@ QDesignerIntegrationInterface::QDesignerIntegrationInterface(QDesignerFormEditor
core->setIntegration(this);
}
-QDesignerIntegrationInterface::~QDesignerIntegrationInterface()
-{
-}
+QDesignerIntegrationInterface::~QDesignerIntegrationInterface() = default;
QDesignerFormEditorInterface *QDesignerIntegrationInterface::core() const
{
@@ -326,14 +324,12 @@ QDesignerIntegrationPrivate::QDesignerIntegrationPrivate(QDesignerIntegration *q
headerLowercase(true),
m_features(QDesignerIntegrationInterface::DefaultFeature),
m_resourceFileWatcherBehaviour(QDesignerIntegrationInterface::PromptToReloadResourceFile),
- m_gradientManager(0)
+ m_gradientManager(nullptr)
{
}
void QDesignerIntegrationPrivate::initialize()
{
- typedef void (QDesignerIntegration::*QDesignerIntegrationUpdatePropertySlot3)(const QString &, const QVariant &, bool);
-
//
// integrate the `Form Editor component'
//
@@ -342,7 +338,7 @@ void QDesignerIntegrationPrivate::initialize()
QDesignerFormEditorInterface *core = q->core();
if (QDesignerPropertyEditor *designerPropertyEditor= qobject_cast<QDesignerPropertyEditor *>(core->propertyEditor())) {
QObject::connect(designerPropertyEditor, &QDesignerPropertyEditor::propertyValueChanged,
- q, static_cast<QDesignerIntegrationUpdatePropertySlot3>(&QDesignerIntegration::updateProperty));
+ q, QOverload<const QString &, const QVariant &, bool>::of(&QDesignerIntegration::updateProperty));
QObject::connect(designerPropertyEditor, &QDesignerPropertyEditor::resetProperty,
q, &QDesignerIntegration::resetProperty);
QObject::connect(designerPropertyEditor, &QDesignerPropertyEditor::addDynamicProperty,
@@ -479,7 +475,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 +545,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 +757,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..f2572a7ab 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,42 +131,42 @@ 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;
- void setHeaderSuffix(const QString &headerSuffix);
+ QString headerSuffix() const override;
+ void setHeaderSuffix(const QString &headerSuffix) override;
- bool isHeaderLowercase() const;
- void setHeaderLowercase(bool headerLowerCase);
+ bool isHeaderLowercase() const override;
+ void setHeaderLowercase(bool headerLowerCase) override;
- Feature features() const;
- virtual void setFeatures(Feature f);
+ Feature features() const override;
+ virtual void setFeatures(Feature f) override;
- ResourceFileWatcherBehaviour resourceFileWatcherBehaviour() const;
- void setResourceFileWatcherBehaviour(ResourceFileWatcherBehaviour behaviour);
+ ResourceFileWatcherBehaviour resourceFileWatcherBehaviour() const override;
+ void setResourceFileWatcherBehaviour(ResourceFileWatcherBehaviour behaviour) override;
- virtual QWidget *containerWindow(QWidget *widget) const;
+ virtual QWidget *containerWindow(QWidget *widget) const override;
// Load plugins into widget database and factory.
static void initializePlugins(QDesignerFormEditorInterface *formEditor);
// Create a resource browser specific to integration. Language integration takes precedence
- virtual QDesignerResourceBrowserInterface *createResourceBrowser(QWidget *parent = Q_NULLPTR);
+ QDesignerResourceBrowserInterface *createResourceBrowser(QWidget *parent = nullptr) override;
- virtual QString contextHelpId() const;
+ QString contextHelpId() const override;
- virtual void updateProperty(const QString &name, const QVariant &value, bool enableSubPropertyHandling);
- virtual void updateProperty(const QString &name, const QVariant &value);
+ void updateProperty(const QString &name, const QVariant &value, bool enableSubPropertyHandling) override;
+ void updateProperty(const QString &name, const QVariant &value) override;
// Additional signals of designer property editor
- virtual void resetProperty(const QString &name);
- virtual void addDynamicProperty(const QString &name, const QVariant &value);
- virtual void removeDynamicProperty(const QString &name);
-
- virtual void updateActiveFormWindow(QDesignerFormWindowInterface *formWindow);
- virtual void setupFormWindow(QDesignerFormWindowInterface *formWindow);
- virtual void updateSelection();
- virtual void updateCustomWidgetPlugins();
+ void resetProperty(const QString &name) override;
+ void addDynamicProperty(const QString &name, const QVariant &value) override;
+ void removeDynamicProperty(const QString &name) override;
+
+ void updateActiveFormWindow(QDesignerFormWindowInterface *formWindow) override;
+ void setupFormWindow(QDesignerFormWindowInterface *formWindow) override;
+ void updateSelection() override;
+ void updateCustomWidgetPlugins() override;
private:
QScopedPointer<qdesigner_internal::QDesignerIntegrationPrivate> d;
diff --git a/src/designer/src/lib/sdk/abstractintrospection.cpp b/src/designer/src/lib/sdk/abstractintrospection.cpp
index 7ac530618..c4e12635a 100644
--- a/src/designer/src/lib/sdk/abstractintrospection.cpp
+++ b/src/designer/src/lib/sdk/abstractintrospection.cpp
@@ -48,16 +48,12 @@ QT_BEGIN_NAMESPACE
Constructs a QDesignerMetaEnumInterface object.
*/
-QDesignerMetaEnumInterface::QDesignerMetaEnumInterface()
-{
-}
+QDesignerMetaEnumInterface::QDesignerMetaEnumInterface() = default;
/*!
Destroys the QDesignerMetaEnumInterface object.
*/
-QDesignerMetaEnumInterface::~QDesignerMetaEnumInterface()
-{
-}
+QDesignerMetaEnumInterface::~QDesignerMetaEnumInterface() = default;
/*!
\fn bool QDesignerMetaEnumInterface::isFlag() const
@@ -143,17 +139,13 @@ QDesignerMetaEnumInterface::~QDesignerMetaEnumInterface()
Constructs a QDesignerMetaPropertyInterface object.
*/
-QDesignerMetaPropertyInterface::QDesignerMetaPropertyInterface()
-{
-}
+QDesignerMetaPropertyInterface::QDesignerMetaPropertyInterface() = default;
/*!
Destroys the QDesignerMetaPropertyInterface object.
*/
-QDesignerMetaPropertyInterface::~QDesignerMetaPropertyInterface()
-{
-}
+QDesignerMetaPropertyInterface::~QDesignerMetaPropertyInterface() = default;
/*!
\enum QDesignerMetaPropertyInterface::Kind
@@ -277,17 +269,13 @@ QDesignerMetaPropertyInterface::~QDesignerMetaPropertyInterface()
Constructs a QDesignerMetaMethodInterface object.
*/
-QDesignerMetaMethodInterface::QDesignerMetaMethodInterface()
-{
-}
+QDesignerMetaMethodInterface::QDesignerMetaMethodInterface() = default;
/*!
Destroys the QDesignerMetaMethodInterface object.
*/
-QDesignerMetaMethodInterface::~QDesignerMetaMethodInterface()
-{
-}
+QDesignerMetaMethodInterface::~QDesignerMetaMethodInterface() = default;
/*!
\enum QDesignerMetaMethodInterface::MethodType
@@ -380,17 +368,13 @@ QDesignerMetaMethodInterface::~QDesignerMetaMethodInterface()
Constructs a QDesignerMetaObjectInterface object.
*/
-QDesignerMetaObjectInterface::QDesignerMetaObjectInterface()
-{
-}
+QDesignerMetaObjectInterface::QDesignerMetaObjectInterface() = default;
/*!
Destroys the QDesignerMetaObjectInterface object.
*/
-QDesignerMetaObjectInterface::~QDesignerMetaObjectInterface()
-{
-}
+QDesignerMetaObjectInterface::~QDesignerMetaObjectInterface() = default;
/*!
\fn QString QDesignerMetaObjectInterface::className() 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.cpp b/src/designer/src/lib/sdk/abstractmetadatabase.cpp
index 0ec4d7457..3ba2d5804 100644
--- a/src/designer/src/lib/sdk/abstractmetadatabase.cpp
+++ b/src/designer/src/lib/sdk/abstractmetadatabase.cpp
@@ -50,9 +50,7 @@ QDesignerMetaDataBaseInterface::QDesignerMetaDataBaseInterface(QObject *parent)
/*!
Destroys the interface to the meta database.
*/
-QDesignerMetaDataBaseInterface::~QDesignerMetaDataBaseInterface()
-{
-}
+QDesignerMetaDataBaseInterface::~QDesignerMetaDataBaseInterface() = default;
/*!
\fn QDesignerMetaDataBaseItemInterface *QDesignerMetaDataBaseInterface::item(QObject *object) const
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.cpp b/src/designer/src/lib/sdk/abstractnewformwidget.cpp
index 8bd94eed0..404c0c595 100644
--- a/src/designer/src/lib/sdk/abstractnewformwidget.cpp
+++ b/src/designer/src/lib/sdk/abstractnewformwidget.cpp
@@ -59,9 +59,7 @@ QDesignerNewFormWidgetInterface::QDesignerNewFormWidgetInterface(QWidget *parent
Destroys the QDesignerNewFormWidgetInterface object.
*/
-QDesignerNewFormWidgetInterface::~QDesignerNewFormWidgetInterface()
-{
-}
+QDesignerNewFormWidgetInterface::~QDesignerNewFormWidgetInterface() = default;
/*!
Creates an instance of the QDesignerNewFormWidgetInterface as a child
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..61fbb6e25 100644
--- a/src/designer/src/lib/sdk/abstractobjectinspector.cpp
+++ b/src/designer/src/lib/sdk/abstractobjectinspector.cpp
@@ -75,9 +75,7 @@ QDesignerObjectInspectorInterface::QDesignerObjectInspectorInterface(QWidget *pa
/*!
Destroys the object inspector interface.
*/
-QDesignerObjectInspectorInterface::~QDesignerObjectInspectorInterface()
-{
-}
+QDesignerObjectInspectorInterface::~QDesignerObjectInspectorInterface() = default;
/*!
Returns a pointer to \QD's current QDesignerFormEditorInterface
@@ -85,7 +83,7 @@ QDesignerObjectInspectorInterface::~QDesignerObjectInspectorInterface()
*/
QDesignerFormEditorInterface *QDesignerObjectInspectorInterface::core() const
{
- return 0;
+ return nullptr;
}
/*!
diff --git a/src/designer/src/lib/sdk/abstractpromotioninterface.h b/src/designer/src/lib/sdk/abstractpromotioninterface.h
index 41cb2281c..94c863116 100644
--- a/src/designer/src/lib/sdk/abstractpromotioninterface.h
+++ b/src/designer/src/lib/sdk/abstractpromotioninterface.h
@@ -49,7 +49,7 @@ public:
QDesignerWidgetDataBaseItemInterface *promotedItem;
};
- typedef QList<PromotedClass> PromotedClasses;
+ using PromotedClasses = QList<PromotedClass>;
virtual PromotedClasses promotedClasses() const = 0;
diff --git a/src/designer/src/lib/sdk/abstractpropertyeditor.cpp b/src/designer/src/lib/sdk/abstractpropertyeditor.cpp
index c154b834b..b9cdeca63 100644
--- a/src/designer/src/lib/sdk/abstractpropertyeditor.cpp
+++ b/src/designer/src/lib/sdk/abstractpropertyeditor.cpp
@@ -98,9 +98,7 @@ QDesignerPropertyEditorInterface::QDesignerPropertyEditorInterface(QWidget *pare
/*!
Destroys the property editor interface.
*/
-QDesignerPropertyEditorInterface::~QDesignerPropertyEditorInterface()
-{
-}
+QDesignerPropertyEditorInterface::~QDesignerPropertyEditorInterface() = default;
/*!
Returns a pointer to \QD's current QDesignerFormEditorInterface
@@ -108,7 +106,7 @@ QDesignerPropertyEditorInterface::~QDesignerPropertyEditorInterface()
*/
QDesignerFormEditorInterface *QDesignerPropertyEditorInterface::core() const
{
- return 0;
+ return nullptr;
}
/*!
diff --git a/src/designer/src/lib/sdk/abstractresourcebrowser.cpp b/src/designer/src/lib/sdk/abstractresourcebrowser.cpp
index 0316b2588..26a5b8dc3 100644
--- a/src/designer/src/lib/sdk/abstractresourcebrowser.cpp
+++ b/src/designer/src/lib/sdk/abstractresourcebrowser.cpp
@@ -36,9 +36,6 @@ QDesignerResourceBrowserInterface::QDesignerResourceBrowserInterface(QWidget *pa
}
-QDesignerResourceBrowserInterface::~QDesignerResourceBrowserInterface()
-{
-
-}
+QDesignerResourceBrowserInterface::~QDesignerResourceBrowserInterface() = default;
QT_END_NAMESPACE
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..06de2016c 100644
--- a/src/designer/src/lib/sdk/abstractwidgetbox.h
+++ b/src/designer/src/lib/sdk/abstractwidgetbox.h
@@ -71,7 +71,9 @@ public:
QSharedDataPointer<QDesignerWidgetBoxWidgetData> m_data;
};
- typedef QList<Widget> WidgetList;
+#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
+ using WidgetList = QList<Widget>;
+#endif
class Category {
public:
@@ -96,9 +98,9 @@ public:
Type m_type;
QList<Widget> m_widget_list;
};
- typedef QList<Category> CategoryList;
+ using CategoryList = QList<Category>;
- 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.cpp b/src/designer/src/lib/sdk/abstractwidgetfactory.cpp
index 9c7dc7bcd..9b4f70680 100644
--- a/src/designer/src/lib/sdk/abstractwidgetfactory.cpp
+++ b/src/designer/src/lib/sdk/abstractwidgetfactory.cpp
@@ -53,9 +53,7 @@ QDesignerWidgetFactoryInterface::QDesignerWidgetFactoryInterface(QObject *parent
/*!
\fn virtual QDesignerWidgetFactoryInterface::~QDesignerWidgetFactoryInterface()
*/
-QDesignerWidgetFactoryInterface::~QDesignerWidgetFactoryInterface()
-{
-}
+QDesignerWidgetFactoryInterface::~QDesignerWidgetFactoryInterface() = default;
/*!
\fn virtual QDesignerFormEditorInterface *QDesignerWidgetFactoryInterface::core() const = 0
diff --git a/src/designer/src/lib/sdk/abstractwidgetfactory.h b/src/designer/src/lib/sdk/abstractwidgetfactory.h
index b91de47d0..2bec8ba3d 100644
--- a/src/designer/src/lib/sdk/abstractwidgetfactory.h
+++ b/src/designer/src/lib/sdk/abstractwidgetfactory.h
@@ -42,7 +42,7 @@ class QDESIGNER_SDK_EXPORT QDesignerWidgetFactoryInterface: public QObject
{
Q_OBJECT
public:
- explicit QDesignerWidgetFactoryInterface(QObject *parent = Q_NULLPTR);
+ explicit QDesignerWidgetFactoryInterface(QObject *parent = nullptr);
virtual ~QDesignerWidgetFactoryInterface();
virtual QDesignerFormEditorInterface *core() const = 0;
@@ -50,7 +50,7 @@ public:
virtual QWidget* containerOfWidget(QWidget *w) const = 0;
virtual QWidget* widgetOfContainer(QWidget *w) const = 0;
- virtual QWidget *createWidget(const QString &name, QWidget *parentWidget = Q_NULLPTR) const = 0;
+ virtual QWidget *createWidget(const QString &name, QWidget *parentWidget = nullptr) const = 0;
virtual QLayout *createLayout(QWidget *widget, QLayout *layout, int type) const = 0;
virtual bool isPassiveInteractor(QWidget *widget) = 0;
diff --git a/src/designer/src/lib/sdk/taskmenu.h b/src/designer/src/lib/sdk/taskmenu.h
index 8f4a6e4e7..68203e705 100644
--- a/src/designer/src/lib/sdk/taskmenu.h
+++ b/src/designer/src/lib/sdk/taskmenu.h
@@ -48,7 +48,7 @@ Q_DECLARE_EXTENSION_INTERFACE(QDesignerTaskMenuExtension, "org.qt-project.Qt.Des
inline QAction *QDesignerTaskMenuExtension::preferredEditAction() const
-{ return Q_NULLPTR; }
+{ return nullptr; }
QT_END_NAMESPACE
diff --git a/src/designer/src/lib/shared/actioneditor.cpp b/src/designer/src/lib/shared/actioneditor.cpp
index 4297065b5..86cbb4959 100644
--- a/src/designer/src/lib/shared/actioneditor.cpp
+++ b/src/designer/src/lib/shared/actioneditor.cpp
@@ -106,7 +106,7 @@ ObjectNamingMode ActionEditor::m_objectNamingMode = Underscore; // fixme Qt 6: C
ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent, Qt::WindowFlags flags) :
QDesignerActionEditorInterface(parent, flags),
m_core(core),
- m_actionGroups(0),
+ m_actionGroups(nullptr),
m_actionView(new ActionView),
m_actionNew(new QAction(tr("New..."), this)),
m_actionEdit(new QAction(tr("Edit..."), this)),
@@ -119,9 +119,9 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent,
m_actionSelectAll(new QAction(tr("Select all"), this)),
m_actionDelete(new QAction(tr("Delete"), this)),
m_viewModeGroup(new QActionGroup(this)),
- m_iconViewAction(0),
- m_listViewAction(0),
- m_filterWidget(0)
+ m_iconViewAction(nullptr),
+ m_listViewAction(nullptr),
+ m_filterWidget(nullptr)
{
m_actionView->initialize(m_core);
m_actionView->setSelectionMode(QAbstractItemView::ExtendedSelection);
@@ -278,14 +278,14 @@ QDesignerFormWindowInterface *ActionEditor::formWindow() const
void ActionEditor::setFormWindow(QDesignerFormWindowInterface *formWindow)
{
- if (formWindow != 0 && formWindow->mainContainer() == 0)
- formWindow = 0;
+ if (formWindow != nullptr && formWindow->mainContainer() == nullptr)
+ formWindow = nullptr;
// we do NOT rely on this function to update the action editor
if (m_formWindow == formWindow)
return;
- if (m_formWindow != 0) {
+ if (m_formWindow != nullptr) {
const ActionList actionList = m_formWindow->mainContainer()->findChildren<QAction*>();
for (QAction *action : actionList)
disconnect(action, &QAction::changed, this, &ActionEditor::slotActionChanged);
@@ -313,7 +313,7 @@ void ActionEditor::setFormWindow(QDesignerFormWindowInterface *formWindow)
const ActionList actionList = formWindow->mainContainer()->findChildren<QAction*>();
for (QAction *action : actionList)
- if (!action->isSeparator() && core()->metaDataBase()->item(action) != 0) {
+ if (!action->isSeparator() && core()->metaDataBase()->item(action) != nullptr) {
// Show unless it has a menu. However, listen for change on menu actions also as it might be removed
if (!action->menu())
m_actionView->model()->addAction(action);
@@ -339,7 +339,7 @@ void ActionEditor::slotCurrentItemChanged(QAction *action)
if (!fw)
return;
- const bool hasCurrentAction = action != 0;
+ const bool hasCurrentAction = action != nullptr;
m_actionEdit->setEnabled(hasCurrentAction);
if (!action) {
@@ -364,14 +364,14 @@ void ActionEditor::slotCurrentItemChanged(QAction *action)
void ActionEditor::slotActionChanged()
{
QAction *action = qobject_cast<QAction*>(sender());
- Q_ASSERT(action != 0);
+ Q_ASSERT(action != nullptr);
ActionModel *model = m_actionView->model();
const int row = model->findAction(action);
if (row == -1) {
- if (action->menu() == 0) // action got its menu deleted, create item
+ if (action->menu() == nullptr) // action got its menu deleted, create item
model->addAction(action);
- } else if (action->menu() != 0) { // action got its menu created, remove item
+ } else if (action->menu() != nullptr) { // action got its menu created, remove item
model->removeRow(row);
} else {
// action text or icon changed, update item
@@ -406,7 +406,7 @@ void ActionEditor::manageAction(QAction *action)
action->setParent(formWindow()->mainContainer());
core()->metaDataBase()->add(action);
- if (action->isSeparator() || action->menu() != 0)
+ if (action->isSeparator() || action->menu() != nullptr)
return;
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), action);
@@ -421,7 +421,7 @@ void ActionEditor::manageAction(QAction *action)
void ActionEditor::unmanageAction(QAction *action)
{
core()->metaDataBase()->remove(action);
- action->setParent(0);
+ action->setParent(nullptr);
disconnect(action, &QAction::changed, this, &ActionEditor::slotActionChanged);
@@ -728,7 +728,7 @@ void ActionEditor::mainContainerChanged()
{
// Invalidate references to objects kept in model
if (sender() == formWindow())
- setFormWindow(0);
+ setFormWindow(nullptr);
}
void ActionEditor::slotViewMode(QAction *a)
diff --git a/src/designer/src/lib/shared/actioneditor_p.h b/src/designer/src/lib/shared/actioneditor_p.h
index 0c913d477..321dbfb32 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;
@@ -121,7 +122,7 @@ signals:
void contextMenuRequested(QMenu *menu, QAction *item);
private:
- typedef QList<QAction *> ActionList;
+ using ActionList = QList<QAction *>;
void deleteActions(QDesignerFormWindowInterface *formWindow, const ActionList &);
#if QT_CONFIG(clipboard)
void copyActions(QDesignerFormWindowInterface *formWindow, const ActionList &);
diff --git a/src/designer/src/lib/shared/actionrepository.cpp b/src/designer/src/lib/shared/actionrepository.cpp
index 1d1c2cd8c..2d91a5f00 100644
--- a/src/designer/src/lib/shared/actionrepository.cpp
+++ b/src/designer/src/lib/shared/actionrepository.cpp
@@ -69,8 +69,7 @@ namespace qdesigner_internal {
// ----------- ActionModel
ActionModel::ActionModel(QWidget *parent ) :
QStandardItemModel(parent),
- m_emptyIcon(emptyIcon()),
- m_core(0)
+ m_emptyIcon(emptyIcon())
{
QStringList headers;
headers += tr("Name");
@@ -234,7 +233,7 @@ QMimeData *ActionModel::mimeData(const QModelIndexList &indexes ) const
if (QStandardItem *item = itemFromIndex(index))
if (QAction *action = actionOfItem(item))
actions.insert(action);
- return new ActionRepositoryMimeData(actions.toList(), Qt::CopyAction);
+ return new ActionRepositoryMimeData(actions.values(), Qt::CopyAction);
}
// Resource images are plain text. The drag needs to be restricted, however.
@@ -270,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 e8744881e..a68b3371f 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();
@@ -98,7 +98,7 @@ signals:
void resourceImageDropped(const QString &path, QAction *action);
private:
- typedef QList<QStandardItem *> QStandardItemList;
+ using QStandardItemList = QList<QStandardItem *>;
void initializeHeaders();
static void setItems(QDesignerFormEditorInterface *core, QAction *a,
@@ -107,7 +107,7 @@ private:
const QIcon m_emptyIcon;
- QDesignerFormEditorInterface *m_core;
+ QDesignerFormEditorInterface *m_core = nullptr;
};
// Internal class that provides the detailed view of actions.
@@ -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
@@ -203,7 +203,7 @@ public:
QAction *currentAction() const;
void setCurrentIndex(const QModelIndex &index);
- typedef QList<QAction*> ActionList;
+ using ActionList = QList<QAction *>;
ActionList selectedActions() const;
QItemSelection selection() const;
@@ -232,7 +232,7 @@ class QDESIGNER_SHARED_EXPORT ActionRepositoryMimeData: public QMimeData
{
Q_OBJECT
public:
- typedef QList<QAction*> ActionList;
+ using ActionList = QList<QAction *>;
ActionRepositoryMimeData(const ActionList &, Qt::DropAction dropAction);
ActionRepositoryMimeData(QAction *, Qt::DropAction dropAction);
diff --git a/src/designer/src/lib/shared/codedialog.cpp b/src/designer/src/lib/shared/codedialog.cpp
index 59c57308a..e3b3f0d74 100644
--- a/src/designer/src/lib/shared/codedialog.cpp
+++ b/src/designer/src/lib/shared/codedialog.cpp
@@ -49,6 +49,7 @@
#include <QtCore/qdebug.h>
#include <QtCore/qdir.h>
+#include <QtCore/qmimedatabase.h>
#include <QtCore/qtemporaryfile.h>
QT_BEGIN_NAMESPACE
@@ -61,6 +62,7 @@ struct CodeDialog::CodeDialogPrivate {
QTextEdit *m_textEdit;
TextEditFindWidget *m_findWidget;
QString m_formFileName;
+ QString m_mimeType;
};
CodeDialog::CodeDialogPrivate::CodeDialogPrivate()
@@ -142,7 +144,13 @@ QString CodeDialog::formFileName() const
return m_impl->m_formFileName;
}
+void CodeDialog::setMimeType(const QString &m)
+{
+ m_impl->m_mimeType = m;
+}
+
bool CodeDialog::generateCode(const QDesignerFormWindowInterface *fw,
+ UicLanguage language,
QString *code,
QString *errorMessage)
{
@@ -175,47 +183,66 @@ bool CodeDialog::generateCode(const QDesignerFormWindowInterface *fw,
tempFormFile.close();
// Run uic
QByteArray rc;
- if (!runUIC(tempFormFileName, rc, *errorMessage))
+ if (!runUIC(tempFormFileName, language, rc, *errorMessage))
return false;
*code = QString::fromUtf8(rc);
return true;
}
bool CodeDialog::showCodeDialog(const QDesignerFormWindowInterface *fw,
+ UicLanguage language,
QWidget *parent,
QString *errorMessage)
{
QString code;
- if (!generateCode(fw, &code, errorMessage))
+ if (!generateCode(fw, language, &code, errorMessage))
return false;
- CodeDialog dialog(parent);
- dialog.setWindowTitle(tr("%1 - [Code]").arg(fw->mainContainer()->windowTitle()));
- dialog.setCode(code);
- dialog.setFormFileName(fw->fileName());
- dialog.exec();
+ auto dialog = new CodeDialog(parent);
+ dialog->setModal(false);
+ dialog->setAttribute(Qt::WA_DeleteOnClose);
+ dialog->setCode(code);
+ dialog->setFormFileName(fw->fileName());
+ QString languageName;
+ switch (language) {
+ case UicLanguage::Cpp:
+ languageName = QLatin1String("C++");
+ dialog->setMimeType(QLatin1String("text/x-chdr"));
+ break;
+ case UicLanguage::Python:
+ languageName = QLatin1String("Python");
+ dialog->setMimeType(QLatin1String("text/x-python"));
+ break;
+ }
+ dialog->setWindowTitle(tr("%1 - [%2 Code]").
+ arg(fw->mainContainer()->windowTitle(), languageName));
+ dialog->show();
return true;
}
void CodeDialog::slotSaveAs()
{
// build the default relative name 'ui_sth.h'
- const QString headerSuffix = QString(QLatin1Char('h'));
- QString filter;
- const QString uiFile = formFileName();
+ QMimeDatabase mimeDb;
+ const QString suffix = mimeDb.mimeTypeForName(m_impl->m_mimeType).preferredSuffix();
+ // file dialog
+ QFileDialog fileDialog(this, tr("Save Code"));
+ fileDialog.setMimeTypeFilters(QStringList(m_impl->m_mimeType));
+ fileDialog.setAcceptMode(QFileDialog::AcceptSave);
+ fileDialog.setDefaultSuffix(suffix);
+ const QString uiFile = formFileName();
if (!uiFile.isEmpty()) {
- filter = QStringLiteral("ui_");
- filter += QFileInfo(uiFile).baseName();
- filter += QLatin1Char('.');
- filter += headerSuffix;
+ QFileInfo uiFi(uiFile);
+ fileDialog.setDirectory(uiFi.absolutePath());
+ fileDialog.selectFile(QLatin1String("ui_") + uiFi.baseName()
+ + QLatin1Char('.') + suffix);
}
- // file dialog
+
while (true) {
- const QString fileName =
- QFileDialog::getSaveFileName (this, tr("Save Code"), filter, tr("Header Files (*.%1)").arg(headerSuffix));
- if (fileName.isEmpty())
+ if (fileDialog.exec() != QDialog::Accepted)
break;
+ const QString fileName = fileDialog.selectedFiles().constFirst();
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly|QIODevice::Text)) {
diff --git a/src/designer/src/lib/shared/codedialog_p.h b/src/designer/src/lib/shared/codedialog_p.h
index c185d0f52..37f798c4f 100644
--- a/src/designer/src/lib/shared/codedialog_p.h
+++ b/src/designer/src/lib/shared/codedialog_p.h
@@ -48,19 +48,24 @@ QT_BEGIN_NAMESPACE
class QDesignerFormWindowInterface;
namespace qdesigner_internal {
+
+enum class UicLanguage;
+
// Dialog for viewing code.
class QDESIGNER_SHARED_EXPORT CodeDialog : public QDialog
{
Q_OBJECT
- explicit CodeDialog(QWidget *parent = 0);
+ explicit CodeDialog(QWidget *parent = nullptr);
public:
~CodeDialog() override;
static bool generateCode(const QDesignerFormWindowInterface *fw,
+ UicLanguage language,
QString *code,
QString *errorMessage);
static bool showCodeDialog(const QDesignerFormWindowInterface *fw,
+ UicLanguage language,
QWidget *parent,
QString *errorMessage);
@@ -75,6 +80,7 @@ private:
QString code() const;
void setFormFileName(const QString &f);
QString formFileName() const;
+ void setMimeType(const QString &m);
void warning(const QString &msg);
diff --git a/src/designer/src/lib/shared/connectionedit.cpp b/src/designer/src/lib/shared/connectionedit.cpp
index 11bfcb4e7..a55465440 100644
--- a/src/designer/src/lib/shared/connectionedit.cpp
+++ b/src/designer/src/lib/shared/connectionedit.cpp
@@ -222,6 +222,7 @@ void DeleteConnectionsCommand::undo()
Q_ASSERT(!edit()->m_con_list.contains(con));
emit edit()->aboutToAddConnection(edit()->m_con_list.size());
edit()->m_con_list.append(con);
+ edit()->selectNone();
edit()->setSelected(con, true);
con->update();
con->inserted();
@@ -281,8 +282,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 +310,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 +343,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 +449,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 +630,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 +742,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 +927,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 +952,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 +978,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 +993,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 +1005,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 +1016,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 +1048,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 +1069,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 +1111,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 +1120,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,11 +1141,12 @@ 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());
m_start_connection_on_drag = false;
+ const bool toggleSelection = e->modifiers().testFlag(Qt::ControlModifier);
switch (cstate) {
case Connecting:
if (button == Qt::RightButton)
@@ -1154,18 +1156,17 @@ void ConnectionEdit::mousePressEvent(QMouseEvent *e)
break;
case Editing:
if (!m_end_point_under_mouse.isNull()) {
- if (!(e->modifiers() & Qt::ShiftModifier)) {
+ if (!toggleSelection)
startDrag(m_end_point_under_mouse, e->pos());
- }
- } else if (con_under_mouse != 0) {
- if (!(e->modifiers() & Qt::ShiftModifier)) {
+ } else if (con_under_mouse != nullptr) {
+ if (toggleSelection) {
+ setSelected(con_under_mouse, !selected(con_under_mouse));
+ } else {
selectNone();
setSelected(con_under_mouse, true);
- } else {
- setSelected(con_under_mouse, !selected(con_under_mouse));
}
} else {
- if (!(e->modifiers() & Qt::ShiftModifier)) {
+ if (!toggleSelection) {
selectNone();
if (!m_widget_under_mouse.isNull())
m_start_connection_on_drag = true;
@@ -1234,9 +1235,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 +1303,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 +1311,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 +1329,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 +1442,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 +1522,10 @@ void ConnectionEdit::resizeEvent(QResizeEvent *e)
void ConnectionEdit::setSource(Connection *con, const QString &obj_name)
{
- QObject *object = 0;
+ QObject *object = nullptr;
if (!obj_name.isEmpty()) {
object = m_bg_widget->findChild<QObject*>(obj_name);
- if (object == 0 && m_bg_widget->objectName() == obj_name)
+ if (object == nullptr && m_bg_widget->objectName() == obj_name)
object = m_bg_widget;
if (object == con->object(EndPoint::Source))
@@ -1535,10 +1536,10 @@ void ConnectionEdit::setSource(Connection *con, const QString &obj_name)
void ConnectionEdit::setTarget(Connection *con, const QString &obj_name)
{
- QObject *object = 0;
+ QObject *object = nullptr;
if (!obj_name.isEmpty()) {
object = m_bg_widget->findChild<QObject*>(obj_name);
- if (object == 0 && m_bg_widget->objectName() == obj_name)
+ if (object == nullptr && m_bg_widget->objectName() == obj_name)
object = m_bg_widget;
if (object == con->object(EndPoint::Target))
@@ -1550,7 +1551,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 +1559,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..6fd623457 100644
--- a/src/designer/src/lib/shared/connectionedit_p.h
+++ b/src/designer/src/lib/shared/connectionedit_p.h
@@ -67,15 +67,15 @@ class ConnectionEdit;
class QDESIGNER_SHARED_EXPORT CETypes
{
public:
- typedef QList<Connection*> ConnectionList;
- typedef QHash<Connection*, Connection*> ConnectionSet;
- typedef QHash<QWidget*, QWidget*> WidgetSet;
+ using ConnectionList = QList<Connection *>;
+ using ConnectionSet = QHash<Connection*, Connection*> ;
+ using WidgetSet = QHash<QWidget*, QWidget*>;
class EndPoint {
public:
enum Type { Source, Target };
- explicit EndPoint(Connection *_con = 0, Type _type = Source) : con(_con), type(_type) {}
- bool isNull() const { return con == 0; }
+ explicit EndPoint(Connection *_con = nullptr, Type _type = Source) : con(_con), type(_type) {}
+ bool isNull() const { return con == nullptr; }
bool operator == (const EndPoint &other) const { return con == other.con && type == other.type; }
bool operator != (const EndPoint &other) const { return !operator == (other); }
Connection *con;
diff --git a/src/designer/src/lib/shared/csshighlighter_p.h b/src/designer/src/lib/shared/csshighlighter_p.h
index 508c56c43..8af8cd337 100644
--- a/src/designer/src/lib/shared/csshighlighter_p.h
+++ b/src/designer/src/lib/shared/csshighlighter_p.h
@@ -54,7 +54,7 @@ public:
explicit CssHighlighter(QTextDocument *document);
protected:
- void highlightBlock(const QString&);
+ void highlightBlock(const QString&) override;
void highlight(const QString&, int, int, int/*State*/);
private:
diff --git a/src/designer/src/lib/shared/deviceprofile.cpp b/src/designer/src/lib/shared/deviceprofile.cpp
index 07655980b..c2df77ffd 100644
--- a/src/designer/src/lib/shared/deviceprofile.cpp
+++ b/src/designer/src/lib/shared/deviceprofile.cpp
@@ -75,25 +75,18 @@ namespace qdesigner_internal {
// ---------------- DeviceProfileData
class DeviceProfileData : public QSharedData {
public:
- DeviceProfileData();
+ DeviceProfileData() = default;
void fromSystem();
void clear();
QString m_fontFamily;
- int m_fontPointSize;
QString m_style;
- int m_dpiX;
- int m_dpiY;
QString m_name;
+ int m_fontPointSize = -1;
+ int m_dpiX = -1;
+ int m_dpiY = -1;
};
-DeviceProfileData::DeviceProfileData() :
- m_fontPointSize(-1),
- m_dpiX(-1),
- m_dpiY(-1)
-{
-}
-
void DeviceProfileData::clear()
{
m_fontPointSize = -1;
diff --git a/src/designer/src/lib/shared/dialoggui.cpp b/src/designer/src/lib/shared/dialoggui.cpp
index 42438e41d..8c537ab34 100644
--- a/src/designer/src/lib/shared/dialoggui.cpp
+++ b/src/designer/src/lib/shared/dialoggui.cpp
@@ -49,7 +49,7 @@ namespace qdesigner_internal {
// Icon provider that reads out the known image formats
class IconProvider : public QFileIconProvider {
- Q_DISABLE_COPY(IconProvider)
+ Q_DISABLE_COPY_MOVE(IconProvider)
public:
IconProvider();
@@ -111,10 +111,7 @@ QIcon IconProvider::icon (const QFileInfo &info) const
}
// ---------------- DialogGui
-DialogGui::DialogGui() :
- m_iconProvider(0)
-{
-}
+DialogGui::DialogGui() = default;
DialogGui::~DialogGui()
{
diff --git a/src/designer/src/lib/shared/dialoggui_p.h b/src/designer/src/lib/shared/dialoggui_p.h
index 8a9ce1b17..0dde0b34e 100644
--- a/src/designer/src/lib/shared/dialoggui_p.h
+++ b/src/designer/src/lib/shared/dialoggui_p.h
@@ -72,19 +72,19 @@ 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();
void initializeImageFileDialog(QFileDialog &fd, QFileDialog::Options options, QFileDialog::FileMode);
- QFileIconProvider *m_iconProvider;
+ QFileIconProvider *m_iconProvider = nullptr;
};
} // namespace qdesigner_internal
diff --git a/src/designer/src/lib/shared/extensionfactory_p.h b/src/designer/src/lib/shared/extensionfactory_p.h
index 0f853fc2e..b1afaf66a 100644
--- a/src/designer/src/lib/shared/extensionfactory_p.h
+++ b/src/designer/src/lib/shared/extensionfactory_p.h
@@ -52,7 +52,7 @@ template <class ExtensionInterface, class Object, class Extension>
class ExtensionFactory: public QExtensionFactory
{
public:
- explicit ExtensionFactory(const QString &iid, QExtensionManager *parent = 0);
+ explicit ExtensionFactory(const QString &iid, QExtensionManager *parent = nullptr);
// Convenience for registering the extension. Do not use for derived classes.
static void registerExtension(QExtensionManager *mgr, const QString &iid);
@@ -85,11 +85,11 @@ template <class ExtensionInterface, class Object, class Extension>
QObject *ExtensionFactory<ExtensionInterface, Object, Extension>::createExtension(QObject *qObject, const QString &iid, QObject *parent) const
{
if (iid != m_iid)
- return 0;
+ return nullptr;
Object *object = checkObject(qObject);
if (!object)
- return 0;
+ return nullptr;
return new Extension(object, parent);
}
diff --git a/src/designer/src/lib/shared/formlayoutmenu.cpp b/src/designer/src/lib/shared/formlayoutmenu.cpp
index 0dd0e57c5..8d4bab6c7 100644
--- a/src/designer/src/lib/shared/formlayoutmenu.cpp
+++ b/src/designer/src/lib/shared/formlayoutmenu.cpp
@@ -81,7 +81,7 @@ struct FormLayoutRow {
// are updated. It also checks the buddy setting depending on whether the
// label text contains a buddy marker.
class FormLayoutRowDialog : public QDialog {
- Q_DISABLE_COPY(FormLayoutRowDialog)
+ Q_DISABLE_COPY_MOVE(FormLayoutRowDialog)
Q_OBJECT
public:
explicit FormLayoutRowDialog(QDesignerFormEditorInterface *core,
@@ -131,8 +131,6 @@ FormLayoutRowDialog::FormLayoutRowDialog(QDesignerFormEditorInterface *core,
m_fieldNameEdited(false),
m_buddyClicked(false)
{
- typedef void (QComboBox::*QComboIntSignal)(int);
-
Q_ASSERT(m_buddyMarkerRegexp.isValid());
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
@@ -155,7 +153,8 @@ FormLayoutRowDialog::FormLayoutRowDialog(QDesignerFormEditorInterface *core,
m_ui.fieldClassComboBox->addItems(fieldWidgetClasses(core));
m_ui.fieldClassComboBox->setCurrentIndex(0);
- connect(m_ui.fieldClassComboBox, static_cast<QComboIntSignal>(&QComboBox::currentIndexChanged),
+ connect(m_ui.fieldClassComboBox,
+ QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &FormLayoutRowDialog::fieldClassChanged);
updateOkButton();
@@ -360,17 +359,16 @@ QStringList FormLayoutRowDialog::fieldWidgetClasses(QDesignerFormEditorInterface
typedef QMultiHash<QString, QString> ClassMap;
static QStringList rc;
- if (rc.empty()) {
- const int fwCount = sizeof(fieldWidgetBaseClasses)/sizeof(const char*);
+ if (rc.isEmpty()) {
// Turn known base classes into list
QStringList baseClasses;
- for (int i = 0; i < fwCount; i++)
- baseClasses.push_back(QLatin1String(fieldWidgetBaseClasses[i]));
+ for (auto fw : fieldWidgetBaseClasses)
+ baseClasses.append(QLatin1String(fw));
// Scan for custom widgets that inherit them and store them in a
// multimap of base class->custom widgets unless we have a language
// extension installed which might do funny things with custom widgets.
ClassMap customClassMap;
- if (qt_extension<QDesignerLanguageExtension *>(core->extensionManager(), core) == 0) {
+ if (qt_extension<QDesignerLanguageExtension *>(core->extensionManager(), core) == nullptr) {
const QDesignerWidgetDataBaseInterface *wdb = core->widgetDataBase();
const int wdbCount = wdb->count();
for (int w = 0; w < wdbCount; ++w) {
@@ -386,9 +384,9 @@ QStringList FormLayoutRowDialog::fieldWidgetClasses(QDesignerFormEditorInterface
}
// Compile final list, taking each base class and append custom widgets
// based on it.
- for (int i = 0; i < fwCount; i++) {
- rc.push_back(baseClasses.at(i));
- rc += customClassMap.values(baseClasses.at(i));
+ for (const auto &baseClass : baseClasses) {
+ rc.append(baseClass);
+ rc += customClassMap.values(baseClass);
}
}
return rc;
@@ -398,10 +396,10 @@ QStringList FormLayoutRowDialog::fieldWidgetClasses(QDesignerFormEditorInterface
static QFormLayout *managedFormLayout(const QDesignerFormEditorInterface *core, const QWidget *w)
{
- QLayout *l = 0;
+ QLayout *l = nullptr;
if (LayoutInfo::managedLayoutType(core, w, &l) == LayoutInfo::Form)
return qobject_cast<QFormLayout *>(l);
- return 0;
+ return nullptr;
}
// Create the widgets of a control row and apply text properties contained
@@ -485,7 +483,7 @@ void FormLayoutMenu::populate(QWidget *w, QDesignerFormWindowInterface *fw, Acti
m_widget = w;
break;
default:
- m_widget = 0;
+ m_widget = nullptr;
break;
}
}
@@ -511,7 +509,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/formlayoutmenu_p.h b/src/designer/src/lib/shared/formlayoutmenu_p.h
index 5d115ead1..d4b56ac96 100644
--- a/src/designer/src/lib/shared/formlayoutmenu_p.h
+++ b/src/designer/src/lib/shared/formlayoutmenu_p.h
@@ -58,10 +58,10 @@ namespace qdesigner_internal {
// pops up a dialog in which the user can specify label name, text and buddy.
class QDESIGNER_SHARED_EXPORT FormLayoutMenu : public QObject
{
- Q_DISABLE_COPY(FormLayoutMenu)
+ Q_DISABLE_COPY_MOVE(FormLayoutMenu)
Q_OBJECT
public:
- typedef QList<QAction *> ActionList;
+ using ActionList = QList<QAction *>;
explicit FormLayoutMenu(QObject *parent);
diff --git a/src/designer/src/lib/shared/formwindowbase.cpp b/src/designer/src/lib/shared/formwindowbase.cpp
index 713d32850..8c35ea700 100644
--- a/src/designer/src/lib/shared/formwindowbase.cpp
+++ b/src/designer/src/lib/shared/formwindowbase.cpp
@@ -84,19 +84,21 @@ public:
FormWindowBase::LineTerminatorMode m_lineTerminatorMode;
FormWindowBase::ResourceFileSaveMode m_saveResourcesBehaviour;
bool m_useIdBasedTranslations;
+ bool m_connectSlotsByName;
};
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),
- m_useIdBasedTranslations(false)
+ m_useIdBasedTranslations(false),
+ m_connectSlotsByName(true)
{
}
@@ -115,8 +117,11 @@ FormWindowBase::FormWindowBase(QDesignerFormEditorInterface *core, QWidget *pare
FormWindowBase::~FormWindowBase()
{
- QSet<QDesignerPropertySheet *> sheets = m_d->m_reloadableResources.keys().toSet();
- sheets |= m_d->m_reloadablePropertySheets.keys().toSet();
+ QSet<QDesignerPropertySheet *> sheets;
+ for (auto it = m_d->m_reloadableResources.cbegin(), end = m_d->m_reloadableResources.cend(); it != end; ++it)
+ sheets.insert(it.key());
+ for (auto it = m_d->m_reloadablePropertySheets.cbegin(), end = m_d->m_reloadablePropertySheets.cend(); it != end; ++it)
+ sheets.insert(it.key());
m_d->m_reloadableResources.clear();
m_d->m_reloadablePropertySheets.clear();
@@ -220,12 +225,10 @@ void FormWindowBase::reloadProperties()
{
pixmapCache()->clear();
iconCache()->clear();
- QMapIterator<QDesignerPropertySheet *, QMap<int, bool> > itSheet(m_d->m_reloadableResources);
- while (itSheet.hasNext()) {
- QDesignerPropertySheet *sheet = itSheet.next().key();
- QMapIterator<int, bool> itIndex(itSheet.value());
- while (itIndex.hasNext()) {
- const int index = itIndex.next().key();
+ for (auto it = m_d->m_reloadableResources.cbegin(), end = m_d->m_reloadableResources.cend(); it != end; ++it) {
+ QDesignerPropertySheet *sheet = it.key();
+ for (auto jt = it.value().begin(), end = it.value().end(); jt != end; ++jt) {
+ const int index = jt.key();
const QVariant newValue = sheet->property(index);
if (qobject_cast<QLabel *>(sheet->object()) && sheet->propertyName(index) == QStringLiteral("text")) {
const PropertySheetStringValue newString = qvariant_cast<PropertySheetStringValue>(newValue);
@@ -260,9 +263,7 @@ void FormWindowBase::reloadProperties()
toolBox->setCurrentIndex(current);
}
}
- QMapIterator<QDesignerPropertySheet *, QObject *> itSh(m_d->m_reloadablePropertySheets);
- while (itSh.hasNext()) {
- QObject *object = itSh.next().value();
+ for (QObject *object : qAsConst(m_d->m_reloadablePropertySheets)) {
reloadIconResources(iconCache(), object);
}
}
@@ -395,7 +396,7 @@ const Grid &FormWindowBase::defaultDesignerGrid()
QMenu *FormWindowBase::initializePopupMenu(QWidget * /*managedWidget*/)
{
- return 0;
+ return nullptr;
}
// Widget under mouse for finding the Widget to highlight
@@ -409,13 +410,13 @@ QWidget *FormWindowBase::widgetUnderMouse(const QPoint &formPos, WidgetUnderMous
// the actual widget that's part of the edited GUI.
QWidget *rc = widgetAt(formPos);
if (!rc || qobject_cast<ConnectionEdit*>(rc))
- return 0;
+ return nullptr;
if (rc == mainContainer()) {
// Refuse main container areas if the main container has a container extension,
// for example when hitting QToolBox/QTabWidget empty areas.
if (qt_extension<QDesignerContainerExtension*>(core()->extensionManager(), rc))
- return 0;
+ return nullptr;
return rc;
}
@@ -427,12 +428,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;
}
@@ -459,7 +460,7 @@ void FormWindowBase::deleteWidgetList(const QWidgetList &widget_list)
QMenu *FormWindowBase::createExtensionTaskMenu(QDesignerFormWindowInterface *fw, QObject *o, bool trailingSeparator)
{
- typedef QList<QAction *> ActionList;
+ using ActionList = QList<QAction *>;
ActionList actions;
// 1) Standard public extension
QExtensionManager *em = fw->core()->extensionManager();
@@ -474,7 +475,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);
@@ -538,6 +539,16 @@ void FormWindowBase::setUseIdBasedTranslations(bool v)
m_d->m_useIdBasedTranslations = v;
}
+bool FormWindowBase::connectSlotsByName() const
+{
+ return m_d->m_connectSlotsByName;
+}
+
+void FormWindowBase::setConnectSlotsByName(bool v)
+{
+ m_d->m_connectSlotsByName = v;
+}
+
QStringList FormWindowBase::checkContents() const
{
if (!mainContainer())
diff --git a/src/designer/src/lib/shared/formwindowbase_p.h b/src/designer/src/lib/shared/formwindowbase_p.h
index d6cf094a9..b240aa521 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();
@@ -164,6 +165,9 @@ public:
bool useIdBasedTranslations() const;
void setUseIdBasedTranslations(bool v);
+ bool connectSlotsByName() const;
+ void setConnectSlotsByName(bool v);
+
public slots:
void resourceSetActivated(QtResourceSet *resourceSet, bool resourceSetChanged);
diff --git a/src/designer/src/lib/shared/grid.cpp b/src/designer/src/lib/shared/grid.cpp
index 5f5f8ea27..d1298d1f0 100644
--- a/src/designer/src/lib/shared/grid.cpp
+++ b/src/designer/src/lib/shared/grid.cpp
@@ -125,7 +125,7 @@ void Grid::paint(QPainter &p, const QWidget *widget, QPaintEvent *e) const
const int xend = e->rect().right();
const int yend = e->rect().bottom();
- typedef QVector<QPointF> Points;
+ using Points = QVector<QPointF>;
static Points points;
points.clear();
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/htmlhighlighter_p.h b/src/designer/src/lib/shared/htmlhighlighter_p.h
index 8a6947eb2..e63186166 100644
--- a/src/designer/src/lib/shared/htmlhighlighter_p.h
+++ b/src/designer/src/lib/shared/htmlhighlighter_p.h
@@ -77,7 +77,7 @@ protected:
InTag
};
- void highlightBlock(const QString &text);
+ void highlightBlock(const QString &text) override;
private:
QTextCharFormat m_formats[LastConstruct + 1];
diff --git a/src/designer/src/lib/shared/iconselector.cpp b/src/designer/src/lib/shared/iconselector.cpp
index 139d61b90..d9d50e782 100644
--- a/src/designer/src/lib/shared/iconselector.cpp
+++ b/src/designer/src/lib/shared/iconselector.cpp
@@ -85,7 +85,7 @@ private:
};
LanguageResourceDialogPrivate::LanguageResourceDialogPrivate(QDesignerResourceBrowserInterface *rb) :
- q_ptr(0),
+ q_ptr(nullptr),
m_browser(rb),
m_dialogButtonBox(new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel))
{
@@ -158,11 +158,11 @@ QString LanguageResourceDialog::currentPath() const
LanguageResourceDialog* LanguageResourceDialog::create(QDesignerFormEditorInterface *core, QWidget *parent)
{
if (QDesignerLanguageExtension *lang = qt_extension<QDesignerLanguageExtension *>(core->extensionManager(), core))
- if (QDesignerResourceBrowserInterface *rb = lang->createResourceBrowser(0))
+ if (QDesignerResourceBrowserInterface *rb = lang->createResourceBrowser(nullptr))
return new LanguageResourceDialog(rb, parent);
- if (QDesignerResourceBrowserInterface *rb = core->integration()->createResourceBrowser(0))
+ if (QDesignerResourceBrowserInterface *rb = core->integration()->createResourceBrowser(nullptr))
return new LanguageResourceDialog(rb, parent);
- return 0;
+ return nullptr;
}
// ------------ IconSelectorPrivate
@@ -176,10 +176,10 @@ static inline QPixmap emptyPixmap()
class IconSelectorPrivate
{
- IconSelector *q_ptr;
+ IconSelector *q_ptr = nullptr;
Q_DECLARE_PUBLIC(IconSelector)
public:
- IconSelectorPrivate();
+ IconSelectorPrivate() = default;
void slotStateActivated();
void slotSetActivated();
@@ -195,30 +195,17 @@ public:
QMap<int, QPair<QIcon::Mode, QIcon::State> > m_indexToState;
const QIcon m_emptyIcon;
- QComboBox *m_stateComboBox;
- QToolButton *m_iconButton;
- QAction *m_resetAction;
- QAction *m_resetAllAction;
+ QComboBox *m_stateComboBox = nullptr;
+ QToolButton *m_iconButton = nullptr;
+ QAction *m_resetAction = nullptr;
+ QAction *m_resetAllAction = nullptr;
PropertySheetIconValue m_icon;
- DesignerIconCache *m_iconCache;
- DesignerPixmapCache *m_pixmapCache;
- QtResourceModel *m_resourceModel;
- QDesignerFormEditorInterface *m_core;
+ DesignerIconCache *m_iconCache = nullptr;
+ DesignerPixmapCache *m_pixmapCache = nullptr;
+ QtResourceModel *m_resourceModel = nullptr;
+ QDesignerFormEditorInterface *m_core = nullptr;
};
-IconSelectorPrivate::IconSelectorPrivate() :
- q_ptr(0),
- m_emptyIcon(emptyPixmap()),
- m_stateComboBox(0),
- m_iconButton(0),
- m_resetAction(0),
- m_resetAllAction(0),
- m_iconCache(0),
- m_pixmapCache(0),
- m_resourceModel(0),
- m_core(0)
-{
-}
void IconSelectorPrivate::slotUpdate()
{
QIcon icon;
@@ -524,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
{
@@ -604,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..40e38acdd 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;
@@ -80,7 +80,7 @@ public:
private:
QScopedPointer<class LanguageResourceDialogPrivate> d_ptr;
Q_DECLARE_PRIVATE(LanguageResourceDialog)
- Q_DISABLE_COPY(LanguageResourceDialog)
+ Q_DISABLE_COPY_MOVE(LanguageResourceDialog)
Q_PRIVATE_SLOT(d_func(), void slotAccepted())
Q_PRIVATE_SLOT(d_func(), void slotPathChanged(QString))
@@ -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
@@ -113,7 +113,7 @@ signals:
private:
QScopedPointer<class IconSelectorPrivate> d_ptr;
Q_DECLARE_PRIVATE(IconSelector)
- Q_DISABLE_COPY(IconSelector)
+ Q_DISABLE_COPY_MOVE(IconSelector)
Q_PRIVATE_SLOT(d_func(), void slotStateActivated())
Q_PRIVATE_SLOT(d_func(), void slotSetActivated())
@@ -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..436d5223b 100644
--- a/src/designer/src/lib/shared/layout.cpp
+++ b/src/designer/src/lib/shared/layout.cpp
@@ -144,7 +144,7 @@ void Layout::setup()
QWidget *p = w->parentWidget();
if (p && LayoutInfo::layoutType(m_formWindow->core(), p) != LayoutInfo::NoLayout
- && m_formWindow->core()->metaDataBase()->item(p->layout()) != 0)
+ && m_formWindow->core()->metaDataBase()->item(p->layout()) != nullptr)
continue;
lists.insert(p, w);
@@ -218,7 +218,7 @@ bool Layout::prepareLayout(bool &needMove, bool &needReparent)
QDesignerWidgetFactoryInterface *widgetFactory = m_formWindow->core()->widgetFactory();
QDesignerMetaDataBaseInterface *metaDataBase = m_formWindow->core()->metaDataBase();
- if (m_layoutBase == 0) {
+ if (m_layoutBase == nullptr) {
const bool useSplitter = m_layoutType == LayoutInfo::HSplitter || m_layoutType == LayoutInfo::VSplitter;
const QString baseWidgetClassName = useSplitter ? QLatin1String("QSplitter") : QLatin1String("QLayoutWidget");
m_layoutBase = widgetFactory->createWidget(baseWidgetClassName, widgetFactory->containerOfWidget(m_parentWidget));
@@ -232,7 +232,7 @@ bool Layout::prepareLayout(bool &needMove, bool &needReparent)
metaDataBase->add(m_layoutBase);
- Q_ASSERT(m_layoutBase->layout() == 0 || metaDataBase->item(m_layoutBase->layout()) == 0);
+ Q_ASSERT(m_layoutBase->layout() == nullptr || metaDataBase->item(m_layoutBase->layout()) == nullptr);
return true;
}
@@ -247,7 +247,7 @@ static bool isPageOfContainerWidget(QDesignerFormWindowInterface *fw, QWidget *w
QDesignerContainerExtension *c = qt_extension<QDesignerContainerExtension*>(
fw->core()->extensionManager(), widget->parentWidget());
- if (c != 0) {
+ if (c != nullptr) {
for (int i = 0; i<c->count(); ++i) {
if (widget == c->widget(i))
return true;
@@ -392,7 +392,7 @@ void Layout::breakLayout()
for (auto it = rects.cbegin(), end = rects.cend(); it != end; ++it) {
QWidget *w = it.key();
if (needReparent) {
- w->setParent(m_layoutBase->parentWidget(), 0);
+ w->setParent(m_layoutBase->parentWidget(), nullptr);
w->move(m_layoutBasePos + it.value().topLeft());
w->show();
}
@@ -438,7 +438,7 @@ static QString suggestLayoutName(const char *className)
QLayout *Layout::createLayout(int type)
{
Q_ASSERT(m_layoutType != LayoutInfo::HSplitter && m_layoutType != LayoutInfo::VSplitter);
- QLayout *layout = m_formWindow->core()->widgetFactory()->createLayout(m_layoutBase, 0, type);
+ QLayout *layout = m_formWindow->core()->widgetFactory()->createLayout(m_layoutBase, nullptr, type);
// set a name
layout->setObjectName(suggestLayoutName(layout->metaObject()->className()));
m_formWindow->ensureUniqueObjectName(layout);
@@ -456,7 +456,7 @@ QLayout *Layout::createLayout(int type)
void Layout::reparentToLayoutBase(QWidget *w)
{
if (w->parent() != m_layoutBase) {
- w->setParent(m_layoutBase, 0);
+ w->setParent(m_layoutBase, nullptr);
w->move(QPoint(0,0));
}
}
@@ -562,7 +562,7 @@ void SplitterLayout::doLayout()
return;
QSplitter *splitter = qobject_cast<QSplitter*>(layoutBaseWidget());
- Q_ASSERT(splitter != 0);
+ Q_ASSERT(splitter != nullptr);
const QWidgetList::const_iterator cend = widgets().constEnd();
@@ -582,7 +582,7 @@ void SplitterLayout::doLayout()
class Grid
{
- Q_DISABLE_COPY(Grid);
+ Q_DISABLE_COPY_MOVE(Grid);
public:
enum Mode {
GridLayout, // Arbitrary size/supports span
@@ -635,7 +635,7 @@ Grid::Grid(Mode mode) :
m_mode(mode),
m_nrows(0),
m_ncols(0),
- m_cells(0)
+ m_cells(nullptr)
{
}
@@ -647,12 +647,12 @@ Grid::~Grid()
void Grid::resize(int nrows, int ncols)
{
delete [] m_cells;
- m_cells = 0;
+ m_cells = nullptr;
m_nrows = nrows;
m_ncols = ncols;
if (const int allocSize = m_nrows * m_ncols) {
m_cells = new QWidget*[allocSize];
- std::fill(m_cells, m_cells + allocSize, static_cast<QWidget *>(0));
+ std::fill(m_cells, m_cells + allocSize, nullptr);
}
}
@@ -910,7 +910,7 @@ void Grid::shrink()
return;
// reallocate and copy omitting the empty cells
QWidget **simplifiedCells = new QWidget*[simplifiedNCols * simplifiedNRows];
- std::fill(simplifiedCells, simplifiedCells + simplifiedNCols * simplifiedNRows, static_cast<QWidget *>(0));
+ std::fill(simplifiedCells, simplifiedCells + simplifiedNCols * simplifiedNRows, nullptr);
QWidget **simplifiedPtr = simplifiedCells;
for (int r = 0; r < m_nrows; r++)
@@ -931,7 +931,7 @@ void Grid::shrink()
bool Grid::shrinkFormLayoutSpans()
{
bool shrunk = false;
- typedef QSet<QWidget*> WidgetSet;
+ using WidgetSet = QSet<QWidget *>;
// Determine unique set of widgets
WidgetSet widgets;
QWidget **end = m_cells + m_ncols * m_nrows;
@@ -962,7 +962,7 @@ bool Grid::shrinkFormLayoutSpans()
for (int j = col; j < col + colspan - 1; j++)
if (i > row + newColSpan - 1 || j > col + newRowSpan - 1)
if (cell(i, j) == w)
- setCell(i, j, 0);
+ setCell(i, j, nullptr);
shrunk = true;
}
}
@@ -983,9 +983,9 @@ void Grid::reallocFormLayout()
for (int r = 0; r < m_nrows; r++) {
// Try to find a column where the form columns are empty and
// there are widgets further to the right.
- if (cell(r, 0) == 0 && cell(r, 1) == 0) {
+ if (cell(r, 0) == nullptr && cell(r, 1) == nullptr) {
int sourceCol = FormLayoutColumns;
- QWidget *firstWidget = 0;
+ QWidget *firstWidget = nullptr;
for ( ; sourceCol < m_ncols; sourceCol++)
if (QWidget *w = cell(r, sourceCol)) {
firstWidget = w;
@@ -999,7 +999,7 @@ void Grid::reallocFormLayout()
setCell(r, targetCol++, w);
// Pad with zero
for ( ; targetCol < m_ncols; targetCol++)
- setCell(r, targetCol, 0);
+ setCell(r, targetCol, nullptr);
}
}
// Any protruding widgets left on that row?
@@ -1011,7 +1011,7 @@ void Grid::reallocFormLayout()
// Reallocate with 2 columns. Just insert the protruding ones as fields.
const int formNRows = m_nrows + pastRightWidgetCount;
QWidget **formCells = new QWidget*[FormLayoutColumns * formNRows];
- std::fill(formCells, formCells + FormLayoutColumns * formNRows, static_cast<QWidget *>(0));
+ std::fill(formCells, formCells + FormLayoutColumns * formNRows, nullptr);
QWidget **formPtr = formCells;
const int matchingColumns = qMin(m_ncols, static_cast<int>(FormLayoutColumns));
for (int r = 0; r < m_nrows; r++) {
@@ -1104,7 +1104,7 @@ void GridLayout<GridLikeLayout, LayoutType, GridMode>::doLayout()
if (needReparent)
reparentToLayoutBase(w);
- Qt::Alignment alignment = Qt::Alignment(0);
+ Qt::Alignment alignment = Qt::Alignment(nullptr);
if (const Spacer *spacer = qobject_cast<const Spacer*>(w))
alignment = spacer->alignment();
@@ -1245,7 +1245,7 @@ Layout* Layout::createLayout(const QWidgetList &widgets, QWidget *parentWidget,
break;
}
Q_ASSERT(0);
- return 0;
+ return nullptr;
}
} // namespace qdesigner_internal
diff --git a/src/designer/src/lib/shared/layout_p.h b/src/designer/src/lib/shared/layout_p.h
index 2b97fb823..e6cd69a63 100644
--- a/src/designer/src/lib/shared/layout_p.h
+++ b/src/designer/src/lib/shared/layout_p.h
@@ -60,7 +60,7 @@ namespace qdesigner_internal {
class QDESIGNER_SHARED_EXPORT Layout : public QObject
{
Q_OBJECT
- Q_DISABLE_COPY(Layout)
+ Q_DISABLE_COPY_MOVE(Layout)
protected:
Layout(const QWidgetList &wl, QWidget *p, QDesignerFormWindowInterface *fw, QWidget *lb, LayoutInfo::Type layoutType);
@@ -89,7 +89,7 @@ public:
void setReparentLayoutWidget(bool v) { m_reparentLayoutWidget = v; }
protected:
- virtual void finishLayout(bool needMove, QLayout *layout = 0);
+ virtual void finishLayout(bool needMove, QLayout *layout = nullptr);
virtual bool prepareLayout(bool &needMove, bool &needReparent);
void setWidgets(const QWidgetList &widgets) { m_widgets = widgets; }
diff --git a/src/designer/src/lib/shared/layoutinfo.cpp b/src/designer/src/lib/shared/layoutinfo.cpp
index 4fce2584d..30cfabfda 100644
--- a/src/designer/src/lib/shared/layoutinfo.cpp
+++ b/src/designer/src/lib/shared/layoutinfo.cpp
@@ -99,7 +99,7 @@ LayoutInfo::Type LayoutInfo::managedLayoutType(const QDesignerFormEditorInterfac
QLayout **ptrToLayout)
{
if (ptrToLayout)
- *ptrToLayout = 0;
+ *ptrToLayout = nullptr;
if (const QSplitter *splitter = qobject_cast<const QSplitter *>(w))
return splitter->orientation() == Qt::Horizontal ? HSplitter : VSplitter;
QLayout *layout = managedLayout(core, w);
@@ -121,7 +121,7 @@ QWidget *LayoutInfo::layoutParent(const QDesignerFormEditorInterface *core, QLay
o = o->parent();
}
- return 0;
+ return nullptr;
}
void LayoutInfo::deleteLayout(const QDesignerFormEditorInterface *core, QWidget *widget)
@@ -129,11 +129,11 @@ void LayoutInfo::deleteLayout(const QDesignerFormEditorInterface *core, QWidget
if (QDesignerContainerExtension *container = qt_extension<QDesignerContainerExtension*>(core->extensionManager(), widget))
widget = container->widget(container->currentIndex());
- Q_ASSERT(widget != 0);
+ Q_ASSERT(widget != nullptr);
QLayout *layout = managedLayout(core, widget);
- if (layout == 0 || core->metaDataBase()->item(layout) != 0) {
+ if (layout == nullptr || core->metaDataBase()->item(layout) != nullptr) {
delete layout;
widget->updateGeometry();
return;
@@ -150,7 +150,7 @@ LayoutInfo::Type LayoutInfo::laidoutWidgetType(const QDesignerFormEditorInterfac
if (isManaged)
*isManaged = false;
if (ptrToLayout)
- *ptrToLayout = 0;
+ *ptrToLayout = nullptr;
QWidget *parent = widget->parentWidget();
if (!parent)
@@ -203,12 +203,12 @@ QLayout *LayoutInfo::internalLayout(const QWidget *widget)
QLayout *LayoutInfo::managedLayout(const QDesignerFormEditorInterface *core, const QWidget *widget)
{
- if (widget == 0)
- return 0;
+ if (widget == nullptr)
+ return nullptr;
QLayout *layout = widget->layout();
if (!layout)
- return 0;
+ return nullptr;
return managedLayout(core, layout);
}
@@ -222,23 +222,23 @@ QLayout *LayoutInfo::managedLayout(const QDesignerFormEditorInterface *core, QLa
/* This code exists mainly for the Q3GroupBox class, for which
* widget->layout() returns an internal VBoxLayout. */
const QDesignerMetaDataBaseItemInterface *item = metaDataBase->item(layout);
- if (item == 0) {
+ if (item == nullptr) {
layout = layout->findChild<QLayout*>();
item = metaDataBase->item(layout);
}
if (!item)
- return 0;
+ return nullptr;
return layout;
}
// Is it a a dummy grid placeholder created by Designer?
bool LayoutInfo::isEmptyItem(QLayoutItem *item)
{
- if (item == 0) {
+ if (item == nullptr) {
qDebug() << "** WARNING Zero-item passed on to isEmptyItem(). This indicates a layout inconsistency.";
return true;
}
- return item->spacerItem() != 0;
+ return item->spacerItem() != nullptr;
}
QDESIGNER_SHARED_EXPORT void getFormLayoutItemPosition(const QFormLayout *formLayout, int index, int *rowPtr, int *columnPtr, int *rowspanPtr, int *colspanPtr)
@@ -273,7 +273,8 @@ QDESIGNER_SHARED_EXPORT void formLayoutAddWidget(QFormLayout *formLayout, QWidge
if (spanning) {
formLayout->insertRow(r.y(), w);
} else {
- QWidget *label = 0, *field = 0;
+ QWidget *label = nullptr;
+ QWidget *field = nullptr;
if (r.x() == 0) {
label = w;
} else {
diff --git a/src/designer/src/lib/shared/layoutinfo_p.h b/src/designer/src/lib/shared/layoutinfo_p.h
index de3b80296..e5326203a 100644
--- a/src/designer/src/lib/shared/layoutinfo_p.h
+++ b/src/designer/src/lib/shared/layoutinfo_p.h
@@ -74,14 +74,14 @@ public:
// Examines the immediate layout of the widget.
static Type layoutType(const QDesignerFormEditorInterface *core, const QWidget *w);
// Examines the managed layout of the widget
- static Type managedLayoutType(const QDesignerFormEditorInterface *core, const QWidget *w, QLayout **layout = 0);
+ static Type managedLayoutType(const QDesignerFormEditorInterface *core, const QWidget *w, QLayout **layout = nullptr);
static Type layoutType(const QDesignerFormEditorInterface *core, const QLayout *layout);
static Type layoutType(const QString &typeName);
static QString layoutName(Type t);
static QWidget *layoutParent(const QDesignerFormEditorInterface *core, QLayout *layout);
- static Type laidoutWidgetType(const QDesignerFormEditorInterface *core, QWidget *widget, bool *isManaged = 0, QLayout **layout = 0);
+ static Type laidoutWidgetType(const QDesignerFormEditorInterface *core, QWidget *widget, bool *isManaged = nullptr, QLayout **layout = nullptr);
static bool inline isWidgetLaidout(const QDesignerFormEditorInterface *core, QWidget *widget) { return laidoutWidgetType(core, widget) != NoLayout; }
static QLayout *managedLayout(const QDesignerFormEditorInterface *core, const QWidget *widget);
@@ -92,7 +92,7 @@ public:
static bool isEmptyItem(QLayoutItem *item);
};
-QDESIGNER_SHARED_EXPORT void getFormLayoutItemPosition(const QFormLayout *formLayout, int index, int *rowPtr, int *columnPtr = 0, int *rowspanPtr = 0, int *colspanPtr = 0);
+QDESIGNER_SHARED_EXPORT void getFormLayoutItemPosition(const QFormLayout *formLayout, int index, int *rowPtr, int *columnPtr = nullptr, int *rowspanPtr = nullptr, int *colspanPtr = nullptr);
QDESIGNER_SHARED_EXPORT void formLayoutAddWidget(QFormLayout *formLayout, QWidget *w, const QRect &r, bool insert);
} // namespace qdesigner_internal
diff --git a/src/designer/src/lib/shared/metadatabase.cpp b/src/designer/src/lib/shared/metadatabase.cpp
index 16a0066bb..ed0de8dd6 100644
--- a/src/designer/src/lib/shared/metadatabase.cpp
+++ b/src/designer/src/lib/shared/metadatabase.cpp
@@ -130,15 +130,15 @@ MetaDataBase::~MetaDataBase()
MetaDataBaseItem *MetaDataBase::metaDataBaseItem(QObject *object) const
{
MetaDataBaseItem *i = m_items.value(object);
- if (i == 0 || !i->enabled())
- return 0;
+ if (i == nullptr || !i->enabled())
+ return nullptr;
return i;
}
void MetaDataBase::add(QObject *object)
{
MetaDataBaseItem *item = m_items.value(object);
- if (item != 0) {
+ if (item != nullptr) {
item->setEnabled(true);
if (debugMetaDatabase) {
qDebug() << "MetaDataBase::add: Existing item for " << object->metaObject()->className() << item->name();
diff --git a/src/designer/src/lib/shared/metadatabase_p.h b/src/designer/src/lib/shared/metadatabase_p.h
index a27d74fed..48dee4086 100644
--- a/src/designer/src/lib/shared/metadatabase_p.h
+++ b/src/designer/src/lib/shared/metadatabase_p.h
@@ -89,7 +89,7 @@ class QDESIGNER_SHARED_EXPORT MetaDataBase: public QDesignerMetaDataBaseInterfac
{
Q_OBJECT
public:
- explicit MetaDataBase(QDesignerFormEditorInterface *core, QObject *parent = 0);
+ explicit MetaDataBase(QDesignerFormEditorInterface *core, QObject *parent = nullptr);
~MetaDataBase() override;
QDesignerFormEditorInterface *core() const override;
diff --git a/src/designer/src/lib/shared/morphmenu.cpp b/src/designer/src/lib/shared/morphmenu.cpp
index 00597b856..ee09dfafd 100644
--- a/src/designer/src/lib/shared/morphmenu.cpp
+++ b/src/designer/src/lib/shared/morphmenu.cpp
@@ -226,15 +226,15 @@ static QString suggestObjectName(const QString &oldClassName, const QString &new
// Find the label whose buddy the widget is.
QLabel *buddyLabelOf(QDesignerFormWindowInterface *fw, QWidget *w)
{
- typedef QList<QLabel*> LabelList;
+ using LabelList = QList<QLabel *>;
const LabelList labelList = fw->findChildren<QLabel*>();
if (labelList.empty())
- return 0;
+ return nullptr;
const LabelList::const_iterator cend = labelList.constEnd();
for (LabelList::const_iterator it = labelList.constBegin(); it != cend; ++it )
if ( (*it)->buddy() == w)
return *it;
- return 0;
+ return nullptr;
}
// Replace widgets in a widget-list type dynamic property of the parent
@@ -256,7 +256,7 @@ static void replaceWidgetListDynamicProperty(QWidget *parentWidget,
* which cause other commands to be added. */
class MorphWidgetCommand : public QDesignerFormWindowCommand
{
- Q_DISABLE_COPY(MorphWidgetCommand)
+ Q_DISABLE_COPY_MOVE(MorphWidgetCommand)
public:
explicit MorphWidgetCommand(QDesignerFormWindowInterface *formWindow);
@@ -275,7 +275,7 @@ public:
static QStringList candidateClasses(QDesignerFormWindowInterface *fw, QWidget *w);
private:
- static bool canMorph(QDesignerFormWindowInterface *fw, QWidget *w, int *childContainerCount = 0, MorphCategory *cat = 0);
+ static bool canMorph(QDesignerFormWindowInterface *fw, QWidget *w, int *childContainerCount = nullptr, MorphCategory *cat = nullptr);
void morph(QWidget *before, QWidget *after);
QWidget *m_beforeWidget;
@@ -313,8 +313,8 @@ bool MorphWidgetCommand::addMorphMacro(QDesignerFormWindowInterface *fw, QWidget
MorphWidgetCommand::MorphWidgetCommand(QDesignerFormWindowInterface *formWindow) :
QDesignerFormWindowCommand(QString(), formWindow),
- m_beforeWidget(0),
- m_afterWidget(0)
+ m_beforeWidget(nullptr),
+ m_afterWidget(nullptr)
{
}
@@ -443,13 +443,13 @@ void MorphWidgetCommand::morph(QWidget *before, QWidget *after)
} else if (QSplitter *splitter = qobject_cast<QSplitter *>(parent)) {
const int index = splitter->indexOf(before);
before->hide();
- before->setParent(0);
+ before->setParent(nullptr);
splitter->insertWidget(index, after);
after->setParent(parent);
after->setGeometry(oldGeom);
} else {
before->hide();
- before->setParent(0);
+ before->setParent(nullptr);
after->setParent(parent);
after->setGeometry(oldGeom);
}
@@ -495,7 +495,7 @@ bool MorphWidgetCommand::canMorph(QDesignerFormWindowInterface *fw, QWidget *w,
// Check the parent relationship. We accept only managed parent widgets
// with a single, managed layout in which widget is a member.
QWidget *parent = w->parentWidget();
- if (parent == 0)
+ if (parent == nullptr)
return false;
if (QLayout *pl = LayoutInfo::managedLayout(core, parent))
if (pl->indexOf(w) < 0 || !core->metaDataBase()->item(pl))
@@ -549,11 +549,7 @@ QStringList MorphWidgetCommand::candidateClasses(QDesignerFormWindowInterface *f
// MorphMenu
MorphMenu::MorphMenu(QObject *parent) :
- QObject(parent),
- m_subMenuAction(0),
- m_menu(0),
- m_widget(0),
- m_formWindow(0)
+ QObject(parent)
{
}
@@ -576,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 b317a37dc..eba1bdf3a 100644
--- a/src/designer/src/lib/shared/morphmenu_p.h
+++ b/src/designer/src/lib/shared/morphmenu_p.h
@@ -52,12 +52,12 @@ namespace qdesigner_internal {
/* Conveniene morph menu that acts on a single widget. */
class QDESIGNER_SHARED_EXPORT MorphMenu : public QObject {
- Q_DISABLE_COPY(MorphMenu)
+ Q_DISABLE_COPY_MOVE(MorphMenu)
Q_OBJECT
public:
- typedef QList<QAction *> ActionList;
+ using ActionList = QList<QAction *>;
- 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);
@@ -68,10 +68,10 @@ private slots:
private:
bool populateMenu(QWidget *w, QDesignerFormWindowInterface *fw);
- QAction *m_subMenuAction;
- QMenu *m_menu;
- QWidget *m_widget;
- QDesignerFormWindowInterface *m_formWindow;
+ QAction *m_subMenuAction = nullptr;
+ QMenu *m_menu = nullptr;
+ QWidget *m_widget = nullptr;
+ QDesignerFormWindowInterface *m_formWindow = nullptr;
};
} // namespace qdesigner_internal
diff --git a/src/designer/src/lib/shared/newformwidget.cpp b/src/designer/src/lib/shared/newformwidget.cpp
index 39a025b87..b3853ae21 100644
--- a/src/designer/src/lib/shared/newformwidget.cpp
+++ b/src/designer/src/lib/shared/newformwidget.cpp
@@ -126,11 +126,10 @@ NewFormWidget::NewFormWidget(QDesignerFormEditorInterface *core, QWidget *parent
QDesignerNewFormWidgetInterface(parentWidget),
m_core(core),
m_ui(new Ui::NewFormWidget),
- m_currentItem(0),
- m_acceptedItem(0)
+ m_currentItem(nullptr),
+ m_acceptedItem(nullptr)
{
- typedef void (QComboBox::*QComboIntSignal)(int);
- typedef QList<qdesigner_internal::DeviceProfile> DeviceProfileList;
+ using DeviceProfileList = QList<qdesigner_internal::DeviceProfile>;
m_ui->setupUi(this);
m_ui->treeWidget->setItemDelegate(new qdesigner_internal::SheetDelegate(m_ui->treeWidget, this));
@@ -150,7 +149,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 +165,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);
@@ -181,7 +180,8 @@ NewFormWidget::NewFormWidget(QDesignerFormEditorInterface *core, QWidget *parent
// Fill profile combo
m_deviceProfiles = settings.deviceProfiles();
m_ui->profileComboBox->addItem(tr("None"));
- connect(m_ui->profileComboBox, static_cast<QComboIntSignal>(&QComboBox::currentIndexChanged),
+ connect(m_ui->profileComboBox,
+ QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &NewFormWidget::slotDeviceProfileIndexChanged);
if (m_deviceProfiles.empty()) {
m_ui->profileComboBox->setEnabled(false);
@@ -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..f6daae122 100644
--- a/src/designer/src/lib/shared/newformwidget_p.h
+++ b/src/designer/src/lib/shared/newformwidget_p.h
@@ -63,21 +63,19 @@ namespace Ui {
class NewFormWidget;
}
-class QDesignerWorkbench;
-
class QDESIGNER_SHARED_EXPORT NewFormWidget : public QDesignerNewFormWidgetInterface
{
Q_OBJECT
- Q_DISABLE_COPY(NewFormWidget)
+ Q_DISABLE_COPY_MOVE(NewFormWidget)
public:
- typedef QList<qdesigner_internal::DeviceProfile> DeviceProfileList;
+ using DeviceProfileList = QList<qdesigner_internal::DeviceProfile>;
explicit NewFormWidget(QDesignerFormEditorInterface *core, QWidget *parentWidget);
~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,
@@ -112,8 +110,8 @@ private:
bool showCurrentItemPixmap();
// Pixmap cache (item, profile combo index)
- typedef QPair<const QTreeWidgetItem *, int> ItemPixmapCacheKey;
- typedef QMap<ItemPixmapCacheKey, QPixmap> ItemPixmapCache;
+ using ItemPixmapCacheKey = QPair<const QTreeWidgetItem *, int>;
+ using ItemPixmapCache = QMap<ItemPixmapCacheKey, QPixmap>;
ItemPixmapCache m_itemPixmapCache;
QDesignerFormEditorInterface *m_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 c4a770e02..ddc8cd611 100644
--- a/src/designer/src/lib/shared/pluginmanager.cpp
+++ b/src/designer/src/lib/shared/pluginmanager.cpp
@@ -88,8 +88,8 @@ QT_BEGIN_NAMESPACE
static QStringList unique(const QStringList &lst)
{
- const QSet<QString> s = QSet<QString>::fromList(lst);
- return s.toList();
+ const QSet<QString> s(lst.cbegin(), lst.cend());
+ return s.values();
}
QStringList QDesignerPluginManager::defaultPluginPaths()
@@ -134,9 +134,9 @@ static inline QString getDesignerLanguage(QDesignerFormEditorInterface *core)
class QDesignerCustomWidgetSharedData : public QSharedData {
public:
// Type of a string property
- typedef QPair<qdesigner_internal::TextPropertyValidationMode, bool> StringPropertyType;
- typedef QHash<QString, StringPropertyType> StringPropertyTypeMap;
- typedef QHash<QString, QString> PropertyToolTipMap;
+ using StringPropertyType = QPair<qdesigner_internal::TextPropertyValidationMode, bool>;
+ using StringPropertyTypeMap = QHash<QString, StringPropertyType>;
+ using PropertyToolTipMap = QHash<QString, QString>;
explicit QDesignerCustomWidgetSharedData(const QString &thePluginPath) : pluginPath(thePluginPath) {}
void clearXML();
@@ -453,7 +453,7 @@ QDesignerCustomWidgetData::ParseResult
class QDesignerPluginManagerPrivate {
public:
- typedef QPair<QString, QString> ClassNamePropertyNameKey;
+ using ClassNamePropertyNameKey = QPair<QString, QString>;
QDesignerPluginManagerPrivate(QDesignerFormEditorInterface *core);
@@ -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/pluginmanager_p.h b/src/designer/src/lib/shared/pluginmanager_p.h
index 249748e93..373d0fe51 100644
--- a/src/designer/src/lib/shared/pluginmanager_p.h
+++ b/src/designer/src/lib/shared/pluginmanager_p.h
@@ -99,7 +99,7 @@ class QDESIGNER_SHARED_EXPORT QDesignerPluginManager: public QObject
{
Q_OBJECT
public:
- typedef QList<QDesignerCustomWidgetInterface*> CustomWidgetList;
+ using CustomWidgetList = QList<QDesignerCustomWidgetInterface *>;
explicit QDesignerPluginManager(QDesignerFormEditorInterface *core);
~QDesignerPluginManager() override;
diff --git a/src/designer/src/lib/shared/previewconfigurationwidget.cpp b/src/designer/src/lib/shared/previewconfigurationwidget.cpp
index 6352468c3..f9ddb4b5e 100644
--- a/src/designer/src/lib/shared/previewconfigurationwidget.cpp
+++ b/src/designer/src/lib/shared/previewconfigurationwidget.cpp
@@ -57,7 +57,7 @@ static const char *skinExtensionC = "skin";
// Pair of skin name, path
typedef QPair<QString, QString> SkinNamePath;
-typedef QList<SkinNamePath> Skins;
+using Skins = QList<SkinNamePath>;
enum { SkinComboNoneIndex = 0 };
// find default skins (resources)
@@ -314,13 +314,11 @@ PreviewConfigurationWidget::PreviewConfigurationWidget(QDesignerFormEditorInterf
QGroupBox(parent),
m_impl(new PreviewConfigurationWidgetPrivate(core, this))
{
- typedef void (QComboBox::*QComboIntSignal)(int);
-
connect(m_impl->appStyleSheetChangeButton(), &QAbstractButton::clicked,
this, &PreviewConfigurationWidget::slotEditAppStyleSheet);
connect(m_impl->skinRemoveButton(), &QAbstractButton::clicked,
this, &PreviewConfigurationWidget::slotDeleteSkinEntry);
- connect(m_impl->skinCombo(), static_cast<QComboIntSignal>(&QComboBox::currentIndexChanged),
+ connect(m_impl->skinCombo(), QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &PreviewConfigurationWidget::slotSkinChanged);
m_impl->retrieveSettings();
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..4649901f9 100644
--- a/src/designer/src/lib/shared/previewmanager.cpp
+++ b/src/designer/src/lib/shared/previewmanager.cpp
@@ -99,9 +99,9 @@ namespace qdesigner_internal {
* should return that in its size hint, else such cases won't work */
class DesignerZoomProxyWidget : public ZoomProxyWidget {
- Q_DISABLE_COPY(DesignerZoomProxyWidget)
+ Q_DISABLE_COPY_MOVE(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;
};
@@ -120,11 +120,12 @@ QSizeF DesignerZoomProxyWidget::sizeHint(Qt::SizeHint which, const QSizeF & cons
// DesignerZoomWidget which returns DesignerZoomProxyWidget in its factory function
class DesignerZoomWidget : public ZoomWidget {
- Q_DISABLE_COPY(DesignerZoomWidget)
+ Q_DISABLE_COPY_MOVE(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 &parameters, 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);
}
}
@@ -303,7 +304,7 @@ QMatrix PreviewDeviceSkin::skinTransform() const
// ------------ PreviewConfigurationPrivate
class PreviewConfigurationData : public QSharedData {
public:
- PreviewConfigurationData() {}
+ PreviewConfigurationData() = default;
explicit PreviewConfigurationData(const QString &style, const QString &applicationStyleSheet, const QString &deviceSkin);
QString m_style;
@@ -352,7 +353,7 @@ private:
ZoomablePreviewDeviceSkin::ZoomablePreviewDeviceSkin(const DeviceSkinParameters &parameters, 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);
@@ -554,7 +555,7 @@ public:
QPointer<QWidget> m_activePreview;
- typedef QList<PreviewData> PreviewDataList;
+ using PreviewDataList = QList<PreviewData>;
PreviewDataList m_previews;
@@ -567,7 +568,7 @@ public:
PreviewManagerPrivate::PreviewManagerPrivate(PreviewManager::PreviewMode mode) :
m_mode(mode),
- m_core(0),
+ m_core(nullptr),
m_updateBlocked(false)
{
}
@@ -621,10 +622,9 @@ static QWidget *fakeContainer(QWidget *w)
dock->setFeatures(dock->features() & ~(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetClosable));
dock->setAllowedAreas(Qt::LeftDockWidgetArea);
QMainWindow *mw = new QMainWindow;
- int leftMargin, topMargin, rightMargin, bottomMargin;
- mw->getContentsMargins(&leftMargin, &topMargin, &rightMargin, &bottomMargin);
+ const QMargins cm = mw->contentsMargins();
mw->addDockWidget(Qt::LeftDockWidgetArea, dock);
- mw->resize(size + QSize(leftMargin + rightMargin, topMargin + bottomMargin));
+ mw->resize(size + QSize(cm.left() + cm.right(), cm.top() + cm.bottom()));
return mw;
}
return w;
@@ -672,7 +672,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 +708,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 +747,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);
@@ -797,9 +797,9 @@ QWidget *PreviewManager::showPreview(const QDesignerFormWindowInterface *fw,
QWidget *PreviewManager::raise(const QDesignerFormWindowInterface *fw, const PreviewConfiguration &pc)
{
- typedef PreviewManagerPrivate::PreviewDataList PreviewDataList;
+ using PreviewDataList = PreviewManagerPrivate::PreviewDataList;
if (d->m_previews.empty())
- return 0;
+ return nullptr;
// find matching window
const PreviewDataList::const_iterator cend = d->m_previews.constEnd();
@@ -811,14 +811,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();
@@ -831,13 +831,13 @@ void PreviewManager::closeAllPreviews()
void PreviewManager::updatePreviewClosed(QWidget *w)
{
- typedef PreviewManagerPrivate::PreviewDataList PreviewDataList;
+ using PreviewDataList = PreviewManagerPrivate::PreviewDataList;
if (d->m_updateBlocked)
return;
// 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 45929df26..c2dd25523 100644
--- a/src/designer/src/lib/shared/promotionmodel.cpp
+++ b/src/designer/src/lib/shared/promotionmodel.cpp
@@ -39,7 +39,7 @@
QT_BEGIN_NAMESPACE
namespace {
- typedef QList<QStandardItem *> StandardItemList;
+ using StandardItemList = QList<QStandardItem *>;
// Model columns.
enum { ClassNameColumn, IncludeFileColumn, IncludeTypeColumn, ReferencedColumn, NumColumns };
@@ -74,7 +74,7 @@ namespace {
data.promotedItem = dbItem;
data.referenced = referenced;
- const QVariant userData = qVariantFromValue(data);
+ const QVariant userData = QVariant::fromValue(data);
StandardItemList rc = modelRow();
// name
@@ -120,7 +120,7 @@ namespace qdesigner_internal {
}
void PromotionModel::updateFromWidgetDatabase() {
- typedef QDesignerPromotionInterface::PromotedClasses PromotedClasses;
+ using PromotedClasses = QDesignerPromotionInterface::PromotedClasses;
clear();
initializeHeaders();
@@ -134,8 +134,8 @@ namespace qdesigner_internal {
const QSet<QString> usedPromotedClasses = m_core->promotion()->referencedPromotedClassNames();
- QDesignerWidgetDataBaseItemInterface *baseClass = 0;
- QStandardItem *baseItem = 0;
+ QDesignerWidgetDataBaseItemInterface *baseClass = nullptr;
+ QStandardItem *baseItem = nullptr;
const PromotedClasses::const_iterator bcend = promotedClasses.constEnd();
for (PromotedClasses::const_iterator it = promotedClasses.constBegin(); it != bcend; ++it) {
diff --git a/src/designer/src/lib/shared/promotiontaskmenu.cpp b/src/designer/src/lib/shared/promotiontaskmenu.cpp
index 481b944cc..bb5631d32 100644
--- a/src/designer/src/lib/shared/promotiontaskmenu.cpp
+++ b/src/designer/src/lib/shared/promotiontaskmenu.cpp
@@ -248,7 +248,7 @@ void PromotionTaskMenu::slotEditPromoteTo()
Q_ASSERT(QDesignerPromotionDialog::baseClassNames(core->promotion()).contains(base_class_name));
// Show over promotable widget
QString promoteToClassName;
- QDialog *promotionEditor = 0;
+ QDialog *promotionEditor = nullptr;
if (QDesignerLanguageExtension *lang = languageExtension(core))
promotionEditor = lang->createPromotionDialog(core, base_class_name, &promoteToClassName, fw);
if (!promotionEditor)
@@ -311,14 +311,14 @@ QDesignerFormWindowInterface *PromotionTaskMenu::formWindow() const
// for QDesignerMenus also.
QObject *o = m_widget;
QDesignerFormWindowInterface *result = QDesignerFormWindowInterface::findFormWindow(o);
- Q_ASSERT(result != 0);
+ Q_ASSERT(result != nullptr);
return result;
}
void PromotionTaskMenu::editPromotedWidgets(QDesignerFormEditorInterface *core, QWidget* parent) {
QDesignerLanguageExtension *lang = languageExtension(core);
// Show over non-promotable widget
- QDialog *promotionEditor = 0;
+ QDialog *promotionEditor = nullptr;
if (lang)
lang->createPromotionDialog(core, parent);
if (!promotionEditor)
diff --git a/src/designer/src/lib/shared/promotiontaskmenu_p.h b/src/designer/src/lib/shared/promotiontaskmenu_p.h
index c9c6312e0..830986968 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);
@@ -82,7 +82,7 @@ public:
// Defaults to "Demote to %1".arg(class).
void setDemoteLabel(const QString &demoteLabel);
- typedef QList<QAction*> ActionList;
+ using ActionList = QList<QAction *>;
enum AddFlags { LeadingSeparator = 1, TrailingSeparator = 2, SuppressGlobalEdit = 4};
@@ -111,7 +111,7 @@ private:
PromotionState createPromotionActions(QDesignerFormWindowInterface *formWindow);
QDesignerFormWindowInterface *formWindow() const;
- typedef QList<QPointer<QWidget> > PromotionSelectionList;
+ using PromotionSelectionList = QList<QPointer<QWidget> >;
PromotionSelectionList promotionSelectionList(QDesignerFormWindowInterface *formWindow) const;
Mode m_mode;
diff --git a/src/designer/src/lib/shared/propertylineedit_p.h b/src/designer/src/lib/shared/propertylineedit_p.h
index 6207aa1d7..a408f8a9d 100644
--- a/src/designer/src/lib/shared/propertylineedit_p.h
+++ b/src/designer/src/lib/shared/propertylineedit_p.h
@@ -56,9 +56,9 @@ namespace qdesigner_internal {
void setWantNewLine(bool nl) { m_wantNewLine = nl; }
bool wantNewLine() const { return m_wantNewLine; }
- bool event(QEvent *e);
+ bool event(QEvent *e) override;
protected:
- void contextMenuEvent (QContextMenuEvent *event );
+ void contextMenuEvent (QContextMenuEvent *event ) override;
private slots:
void insertNewLine();
private:
diff --git a/src/designer/src/lib/shared/qdesigner_command.cpp b/src/designer/src/lib/shared/qdesigner_command.cpp
index ea85d57e3..7346b98f3 100644
--- a/src/designer/src/lib/shared/qdesigner_command.cpp
+++ b/src/designer/src/lib/shared/qdesigner_command.cpp
@@ -119,7 +119,7 @@ static int removeFromWidgetListDynamicProperty(QWidget *parentWidget, QWidget *w
InsertWidgetCommand::InsertWidgetCommand(QDesignerFormWindowInterface *formWindow) :
QDesignerFormWindowCommand(QString(), formWindow),
m_insertMode(QDesignerLayoutDecorationExtension::InsertWidgetMode),
- m_layoutHelper(0),
+ m_layoutHelper(nullptr),
m_widgetWasManaged(false)
{
}
@@ -172,7 +172,7 @@ void InsertWidgetCommand::redo()
QDesignerFormEditorInterface *core = formWindow()->core();
QDesignerLayoutDecorationExtension *deco = qt_extension<QDesignerLayoutDecorationExtension*>(core->extensionManager(), parentWidget);
- if (deco != 0) {
+ if (deco != nullptr) {
const LayoutInfo::Type type = LayoutInfo::layoutType(core, LayoutInfo::managedLayout(core, parentWidget));
m_layoutHelper = LayoutHelper::createLayoutHelper(type);
m_layoutHelper->pushState(core, parentWidget);
@@ -232,7 +232,7 @@ void InsertWidgetCommand::undo()
void InsertWidgetCommand::refreshBuddyLabels()
{
- typedef QList<QLabel*> LabelList;
+ using LabelList = QList<QLabel *>;
const LabelList label_list = formWindow()->findChildren<QLabel*>();
if (label_list.empty())
@@ -342,10 +342,7 @@ void LowerWidgetCommand::reorder(QWidget *widget) const
}
// ---- ManageWidgetCommandHelper
-ManageWidgetCommandHelper::ManageWidgetCommandHelper() :
- m_widget(0)
-{
-}
+ManageWidgetCommandHelper::ManageWidgetCommandHelper() = default;
void ManageWidgetCommandHelper::init(const QDesignerFormWindowInterface *fw, QWidget *widget)
{
@@ -395,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)
@@ -623,7 +620,7 @@ PromoteToCustomWidgetCommand::PromoteToCustomWidgetCommand
{
}
-void PromoteToCustomWidgetCommand::init(const WidgetList &widgets,const QString &customClassName)
+void PromoteToCustomWidgetCommand::init(const WidgetPointerList &widgets,const QString &customClassName)
{
m_widgets = widgets;
m_customClassName = customClassName;
@@ -775,7 +772,7 @@ void LayoutCommand::undo()
delete deco; // release the extension
// ### generalize (put in function)
- if (!m_layoutBase && lb != 0 && !(qobject_cast<QLayoutWidget*>(lb) || qobject_cast<QSplitter*>(lb))) {
+ if (!m_layoutBase && lb != nullptr && !(qobject_cast<QLayoutWidget*>(lb) || qobject_cast<QSplitter*>(lb))) {
core->metaDataBase()->add(lb);
lb->show();
}
@@ -786,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)
{
}
@@ -836,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();
@@ -892,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)
{
}
@@ -1144,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);
@@ -1408,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)
{
}
@@ -1494,7 +1491,7 @@ void DeleteMenuBarCommand::redo()
if (m_mainWindow) {
QDesignerContainerExtension *c;
c = qt_extension<QDesignerContainerExtension*>(core()->extensionManager(), m_mainWindow);
- Q_ASSERT(c != 0);
+ Q_ASSERT(c != nullptr);
for (int i=0; i<c->count(); ++i) {
if (c->widget(i) == m_menuBar) {
c->remove(i);
@@ -1582,7 +1579,7 @@ void DeleteStatusBarCommand::redo()
{
if (m_mainWindow) {
QDesignerContainerExtension *c = qt_extension<QDesignerContainerExtension*>(core()->extensionManager(), m_mainWindow);
- Q_ASSERT(c != 0);
+ Q_ASSERT(c != nullptr);
for (int i=0; i<c->count(); ++i) {
if (c->widget(i) == m_statusBar) {
c->remove(i);
@@ -1617,12 +1614,13 @@ AddToolBarCommand::AddToolBarCommand(QDesignerFormWindowInterface *formWindow)
{
}
-void AddToolBarCommand::init(QMainWindow *mainWindow)
+void AddToolBarCommand::init(QMainWindow *mainWindow, Qt::ToolBarArea area)
{
m_mainWindow = mainWindow;
QDesignerWidgetFactoryInterface * wf = formWindow()->core()->widgetFactory();
// Pass on 0 parent first to avoid reparenting flicker.
- m_toolBar = qobject_cast<QToolBar*>(wf->createWidget(QStringLiteral("QToolBar"), 0));
+ m_toolBar = qobject_cast<QToolBar*>(wf->createWidget(QStringLiteral("QToolBar"), nullptr));
+ m_toolBar->setProperty("_q_desiredArea", QVariant(area));
wf->initialize(m_toolBar);
m_toolBar->hide();
}
@@ -1746,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();
@@ -1853,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;
@@ -1870,7 +1868,7 @@ QFormLayout *ChangeFormLayoutItemRoleCommand::managedFormLayoutOf(QDesignerFormE
if (QLayout *layout = LayoutInfo::managedLayout(core, w->parentWidget()))
if (QFormLayout *fl = qobject_cast<QFormLayout *>(layout))
return fl;
- return 0;
+ return nullptr;
}
// ---- ChangeLayoutItemGeometry ----
@@ -1882,13 +1880,13 @@ ChangeLayoutItemGeometry::ChangeLayoutItemGeometry(QDesignerFormWindowInterface
void ChangeLayoutItemGeometry::init(QWidget *widget, int row, int column, int rowspan, int colspan)
{
m_widget = widget;
- Q_ASSERT(m_widget->parentWidget() != 0);
+ Q_ASSERT(m_widget->parentWidget() != nullptr);
QLayout *layout = LayoutInfo::managedLayout(formWindow()->core(), m_widget->parentWidget());
- Q_ASSERT(layout != 0);
+ Q_ASSERT(layout != nullptr);
QGridLayout *grid = qobject_cast<QGridLayout*>(layout);
- Q_ASSERT(grid != 0);
+ Q_ASSERT(grid != nullptr);
const int itemIndex = grid->indexOf(m_widget);
Q_ASSERT(itemIndex != -1);
@@ -1903,10 +1901,10 @@ void ChangeLayoutItemGeometry::init(QWidget *widget, int row, int column, int ro
void ChangeLayoutItemGeometry::changeItemPosition(const QRect &g)
{
QLayout *layout = LayoutInfo::managedLayout(formWindow()->core(), m_widget->parentWidget());
- Q_ASSERT(layout != 0);
+ Q_ASSERT(layout != nullptr);
QGridLayout *grid = qobject_cast<QGridLayout*>(layout);
- Q_ASSERT(grid != 0);
+ Q_ASSERT(grid != nullptr);
const int itemIndex = grid->indexOf(m_widget);
Q_ASSERT(itemIndex != -1);
@@ -2042,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:
@@ -2057,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);
@@ -2331,11 +2329,7 @@ void ListContents::applyToComboBox(QComboBox *comboBox, DesignerIconCache *iconC
// --------- TableWidgetContents
-TableWidgetContents::TableWidgetContents() :
- m_columnCount(0),
- m_rowCount(0)
-{
-}
+TableWidgetContents::TableWidgetContents() = default;
void TableWidgetContents::clear()
{
@@ -2444,7 +2438,7 @@ bool TableWidgetContents::operator==(const TableWidgetContents &rhs) const
// ---- ChangeTableContentsCommand ----
ChangeTableContentsCommand::ChangeTableContentsCommand(QDesignerFormWindowInterface *formWindow) :
QDesignerFormWindowCommand(QApplication::translate("Command", "Change Table Contents"),
- formWindow), m_iconCache(0)
+ formWindow), m_iconCache(nullptr)
{
FormWindowBase *fwb = qobject_cast<FormWindowBase *>(formWindow);
if (fwb)
@@ -2551,7 +2545,7 @@ bool TreeWidgetContents::operator==(const TreeWidgetContents &rhs) const
// ---- ChangeTreeContentsCommand ----
ChangeTreeContentsCommand::ChangeTreeContentsCommand(QDesignerFormWindowInterface *formWindow)
: QDesignerFormWindowCommand(QApplication::translate("Command", "Change Tree Contents"), formWindow),
- m_iconCache(0)
+ m_iconCache(nullptr)
{
FormWindowBase *fwb = qobject_cast<FormWindowBase *>(formWindow);
if (fwb)
@@ -2578,7 +2572,7 @@ void ChangeTreeContentsCommand::undo()
// ---- ChangeListContentsCommand ----
ChangeListContentsCommand::ChangeListContentsCommand(QDesignerFormWindowInterface *formWindow)
- : QDesignerFormWindowCommand(QString(), formWindow), m_iconCache(0)
+ : QDesignerFormWindowCommand(QString(), formWindow), m_iconCache(nullptr)
{
FormWindowBase *fwb = qobject_cast<FormWindowBase *>(formWindow);
if (fwb)
@@ -2589,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;
@@ -2598,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;
@@ -2626,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;
}
@@ -2666,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));
@@ -2680,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);
@@ -2716,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;
@@ -2736,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);
@@ -2755,8 +2749,8 @@ void ActionInsertionCommand::insertAction()
}
void ActionInsertionCommand::removeAction()
{
- Q_ASSERT(m_action != 0);
- Q_ASSERT(m_parentWidget != 0);
+ Q_ASSERT(m_action != nullptr);
+ Q_ASSERT(m_parentWidget != nullptr);
if (QDesignerMenu *menu = qobject_cast<QDesignerMenu*>(m_parentWidget))
menu->hideSubMenu();
@@ -2785,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)
{
}
@@ -2819,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();
@@ -2843,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)
{
}
@@ -2887,7 +2881,7 @@ void DeleteToolBarCommand::redo()
{
if (m_mainWindow) {
QDesignerContainerExtension *c = qt_extension<QDesignerContainerExtension*>(core()->extensionManager(), m_mainWindow);
- Q_ASSERT(c != 0);
+ Q_ASSERT(c != nullptr);
for (int i=0; i<c->count(); ++i) {
if (c->widget(i) == m_toolBar) {
c->remove(i);
diff --git a/src/designer/src/lib/shared/qdesigner_command2.cpp b/src/designer/src/lib/shared/qdesigner_command2.cpp
index 8f72e2a0a..e956e7d92 100644
--- a/src/designer/src/lib/shared/qdesigner_command2.cpp
+++ b/src/designer/src/lib/shared/qdesigner_command2.cpp
@@ -48,7 +48,7 @@ MorphLayoutCommand::MorphLayoutCommand(QDesignerFormWindowInterface *formWindow)
m_breakLayoutCommand(new BreakLayoutCommand(formWindow)),
m_layoutCommand(new LayoutCommand(formWindow)),
m_newType(LayoutInfo::VBox),
- m_layoutBase(0)
+ m_layoutBase(nullptr)
{
}
@@ -143,7 +143,7 @@ QString MorphLayoutCommand::formatDescription(QDesignerFormEditorInterface * /*
LayoutAlignmentCommand::LayoutAlignmentCommand(QDesignerFormWindowInterface *formWindow) :
QDesignerFormWindowCommand(QApplication::translate("Command", "Change layout alignment"), formWindow),
- m_newAlignment(0), m_oldAlignment(0), m_widget(0)
+ m_newAlignment(nullptr), m_oldAlignment(nullptr), m_widget(nullptr)
{
}
@@ -180,7 +180,7 @@ Qt::Alignment LayoutAlignmentCommand::alignmentOf(const QDesignerFormEditorInter
(type == LayoutInfo::HBox || type == LayoutInfo::VBox
|| type == LayoutInfo::Grid);
if (!enabled)
- return Qt::Alignment(0);
+ return Qt::Alignment(nullptr);
// Get alignment
const int index = layout->indexOf(w);
Q_ASSERT(index >= 0);
@@ -193,7 +193,7 @@ void LayoutAlignmentCommand::applyAlignment(const QDesignerFormEditorInterface *
{
// Find layout and apply to item
QLayout *layout;
- LayoutInfo::laidoutWidgetType(core, w, 0, &layout);
+ LayoutInfo::laidoutWidgetType(core, w, nullptr, &layout);
if (layout) {
const int index = layout->indexOf(w);
if (index >= 0) {
diff --git a/src/designer/src/lib/shared/qdesigner_command2_p.h b/src/designer/src/lib/shared/qdesigner_command2_p.h
index 54ecb09ae..6d5fd00b9 100644
--- a/src/designer/src/lib/shared/qdesigner_command2_p.h
+++ b/src/designer/src/lib/shared/qdesigner_command2_p.h
@@ -59,14 +59,14 @@ class BreakLayoutCommand;
* QLayoutWidget's. */
class QDESIGNER_SHARED_EXPORT MorphLayoutCommand : public QDesignerFormWindowCommand {
- Q_DISABLE_COPY(MorphLayoutCommand)
+ Q_DISABLE_COPY_MOVE(MorphLayoutCommand)
public:
explicit MorphLayoutCommand(QDesignerFormWindowInterface *formWindow);
~MorphLayoutCommand() override;
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;
@@ -83,7 +83,7 @@ private:
// Change the alignment of a widget in a managed grid/box layout cell.
class LayoutAlignmentCommand : public QDesignerFormWindowCommand {
- Q_DISABLE_COPY(LayoutAlignmentCommand)
+ Q_DISABLE_COPY_MOVE(LayoutAlignmentCommand)
public:
explicit LayoutAlignmentCommand(QDesignerFormWindowInterface *formWindow);
@@ -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 98eda4669..8053c8918 100644
--- a/src/designer/src/lib/shared/qdesigner_command_p.h
+++ b/src/designer/src/lib/shared/qdesigner_command_p.h
@@ -179,7 +179,7 @@ private:
// Helper to correctly unmanage a widget and its children for delete operations
class QDESIGNER_SHARED_EXPORT ManageWidgetCommandHelper {
public:
- typedef QVector<QWidget*> WidgetVector;
+ using WidgetVector = QVector<QWidget *>;
ManageWidgetCommandHelper();
void init(const QDesignerFormWindowInterface *fw, QWidget *widget);
@@ -190,7 +190,7 @@ public:
const WidgetVector &managedChildren() const { return m_managedChildren; }
private:
- QWidget *m_widget;
+ QWidget *m_widget = nullptr;
WidgetVector m_managedChildren;
};
@@ -316,24 +316,24 @@ private:
class QDESIGNER_SHARED_EXPORT PromoteToCustomWidgetCommand : public QDesignerFormWindowCommand
{
public:
- typedef QList<QPointer<QWidget> > WidgetList;
+ using WidgetPointerList = QList<QPointer<QWidget> >;
explicit PromoteToCustomWidgetCommand(QDesignerFormWindowInterface *formWindow);
- void init(const WidgetList &widgets, const QString &customClassName);
+ void init(const WidgetPointerList &widgets, const QString &customClassName);
void redo() override;
void undo() override;
private:
void updateSelection();
- WidgetList m_widgets;
+ WidgetPointerList m_widgets;
QString m_customClassName;
};
class QDESIGNER_SHARED_EXPORT DemoteFromCustomWidgetCommand : public QDesignerFormWindowCommand
{
public:
- typedef PromoteToCustomWidgetCommand::WidgetList WidgetList;
+ using WidgetList = PromoteToCustomWidgetCommand::WidgetPointerList;
explicit DemoteFromCustomWidgetCommand(QDesignerFormWindowInterface *formWindow);
@@ -346,7 +346,7 @@ private:
// Mixin class for storing the selection state
class QDESIGNER_SHARED_EXPORT CursorSelectionState {
- Q_DISABLE_COPY(CursorSelectionState)
+ Q_DISABLE_COPY_MOVE(CursorSelectionState)
public:
CursorSelectionState();
@@ -354,7 +354,7 @@ public:
void restore(QDesignerFormWindowInterface *formWindow) const;
private:
- typedef QList<QPointer<QWidget> > WidgetPointerList;
+ using WidgetPointerList = QList<QPointer<QWidget> >;
WidgetPointerList m_selection;
QPointer<QWidget> m_current;
};
@@ -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;
@@ -713,7 +713,7 @@ class AddToolBarCommand: public QDesignerFormWindowCommand
public:
explicit AddToolBarCommand(QDesignerFormWindowInterface *formWindow);
- void init(QMainWindow *mainWindow);
+ void init(QMainWindow *mainWindow, Qt::ToolBarArea area);
void undo() override;
void redo() override;
@@ -841,7 +841,7 @@ protected:
};
struct QDESIGNER_SHARED_EXPORT ItemData {
- ItemData() {}
+ ItemData() = default;
ItemData(const QListWidgetItem *item, bool editor);
ItemData(const QTableWidgetItem *item, bool editor);
@@ -858,7 +858,7 @@ struct QDESIGNER_SHARED_EXPORT ItemData {
};
struct QDESIGNER_SHARED_EXPORT ListContents {
- ListContents() {}
+ ListContents() = default;
ListContents(const QTreeWidgetItem *item);
QTreeWidgetItem *createTreeItem(DesignerIconCache *iconCache) const;
@@ -878,8 +878,8 @@ struct QDESIGNER_SHARED_EXPORT ListContents {
// methods to retrieve and apply for ChangeTableContentsCommand
struct QDESIGNER_SHARED_EXPORT TableWidgetContents {
- typedef QPair<int, int> CellRowColumnAddress;
- typedef QMap<CellRowColumnAddress, ItemData> TableItemMap;
+ using CellRowColumnAddress = QPair<int, int>;
+ using TableItemMap = QMap<CellRowColumnAddress, ItemData>;
TableWidgetContents();
void clear();
@@ -894,8 +894,8 @@ struct QDESIGNER_SHARED_EXPORT TableWidgetContents {
static QString defaultHeaderText(int i);
static void insertHeaderItem(const QTableWidgetItem *item, int i, ListContents *header, bool editor);
- int m_columnCount;
- int m_rowCount;
+ int m_columnCount = 0;
+ int m_rowCount = 0;
ListContents m_horizontalHeader;
ListContents m_verticalHeader;
TableItemMap m_items;
@@ -922,14 +922,14 @@ private:
struct QDESIGNER_SHARED_EXPORT TreeWidgetContents {
struct ItemContents : public ListContents {
- ItemContents() : m_itemFlags(-1) {}
+ ItemContents() = default;
ItemContents(const QTreeWidgetItem *item, bool editor);
QTreeWidgetItem *createTreeItem(DesignerIconCache *iconCache, bool editor) const;
bool operator==(const ItemContents &rhs) const;
bool operator!=(const ItemContents &rhs) const { return !(*this == rhs); }
- int m_itemFlags;
+ int m_itemFlags = -1;
//bool m_firstColumnSpanned:1;
//bool m_hidden:1;
//bool m_expanded:1;
@@ -1011,12 +1011,12 @@ 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;
};
- typedef QList<ActionDataItem> ActionData;
+ using ActionData = QList<ActionDataItem>;
private:
QAction *m_action;
@@ -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..36419389b 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;
@@ -82,7 +82,7 @@ private:
QWidget *m_decoration;
QPoint m_hot_spot;
- Q_DISABLE_COPY(QDesignerDnDItem)
+ Q_DISABLE_COPY_MOVE(QDesignerDnDItem)
};
// Mime data for use with designer drag and drop operations.
@@ -91,7 +91,7 @@ class QDESIGNER_SHARED_EXPORT QDesignerMimeData : public QMimeData {
Q_OBJECT
public:
- typedef QList<QDesignerDnDItemInterface *> QDesignerDnDItems;
+ using QDesignerDnDItems = QList<QDesignerDnDItemInterface *>;
~QDesignerMimeData() override;
diff --git a/src/designer/src/lib/shared/qdesigner_dockwidget.cpp b/src/designer/src/lib/shared/qdesigner_dockwidget.cpp
index 8619c22be..278f9b829 100644
--- a/src/designer/src/lib/shared/qdesigner_dockwidget.cpp
+++ b/src/designer/src/lib/shared/qdesigner_dockwidget.cpp
@@ -61,7 +61,7 @@ void QDesignerDockWidget::setDocked(bool b)
if (b && !docked()) {
// Dock it
// ### undo/redo stack
- setParent(0);
+ setParent(nullptr);
c->addWidget(this);
formWindow()->selectWidget(this, formWindow()->cursor()->isWidgetSelected(this));
} else if (!b && docked()) {
@@ -119,7 +119,7 @@ QMainWindow *QDesignerDockWidget::findMainWindow() const
{
if (QDesignerFormWindowInterface *fw = formWindow())
return qobject_cast<QMainWindow*>(fw->mainContainer());
- return 0;
+ return nullptr;
}
QT_END_NAMESPACE
diff --git a/src/designer/src/lib/shared/qdesigner_dockwidget_p.h b/src/designer/src/lib/shared/qdesigner_dockwidget_p.h
index 59cf72ab5..7db332495 100644
--- a/src/designer/src/lib/shared/qdesigner_dockwidget_p.h
+++ b/src/designer/src/lib/shared/qdesigner_dockwidget_p.h
@@ -53,7 +53,7 @@ class QDESIGNER_SHARED_EXPORT QDesignerDockWidget: public QDockWidget
Q_PROPERTY(Qt::DockWidgetArea dockWidgetArea READ dockWidgetArea WRITE setDockWidgetArea DESIGNABLE docked STORED false)
Q_PROPERTY(bool docked READ docked WRITE setDocked DESIGNABLE inMainWindow STORED false)
public:
- QDesignerDockWidget(QWidget *parent = 0);
+ QDesignerDockWidget(QWidget *parent = nullptr);
~QDesignerDockWidget() override;
bool docked() const;
diff --git a/src/designer/src/lib/shared/qdesigner_formbuilder.cpp b/src/designer/src/lib/shared/qdesigner_formbuilder.cpp
index a2f1d1560..260316381 100644
--- a/src/designer/src/lib/shared/qdesigner_formbuilder.cpp
+++ b/src/designer/src/lib/shared/qdesigner_formbuilder.cpp
@@ -75,10 +75,10 @@ QDesignerFormBuilder::QDesignerFormBuilder(QDesignerFormEditorInterface *core,
const DeviceProfile &deviceProfile) :
m_core(core),
m_deviceProfile(deviceProfile),
- m_pixmapCache(0),
- m_iconCache(0),
+ m_pixmapCache(nullptr),
+ m_iconCache(nullptr),
m_ignoreCreateResources(false),
- m_tempResourceSet(0),
+ m_tempResourceSet(nullptr),
m_mainWidget(true)
{
Q_ASSERT(m_core);
@@ -110,10 +110,10 @@ QWidget *QDesignerFormBuilder::create(DomUI *ui, QWidget *parentWidget)
core()->resourceModel()->setCurrentResourceSet(resourceSet);
core()->resourceModel()->removeResourceSet(m_tempResourceSet);
- m_tempResourceSet = 0;
+ m_tempResourceSet = nullptr;
m_ignoreCreateResources = false;
- m_pixmapCache = 0;
- m_iconCache = 0;
+ m_pixmapCache = nullptr;
+ m_iconCache = nullptr;
m_customWidgetsWithScript.clear();
return widget;
@@ -121,7 +121,7 @@ QWidget *QDesignerFormBuilder::create(DomUI *ui, QWidget *parentWidget)
QWidget *QDesignerFormBuilder::createWidget(const QString &widgetName, QWidget *parentWidget, const QString &name)
{
- QWidget *widget = 0;
+ QWidget *widget = nullptr;
if (widgetName == QStringLiteral("QToolBar")) {
widget = new QToolBar(parentWidget);
@@ -295,7 +295,7 @@ void QDesignerFormBuilder::createResources(DomResources *resources)
if (m_ignoreCreateResources)
return;
QStringList paths;
- if (resources != 0) {
+ if (resources != nullptr) {
const auto &dom_include = resources->elementInclude();
for (DomResource *res : dom_include) {
QString path = QDir::cleanPath(workingDirectory().absoluteFilePath(res->attributeLocation()));
@@ -331,10 +331,10 @@ QWidget *QDesignerFormBuilder::createPreview(const QDesignerFormWindowInterface
QBuffer buffer(&bytes);
buffer.open(QIODevice::ReadOnly);
- QWidget *widget = builder.load(&buffer, 0);
+ QWidget *widget = builder.load(&buffer, nullptr);
if (!widget) { // Shouldn't happen
*errorMessage = QCoreApplication::translate("QDesignerFormBuilder", "The preview failed to build.");
- return 0;
+ return nullptr;
}
// Make sure palette is applied
const QString styleToUse = styleName.isEmpty() ? builder.deviceProfile().style() : styleName;
@@ -378,7 +378,7 @@ QWidget *QDesignerFormBuilder::createPreview(const QDesignerFormWindowInterface
fw->core()->dialogGui()->message(dialogParent, QDesignerDialogGuiInterface::PreviewFailureMessage,
QMessageBox::Warning, QCoreApplication::translate("QDesignerFormBuilder", "Designer"),
errorMessage, QMessageBox::Ok);
- return 0;
+ return nullptr;
}
return widget;
}
diff --git a/src/designer/src/lib/shared/qdesigner_formbuilder_p.h b/src/designer/src/lib/shared/qdesigner_formbuilder_p.h
index bceeb2a60..ceaf1b395 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
@@ -122,7 +122,7 @@ protected:
private:
QDesignerFormEditorInterface *m_core;
- typedef QSet<QWidget *> WidgetSet;
+ using WidgetSet = QSet<QWidget *>;
WidgetSet m_customWidgetsWithScript;
const DeviceProfile m_deviceProfile;
diff --git a/src/designer/src/lib/shared/qdesigner_formwindowcommand.cpp b/src/designer/src/lib/shared/qdesigner_formwindowcommand.cpp
index 6b70031cd..7c44ec4f7 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()
@@ -100,7 +100,7 @@ void QDesignerFormWindowCommand::updateBuddies(QDesignerFormWindowInterface *for
{
QExtensionManager* extensionManager = form->core()->extensionManager();
- typedef QList<QLabel*> LabelList;
+ using LabelList = QList<QLabel *>;
const LabelList label_list = form->findChildren<QLabel*>();
if (label_list.empty())
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.cpp b/src/designer/src/lib/shared/qdesigner_formwindowmanager.cpp
index 2b2695159..91332b0ec 100644
--- a/src/designer/src/lib/shared/qdesigner_formwindowmanager.cpp
+++ b/src/designer/src/lib/shared/qdesigner_formwindowmanager.cpp
@@ -49,13 +49,11 @@ using namespace qdesigner_internal;
QDesignerFormWindowManager::QDesignerFormWindowManager(QObject *parent)
- : QDesignerFormWindowManagerInterface(parent), m_unused(0)
+ : QDesignerFormWindowManagerInterface(parent)
{
}
-QDesignerFormWindowManager::~QDesignerFormWindowManager()
-{
-}
+QDesignerFormWindowManager::~QDesignerFormWindowManager() = default;
/*!
\fn PreviewManager *qdesigner_internal::QDesignerFormWindowManager::previewManager() const
diff --git a/src/designer/src/lib/shared/qdesigner_formwindowmanager_p.h b/src/designer/src/lib/shared/qdesigner_formwindowmanager_p.h
index 4aed283f6..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;
@@ -65,7 +65,7 @@ public:
void showPluginDialog() override;
private:
- void *m_unused;
+ void *m_unused = nullptr;
};
} // namespace qdesigner_internal
diff --git a/src/designer/src/lib/shared/qdesigner_introspection.cpp b/src/designer/src/lib/shared/qdesigner_introspection.cpp
index 9884c6bba..3001d6b76 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();
@@ -283,13 +283,13 @@ namespace {
const qdesigner_internal::QDesignerIntrospection *m_introspection;
const QMetaObject *m_metaObject;
- typedef QVector<QDesignerMetaEnumInterface *> Enumerators;
+ using Enumerators = QVector<QDesignerMetaEnumInterface *>;
Enumerators m_enumerators;
- typedef QVector<QDesignerMetaMethodInterface *> Methods;
+ using Methods = QVector<QDesignerMetaMethodInterface *>;
Methods m_methods;
- typedef QVector<QDesignerMetaPropertyInterface *> Properties;
+ using Properties = QVector<QDesignerMetaPropertyInterface *>;
Properties m_properties;
QDesignerMetaPropertyInterface *m_userProperty;
@@ -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_introspection_p.h b/src/designer/src/lib/shared/qdesigner_introspection_p.h
index 3fec4bc47..6c4d37e4d 100644
--- a/src/designer/src/lib/shared/qdesigner_introspection_p.h
+++ b/src/designer/src/lib/shared/qdesigner_introspection_p.h
@@ -60,7 +60,7 @@ namespace qdesigner_internal {
const QDesignerMetaObjectInterface* metaObjectForQMetaObject(const QMetaObject *metaObject) const;
private:
- typedef QMap<const QMetaObject*, QDesignerMetaObjectInterface*> MetaObjectMap;
+ using MetaObjectMap = QMap<const QMetaObject*, QDesignerMetaObjectInterface*>;
mutable MetaObjectMap m_metaObjectMap;
};
diff --git a/src/designer/src/lib/shared/qdesigner_membersheet.cpp b/src/designer/src/lib/shared/qdesigner_membersheet.cpp
index 47451f5a3..93371ac06 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
@@ -73,7 +73,7 @@ public:
bool visible{true};
};
- typedef QHash<int, Info> InfoHash;
+ using InfoHash = QHash<int, Info>;
Info &ensureInfo(int index);
@@ -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;
@@ -158,8 +158,7 @@ QString QDesignerMemberSheet::signature(int index) const
bool QDesignerMemberSheet::isVisible(int index) const
{
- typedef QDesignerMemberSheetPrivate::InfoHash InfoHash;
- const InfoHash::const_iterator it = d->m_info.constFind(index);
+ const auto it = d->m_info.constFind(index);
if (it != d->m_info.constEnd())
return it.value().visible;
@@ -248,7 +247,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 e47a60913..88668ea45 100644
--- a/src/designer/src/lib/shared/qdesigner_menu.cpp
+++ b/src/designer/src/lib/shared/qdesigner_menu.cpp
@@ -312,9 +312,9 @@ bool QDesignerMenu::handleMouseDoubleClickEvent(QWidget *, QMouseEvent *event)
QWidget *target = QApplication::widgetAt(event->globalPos());
QMenuBar *mb = qobject_cast<QMenuBar*>(target);
QDesignerMenu *menu = qobject_cast<QDesignerMenu*>(target);
- if (mb != 0 || menu != 0) {
+ if (mb != nullptr || menu != nullptr) {
const QPoint pt = target->mapFromGlobal(event->globalPos());
- QAction *action = mb == 0 ? menu->actionAt(pt) : mb->actionAt(pt);
+ QAction *action = mb == nullptr ? menu->actionAt(pt) : mb->actionAt(pt);
if (action)
sendMouseEventTo(target, pt, event);
}
@@ -386,7 +386,7 @@ bool QDesignerMenu::handleMousePressEvent(QWidget * /*widget*/, QMouseEvent *eve
const int old_index = m_currentIndex;
m_currentIndex = index;
- if ((hasSubMenuPixmap(action) || action->menu() != 0)
+ if ((hasSubMenuPixmap(action) || action->menu() != nullptr)
&& pm_rect.contains(m_startPosition)) {
if (m_currentIndex == m_lastSubMenuIndex) {
hideSubMenu();
@@ -469,7 +469,7 @@ bool QDesignerMenu::handleContextMenuEvent(QWidget *, QContextMenuEvent *event)
QAction *addSeparatorAction = menu.addAction(tr("Insert separator"));
addSeparatorAction->setData(itemData);
- QAction *removeAction = 0;
+ QAction *removeAction = nullptr;
if (action->isSeparator())
removeAction = menu.addAction(tr("Remove separator"));
else
@@ -490,10 +490,10 @@ void QDesignerMenu::slotAddSeparator()
return;
QAction *a = qvariant_cast<QAction*>(action->data());
- Q_ASSERT(a != 0);
+ Q_ASSERT(a != nullptr);
const int pos = actions().indexOf(a);
- QAction *action_before = 0;
+ QAction *action_before = nullptr;
if (pos != -1)
action_before = safeActionAt(pos);
@@ -507,7 +507,7 @@ void QDesignerMenu::slotAddSeparator()
if (parentMenu()) {
QAction *parent_action = parentMenu()->currentAction();
- if (parent_action->menu() == 0) {
+ if (parent_action->menu() == nullptr) {
CreateSubmenuCommand *cmd = new CreateSubmenuCommand(fw);
cmd->init(parentMenu(), parentMenu()->currentAction());
fw->commandHistory()->push(cmd);
@@ -527,7 +527,7 @@ void QDesignerMenu::slotRemoveSelectedAction()
void QDesignerMenu::deleteAction(QAction *a)
{
const int pos = actions().indexOf(a);
- QAction *action_before = 0;
+ QAction *action_before = nullptr;
if (pos != -1)
action_before = safeActionAt(pos + 1);
@@ -547,7 +547,7 @@ QRect QDesignerMenu::subMenuPixmapRect(QAction *action) const
bool QDesignerMenu::hasSubMenuPixmap(QAction *action) const
{
- return action != 0
+ return action != nullptr
&& qobject_cast<SpecialMenuAction*>(action) == 0
&& !action->isSeparator()
&& !action->menu()
@@ -621,7 +621,7 @@ QDesignerMenu *QDesignerMenu::findActivatedMenu() const
return activeDesignerMenu;
}
- return 0;
+ return nullptr;
}
bool QDesignerMenu::eventFilter(QObject *object, QEvent *event)
@@ -804,7 +804,7 @@ void QDesignerMenu::dropEvent(QDropEvent *event)
if (parentMenu()) {
QAction *parent_action = parentMenu()->currentAction();
- if (parent_action->menu() == 0) {
+ if (parent_action->menu() == nullptr) {
CreateSubmenuCommand *cmd = new CreateSubmenuCommand(fw);
cmd->init(parentMenu(), parentMenu()->currentAction(), action);
fw->commandHistory()->push(cmd);
@@ -839,7 +839,7 @@ QDesignerActionProviderExtension *QDesignerMenu::actionProvider()
return qt_extension<QDesignerActionProviderExtension*>(core->extensionManager(), this);
}
- return 0;
+ return nullptr;
}
void QDesignerMenu::closeMenuChain()
@@ -940,7 +940,7 @@ void QDesignerMenu::moveDown(bool ctrl)
QAction *QDesignerMenu::currentAction() const
{
if (m_currentIndex < 0 || m_currentIndex >= actions().count())
- return 0;
+ return nullptr;
return safeActionAt(m_currentIndex);
}
@@ -956,7 +956,7 @@ void QDesignerMenu::selectCurrentAction()
if (!action || action == m_addSeparator || action == m_addItem)
return;
- QDesignerObjectInspector *oi = 0;
+ QDesignerObjectInspector *oi = nullptr;
if (QDesignerFormWindowInterface *fw = formWindow())
oi = qobject_cast<QDesignerObjectInspector *>(fw->core()->objectInspector());
@@ -1001,9 +1001,9 @@ void QDesignerMenu::createRealMenuAction(QAction *action)
void QDesignerMenu::removeRealMenu(QAction *action)
{
QDesignerMenu *menu = qobject_cast<QDesignerMenu*>(action->menu());
- if (menu == 0)
+ if (menu == nullptr)
return;
- action->setMenu(0);
+ action->setMenu(nullptr);
m_subMenus.insert(action, menu);
QDesignerFormEditorInterface *core = formWindow()->core();
core->metaDataBase()->remove(menu);
@@ -1101,13 +1101,12 @@ QDesignerMenu *QDesignerMenu::parentMenu() const
QDesignerMenuBar *QDesignerMenu::parentMenuBar() const
{
- if (QDesignerMenuBar *mb = qobject_cast<QDesignerMenuBar*>(parentWidget())) {
+ if (QDesignerMenuBar *mb = qobject_cast<QDesignerMenuBar*>(parentWidget()))
return mb;
- } else if (QDesignerMenu *m = parentMenu()) {
+ if (QDesignerMenu *m = parentMenu())
return m->parentMenuBar();
- }
- return 0;
+ return nullptr;
}
void QDesignerMenu::setVisible(bool visible)
@@ -1129,13 +1128,6 @@ void QDesignerMenu::adjustSpecialActions()
addAction(m_addSeparator);
}
-bool QDesignerMenu::interactive(bool i)
-{
- const bool old = m_interactive;
- m_interactive = i;
- return old;
-}
-
void QDesignerMenu::enterEditMode()
{
if (m_currentIndex >= 0 && m_currentIndex <= realActionCount()) {
@@ -1152,7 +1144,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);
@@ -1171,14 +1163,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);
@@ -1192,7 +1184,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);
@@ -1217,7 +1209,7 @@ void QDesignerMenu::showLineEdit()
{
m_showSubMenuTimer->stop();
- QAction *action = 0;
+ QAction *action = nullptr;
if (m_currentIndex < realActionCount())
action = safeActionAt(m_currentIndex);
@@ -1298,7 +1290,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);
}
@@ -1315,7 +1307,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 e0a4a6267..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;
@@ -83,7 +83,6 @@ public:
void adjustSpecialActions();
- bool interactive(bool i);
void createRealMenuAction(QAction *action);
void removeRealMenu(QAction *action);
@@ -174,17 +173,16 @@ private:
const QPixmap m_subMenuPixmap;
QPoint m_startPosition;
- int m_currentIndex;
+ int m_currentIndex = 0;
QAction *m_addItem;
QAction *m_addSeparator;
QHash<QAction*, QDesignerMenu*> m_subMenus;
QTimer *m_showSubMenuTimer;
QTimer *m_deactivateWindowTimer;
QTimer *m_adjustSizeTimer;
- bool m_interactive;
QLineEdit *m_editor;
- bool m_dragging;
- int m_lastSubMenuIndex;
+ bool m_dragging = false;
+ int m_lastSubMenuIndex = -1;
friend class qdesigner_internal::CreateSubmenuCommand;
friend class qdesigner_internal::ActionInsertionCommand;
diff --git a/src/designer/src/lib/shared/qdesigner_menubar.cpp b/src/designer/src/lib/shared/qdesigner_menubar.cpp
index aab029e91..e212eff82 100644
--- a/src/designer/src/lib/shared/qdesigner_menubar.cpp
+++ b/src/designer/src/lib/shared/qdesigner_menubar.cpp
@@ -56,7 +56,7 @@ Q_DECLARE_METATYPE(QAction*)
QT_BEGIN_NAMESPACE
-typedef QList<QAction *> ActionList;
+using ActionList = QList<QAction *>;
using namespace qdesigner_internal;
@@ -78,11 +78,7 @@ SpecialMenuAction::~SpecialMenuAction() = default;
QDesignerMenuBar::QDesignerMenuBar(QWidget *parent) :
QMenuBar(parent),
m_addMenu(new SpecialMenuAction(this)),
- m_currentIndex(0),
- m_interactive(true),
m_editor(new QLineEdit(this)),
- m_dragging(false),
- m_lastMenuActionIndex( -1),
m_promotionTaskMenu(new PromotionTaskMenu(this, PromotionTaskMenu::ModeSingleWidget, this))
{
setContextMenuPolicy(Qt::DefaultContextMenu);
@@ -388,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);
}
@@ -400,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;
@@ -425,7 +421,7 @@ bool QDesignerMenuBar::handleContextMenuEvent(QWidget *, QContextMenuEvent *even
void QDesignerMenuBar::slotRemoveMenuBar()
{
- Q_ASSERT(formWindow() != 0);
+ Q_ASSERT(formWindow() != nullptr);
QDesignerFormWindowInterface *fw = formWindow();
@@ -456,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);
@@ -486,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);
@@ -571,7 +567,7 @@ void QDesignerMenuBar::adjustIndicator(const QPoint &pos)
{
const int index = findAction(pos);
QAction *action = safeActionAt(index);
- Q_ASSERT(action != 0);
+ Q_ASSERT(action != nullptr);
if (pos != QPoint(-1, -1)) {
QDesignerMenu *m = qobject_cast<QDesignerMenu*>(action->menu());
@@ -704,13 +700,13 @@ QDesignerActionProviderExtension *QDesignerMenuBar::actionProvider()
return qt_extension<QDesignerActionProviderExtension*>(core->extensionManager(), this);
}
- return 0;
+ return nullptr;
}
QAction *QDesignerMenuBar::currentAction() const
{
if (m_currentIndex < 0 || m_currentIndex >= actions().count())
- return 0;
+ return nullptr;
return safeActionAt(m_currentIndex);
}
@@ -780,13 +776,6 @@ void QDesignerMenuBar::adjustSpecialActions()
addAction(m_addMenu);
}
-bool QDesignerMenuBar::interactive(bool i)
-{
- const bool old = m_interactive;
- m_interactive = i;
- return old;
-}
-
void QDesignerMenuBar::hideMenu(int index)
{
if (index < 0 && m_currentIndex >= 0)
@@ -815,7 +804,7 @@ void QDesignerMenuBar::deleteMenuAction(QAction *action)
{
if (action && !qobject_cast<SpecialMenuAction*>(action)) {
const int pos = actions().indexOf(action);
- QAction *action_before = 0;
+ QAction *action_before = nullptr;
if (pos != -1)
action_before = safeActionAt(pos + 1);
@@ -870,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);
}
@@ -947,7 +936,7 @@ void QDesignerMenuBar::updateCurrentAction(bool selectAction)
if (!menu)
return;
- QDesignerObjectInspector *oi = 0;
+ QDesignerObjectInspector *oi = nullptr;
if (QDesignerFormWindowInterface *fw = formWindow())
oi = qobject_cast<QDesignerObjectInspector *>(fw->core()->objectInspector());
diff --git a/src/designer/src/lib/shared/qdesigner_menubar_p.h b/src/designer/src/lib/shared/qdesigner_menubar_p.h
index e171a94e0..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;
@@ -82,7 +82,6 @@ public:
QDesignerActionProviderExtension *actionProvider();
void adjustSpecialActions();
- bool interactive(bool i);
bool dragging() const;
void moveLeft(bool ctrl = false);
@@ -152,11 +151,10 @@ private:
QAction *m_addMenu;
QPointer<QMenu> m_activeMenu;
QPoint m_startPosition;
- int m_currentIndex;
- bool m_interactive;
+ int m_currentIndex = 0;
QLineEdit *m_editor;
- bool m_dragging;
- int m_lastMenuActionIndex;
+ bool m_dragging = false;
+ int m_lastMenuActionIndex = -1;
QPointer<QWidget> m_lastFocusWidget;
qdesigner_internal::PromotionTaskMenu* m_promotionTaskMenu;
};
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..2d8169960 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);
}
@@ -166,7 +166,7 @@ namespace qdesigner_internal {
QList<QDesignerWidgetDataBaseItemInterface *> QDesignerPromotion::promotionBaseClasses() const
{
- typedef QMap<QString, QDesignerWidgetDataBaseItemInterface *> SortedDatabaseItemMap;
+ using SortedDatabaseItemMap = QMap<QString, QDesignerWidgetDataBaseItemInterface *>;
SortedDatabaseItemMap sortedDatabaseItemMap;
QDesignerWidgetDataBaseInterface *widgetDataBase = m_core->widgetDataBase();
@@ -202,9 +202,9 @@ namespace qdesigner_internal {
QDesignerPromotion::PromotedClasses QDesignerPromotion::promotedClasses() const
{
- typedef QMap<QString, QDesignerWidgetDataBaseItemInterface *> ClassNameItemMap;
+ using ClassNameItemMap = QMap<QString, QDesignerWidgetDataBaseItemInterface *>;
// A map containing base classes and their promoted classes.
- typedef QMap<QString, ClassNameItemMap> BaseClassPromotedMap;
+ using BaseClassPromotedMap = QMap<QString, ClassNameItemMap>;
BaseClassPromotedMap baseClassPromotedMap;
diff --git a/src/designer/src/lib/shared/qdesigner_promotiondialog.cpp b/src/designer/src/lib/shared/qdesigner_promotiondialog.cpp
index 24e10fb70..7058b0c81 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();
@@ -288,7 +288,7 @@ namespace qdesigner_internal {
}
const QStringList &QDesignerPromotionDialog::baseClassNames(const QDesignerPromotionInterface *promotion) {
- typedef QList<QDesignerWidgetDataBaseItemInterface *> WidgetDataBaseItemList;
+ using WidgetDataBaseItemList = QList<QDesignerWidgetDataBaseItemInterface *>;
static QStringList rc;
if (rc.empty()) {
// Convert the item list into a string list.
@@ -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 7c2868c56..8b564ab6f 100644
--- a/src/designer/src/lib/shared/qdesigner_propertycommand.cpp
+++ b/src/designer/src/lib/shared/qdesigner_propertycommand.cpp
@@ -938,12 +938,6 @@ PropertyListCommand::PropertyDescription::PropertyDescription(const QString &pro
{
}
-PropertyListCommand::PropertyDescription::PropertyDescription() :
- m_propertyType(QVariant::Invalid),
- m_specialProperty(SP_None)
-{
-}
-
void PropertyListCommand::PropertyDescription::debug() const
{
qDebug() << m_propertyName << m_propertyGroup << m_propertyType << m_specialProperty;
@@ -984,7 +978,7 @@ bool PropertyListCommand::add(QObject *object, const QString &propertyName)
return false;
if (!sheet->isEnabled(index))
- return false;
+ return false;
const PropertyDescription description(propertyName, sheet, index);
@@ -1010,7 +1004,7 @@ PropertyHelper *PropertyListCommand::createPropertyHelper(QObject *object, Speci
}
// Init from a list and make sure referenceObject is added first to obtain the right property group
-bool PropertyListCommand::initList(const ObjectList &list, const QString &apropertyName, QObject *referenceObject)
+bool PropertyListCommand::initList(const QObjectList &list, const QString &apropertyName, QObject *referenceObject)
{
propertyHelperList().clear();
@@ -1120,7 +1114,7 @@ template <class PropertyListIterator, class Function>
// set a new value, return update mask
-unsigned PropertyListCommand::setValue(QVariant value, bool changed, unsigned subPropertyMask)
+unsigned PropertyListCommand::setValue(const QVariant &value, bool changed, unsigned subPropertyMask)
{
if(debugPropertyCommands)
qDebug() << "PropertyListCommand::setValue(" << value
@@ -1215,7 +1209,7 @@ bool SetPropertyCommand::init(QObject *object, const QString &apropertyName, con
return true;
}
-bool SetPropertyCommand::init(const ObjectList &list, const QString &apropertyName, const QVariant &newValue,
+bool SetPropertyCommand::init(const QObjectList &list, const QString &apropertyName, const QVariant &newValue,
QObject *referenceObject, bool enableSubPropertyHandling)
{
if (!initList(list, apropertyName, referenceObject))
@@ -1325,10 +1319,10 @@ bool ResetPropertyCommand::init(QObject *object, const QString &apropertyName)
return true;
}
-bool ResetPropertyCommand::init(const ObjectList &list, const QString &apropertyName, QObject *referenceObject)
+bool ResetPropertyCommand::init(const QObjectList &list, const QString &apropertyName, QObject *referenceObject)
{
- ObjectList modifiedList = list; // filter out modified properties
- for (ObjectList::iterator it = modifiedList.begin(); it != modifiedList.end() ; ) {
+ QObjectList modifiedList = list; // filter out modified properties
+ for (auto it = modifiedList.begin(); it != modifiedList.end() ; ) {
QDesignerPropertySheetExtension* sheet = propertySheet(*it);
Q_ASSERT(sheet);
const int index = sheet->indexOf(apropertyName);
@@ -1338,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 cc607ae91..2ee57ad2c 100644
--- a/src/designer/src/lib/shared/qdesigner_propertycommand_p.h
+++ b/src/designer/src/lib/shared/qdesigner_propertycommand_p.h
@@ -72,7 +72,7 @@ class QDESIGNER_SHARED_EXPORT PropertyHelper {
Q_DISABLE_COPY(PropertyHelper)
public:
// A pair of Value and changed flag
- typedef QPair<QVariant, bool> Value;
+ using Value = QPair<QVariant, bool>;
enum ObjectType {OT_Object, OT_FreeAction, OT_AssociatedAction, OT_Widget};
@@ -80,7 +80,7 @@ public:
SpecialProperty specialProperty,
QDesignerPropertySheetExtension *sheet,
int index);
- virtual ~PropertyHelper() {}
+ virtual ~PropertyHelper() = default;
QObject *object() const { return m_object; }
SpecialProperty specialProperty() const { return m_specialProperty; }
@@ -135,9 +135,7 @@ private:
class QDESIGNER_SHARED_EXPORT PropertyListCommand : public QDesignerFormWindowCommand {
public:
- typedef QList<QObject *> ObjectList;
-
- explicit PropertyListCommand(QDesignerFormWindowInterface *formWindow, QUndoCommand *parent = 0);
+ explicit PropertyListCommand(QDesignerFormWindowInterface *formWindow, QUndoCommand *parent = nullptr);
QObject* object(int index = 0) const;
@@ -146,20 +144,20 @@ public:
void setOldValue(const QVariant &oldValue, int index = 0);
// Calls restoreDefaultValue() and update()
- virtual void undo();
+ void undo() override;
protected:
- typedef QSharedPointer<PropertyHelper> PropertyHelperPtr;
- typedef QList<PropertyHelperPtr> PropertyHelperList;
+ using PropertyHelperPtr = QSharedPointer<PropertyHelper>;
+ using PropertyHelperList = QList<PropertyHelperPtr>;
// add an object
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 QObjectList &list, const QString &apropertyName, QObject *referenceObject = nullptr);
// set a new value, return update mask
- unsigned setValue(QVariant value, bool changed, unsigned subPropertyMask);
+ unsigned setValue(const QVariant &value, bool changed, unsigned subPropertyMask);
// restore old value, return update mask
unsigned restoreOldValue();
@@ -182,15 +180,15 @@ protected:
// properties of different widgets are equivalent
struct PropertyDescription {
public:
- PropertyDescription();
+ PropertyDescription() = default;
PropertyDescription(const QString &propertyName, QDesignerPropertySheetExtension *propertySheet, int index);
bool equals(const PropertyDescription &p) const;
void debug() const;
QString m_propertyName;
QString m_propertyGroup;
- QVariant::Type m_propertyType;
- SpecialProperty m_specialProperty;
+ QVariant::Type m_propertyType = QVariant::Invalid;
+ SpecialProperty m_specialProperty = SP_None;
};
const PropertyDescription &propertyDescription() const { return m_propertyDescription; }
@@ -207,13 +205,11 @@ class QDESIGNER_SHARED_EXPORT SetPropertyCommand: public PropertyListCommand
{
public:
- typedef QList<QObject *> ObjectList;
-
- explicit SetPropertyCommand(QDesignerFormWindowInterface *formWindow, QUndoCommand *parent = 0);
+ explicit SetPropertyCommand(QDesignerFormWindowInterface *formWindow, QUndoCommand *parent = nullptr);
bool init(QObject *object, const QString &propertyName, const QVariant &newValue);
- bool init(const ObjectList &list, const QString &propertyName, const QVariant &newValue,
- QObject *referenceObject = 0, bool enableSubPropertyHandling = true);
+ bool init(const QObjectList &list, const QString &propertyName, const QVariant &newValue,
+ QObject *referenceObject = nullptr, bool enableSubPropertyHandling = true);
inline QVariant newValue() const
@@ -222,10 +218,10 @@ public:
inline void setNewValue(const QVariant &newValue)
{ m_newValue = newValue; }
- int id() const;
- bool mergeWith(const QUndoCommand *other);
+ int id() const override;
+ bool mergeWith(const QUndoCommand *other) override;
- virtual void redo();
+ void redo() override;
protected:
virtual QVariant mergeValue(const QVariant &newValue);
@@ -241,12 +237,10 @@ class QDESIGNER_SHARED_EXPORT ResetPropertyCommand: public PropertyListCommand
{
public:
- typedef QList<QObject *> ObjectList;
-
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 QObjectList &list, const QString &propertyName, QObject *referenceObject = nullptr);
virtual void redo();
diff --git a/src/designer/src/lib/shared/qdesigner_propertyeditor.cpp b/src/designer/src/lib/shared/qdesigner_propertyeditor.cpp
index e3806ba96..3a26553fd 100644
--- a/src/designer/src/lib/shared/qdesigner_propertyeditor.cpp
+++ b/src/designer/src/lib/shared/qdesigner_propertyeditor.cpp
@@ -41,9 +41,9 @@
QT_BEGIN_NAMESPACE
namespace qdesigner_internal {
-typedef QDesignerPropertyEditor::StringPropertyParameters StringPropertyParameters;
+using StringPropertyParameters = QDesignerPropertyEditor::StringPropertyParameters;
// A map of property name to type
-typedef QHash<QString, StringPropertyParameters> PropertyNameTypeMap;
+using PropertyNameTypeMap = QHash<QString, StringPropertyParameters>;
// Compile a map of hard-coded string property types
static const PropertyNameTypeMap &stringPropertyTypes()
@@ -82,8 +82,7 @@ static const PropertyNameTypeMap &stringPropertyTypes()
}
QDesignerPropertyEditor::QDesignerPropertyEditor(QWidget *parent, Qt::WindowFlags flags) :
- QDesignerPropertyEditorInterface(parent, flags),
- m_propertyChangedForwardingBlocked(false)
+ QDesignerPropertyEditorInterface(parent, flags)
{
// Make old signal work for compatibility
connect(this, &QDesignerPropertyEditorInterface::propertyChanged,
diff --git a/src/designer/src/lib/shared/qdesigner_propertyeditor_p.h b/src/designer/src/lib/shared/qdesigner_propertyeditor_p.h
index 7d98e2c86..dbb116f65 100644
--- a/src/designer/src/lib/shared/qdesigner_propertyeditor_p.h
+++ b/src/designer/src/lib/shared/qdesigner_propertyeditor_p.h
@@ -56,10 +56,10 @@ class QDESIGNER_SHARED_EXPORT QDesignerPropertyEditor: public QDesignerPropertyE
{
Q_OBJECT
public:
- explicit QDesignerPropertyEditor(QWidget *parent = 0, Qt::WindowFlags flags = 0);
+ explicit QDesignerPropertyEditor(QWidget *parent = nullptr, Qt::WindowFlags flags = nullptr);
// A pair <ValidationMode, bool isTranslatable>.
- typedef QPair<TextPropertyValidationMode, bool> StringPropertyParameters;
+ using StringPropertyParameters = QPair<TextPropertyValidationMode, bool>;
// Return a pair of validation mode and flag indicating whether property is translatable
// for textual properties.
@@ -88,7 +88,7 @@ protected:
void emitPropertyValueChanged(const QString &name, const QVariant &value, bool enableSubPropertyHandling);
private:
- bool m_propertyChangedForwardingBlocked;
+ bool m_propertyChangedForwardingBlocked = false;
};
diff --git a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp
index ae00b5642..eafc0de4f 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)
@@ -127,8 +127,8 @@ static bool hasLayoutAttributes(QDesignerFormEditorInterface *core, QObject *obj
// Cache DesignerMetaEnum by scope/name of a QMetaEnum
static const qdesigner_internal::DesignerMetaEnum &designerMetaEnumFor(const QDesignerMetaEnumInterface *me)
{
- typedef QPair<QString, QString> ScopeNameKey;
- typedef QMap<ScopeNameKey, qdesigner_internal::DesignerMetaEnum> DesignerMetaEnumCache;
+ using ScopeNameKey = QPair<QString, QString>;
+ using DesignerMetaEnumCache = QMap<ScopeNameKey, qdesigner_internal::DesignerMetaEnum>;
static DesignerMetaEnumCache cache;
const QString name = me->name();
@@ -149,8 +149,8 @@ static const qdesigner_internal::DesignerMetaEnum &designerMetaEnumFor(const QDe
// Cache DesignerMetaFlags by scope/name of a QMetaEnum
static const qdesigner_internal::DesignerMetaFlags &designerMetaFlagsFor(const QDesignerMetaEnumInterface *me)
{
- typedef QPair<QString, QString> ScopeNameKey;
- typedef QMap<ScopeNameKey, qdesigner_internal::DesignerMetaFlags> DesignerMetaFlagsCache;
+ using ScopeNameKey = QPair<QString, QString>;
+ using DesignerMetaFlagsCache = QMap<ScopeNameKey, qdesigner_internal::DesignerMetaFlags>;
static DesignerMetaFlagsCache cache;
const QString name = me->name();
@@ -171,8 +171,8 @@ static const qdesigner_internal::DesignerMetaFlags &designerMetaFlagsFor(const Q
// ------------ QDesignerMemberSheetPrivate
class QDesignerPropertySheetPrivate {
public:
- typedef QDesignerPropertySheet::PropertyType PropertyType;
- typedef QDesignerPropertySheet::ObjectType ObjectType;
+ using PropertyType = QDesignerPropertySheet::PropertyType;
+ using ObjectType = QDesignerPropertySheet::ObjectType;
explicit QDesignerPropertySheetPrivate(QDesignerPropertySheet *sheetPublic, QObject *object, QObject *sheetParent);
@@ -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;
@@ -209,16 +209,16 @@ public:
enum PropertyKind { NormalProperty, FakeProperty, DynamicProperty, DefaultDynamicProperty };
class Info {
public:
- Info();
+ Info() = default;
QString group;
QVariant defaultValue;
- bool changed;
- bool visible;
- bool attribute;
- bool reset;
- PropertyType propertyType;
- PropertyKind kind;
+ bool changed = false;
+ bool visible = true;
+ bool attribute = false;
+ bool reset = true;
+ PropertyType propertyType = QDesignerPropertySheet::PropertyNone;
+ PropertyKind kind = NormalProperty;
};
Info &ensureInfo(int index);
@@ -228,7 +228,7 @@ public:
const QDesignerMetaObjectInterface *m_meta;
const ObjectType m_objectType;
- typedef QHash<int, Info> InfoHash;
+ using InfoHash = QHash<int, Info>;
InfoHash m_info;
QHash<int, QVariant> m_fakeProperties;
QHash<int, QVariant> m_addProperties;
@@ -383,16 +383,6 @@ void QDesignerPropertySheetPrivate::setKeySequenceProperty(int index, const qdes
m_keySequenceProperties[index] = value;
}
-QDesignerPropertySheetPrivate::Info::Info() :
- changed(false),
- visible(true),
- attribute(false),
- reset(true),
- propertyType(QDesignerPropertySheet::PropertyNone),
- kind(NormalProperty)
-{
-}
-
QDesignerPropertySheetPrivate::QDesignerPropertySheetPrivate(QDesignerPropertySheet *sheetPublic, QObject *object, QObject *sheetParent) :
q(sheetPublic),
m_core(formEditorForObject(sheetParent)),
@@ -400,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)
{
}
@@ -428,23 +418,23 @@ QLayout* QDesignerPropertySheetPrivate::layout(QDesignerPropertySheetExtension *
// only if it is managed by designer and not one created on a custom widget.
// (attempt to cache the value as this requires some hoops).
if (layoutPropertySheet)
- *layoutPropertySheet = 0;
+ *layoutPropertySheet = nullptr;
if (!m_object->isWidgetType() || !m_canHaveLayoutAttributes)
- return 0;
+ return nullptr;
QWidget *widget = qobject_cast<QWidget*>(m_object);
QLayout *widgetLayout = qdesigner_internal::LayoutInfo::internalLayout(widget);
if (!widgetLayout) {
- m_lastLayout = 0;
- m_lastLayoutPropertySheet = 0;
- return 0;
+ m_lastLayout = nullptr;
+ m_lastLayoutPropertySheet = nullptr;
+ return nullptr;
}
// Smart logic to avoid retrieving the meta DB from the widget every time.
if (widgetLayout != m_lastLayout) {
m_lastLayout = widgetLayout;
m_LastLayoutByDesigner = false;
- m_lastLayoutPropertySheet = 0;
+ m_lastLayoutPropertySheet = nullptr;
// Is this a layout managed by designer or some layout on a custom widget?
if (qdesigner_internal::LayoutInfo::managedLayout(m_core ,widgetLayout)) {
m_LastLayoutByDesigner = true;
@@ -452,7 +442,7 @@ QLayout* QDesignerPropertySheetPrivate::layout(QDesignerPropertySheetExtension *
}
}
if (!m_LastLayoutByDesigner)
- return 0;
+ return nullptr;
if (layoutPropertySheet)
*layoutPropertySheet = m_lastLayoutPropertySheet;
@@ -478,7 +468,7 @@ QDesignerPropertySheet::PropertyType QDesignerPropertySheetPrivate::propertyType
QString QDesignerPropertySheetPrivate::transformLayoutPropertyName(int index) const
{
- typedef QMap<QDesignerPropertySheet::PropertyType, QString> TypeNameMap;
+ using TypeNameMap = QMap<QDesignerPropertySheet::PropertyType, QString>;
static TypeNameMap typeNameMap;
if (typeNameMap.empty()) {
typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutObjectName, QStringLiteral("objectName"));
@@ -570,13 +560,13 @@ QDesignerPropertySheet::QDesignerPropertySheet(QObject *object, QObject *parent)
QObject(parent),
d(new QDesignerPropertySheetPrivate(this, object, parent))
{
- typedef QDesignerPropertySheetPrivate::Info Info;
+ using Info = QDesignerPropertySheetPrivate::Info;
const QDesignerMetaObjectInterface *baseMeta = d->m_meta;
while (baseMeta &&baseMeta->className().startsWith(QStringLiteral("QDesigner"))) {
baseMeta = baseMeta->superClass();
}
- Q_ASSERT(baseMeta != 0);
+ Q_ASSERT(baseMeta != nullptr);
QDesignerFormWindowInterface *formWindow = QDesignerFormWindowInterface::findFormWindow(d->m_object);
d->m_fwb = qobject_cast<qdesigner_internal::FormWindowBase *>(formWindow);
@@ -684,7 +674,7 @@ QDesignerPropertySheet::QDesignerPropertySheet(QObject *object, QObject *parent)
createFakeProperty(QStringLiteral("floating"));
}
- typedef QList<QByteArray> ByteArrayList;
+ using ByteArrayList = QList<QByteArray>;
const ByteArrayList names = object->dynamicPropertyNames();
if (!names.empty()) {
const ByteArrayList::const_iterator cend = names.constEnd();
@@ -732,7 +722,7 @@ bool QDesignerPropertySheet::canAddDynamicProperty(const QString &propName) cons
int QDesignerPropertySheet::addDynamicProperty(const QString &propName, const QVariant &value)
{
- typedef QDesignerPropertySheetPrivate::Info Info;
+ using Info = QDesignerPropertySheetPrivate::Info;
if (!value.isValid())
return -1; // property has invalid type
if (!canAddDynamicProperty(propName))
@@ -893,7 +883,7 @@ void QDesignerPropertySheet::setIconCache(qdesigner_internal::DesignerIconCache
int QDesignerPropertySheet::createFakeProperty(const QString &propertyName, const QVariant &value)
{
- typedef QDesignerPropertySheetPrivate::Info Info;
+ using Info = QDesignerPropertySheetPrivate::Info;
// fake properties
const int index = d->m_meta->indexOfProperty(propertyName);
if (index != -1) {
@@ -1269,7 +1259,8 @@ bool QDesignerPropertySheet::reset(int index)
if (d->isResourceProperty(index)) {
setProperty(index, d->emptyResourceProperty(index));
return true;
- } else if (isDynamic(index)) {
+ }
+ if (isDynamic(index)) {
const QString propName = propertyName(index);
const QVariant oldValue = d->m_addProperties.value(index);
const QVariant defaultValue = d->m_info.value(index).defaultValue;
@@ -1622,7 +1613,7 @@ struct QDesignerAbstractPropertySheetFactory::PropertySheetFactoryPrivate {
const QString m_propertySheetId;
const QString m_dynamicPropertySheetId;
- typedef QMap<QObject*, QObject*> ExtensionMap;
+ using ExtensionMap = QMap<QObject*, QObject*>;
ExtensionMap m_extensions;
};
@@ -1649,10 +1640,10 @@ QDesignerAbstractPropertySheetFactory::~QDesignerAbstractPropertySheetFactory()
QObject *QDesignerAbstractPropertySheetFactory::extension(QObject *object, const QString &iid) const
{
if (!object)
- return 0;
+ return nullptr;
if (iid != m_impl->m_propertySheetId && iid != m_impl->m_dynamicPropertySheetId)
- return 0;
+ return nullptr;
QObject *ext = m_impl->m_extensions.value(object, 0);
if (!ext && (ext = createPropertySheet(object, const_cast<QDesignerAbstractPropertySheetFactory*>(this)))) {
@@ -1666,16 +1657,16 @@ QObject *QDesignerAbstractPropertySheetFactory::extension(QObject *object, const
void QDesignerAbstractPropertySheetFactory::objectDestroyed(QObject *object)
{
- QMutableMapIterator<QObject*, QObject*> it(m_impl->m_extensions);
- while (it.hasNext()) {
- it.next();
+ for (auto it = m_impl->m_extensions.begin(), end = m_impl->m_extensions.end(); it != end; /*erasing*/) {
if (it.key() == object || it.value() == object) {
if (it.key() == object) {
QObject *ext = it.value();
disconnect(ext, &QObject::destroyed, this, &QDesignerAbstractPropertySheetFactory::objectDestroyed);
delete ext;
}
- it.remove();
+ it = m_impl->m_extensions.erase(it);
+ } else {
+ ++it;
}
}
}
diff --git a/src/designer/src/lib/shared/qdesigner_propertysheet_p.h b/src/designer/src/lib/shared/qdesigner_propertysheet_p.h
index b7c2113a4..4da33b525 100644
--- a/src/designer/src/lib/shared/qdesigner_propertysheet_p.h
+++ b/src/designer/src/lib/shared/qdesigner_propertysheet_p.h
@@ -69,7 +69,7 @@ class QDESIGNER_SHARED_EXPORT QDesignerPropertySheet: public QObject, public QDe
Q_OBJECT
Q_INTERFACES(QDesignerPropertySheetExtension QDesignerDynamicPropertySheetExtension)
public:
- explicit QDesignerPropertySheet(QObject *object, QObject *parent = 0);
+ explicit QDesignerPropertySheet(QObject *object, QObject *parent = nullptr);
~QDesignerPropertySheet() override;
int indexOf(const QString &name) const override;
@@ -190,7 +190,7 @@ class QDESIGNER_SHARED_EXPORT QDesignerAbstractPropertySheetFactory: public QExt
Q_OBJECT
Q_INTERFACES(QAbstractExtensionFactory)
public:
- explicit QDesignerAbstractPropertySheetFactory(QExtensionManager *parent = 0);
+ explicit QDesignerAbstractPropertySheetFactory(QExtensionManager *parent = nullptr);
~QDesignerAbstractPropertySheetFactory() override;
QObject *extension(QObject *object, const QString &iid) const override;
@@ -212,7 +212,7 @@ private:
template <class Object, class PropertySheet>
class QDesignerPropertySheetFactory : public QDesignerAbstractPropertySheetFactory {
public:
- explicit QDesignerPropertySheetFactory(QExtensionManager *parent = 0);
+ explicit QDesignerPropertySheetFactory(QExtensionManager *parent = nullptr);
static void registerExtension(QExtensionManager *mgr);
@@ -232,7 +232,7 @@ QObject *QDesignerPropertySheetFactory<Object, PropertySheet>::createPropertyShe
{
Object *object = qobject_cast<Object *>(qObject);
if (!object)
- return 0;
+ return nullptr;
return new PropertySheet(object, parent);
}
diff --git a/src/designer/src/lib/shared/qdesigner_stackedbox.cpp b/src/designer/src/lib/shared/qdesigner_stackedbox.cpp
index e132a23ec..a85df2693 100644
--- a/src/designer/src/lib/shared/qdesigner_stackedbox.cpp
+++ b/src/designer/src/lib/shared/qdesigner_stackedbox.cpp
@@ -187,7 +187,7 @@ QStackedWidgetEventFilter::QStackedWidgetEventFilter(QStackedWidget *parent) :
m_actionInsertPage(new QAction(tr("Before Current Page"), this)),
m_actionInsertPageAfter(new QAction(tr("After Current Page"), this)),
m_actionChangePageOrder(new QAction(tr("Change Page Order..."), this)),
- m_pagePromotionTaskMenu(new qdesigner_internal::PromotionTaskMenu(0, qdesigner_internal::PromotionTaskMenu::ModeSingleWidget, this))
+ m_pagePromotionTaskMenu(new qdesigner_internal::PromotionTaskMenu(nullptr, qdesigner_internal::PromotionTaskMenu::ModeSingleWidget, this))
{
setButtonToolTipEnabled(true);
connect(m_actionPreviousPage, &QAction::triggered, this, &QStackedWidgetEventFilter::prevPage);
@@ -211,14 +211,14 @@ QStackedWidgetEventFilter *QStackedWidgetEventFilter::eventFilterOf(const QStack
if (QStackedWidgetEventFilter *ef = qobject_cast<QStackedWidgetEventFilter *>(o))
return ef;
}
- return 0;
+ return nullptr;
}
QMenu *QStackedWidgetEventFilter::addStackedWidgetContextMenuActions(const QStackedWidget *stackedWidget, QMenu *popup)
{
QStackedWidgetEventFilter *filter = eventFilterOf(stackedWidget);
if (!filter)
- return 0;
+ return nullptr;
return filter->addContextMenuActions(popup);
}
@@ -299,7 +299,7 @@ void QStackedWidgetEventFilter::gotoPage(int page) {
QMenu *QStackedWidgetEventFilter::addContextMenuActions(QMenu *popup)
{
- QMenu *pageMenu = 0;
+ QMenu *pageMenu = nullptr;
const int count = stackedWidget()->count();
const bool hasSeveralPages = count > 1;
m_actionDeletePage->setEnabled(count);
@@ -346,7 +346,7 @@ bool QStackedWidgetPropertySheet::isEnabled(int index) const
{
if (propertyName(index) != QLatin1String(pagePropertyName))
return QDesignerPropertySheet::isEnabled(index);
- return m_stackedWidget->currentWidget() != 0;
+ return m_stackedWidget->currentWidget() != nullptr;
}
void QStackedWidgetPropertySheet::setProperty(int index, const QVariant &value)
diff --git a/src/designer/src/lib/shared/qdesigner_stackedbox_p.h b/src/designer/src/lib/shared/qdesigner_stackedbox_p.h
index 22d4cffdf..36b876d78 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;
@@ -144,7 +144,7 @@ private:
QStackedWidget *m_stackedWidget;
};
-typedef QDesignerPropertySheetFactory<QStackedWidget, QStackedWidgetPropertySheet> QStackedWidgetPropertySheetFactory;
+using QStackedWidgetPropertySheetFactory = QDesignerPropertySheetFactory<QStackedWidget, QStackedWidgetPropertySheet>;
QT_END_NAMESPACE
diff --git a/src/designer/src/lib/shared/qdesigner_tabwidget.cpp b/src/designer/src/lib/shared/qdesigner_tabwidget.cpp
index ea4577e47..2f003cf6c 100644
--- a/src/designer/src/lib/shared/qdesigner_tabwidget.cpp
+++ b/src/designer/src/lib/shared/qdesigner_tabwidget.cpp
@@ -72,13 +72,13 @@ private:
QTabWidgetEventFilter::QTabWidgetEventFilter(QTabWidget *parent) :
QObject(parent),
m_tabWidget(parent),
- m_dropIndicator(0),
- m_dragPage(0),
+ m_dropIndicator(nullptr),
+ m_dragPage(nullptr),
m_mousePressed(false),
m_actionDeletePage(new QAction(tr("Delete"), this)),
m_actionInsertPage(new QAction(tr("Before Current Page"), this)),
m_actionInsertPageAfter(new QAction(tr("After Current Page"), this)),
- m_pagePromotionTaskMenu(new qdesigner_internal::PromotionTaskMenu(0, qdesigner_internal::PromotionTaskMenu::ModeSingleWidget, this))
+ m_pagePromotionTaskMenu(new qdesigner_internal::PromotionTaskMenu(nullptr, qdesigner_internal::PromotionTaskMenu::ModeSingleWidget, this))
{
tabBar()->setAcceptDrops(true);
tabBar()->installEventFilter(this);
@@ -103,14 +103,14 @@ QTabWidgetEventFilter *QTabWidgetEventFilter::eventFilterOf(const QTabWidget *ta
if (QTabWidgetEventFilter *ef = qobject_cast<QTabWidgetEventFilter*>(o))
return ef;
}
- return 0;
+ return nullptr;
}
QMenu *QTabWidgetEventFilter::addTabWidgetContextMenuActions(const QTabWidget *tabWidget, QMenu *popup)
{
QTabWidgetEventFilter *filter = eventFilterOf(tabWidget);
if (!filter)
- return 0;
+ return nullptr;
return filter->addContextMenuActions(popup);
}
@@ -352,7 +352,7 @@ int QTabWidgetEventFilter::pageFromPosition(const QPoint &pos, QRect &rect) cons
QMenu *QTabWidgetEventFilter::addContextMenuActions(QMenu *popup)
{
- QMenu *pageMenu = 0;
+ QMenu *pageMenu = nullptr;
const int count = m_tabWidget->count();
m_actionDeletePage->setEnabled(count);
if (count) {
@@ -404,7 +404,7 @@ QTabWidgetPropertySheet::QTabWidgetPropertySheet(QTabWidget *object, QObject *pa
QTabWidgetPropertySheet::TabWidgetProperty QTabWidgetPropertySheet::tabWidgetPropertyFromName(const QString &name)
{
- typedef QHash<QString, TabWidgetProperty> TabWidgetPropertyHash;
+ using TabWidgetPropertyHash = QHash<QString, TabWidgetProperty>;
static TabWidgetPropertyHash tabWidgetPropertyHash;
if (tabWidgetPropertyHash.empty()) {
tabWidgetPropertyHash.insert(QLatin1String(currentTabTextKey), PropertyCurrentTabText);
diff --git a/src/designer/src/lib/shared/qdesigner_tabwidget_p.h b/src/designer/src/lib/shared/qdesigner_tabwidget_p.h
index ab431fb60..1a488fe69 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;
@@ -133,7 +133,7 @@ private:
QMap<QWidget *, PageData> m_pageToData;
};
-typedef QDesignerPropertySheetFactory<QTabWidget, QTabWidgetPropertySheet> QTabWidgetPropertySheetFactory;
+using QTabWidgetPropertySheetFactory = QDesignerPropertySheetFactory<QTabWidget, QTabWidgetPropertySheet>;
QT_END_NAMESPACE
diff --git a/src/designer/src/lib/shared/qdesigner_taskmenu.cpp b/src/designer/src/lib/shared/qdesigner_taskmenu.cpp
index b81979062..f1783587f 100644
--- a/src/designer/src/lib/shared/qdesigner_taskmenu.cpp
+++ b/src/designer/src/lib/shared/qdesigner_taskmenu.cpp
@@ -84,7 +84,7 @@ static inline QAction *createSeparatorHelper(QObject *parent) {
static QString objName(const QDesignerFormEditorInterface *core, QObject *object) {
QDesignerPropertySheetExtension *sheet
= qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), object);
- Q_ASSERT(sheet != 0);
+ Q_ASSERT(sheet != nullptr);
const QString objectNameProperty = QStringLiteral("objectName");
const int index = sheet->indexOf(objectNameProperty);
@@ -170,7 +170,7 @@ private:
QAction *LayoutAlignmentMenu::createAction(const QString &text, int data, QMenu *menu, QActionGroup *ag)
{
- QAction * a = new QAction(text, 0);
+ QAction * a = new QAction(text, nullptr);
a->setCheckable(true);
a->setData(QVariant(data));
menu->addAction(a);
@@ -250,7 +250,7 @@ bool LayoutAlignmentMenu::setAlignment(const QDesignerFormEditorInterface *core,
Qt::Alignment LayoutAlignmentMenu::alignment() const
{
- Qt::Alignment alignment = 0;
+ Qt::Alignment alignment = nullptr;
if (const QAction *horizAction = m_horizGroup->checkedAction())
if (const int horizAlign = horizAction->data().toInt())
alignment |= static_cast<Qt::Alignment>(horizAlign);
@@ -283,6 +283,7 @@ public:
QAction *m_addMenuBar;
QAction *m_addToolBar;
+ QAction *m_addAreaSubMenu;
QAction *m_addStatusBar;
QAction *m_removeStatusBar;
QAction *m_containerFakeMethods;
@@ -294,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)),
@@ -311,6 +312,7 @@ QDesignerTaskMenuPrivate::QDesignerTaskMenuPrivate(QWidget *widget, QObject *par
m_formLayoutMenu(new FormLayoutMenu(parent)),
m_addMenuBar(new QAction(QDesignerTaskMenu::tr("Create Menu Bar"), parent)),
m_addToolBar(new QAction(QDesignerTaskMenu::tr("Add Tool Bar"), parent)),
+ m_addAreaSubMenu(new QAction(QDesignerTaskMenu::tr("Add Tool Bar to Other Area"), parent)),
m_addStatusBar(new QAction(QDesignerTaskMenu::tr("Create Status Bar"), parent)),
m_removeStatusBar(new QAction(QDesignerTaskMenu::tr("Remove Status Bar"), parent)),
m_containerFakeMethods(new QAction(QDesignerTaskMenu::tr("Change signals/slots..."), parent)),
@@ -362,7 +364,16 @@ QDesignerTaskMenu::QDesignerTaskMenu(QWidget *widget, QObject *parent) :
connect(d->m_changeWhatsThis, &QAction::triggered, this, &QDesignerTaskMenu::changeWhatsThis);
connect(d->m_changeStyleSheet, &QAction::triggered, this, &QDesignerTaskMenu::changeStyleSheet);
connect(d->m_addMenuBar, &QAction::triggered, this, &QDesignerTaskMenu::createMenuBar);
- connect(d->m_addToolBar, &QAction::triggered, this, &QDesignerTaskMenu::addToolBar);
+ connect(d->m_addToolBar, &QAction::triggered, this,
+ [this] () { this->addToolBar(Qt::TopToolBarArea); });
+ auto areaMenu = new QMenu;
+ d->m_addAreaSubMenu->setMenu(areaMenu);
+ areaMenu->addAction(QDesignerTaskMenu::tr("Left"),
+ [this] () { this->addToolBar(Qt::LeftToolBarArea); });
+ areaMenu->addAction(QDesignerTaskMenu::tr("Right"),
+ [this] () { this->addToolBar(Qt::RightToolBarArea); });
+ areaMenu->addAction(QDesignerTaskMenu::tr("Bottom"),
+ [this] () { this->addToolBar(Qt::BottomToolBarArea); });
connect(d->m_addStatusBar, &QAction::triggered, this, &QDesignerTaskMenu::createStatusBar);
connect(d->m_removeStatusBar, &QAction::triggered, this, &QDesignerTaskMenu::removeStatusBar);
connect(d->m_containerFakeMethods, &QAction::triggered, this, &QDesignerTaskMenu::containerFakeMethods);
@@ -389,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;
}
@@ -408,7 +419,7 @@ void QDesignerTaskMenu::createMenuBar()
}
}
-void QDesignerTaskMenu::addToolBar()
+void QDesignerTaskMenu::addToolBar(Qt::ToolBarArea area)
{
if (QDesignerFormWindowInterface *fw = formWindow()) {
QMainWindow *mw = qobject_cast<QMainWindow*>(fw->mainContainer());
@@ -418,7 +429,7 @@ void QDesignerTaskMenu::addToolBar()
}
AddToolBarCommand *cmd = new AddToolBarCommand(fw);
- cmd->init(mw);
+ cmd->init(mw, area);
fw->commandHistory()->push(cmd);
}
}
@@ -468,6 +479,7 @@ QList<QAction*> QDesignerTaskMenu::taskActions() const
actions.append(d->m_addMenuBar);
actions.append(d->m_addToolBar);
+ actions.append(d->m_addAreaSubMenu);
// ### create the status bar
if (mw->findChild<QStatusBar *>(QString(), Qt::FindDirectChildrenOnly))
actions.append(d->m_removeStatusBar);
@@ -509,7 +521,7 @@ QList<QAction*> QDesignerTaskMenu::taskActions() const
void QDesignerTaskMenu::changeObjectName()
{
QDesignerFormWindowInterface *fw = formWindow();
- Q_ASSERT(fw != 0);
+ Q_ASSERT(fw != nullptr);
const QString oldObjectName = objName(fw->core(), widget());
@@ -530,7 +542,7 @@ void QDesignerTaskMenu::changeTextProperty(const QString &propertyName, const QS
QDesignerFormWindowInterface *fw = formWindow();
if (!fw)
return;
- Q_ASSERT(d->m_widget->parentWidget() != 0);
+ Q_ASSERT(d->m_widget->parentWidget() != nullptr);
const QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(fw->core()->extensionManager(), d->m_widget);
const int index = sheet->indexOf(propertyName);
@@ -668,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_taskmenu_p.h b/src/designer/src/lib/shared/qdesigner_taskmenu_p.h
index 7d43d6495..b4bc23da4 100644
--- a/src/designer/src/lib/shared/qdesigner_taskmenu_p.h
+++ b/src/designer/src/lib/shared/qdesigner_taskmenu_p.h
@@ -97,7 +97,7 @@ private slots:
void changeWhatsThis();
void changeStyleSheet();
void createMenuBar();
- void addToolBar();
+ void addToolBar(Qt::ToolBarArea area);
void createStatusBar();
void removeStatusBar();
void containerFakeMethods();
@@ -109,7 +109,7 @@ private:
QDesignerTaskMenuPrivate *d;
};
-typedef ExtensionFactory<QDesignerTaskMenuExtension, QWidget, QDesignerTaskMenu> QDesignerTaskMenuFactory;
+using QDesignerTaskMenuFactory = ExtensionFactory<QDesignerTaskMenuExtension, QWidget, QDesignerTaskMenu>;
} // namespace qdesigner_internal
diff --git a/src/designer/src/lib/shared/qdesigner_toolbar.cpp b/src/designer/src/lib/shared/qdesigner_toolbar.cpp
index c686c8fb1..28c2ca285 100644
--- a/src/designer/src/lib/shared/qdesigner_toolbar.cpp
+++ b/src/designer/src/lib/shared/qdesigner_toolbar.cpp
@@ -55,7 +55,7 @@ Q_DECLARE_METATYPE(QAction*)
QT_BEGIN_NAMESPACE
-typedef QList<QAction*> ActionList;
+using ActionList = QList<QAction *>;
namespace qdesigner_internal {
// ------------------- ToolBarEventFilter
@@ -69,7 +69,7 @@ void ToolBarEventFilter::install(QToolBar *tb)
ToolBarEventFilter::ToolBarEventFilter(QToolBar *tb) :
QObject(tb),
m_toolBar(tb),
- m_promotionTaskMenu(0)
+ m_promotionTaskMenu(nullptr)
{
}
@@ -81,7 +81,7 @@ ToolBarEventFilter *ToolBarEventFilter::eventFilterOf(const QToolBar *tb)
if (ToolBarEventFilter *ef = qobject_cast<ToolBarEventFilter *>(o))
return ef;
}
- return 0;
+ return nullptr;
}
bool ToolBarEventFilter::eventFilter (QObject *watched, QEvent *event)
@@ -130,7 +130,7 @@ ActionList ToolBarEventFilter::contextMenuActions(const QPoint &globalPos)
// Insert before
if (action && index != 0 && !action->isSeparator()) {
- QAction *newSeperatorAct = new QAction(tr("Insert Separator before '%1'").arg(action->objectName()), 0);
+ QAction *newSeperatorAct = new QAction(tr("Insert Separator before '%1'").arg(action->objectName()), nullptr);
itemData.setValue(action);
newSeperatorAct->setData(itemData);
connect(newSeperatorAct, &QAction::triggered, this, &ToolBarEventFilter::slotInsertSeparator);
@@ -139,8 +139,8 @@ ActionList ToolBarEventFilter::contextMenuActions(const QPoint &globalPos)
// Append separator
if (actions.empty() || !actions.back()->isSeparator()) {
- QAction *newSeperatorAct = new QAction(tr("Append Separator"), 0);
- itemData.setValue(static_cast<QAction*>(0));
+ QAction *newSeperatorAct = new QAction(tr("Append Separator"), nullptr);
+ itemData.setValue(static_cast<QAction*>(nullptr));
newSeperatorAct->setData(itemData);
connect(newSeperatorAct, &QAction::triggered, this, &ToolBarEventFilter::slotInsertSeparator);
rc.push_back(newSeperatorAct);
@@ -151,14 +151,14 @@ ActionList ToolBarEventFilter::contextMenuActions(const QPoint &globalPos)
m_promotionTaskMenu->addActions(formWindow(), PromotionTaskMenu::LeadingSeparator|PromotionTaskMenu::TrailingSeparator, rc);
// Remove
if (action) {
- QAction *a = new QAction(tr("Remove action '%1'").arg(action->objectName()), 0);
+ QAction *a = new QAction(tr("Remove action '%1'").arg(action->objectName()), nullptr);
itemData.setValue(action);
a->setData(itemData);
connect(a, &QAction::triggered, this, &ToolBarEventFilter::slotRemoveSelectedAction);
rc.push_back(a);
}
- QAction *remove_toolbar = new QAction(tr("Remove Toolbar '%1'").arg(m_toolBar->objectName()), 0);
+ QAction *remove_toolbar = new QAction(tr("Remove Toolbar '%1'").arg(m_toolBar->objectName()), nullptr);
connect(remove_toolbar, &QAction::triggered, this, &ToolBarEventFilter::slotRemoveToolBar);
rc.push_back(remove_toolbar);
return rc;
@@ -171,7 +171,7 @@ bool ToolBarEventFilter::handleContextMenuEvent(QContextMenuEvent * event )
const QPoint globalPos = event->globalPos();
const ActionList al = contextMenuActions(event->globalPos());
- QMenu menu(0);
+ QMenu menu(nullptr);
const ActionList::const_iterator acend = al.constEnd();
for (ActionList::const_iterator it = al.constBegin(); it != acend; ++it)
menu.addAction(*it);
@@ -186,14 +186,14 @@ void ToolBarEventFilter::slotRemoveSelectedAction()
return;
QAction *a = qvariant_cast<QAction*>(action->data());
- Q_ASSERT(a != 0);
+ Q_ASSERT(a != nullptr);
QDesignerFormWindowInterface *fw = formWindow();
Q_ASSERT(fw);
const ActionList actions = m_toolBar->actions();
const int pos = actions.indexOf(a);
- QAction *action_before = 0;
+ QAction *action_before = nullptr;
if (pos != -1 && actions.count() > pos + 1)
action_before = actions.at(pos + 1);
@@ -358,7 +358,7 @@ bool ToolBarEventFilter::handleDropEvent(QDropEvent *event)
}
// Try to find action to 'insert before'. Click on action or in free area, else ignore.
- QAction *beforeAction = 0;
+ QAction *beforeAction = nullptr;
const QPoint pos = event->pos();
const int index = actionIndexAt(m_toolBar, pos, m_toolBar->orientation());
if (index != -1) {
@@ -407,7 +407,7 @@ void ToolBarEventFilter::startDrag(const QPoint &pos, Qt::KeyboardModifiers modi
hideDragIndicator();
if (dropAction == Qt::MoveAction) {
const ActionList currentActions = m_toolBar->actions();
- QAction *previous = 0;
+ QAction *previous = nullptr;
if (index >= 0 && index < currentActions.size())
previous = currentActions.at(index);
InsertActionIntoCommand *cmd = new InsertActionIntoCommand(fw);
@@ -421,7 +421,7 @@ QAction *ToolBarEventFilter::actionAt(const QToolBar *tb, const QPoint &pos)
{
const int index = actionIndexAt(tb, pos, tb->orientation());
if (index == -1)
- return 0;
+ return nullptr;
return tb->actions().at(index);
}
diff --git a/src/designer/src/lib/shared/qdesigner_toolbox.cpp b/src/designer/src/lib/shared/qdesigner_toolbox.cpp
index 90911a9fa..f0c0dc726 100644
--- a/src/designer/src/lib/shared/qdesigner_toolbox.cpp
+++ b/src/designer/src/lib/shared/qdesigner_toolbox.cpp
@@ -51,7 +51,7 @@ QToolBoxHelper::QToolBoxHelper(QToolBox *toolbox) :
m_actionInsertPage(new QAction(tr("Before Current Page"), this)),
m_actionInsertPageAfter(new QAction(tr("After Current Page"), this)),
m_actionChangePageOrder(new QAction(tr("Change Page Order..."), this)),
- m_pagePromotionTaskMenu(new qdesigner_internal::PromotionTaskMenu(0, qdesigner_internal::PromotionTaskMenu::ModeSingleWidget, this))
+ m_pagePromotionTaskMenu(new qdesigner_internal::PromotionTaskMenu(nullptr, qdesigner_internal::PromotionTaskMenu::ModeSingleWidget, this))
{
connect(m_actionDeletePage, &QAction::triggered, this, &QToolBoxHelper::removeCurrentPage);
connect(m_actionInsertPage, &QAction::triggered, this, &QToolBoxHelper::addPage);
@@ -110,14 +110,14 @@ QToolBoxHelper *QToolBoxHelper::helperOf(const QToolBox *toolbox)
if (QToolBoxHelper *h = qobject_cast<QToolBoxHelper *>(o))
return h;
}
- return 0;
+ return nullptr;
}
QMenu *QToolBoxHelper::addToolBoxContextMenuActions(const QToolBox *toolbox, QMenu *popup)
{
QToolBoxHelper *helper = helperOf(toolbox);
if (!helper)
- return 0;
+ return nullptr;
return helper->addContextMenuActions(popup);
}
@@ -203,7 +203,7 @@ void QToolBoxHelper::setCurrentItemBackgroundRole(QPalette::ColorRole role)
QMenu *QToolBoxHelper::addContextMenuActions(QMenu *popup) const
{
- QMenu *pageMenu = 0;
+ QMenu *pageMenu = nullptr;
const int count = m_toolbox->count();
m_actionDeletePage->setEnabled(count > 1);
if (count) {
@@ -254,7 +254,7 @@ QToolBoxWidgetPropertySheet::QToolBoxWidgetPropertySheet(QToolBox *object, QObje
QToolBoxWidgetPropertySheet::ToolBoxProperty QToolBoxWidgetPropertySheet::toolBoxPropertyFromName(const QString &name)
{
- typedef QHash<QString, ToolBoxProperty> ToolBoxPropertyHash;
+ using ToolBoxPropertyHash = QHash<QString, ToolBoxProperty>;
static ToolBoxPropertyHash toolBoxPropertyHash;
if (toolBoxPropertyHash.empty()) {
toolBoxPropertyHash.insert(QLatin1String(currentItemTextKey), PropertyCurrentItemText);
diff --git a/src/designer/src/lib/shared/qdesigner_toolbox_p.h b/src/designer/src/lib/shared/qdesigner_toolbox_p.h
index 12be40c39..9828ff2c3 100644
--- a/src/designer/src/lib/shared/qdesigner_toolbox_p.h
+++ b/src/designer/src/lib/shared/qdesigner_toolbox_p.h
@@ -71,7 +71,7 @@ public:
QPalette::ColorRole currentItemBackgroundRole() const;
void setCurrentItemBackgroundRole(QPalette::ColorRole role);
- bool eventFilter(QObject *watched, QEvent *event);
+ bool eventFilter(QObject *watched, QEvent *event) override;
// Add context menu and return page submenu or 0.
QMenu *addContextMenuActions(QMenu *popup) const;
@@ -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;
@@ -120,7 +120,7 @@ private:
QMap<QWidget *, PageData> m_pageToData;
};
-typedef QDesignerPropertySheetFactory<QToolBox, QToolBoxWidgetPropertySheet> QToolBoxWidgetPropertySheetFactory;
+using QToolBoxWidgetPropertySheetFactory = QDesignerPropertySheetFactory<QToolBox, QToolBoxWidgetPropertySheet>;
QT_END_NAMESPACE
diff --git a/src/designer/src/lib/shared/qdesigner_utils.cpp b/src/designer/src/lib/shared/qdesigner_utils.cpp
index 3be1fb94d..a7c4fdd72 100644
--- a/src/designer/src/lib/shared/qdesigner_utils.cpp
+++ b/src/designer/src/lib/shared/qdesigner_utils.cpp
@@ -270,9 +270,7 @@ namespace qdesigner_internal
{
}
- PropertySheetPixmapValue::PropertySheetPixmapValue()
- {
- }
+ PropertySheetPixmapValue::PropertySheetPixmapValue() = default;
PropertySheetPixmapValue::PixmapSource PropertySheetPixmapValue::getPixmapSource(QDesignerFormEditorInterface *core, const QString & path)
{
@@ -693,7 +691,7 @@ namespace qdesigner_internal
QDESIGNER_SHARED_EXPORT QAction *preferredEditAction(QDesignerFormEditorInterface *core, QWidget *managedWidget)
{
- QAction *action = 0;
+ QAction *action = nullptr;
if (const QDesignerTaskMenuExtension *taskMenu = qt_extension<QDesignerTaskMenuExtension*>(core->extensionManager(), managedWidget)) {
action = taskMenu->preferredEditAction();
if (!action) {
@@ -716,13 +714,25 @@ namespace qdesigner_internal
return action;
}
- QDESIGNER_SHARED_EXPORT bool runUIC(const QString &fileName, QByteArray& ba, QString &errorMessage)
+ QDESIGNER_SHARED_EXPORT bool runUIC(const QString &fileName, UicLanguage language,
+ QByteArray& ba, QString &errorMessage)
{
- const QString binary = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QStringLiteral("/uic");
QProcess uic;
- uic.start(binary, QStringList(fileName));
+ QStringList arguments;
+ QString binary = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QStringLiteral("/uic");
+ switch (language) {
+ case UicLanguage::Cpp:
+ break;
+ case UicLanguage::Python:
+ arguments << QLatin1String("-g") << QLatin1String("python");
+ break;
+ }
+ arguments << fileName;
+
+ uic.start(binary, arguments);
if (!uic.waitForStarted()) {
- errorMessage = QApplication::translate("Designer", "Unable to launch %1.").arg(binary);
+ errorMessage = QApplication::translate("Designer", "Unable to launch %1: %2").
+ arg(QDir::toNativeSeparators(binary), uic.errorString());
return false;
}
if (!uic.waitForFinished()) {
diff --git a/src/designer/src/lib/shared/qdesigner_utils_p.h b/src/designer/src/lib/shared/qdesigner_utils_p.h
index fca5ca956..38cb31c9d 100644
--- a/src/designer/src/lib/shared/qdesigner_utils_p.h
+++ b/src/designer/src/lib/shared/qdesigner_utils_p.h
@@ -81,15 +81,15 @@ template <class IntType>
class MetaEnum
{
public:
- typedef QMap<QString, IntType> KeyToValueMap;
+ using KeyToValueMap = QMap<QString, IntType>;
MetaEnum(const QString &name, const QString &scope, const QString &separator);
- MetaEnum() {}
+ MetaEnum() = default;
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; }
@@ -161,16 +161,16 @@ class QDESIGNER_SHARED_EXPORT DesignerMetaEnum : public MetaEnum<int>
{
public:
DesignerMetaEnum(const QString &name, const QString &scope, const QString &separator);
- DesignerMetaEnum() {}
+ DesignerMetaEnum() = default;
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.
@@ -181,7 +181,7 @@ class QDESIGNER_SHARED_EXPORT DesignerMetaFlags : public MetaEnum<uint>
{
public:
DesignerMetaFlags(const QString &name, const QString &scope, const QString &separator);
- DesignerMetaFlags() {}
+ DesignerMetaFlags() = default;
enum SerializationMode { FullyQualified, NameOnly };
QString toString(int value, SerializationMode sm) const;
@@ -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
@@ -273,8 +273,8 @@ class QDESIGNER_SHARED_EXPORT PropertySheetIconValue
PropertySheetIconValue themed() const;
PropertySheetIconValue unthemed() const;
- typedef QPair<QIcon::Mode, QIcon::State> ModeStateKey;
- typedef QMap<ModeStateKey, PropertySheetPixmapValue> ModeStateToPixmapMap;
+ using ModeStateKey = QPair<QIcon::Mode, QIcon::State>;
+ using ModeStateToPixmapMap = QMap<ModeStateKey, PropertySheetPixmapValue>;
const ModeStateToPixmapMap &paths() const;
@@ -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:
@@ -435,8 +435,15 @@ QDESIGNER_SHARED_EXPORT QDesignerFormWindowCommand *createTextPropertyCommand(co
// Returns preferred task menu action for managed widget
QDESIGNER_SHARED_EXPORT QAction *preferredEditAction(QDesignerFormEditorInterface *core, QWidget *managedWidget);
+enum class UicLanguage
+{
+ Cpp,
+ Python,
+};
+
// Convenience to run UIC
-QDESIGNER_SHARED_EXPORT bool runUIC(const QString &fileName, QByteArray& ba, QString &errorMessage);
+QDESIGNER_SHARED_EXPORT bool runUIC(const QString &fileName, UicLanguage language,
+ QByteArray& ba, QString &errorMessage);
// Find a suitable variable name for a class.
QDESIGNER_SHARED_EXPORT QString qtify(const QString &name);
@@ -446,7 +453,7 @@ QDESIGNER_SHARED_EXPORT QString qtify(const QString &name);
* which is important to avoid side-effects when putting it into QStackedLayout. */
class QDESIGNER_SHARED_EXPORT UpdateBlocker {
- Q_DISABLE_COPY(UpdateBlocker)
+ Q_DISABLE_COPY_MOVE(UpdateBlocker)
public:
UpdateBlocker(QWidget *w);
@@ -459,14 +466,14 @@ private:
namespace Utils {
-inline int valueOf(const QVariant &value, bool *ok = 0)
+inline int valueOf(const QVariant &value, bool *ok = nullptr)
{
if (value.canConvert<PropertySheetEnumValue>()) {
if (ok)
*ok = true;
return qvariant_cast<PropertySheetEnumValue>(value).value;
}
- else if (value.canConvert<PropertySheetFlagValue>()) {
+ if (value.canConvert<PropertySheetFlagValue>()) {
if (ok)
*ok = true;
return qvariant_cast<PropertySheetFlagValue>(value).value;
@@ -477,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 f2e4cd5cc..1ca79d777 100644
--- a/src/designer/src/lib/shared/qdesigner_widgetbox.cpp
+++ b/src/designer/src/lib/shared/qdesigner_widgetbox.cpp
@@ -126,8 +126,7 @@ bool QDesignerWidgetBoxInterface::Widget::isNull() const
namespace qdesigner_internal {
QDesignerWidgetBox::QDesignerWidgetBox(QWidget *parent, Qt::WindowFlags flags)
- : QDesignerWidgetBoxInterface(parent, flags),
- m_loadMode(LoadMerge)
+ : QDesignerWidgetBoxInterface(parent, flags)
{
}
@@ -184,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)
@@ -217,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 7a3aaad32..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);
@@ -79,7 +79,7 @@ public:
static DomUI *xmlToUi(const QString &name, const QString &xml, bool insertFakeTopLevel);
private:
- LoadMode m_loadMode;
+ LoadMode m_loadMode = LoadMerge;
};
} // namespace qdesigner_internal
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..7b3ed395f 100644
--- a/src/designer/src/lib/shared/qdesigner_widgetitem_p.h
+++ b/src/designer/src/lib/shared/qdesigner_widgetitem_p.h
@@ -67,7 +67,7 @@ namespace qdesigner_internal {
// shrink them.
class QDESIGNER_SHARED_EXPORT QDesignerWidgetItem : public QObject, public QWidgetItemV2 {
- Q_DISABLE_COPY(QDesignerWidgetItem)
+ Q_DISABLE_COPY_MOVE(QDesignerWidgetItem)
Q_OBJECT
public:
explicit QDesignerWidgetItem(const QLayout *containingLayout, QWidget *w, Qt::Orientations o = Qt::Horizontal|Qt::Vertical);
@@ -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();
@@ -117,7 +117,7 @@ private:
// instance is in scope.
class QDESIGNER_SHARED_EXPORT QDesignerWidgetItemInstaller {
- Q_DISABLE_COPY(QDesignerWidgetItemInstaller)
+ Q_DISABLE_COPY_MOVE(QDesignerWidgetItemInstaller)
public:
QDesignerWidgetItemInstaller();
diff --git a/src/designer/src/lib/shared/qlayout_widget.cpp b/src/designer/src/lib/shared/qlayout_widget.cpp
index 60abbd72a..852002838 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;
}
@@ -417,13 +417,9 @@ int LayoutProperties::toPropertySheet(const QDesignerFormEditorInterface *core,
}
// ---------------- LayoutHelper
-LayoutHelper::LayoutHelper()
-{
-}
+LayoutHelper::LayoutHelper() = default;
-LayoutHelper::~LayoutHelper()
-{
-}
+LayoutHelper::~LayoutHelper() = default;
int LayoutHelper::indexOf(const QLayout *lt, const QWidget *widget)
{
@@ -464,12 +460,12 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
void simplify(const QDesignerFormEditorInterface *, QWidget *, const QRect &) override {}
// Helper for restoring layout states
- typedef QVector <QLayoutItem *> LayoutItemVector;
+ using LayoutItemVector = QVector<QLayoutItem *>;
static LayoutItemVector disassembleLayout(QLayout *lt);
static QLayoutItem *findItemOfWidget(const LayoutItemVector &lv, QWidget *w);
private:
- typedef QVector<QWidget *> BoxLayoutState;
+ using BoxLayoutState = QVector<QWidget *>;
static BoxLayoutState state(const QBoxLayout*lt);
@@ -508,7 +504,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 +539,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)
@@ -587,7 +583,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
// that do not change the widgets within the layout; also provides some manipulation
// functions and ability to apply the state to a layout provided its widgets haven't changed.
struct GridLayoutState {
- GridLayoutState();
+ GridLayoutState() = default;
void fromLayout(QGridLayout *l);
void applyToLayout(const QDesignerFormEditorInterface *core, QWidget *w) const;
@@ -608,7 +604,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
};
// Horiontal, Vertical pair of state
typedef QPair<DimensionCellState, DimensionCellState> CellState;
- typedef QVector<CellState> CellStates;
+ using CellStates = QVector<CellState>;
// Figure out states of a cell and return as a flat vector of
// [column1, column2,...] (address as row * columnCount + col)
@@ -620,8 +616,8 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
WidgetItemMap widgetItemMap;
WidgetAlignmentMap widgetAlignmentMap;
- int rowCount;
- int colCount;
+ int rowCount = 0;
+ int colCount = 0;
};
static inline bool needsSpacerItem(const GridLayoutState::CellState &cs) {
@@ -639,12 +635,6 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
return str;
}
- GridLayoutState::GridLayoutState() :
- rowCount(0),
- colCount(0)
- {
- }
-
GridLayoutState::CellStates GridLayoutState::cellStates(const QList<QRect> &rects, int numRows, int numColumns)
{
CellStates rc = CellStates(numRows * numColumns, CellState(Free, Free));
@@ -701,7 +691,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
void GridLayoutState::applyToLayout(const QDesignerFormEditorInterface *core, QWidget *w) const
{
- typedef QHash<QLayoutItem *, QRect> LayoutItemRectMap;
+ using LayoutItemRectMap =QHash<QLayoutItem *, QRect>;
QGridLayout *grid = qobject_cast<QGridLayout *>(LayoutInfo::managedLayout(core, w));
Q_ASSERT(grid);
if (debugLayout)
@@ -731,7 +721,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
@@ -866,7 +856,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
// ---------------- GridLayoutHelper
class GridLayoutHelper : public LayoutHelper {
public:
- GridLayoutHelper() {}
+ GridLayoutHelper() = default;
QRect itemInfo(QLayout *lt, int index) const override;
void insertWidget(QLayout *lt, const QRect &info, QWidget *w) override;
@@ -969,7 +959,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;
}
@@ -1021,9 +1011,9 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
class FormLayoutHelper : public LayoutHelper {
public:
typedef QPair<QWidget *, QWidget *> WidgetPair;
- typedef QVector<WidgetPair> FormLayoutState;
+ using FormLayoutState = QVector<WidgetPair>;
- FormLayoutHelper() {}
+ FormLayoutHelper() = default;
QRect itemInfo(QLayout *lt, int index) const override;
void insertWidget(QLayout *lt, const QRect &info, QWidget *w) override;
@@ -1047,7 +1037,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
QFormLayout *form = qobject_cast<QFormLayout *>(lt);
Q_ASSERT(form);
int row, column, colspan;
- getFormLayoutItemPosition(form, index, &row, &column, 0, &colspan);
+ getFormLayoutItemPosition(form, index, &row, &column, nullptr, &colspan);
return QRect(column, row, colspan, 1);
}
@@ -1076,7 +1066,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);
@@ -1100,7 +1090,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;
}
@@ -1122,7 +1112,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)
@@ -1160,7 +1150,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
formLayout = static_cast<QFormLayout*>(recreateManagedLayout(core, widgetWithManagedLayout, formLayout ));
for (int r = 0; r < rowCount; r++) {
QWidget *widgets[FormLayoutColumns] = { storedState[r].first, storedState[r].second };
- const bool spanning = widgets[0] != 0 && widgets[0] == widgets[1];
+ const bool spanning = widgets[0] != nullptr && widgets[0] == widgets[1];
if (spanning) {
formLayout->setWidget(r, QFormLayout::SpanningRole, widgets[0]);
} else {
@@ -1185,8 +1175,8 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
void FormLayoutHelper::simplify(const QDesignerFormEditorInterface *core, QWidget *widgetWithManagedLayout, const QRect &restrictionArea)
{
- typedef QPair<QLayoutItem*, QLayoutItem*> LayoutItemPair;
- typedef QVector<LayoutItemPair> LayoutItemPairs;
+ using LayoutItemPair = QPair<QLayoutItem*, QLayoutItem*>;
+ using LayoutItemPairs = QVector<LayoutItemPair>;
QFormLayout *formLayout = qobject_cast<QFormLayout *>(LayoutInfo::managedLayout(core, widgetWithManagedLayout));
Q_ASSERT(formLayout);
@@ -1197,7 +1187,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 {
@@ -1232,7 +1222,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);
@@ -1546,7 +1536,7 @@ namespace {
class QBoxLayoutSupport: public QLayoutSupport
{
public:
- QBoxLayoutSupport(QDesignerFormWindowInterface *formWindow, QWidget *widget, Qt::Orientation orientation, QObject *parent = 0);
+ QBoxLayoutSupport(QDesignerFormWindowInterface *formWindow, QWidget *widget, Qt::Orientation orientation, QObject *parent = nullptr);
void insertWidget(QWidget *widget, const QPair<int, int> &cell) override;
void removeWidget(QWidget *widget) override;
@@ -1677,7 +1667,7 @@ class GridLikeLayoutSupportBase: public QLayoutSupport
{
public:
- GridLikeLayoutSupportBase(QDesignerFormWindowInterface *formWindow, QWidget *widget, LayoutHelper *helper, QObject *parent = 0) :
+ GridLikeLayoutSupportBase(QDesignerFormWindowInterface *formWindow, QWidget *widget, LayoutHelper *helper, QObject *parent = nullptr) :
QLayoutSupport(formWindow, widget, helper, parent) {}
void insertWidget(QWidget *widget, const QPair<int, int> &cell) override;
@@ -1792,7 +1782,7 @@ class QGridLayoutSupport: public GridLikeLayoutSupportBase<QGridLayout>
{
public:
- QGridLayoutSupport(QDesignerFormWindowInterface *formWindow, QWidget *widget, QObject *parent = 0);
+ QGridLayoutSupport(QDesignerFormWindowInterface *formWindow, QWidget *widget, QObject *parent = nullptr);
void simplify() override;
void insertRow(int row) override;
@@ -1839,7 +1829,7 @@ void QGridLayoutSupport::simplify()
class QFormLayoutSupport: public GridLikeLayoutSupportBase<QFormLayout>
{
public:
- QFormLayoutSupport(QDesignerFormWindowInterface *formWindow, QWidget *widget, QObject *parent = 0);
+ QFormLayoutSupport(QDesignerFormWindowInterface *formWindow, QWidget *widget, QObject *parent = nullptr);
void simplify() override {}
void insertRow(int /*row*/) override {}
@@ -1867,7 +1857,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);
@@ -1998,7 +1988,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;
@@ -2021,7 +2011,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;
@@ -2044,7 +2034,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;
@@ -2067,7 +2057,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..1efe3a905 100644
--- a/src/designer/src/lib/shared/qlayout_widget_p.h
+++ b/src/designer/src/lib/shared/qlayout_widget_p.h
@@ -131,6 +131,8 @@ protected:
LayoutHelper();
public:
+ Q_DISABLE_COPY(LayoutHelper)
+
virtual ~LayoutHelper();
static LayoutHelper *createLayoutHelper(int type);
@@ -165,7 +167,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 +205,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 +248,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..e2dccaa53 100644
--- a/src/designer/src/lib/shared/qsimpleresource_p.h
+++ b/src/designer/src/lib/shared/qsimpleresource_p.h
@@ -101,9 +101,9 @@ private:
// Contents of clipboard for formbuilder copy and paste operations
// (Actions and widgets)
struct QDESIGNER_SHARED_EXPORT FormBuilderClipboard {
- typedef QList<QAction*> ActionList;
+ using ActionList = QList<QAction *>;
- FormBuilderClipboard() {}
+ FormBuilderClipboard() = default;
FormBuilderClipboard(QWidget *w);
bool empty() const;
@@ -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 b072b00ad..f2275d0b9 100644
--- a/src/designer/src/lib/shared/qtresourceeditordialog.cpp
+++ b/src/designer/src/lib/shared/qtresourceeditordialog.cpp
@@ -269,7 +269,7 @@ class QtQrcManager : public QObject
{
Q_OBJECT
public:
- QtQrcManager(QObject *parent = 0);
+ QtQrcManager(QObject *parent = nullptr);
~QtQrcManager() override;
QList<QtQrcFile *> qrcFiles() const;
@@ -279,7 +279,7 @@ public:
QtQrcFile *qrcFileOf(QtResourcePrefix *resourcePrefix) const;
QtResourcePrefix *resourcePrefixOf(QtResourceFile *resourceFile) const;
- QtQrcFile *importQrcFile(const QtQrcFileData &qrcFileData, QtQrcFile *beforeQrcFile = 0);
+ QtQrcFile *importQrcFile(const QtQrcFileData &qrcFileData, QtQrcFile *beforeQrcFile = nullptr);
void exportQrcFile(QtQrcFile *qrcFile, QtQrcFileData *qrcFileData) const;
QIcon icon(const QString &resourceFullPath) const;
@@ -297,20 +297,20 @@ public:
public slots:
- QtQrcFile *insertQrcFile(const QString &path, QtQrcFile *beforeQrcFile = 0, bool newFile = false);
+ QtQrcFile *insertQrcFile(const QString &path, QtQrcFile *beforeQrcFile = nullptr, bool newFile = false);
void moveQrcFile(QtQrcFile *qrcFile, QtQrcFile *beforeQrcFile);
void setInitialState(QtQrcFile *qrcFile, const QtQrcFileData &initialState);
void removeQrcFile(QtQrcFile *qrcFile);
QtResourcePrefix *insertResourcePrefix(QtQrcFile *qrcFile, const QString &prefix,
- const QString &language, QtResourcePrefix *beforeResourcePrefix = 0);
+ const QString &language, QtResourcePrefix *beforeResourcePrefix = nullptr);
void moveResourcePrefix(QtResourcePrefix *resourcePrefix, QtResourcePrefix *beforeResourcePrefix); // the same qrc file???
void changeResourcePrefix(QtResourcePrefix *resourcePrefix, const QString &newPrefix);
void changeResourceLanguage(QtResourcePrefix *resourcePrefix, const QString &newLanguage);
void removeResourcePrefix(QtResourcePrefix *resourcePrefix);
QtResourceFile *insertResourceFile(QtResourcePrefix *resourcePrefix, const QString &path,
- const QString &alias, QtResourceFile *beforeResourceFile = 0);
+ const QString &alias, QtResourceFile *beforeResourceFile = nullptr);
void moveResourceFile(QtResourceFile *resourceFile, QtResourceFile *beforeResourceFile); // the same prefix???
void changeResourceAlias(QtResourceFile *resourceFile, const QString &newAlias);
void removeResourceFile(QtResourceFile *resourceFile);
@@ -377,11 +377,11 @@ QtQrcFile *QtQrcManager::importQrcFile(const QtQrcFileData &qrcFileData, QtQrcFi
{
QtQrcFile *qrcFile = insertQrcFile(qrcFileData.qrcPath, beforeQrcFile);
if (!qrcFile)
- return 0;
+ return nullptr;
for (const QtResourcePrefixData &prefixData : qrcFileData.resourceList) {
- QtResourcePrefix *resourcePrefix = insertResourcePrefix(qrcFile, prefixData.prefix, prefixData.language, 0);
+ QtResourcePrefix *resourcePrefix = insertResourcePrefix(qrcFile, prefixData.prefix, prefixData.language, nullptr);
for (const QtResourceFileData &fileData : prefixData.resourceFileList)
- insertResourceFile(resourcePrefix, fileData.path, fileData.alias, 0);
+ insertResourceFile(resourcePrefix, fileData.path, fileData.alias, nullptr);
}
setInitialState(qrcFile, qrcFileData);
return qrcFile;
@@ -439,64 +439,64 @@ bool QtQrcManager::exists(QtQrcFile *qrcFile) const
QtQrcFile *QtQrcManager::prevQrcFile(QtQrcFile *qrcFile) const
{
if (!qrcFile)
- return 0;
+ return nullptr;
const int idx = m_qrcFiles.indexOf(qrcFile);
if (idx <= 0)
- return 0;
+ return nullptr;
return m_qrcFiles.at(idx - 1);
}
QtQrcFile *QtQrcManager::nextQrcFile(QtQrcFile *qrcFile) const
{
if (!qrcFile)
- return 0;
+ return nullptr;
const int idx = m_qrcFiles.indexOf(qrcFile);
if (idx < 0 || idx == m_qrcFiles.size() - 1)
- return 0;
+ return nullptr;
return m_qrcFiles.at(idx + 1);
}
QtResourcePrefix *QtQrcManager::prevResourcePrefix(QtResourcePrefix *resourcePrefix) const
{
if (!resourcePrefix)
- return 0;
+ return nullptr;
QList<QtResourcePrefix *> prefixes = qrcFileOf(resourcePrefix)->resourcePrefixList();
const int idx = prefixes.indexOf(resourcePrefix);
if (idx <= 0)
- return 0;
+ return nullptr;
return prefixes.at(idx - 1);
}
QtResourcePrefix *QtQrcManager::nextResourcePrefix(QtResourcePrefix *resourcePrefix) const
{
if (!resourcePrefix)
- return 0;
+ return nullptr;
QList<QtResourcePrefix *> prefixes = qrcFileOf(resourcePrefix)->resourcePrefixList();
const int idx = prefixes.indexOf(resourcePrefix);
if (idx < 0 || idx == prefixes.size() - 1)
- return 0;
+ return nullptr;
return prefixes.at(idx + 1);
}
QtResourceFile *QtQrcManager::prevResourceFile(QtResourceFile *resourceFile) const
{
if (!resourceFile)
- return 0;
+ return nullptr;
QList<QtResourceFile *> files = resourcePrefixOf(resourceFile)->resourceFiles();
const int idx = files.indexOf(resourceFile);
if (idx <= 0)
- return 0;
+ return nullptr;
return files.at(idx - 1);
}
QtResourceFile *QtQrcManager::nextResourceFile(QtResourceFile *resourceFile) const
{
if (!resourceFile)
- return 0;
+ return nullptr;
QList<QtResourceFile *> files = resourcePrefixOf(resourceFile)->resourceFiles();
const int idx = files.indexOf(resourceFile);
if (idx < 0 || idx == files.size() - 1)
- return 0;
+ return nullptr;
return files.at(idx + 1);
}
@@ -510,7 +510,7 @@ void QtQrcManager::clear()
QtQrcFile *QtQrcManager::insertQrcFile(const QString &path, QtQrcFile *beforeQrcFile, bool newFile)
{
if (m_pathToQrc.contains(path))
- return 0;
+ return nullptr;
int idx = m_qrcFiles.indexOf(beforeQrcFile);
if (idx < 0)
@@ -545,7 +545,7 @@ void QtQrcManager::moveQrcFile(QtQrcFile *qrcFile, QtQrcFile *beforeQrcFile)
if (idx == beforeIdx - 1) // the same position, nothing changes
return;
- QtQrcFile *oldBefore = 0;
+ QtQrcFile *oldBefore = nullptr;
if (idx < m_qrcFiles.size() - 1)
oldBefore = m_qrcFiles.at(idx + 1);
@@ -585,7 +585,7 @@ QtResourcePrefix *QtQrcManager::insertResourcePrefix(QtQrcFile *qrcFile, const Q
const QString &language, QtResourcePrefix *beforeResourcePrefix)
{
if (!qrcFile)
- return 0;
+ return nullptr;
int idx = qrcFile->m_resourcePrefixes.indexOf(beforeResourcePrefix);
if (idx < 0)
@@ -623,7 +623,7 @@ void QtQrcManager::moveResourcePrefix(QtResourcePrefix *resourcePrefix, QtResour
if (idx == beforeIdx - 1) // the same position, nothing changes
return;
- QtResourcePrefix *oldBefore = 0;
+ QtResourcePrefix *oldBefore = nullptr;
if (idx < qrcFile->m_resourcePrefixes.size() - 1)
oldBefore = qrcFile->m_resourcePrefixes.at(idx + 1);
@@ -687,7 +687,7 @@ QtResourceFile *QtQrcManager::insertResourceFile(QtResourcePrefix *resourcePrefi
const QString &alias, QtResourceFile *beforeResourceFile)
{
if (!resourcePrefix)
- return 0;
+ return nullptr;
int idx = resourcePrefix->m_resourceFiles.indexOf(beforeResourceFile);
if (idx < 0)
@@ -735,7 +735,7 @@ void QtQrcManager::moveResourceFile(QtResourceFile *resourceFile, QtResourceFile
if (idx == beforeIdx - 1) // the same position, nothing changes
return;
- QtResourceFile *oldBefore = 0;
+ QtResourceFile *oldBefore = nullptr;
if (idx < resourcePrefix->m_resourceFiles.size() - 1)
oldBefore = resourcePrefix->m_resourceFiles.at(idx + 1);
@@ -794,7 +794,7 @@ class QtResourceEditorDialogPrivate
QtResourceEditorDialog *q_ptr;
Q_DECLARE_PUBLIC(QtResourceEditorDialog)
public:
- QtResourceEditorDialogPrivate();
+ QtResourceEditorDialogPrivate() = default;
void slotQrcFileInserted(QtQrcFile *qrcFile);
void slotQrcFileMoved(QtQrcFile *qrcFile);
@@ -853,10 +853,10 @@ public:
QString qrcStartDirectory() const;
Ui::QtResourceEditorDialog m_ui;
- QDesignerFormEditorInterface *m_core;
- QtResourceModel *m_resourceModel;
- QDesignerDialogGuiInterface *m_dlgGui;
- QtQrcManager *m_qrcManager;
+ QDesignerFormEditorInterface *m_core = nullptr;
+ QtResourceModel *m_resourceModel = nullptr;
+ QDesignerDialogGuiInterface *m_dlgGui = nullptr;
+ QtQrcManager *m_qrcManager = nullptr;
QList<QtQrcFileData> m_initialState;
QMap<QtQrcFile *, QListWidgetItem *> m_qrcFileToItem;
@@ -870,58 +870,30 @@ public:
QMap<QStandardItem *, QtResourceFile *> m_pathItemToResourceFile;
QMap<QStandardItem *, QtResourceFile *> m_aliasItemToResourceFile;
- bool m_ignoreCurrentChanged;
- bool m_firstQrcFileDialog;
- QtQrcFile *m_currentQrcFile;
-
- QAction *m_newQrcFileAction;
- QAction *m_importQrcFileAction;
- QAction *m_removeQrcFileAction;
- QAction *m_moveUpQrcFileAction;
- QAction *m_moveDownQrcFileAction;
-
- QAction *m_newPrefixAction;
- QAction *m_addResourceFileAction;
- QAction *m_changePrefixAction;
- QAction *m_changeLanguageAction;
- QAction *m_changeAliasAction;
- QAction *m_clonePrefixAction;
- QAction *m_moveUpAction;
- QAction *m_moveDownAction;
- QAction *m_removeAction;
-
- QStandardItemModel *m_treeModel;
- QItemSelectionModel *m_treeSelection;
+ bool m_ignoreCurrentChanged = false;
+ bool m_firstQrcFileDialog = true;
+ QtQrcFile *m_currentQrcFile = nullptr;
+
+ QAction *m_newQrcFileAction = nullptr;
+ QAction *m_importQrcFileAction = nullptr;
+ QAction *m_removeQrcFileAction = nullptr;
+ QAction *m_moveUpQrcFileAction = nullptr;
+ QAction *m_moveDownQrcFileAction = nullptr;
+
+ QAction *m_newPrefixAction = nullptr;
+ QAction *m_addResourceFileAction = nullptr;
+ QAction *m_changePrefixAction = nullptr;
+ QAction *m_changeLanguageAction = nullptr;
+ QAction *m_changeAliasAction = nullptr;
+ QAction *m_clonePrefixAction = nullptr;
+ QAction *m_moveUpAction = nullptr;
+ QAction *m_moveDownAction = nullptr;
+ QAction *m_removeAction = nullptr;
+
+ QStandardItemModel *m_treeModel = nullptr;
+ QItemSelectionModel *m_treeSelection = nullptr;
};
-QtResourceEditorDialogPrivate::QtResourceEditorDialogPrivate() :
- q_ptr(0),
- m_core(0),
- m_resourceModel(0),
- m_dlgGui(0),
- m_qrcManager(0),
- m_ignoreCurrentChanged(false),
- m_firstQrcFileDialog(true),
- m_currentQrcFile(0),
- m_newQrcFileAction(0),
- m_importQrcFileAction(0),
- m_removeQrcFileAction(0),
- m_moveUpQrcFileAction(0),
- m_moveDownQrcFileAction(0),
- m_newPrefixAction(0),
- m_addResourceFileAction(0),
- m_changePrefixAction(0),
- m_changeLanguageAction(0),
- m_changeAliasAction(0),
- m_clonePrefixAction(0),
- m_moveUpAction(0),
- m_moveDownAction(0),
- m_removeAction(0),
- m_treeModel(0),
- m_treeSelection(0)
-{
-}
-
QMessageBox::StandardButton QtResourceEditorDialogPrivate::warning(const QString &title, const QString &text, QMessageBox::StandardButtons buttons,
QMessageBox::StandardButton defaultButton) const
{
@@ -989,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;
@@ -1000,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);
@@ -1226,7 +1198,7 @@ void QtResourceEditorDialogPrivate::slotCurrentQrcFileChanged(QListWidgetItem *i
m_currentQrcFile = newCurrentQrcFile;
slotCurrentTreeViewItemChanged(QModelIndex());
- QStandardItem *firstPrefix = 0; // select first prefix
+ QStandardItem *firstPrefix = nullptr; // select first prefix
if (m_currentQrcFile) {
const QList<QtResourcePrefix *> newPrefixList = m_currentQrcFile->resourcePrefixList();
for (QtResourcePrefix *resourcePrefix : newPrefixList) {
@@ -1344,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;
@@ -1471,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)
@@ -1484,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) {
@@ -1717,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..5a6ea9755 100644
--- a/src/designer/src/lib/shared/qtresourceeditordialog_p.h
+++ b/src/designer/src/lib/shared/qtresourceeditordialog_p.h
@@ -59,21 +59,21 @@ public:
QString selectedResource() const;
static QString editResources(QDesignerFormEditorInterface *core, QtResourceModel *model,
- QDesignerDialogGuiInterface *dlgGui, QWidget *parent = 0);
+ QDesignerDialogGuiInterface *dlgGui, QWidget *parent = nullptr);
// Helper to display a message box with rcc logs in case of errors.
- static void displayResourceFailures(const QString &logOutput, QDesignerDialogGuiInterface *dlgGui, QWidget *parent = 0);
+ static void displayResourceFailures(const QString &logOutput, QDesignerDialogGuiInterface *dlgGui, QWidget *parent = nullptr);
public slots:
void accept() override;
private:
- QtResourceEditorDialog(QDesignerFormEditorInterface *core, QDesignerDialogGuiInterface *dlgGui, QWidget *parent = 0);
+ QtResourceEditorDialog(QDesignerFormEditorInterface *core, QDesignerDialogGuiInterface *dlgGui, QWidget *parent = nullptr);
~QtResourceEditorDialog() override;
QScopedPointer<class QtResourceEditorDialogPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtResourceEditorDialog)
- Q_DISABLE_COPY(QtResourceEditorDialog)
+ Q_DISABLE_COPY_MOVE(QtResourceEditorDialog)
Q_PRIVATE_SLOT(d_func(), void slotQrcFileInserted(QtQrcFile *))
Q_PRIVATE_SLOT(d_func(), void slotQrcFileMoved(QtQrcFile *))
diff --git a/src/designer/src/lib/shared/qtresourcemodel.cpp b/src/designer/src/lib/shared/qtresourcemodel.cpp
index e3fa77c69..1586fcf44 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)
{
}
@@ -63,12 +63,12 @@ QtResourceSetPrivate::QtResourceSetPrivate(QtResourceModel *model) :
// -------------------- QtResourceModelPrivate
class QtResourceModelPrivate
{
- QtResourceModel *q_ptr;
+ QtResourceModel *q_ptr = nullptr;
Q_DECLARE_PUBLIC(QtResourceModel)
- Q_DISABLE_COPY(QtResourceModelPrivate)
+ Q_DISABLE_COPY_MOVE(QtResourceModelPrivate)
public:
QtResourceModelPrivate();
- void activate(QtResourceSet *resourceSet, const QStringList &newPaths, int *errorCount = 0, QString *errorMessages = 0);
+ void activate(QtResourceSet *resourceSet, const QStringList &newPaths, int *errorCount = nullptr, QString *errorMessages = nullptr);
void removeOldPaths(QtResourceSet *resourceSet, const QStringList &newPaths);
QMap<QString, bool> m_pathToModified;
@@ -80,7 +80,7 @@ public:
QMap<QtResourceSet *, bool> m_newlyCreated; // all created but not activated yet
// (if was active at some point and it's not now it will not be on that map)
QMap<QString, QList<QtResourceSet *> > m_pathToResourceSet;
- QtResourceSet *m_currentResourceSet;
+ QtResourceSet *m_currentResourceSet = nullptr;
typedef QMap<QString, const QByteArray *> PathDataMap;
PathDataMap m_pathToData;
@@ -89,8 +89,8 @@ public:
QMap<QString, QString> m_fileToQrc; // this map contains the content of active resource set only.
// Activating different resource set changes the contents.
- QFileSystemWatcher *m_fileWatcher;
- bool m_fileWatcherEnabled;
+ QFileSystemWatcher *m_fileWatcher = nullptr;
+ bool m_fileWatcherEnabled = true;
QMap<QString, bool> m_fileWatchedMap;
private:
void registerResourceSet(QtResourceSet *resourceSet);
@@ -105,13 +105,7 @@ private:
void deleteResource(const QByteArray *data) const;
};
-QtResourceModelPrivate::QtResourceModelPrivate() :
- q_ptr(0),
- m_currentResourceSet(0),
- m_fileWatcher(0),
- m_fileWatcherEnabled(true)
-{
-}
+QtResourceModelPrivate::QtResourceModelPrivate() = default;
// --------------------- QtResourceSet
QtResourceSet::QtResourceSet() :
@@ -152,8 +146,8 @@ void QtResourceSet::setModified(const QString &path)
// ------------------- QtResourceModelPrivate
const QByteArray *QtResourceModelPrivate::createResource(const QString &path, QStringList *contents, int *errorCount, QIODevice &errorDevice) const
{
- typedef RCCResourceLibrary::ResourceDataFileMap ResourceDataFileMap;
- const QByteArray *rc = 0;
+ using ResourceDataFileMap = RCCResourceLibrary::ResourceDataFileMap;
+ const QByteArray *rc = nullptr;
*errorCount = -1;
contents->clear();
do {
@@ -525,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..65d615f52 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)
@@ -77,14 +77,14 @@ private:
QScopedPointer<class QtResourceSetPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtResourceSet)
- Q_DISABLE_COPY(QtResourceSet)
+ Q_DISABLE_COPY_MOVE(QtResourceSet)
};
class QDESIGNER_SHARED_EXPORT QtResourceModel : public QObject // one instance per whole designer
{
Q_OBJECT
public:
- QtResourceModel(QObject *parent = 0);
+ QtResourceModel(QObject *parent = nullptr);
~QtResourceModel();
QStringList loadedQrcFiles() const;
@@ -94,13 +94,13 @@ public:
QList<QtResourceSet *> resourceSets() const;
QtResourceSet *currentResourceSet() const;
- void setCurrentResourceSet(QtResourceSet *resourceSet, int *errorCount = 0, QString *errorMessages = 0);
+ void setCurrentResourceSet(QtResourceSet *resourceSet, int *errorCount = nullptr, QString *errorMessages = nullptr);
QtResourceSet *addResourceSet(const QStringList &paths);
void removeResourceSet(QtResourceSet *resourceSet);
- void reload(const QString &path, int *errorCount = 0, QString *errorMessages = 0);
- void reload(int *errorCount = 0, QString *errorMessages = 0);
+ void reload(const QString &path, int *errorCount = nullptr, QString *errorMessages = nullptr);
+ void reload(int *errorCount = nullptr, QString *errorMessages = nullptr);
// Contents of the current resource set (content file to qrc path)
QMap<QString, QString> contents() const;
@@ -122,7 +122,7 @@ private:
QScopedPointer<class QtResourceModelPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtResourceModel)
- Q_DISABLE_COPY(QtResourceModel)
+ Q_DISABLE_COPY_MOVE(QtResourceModel)
Q_PRIVATE_SLOT(d_func(), void slotFileChanged(const QString &))
};
diff --git a/src/designer/src/lib/shared/qtresourceview.cpp b/src/designer/src/lib/shared/qtresourceview.cpp
index f79926d88..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;
@@ -123,7 +123,7 @@ void ResourceListWidget::startDrag(Qt::DropActions supportedActions)
// ---------------------------- QtResourceViewPrivate
class QtResourceViewPrivate
{
- QtResourceView *q_ptr;
+ QtResourceView *q_ptr = nullptr;
Q_DECLARE_PUBLIC(QtResourceView)
public:
QtResourceViewPrivate(QDesignerFormEditorInterface *core);
@@ -152,12 +152,12 @@ public:
QPixmap makeThumbnail(const QPixmap &pix) const;
QDesignerFormEditorInterface *m_core;
- QtResourceModel *m_resourceModel;
+ QtResourceModel *m_resourceModel = nullptr;
QToolBar *m_toolBar;
- QWidget *m_filterWidget;
+ QWidget *m_filterWidget = nullptr;
QTreeWidget *m_treeWidget;
QListWidget *m_listWidget;
- QSplitter *m_splitter;
+ QSplitter *m_splitter = nullptr;
QMap<QString, QStringList> m_pathToContents; // full path to contents file names (full path to its resource filenames)
QMap<QString, QString> m_pathToParentPath; // full path to full parent path
QMap<QString, QStringList> m_pathToSubPaths; // full path to full sub paths
@@ -165,31 +165,23 @@ public:
QMap<QTreeWidgetItem *, QString> m_itemToPath;
QMap<QString, QListWidgetItem *> m_resourceToItem;
QMap<QListWidgetItem *, QString> m_itemToResource;
- QAction *m_editResourcesAction;
- QAction *m_reloadResourcesAction;
- QAction *m_copyResourcePathAction;
+ QAction *m_editResourcesAction = nullptr;
+ QAction *m_reloadResourcesAction = nullptr;
+ QAction *m_copyResourcePathAction = nullptr;
QMap<QString, bool> m_expansionState;
- bool m_ignoreGuiSignals;
QString m_settingsKey;
- bool m_resourceEditingEnabled;
QString m_filterPattern;
+ bool m_ignoreGuiSignals = false;
+ bool m_resourceEditingEnabled = true;
};
QtResourceViewPrivate::QtResourceViewPrivate(QDesignerFormEditorInterface *core) :
- q_ptr(0),
m_core(core),
- m_resourceModel(0),
m_toolBar(new QToolBar),
m_treeWidget(new QTreeWidget),
- m_listWidget(new ResourceListWidget),
- m_splitter(0),
- m_editResourcesAction(0),
- m_reloadResourcesAction(0),
- m_copyResourcePathAction(0),
- m_ignoreGuiSignals(false),
- m_resourceEditingEnabled(true)
+ m_listWidget(new ResourceListWidget)
{
m_toolBar->setIconSize(QSize(22, 22));
}
@@ -385,7 +377,7 @@ void QtResourceViewPrivate::createPaths()
}
QQueue<QPair<QString, QTreeWidgetItem *> > pathToParentItemQueue;
- pathToParentItemQueue.enqueue(qMakePair(root, static_cast<QTreeWidgetItem *>(0)));
+ pathToParentItemQueue.enqueue(qMakePair(root, static_cast<QTreeWidgetItem *>(nullptr)));
while (!pathToParentItemQueue.isEmpty()) {
QPair<QString, QTreeWidgetItem *> pathToParentItem = pathToParentItemQueue.dequeue();
const QString path = pathToParentItem.first;
@@ -504,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
@@ -823,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..17ec9c194 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,21 +77,21 @@ 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);
void resourceActivated(const QString &resource);
protected:
- bool event(QEvent *event);
+ bool event(QEvent *event) override;
private:
QScopedPointer<class QtResourceViewPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtResourceView)
- Q_DISABLE_COPY(QtResourceView)
+ Q_DISABLE_COPY_MOVE(QtResourceView)
Q_PRIVATE_SLOT(d_func(), void slotResourceSetActivated(QtResourceSet *))
Q_PRIVATE_SLOT(d_func(), void slotCurrentPathChanged(QTreeWidgetItem *))
Q_PRIVATE_SLOT(d_func(), void slotCurrentResourceChanged(QListWidgetItem *))
@@ -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;
@@ -121,7 +121,7 @@ public:
private:
QScopedPointer<class QtResourceViewDialogPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtResourceViewDialog)
- Q_DISABLE_COPY(QtResourceViewDialog)
+ Q_DISABLE_COPY_MOVE(QtResourceViewDialog)
Q_PRIVATE_SLOT(d_func(), void slotResourceSelected(const QString &))
};
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 adf18a4c4..ca2a82b09 100644
--- a/src/designer/src/lib/shared/richtexteditor.cpp
+++ b/src/designer/src/lib/shared/richtexteditor.cpp
@@ -116,7 +116,7 @@ static inline bool isWhiteSpace(const QStringRef &in)
// Richtext simplification filter: Remove hard-coded font settings,
// <style> elements, <p> attributes other than 'align' and
// and unnecessary meta-information.
-QString simplifyRichTextFilter(const QString &in, bool *isPlainTextPtr = 0)
+QString simplifyRichTextFilter(const QString &in, bool *isPlainTextPtr = nullptr)
{
unsigned elementCount = 0;
bool paragraphAlignmentFound = false;
@@ -162,10 +162,10 @@ class RichTextEditor : public QTextEdit
{
Q_OBJECT
public:
- explicit RichTextEditor(QWidget *parent = 0);
+ explicit RichTextEditor(QWidget *parent = nullptr);
void setDefaultFont(QFont font);
- QToolBar *createToolBar(QDesignerFormEditorInterface *core, QWidget *parent = 0);
+ QToolBar *createToolBar(QDesignerFormEditorInterface *core, QWidget *parent = nullptr);
bool simplifyRichText() const { return m_simplifyRichText; }
@@ -189,7 +189,7 @@ class AddLinkDialog : public QDialog
Q_OBJECT
public:
- AddLinkDialog(RichTextEditor *editor, QWidget *parent = 0);
+ AddLinkDialog(RichTextEditor *editor, QWidget *parent = nullptr);
~AddLinkDialog() override;
int showDialog();
@@ -258,11 +258,11 @@ class HtmlTextEdit : public QTextEdit
Q_OBJECT
public:
- HtmlTextEdit(QWidget *parent = 0)
+ HtmlTextEdit(QWidget *parent = nullptr)
: QTextEdit(parent)
{}
- void contextMenuEvent(QContextMenuEvent *event);
+ void contextMenuEvent(QContextMenuEvent *event) override;
private slots:
void actionTriggered(QAction *action);
@@ -349,7 +349,7 @@ void ColorAction::setColor(const QColor &color)
void ColorAction::chooseColor()
{
- const QColor col = QColorDialog::getColor(m_color, 0);
+ const QColor col = QColorDialog::getColor(m_color, nullptr);
if (col.isValid() && col != m_color) {
setColor(col);
emit colorChanged(m_color);
@@ -362,7 +362,7 @@ class RichTextEditorToolBar : public QToolBar
public:
RichTextEditorToolBar(QDesignerFormEditorInterface *core,
RichTextEditor *editor,
- QWidget *parent = 0);
+ QWidget *parent = nullptr);
public slots:
void updateActions();
@@ -400,7 +400,7 @@ private:
static QAction *createCheckableAction(const QIcon &icon, const QString &text,
QObject *receiver, const char *slot,
- QObject *parent = 0)
+ QObject *parent = nullptr)
{
QAction *result = new QAction(parent);
result->setIcon(icon);
@@ -423,15 +423,13 @@ RichTextEditorToolBar::RichTextEditorToolBar(QDesignerFormEditorInterface *core,
m_core(core),
m_editor(editor)
{
- typedef void (QComboBox::*QComboStringSignal)(const QString &);
-
// Font size combo box
m_font_size_input->setEditable(false);
const QList<int> font_sizes = QFontDatabase::standardSizes();
for (int font_size : font_sizes)
m_font_size_input->addItem(QString::number(font_size));
- connect(m_font_size_input, static_cast<QComboStringSignal>(&QComboBox::activated),
+ connect(m_font_size_input, &QComboBox::textActivated,
this, &RichTextEditorToolBar::sizeInputActivated);
addWidget(m_font_size_input);
@@ -467,22 +465,22 @@ RichTextEditorToolBar::RichTextEditorToolBar(QDesignerFormEditorInterface *core,
m_align_left_action = createCheckableAction(
createIconSet(QStringLiteral("textleft.png")),
- tr("Left Align"), editor, 0, alignment_group);
+ tr("Left Align"), editor, nullptr, alignment_group);
addAction(m_align_left_action);
m_align_center_action = createCheckableAction(
createIconSet(QStringLiteral("textcenter.png")),
- tr("Center"), editor, 0, alignment_group);
+ tr("Center"), editor, nullptr, alignment_group);
addAction(m_align_center_action);
m_align_right_action = createCheckableAction(
createIconSet(QStringLiteral("textright.png")),
- tr("Right Align"), editor, 0, alignment_group);
+ tr("Right Align"), editor, nullptr, alignment_group);
addAction(m_align_right_action);
m_align_justify_action = createCheckableAction(
createIconSet(QStringLiteral("textjustify.png")),
- tr("Justify"), editor, 0, alignment_group);
+ tr("Justify"), editor, nullptr, alignment_group);
addAction(m_align_justify_action);
m_layoutDirectionAction = createCheckableAction(
@@ -632,7 +630,7 @@ void RichTextEditorToolBar::layoutDirectionChanged()
void RichTextEditorToolBar::updateActions()
{
- if (m_editor == 0) {
+ if (m_editor == nullptr) {
setEnabled(false);
return;
}
@@ -740,7 +738,7 @@ QString RichTextEditor::text(Qt::TextFormat format) const
return toPlainText();
case Qt::RichText:
return m_simplifyRichText ? simplifyRichTextFilter(toHtml()) : toHtml();
- case Qt::AutoText:
+ default:
break;
}
const QString html = toHtml();
diff --git a/src/designer/src/lib/shared/richtexteditor_p.h b/src/designer/src/lib/shared/richtexteditor_p.h
index 7098e7ce2..4fc166e3c 100644
--- a/src/designer/src/lib/shared/richtexteditor_p.h
+++ b/src/designer/src/lib/shared/richtexteditor_p.h
@@ -59,7 +59,7 @@ class QDESIGNER_SHARED_EXPORT RichTextEditorDialog : public QDialog
{
Q_OBJECT
public:
- explicit RichTextEditorDialog(QDesignerFormEditorInterface *core, QWidget *parent = 0);
+ explicit RichTextEditorDialog(QDesignerFormEditorInterface *core, QWidget *parent = nullptr);
~RichTextEditorDialog();
int showDialog();
diff --git a/src/designer/src/lib/shared/selectsignaldialog.cpp b/src/designer/src/lib/shared/selectsignaldialog.cpp
index 884ddb4d6..67b988a56 100644
--- a/src/designer/src/lib/shared/selectsignaldialog.cpp
+++ b/src/designer/src/lib/shared/selectsignaldialog.cpp
@@ -53,7 +53,7 @@ namespace qdesigner_internal {
enum { MethodRole = Qt::UserRole + 1 };
-typedef QVector<SelectSignalDialog::Method> Methods;
+using Methods = QVector<SelectSignalDialog::Method>;
SelectSignalDialog::SelectSignalDialog(QWidget *parent)
: QDialog(parent)
@@ -117,7 +117,7 @@ static void appendClass(const QString &className, Methods methods, QStandardItem
for (const SelectSignalDialog::Method &m : qAsConst(methods)) {
QStandardItem *item = new QStandardItem(m.signature);
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
- item->setData(qVariantFromValue(m), MethodRole);
+ item->setData(QVariant::fromValue(m), MethodRole);
topLevelItem->appendRow(item);
}
}
@@ -129,7 +129,7 @@ static QString declaredInClass(const QDesignerMetaObjectInterface *metaObject, c
for (;;) {
const QDesignerMetaObjectInterface *tmpMeta = meta->superClass();
- if (tmpMeta == 0)
+ if (tmpMeta == nullptr)
break;
if (tmpMeta->indexOfMethod(member) == -1)
break;
diff --git a/src/designer/src/lib/shared/selectsignaldialog_p.h b/src/designer/src/lib/shared/selectsignaldialog_p.h
index 6d2a0d1ac..ab94fb1ec 100644
--- a/src/designer/src/lib/shared/selectsignaldialog_p.h
+++ b/src/designer/src/lib/shared/selectsignaldialog_p.h
@@ -58,7 +58,7 @@ class SelectSignalDialog : public QDialog
public:
struct Method
{
- Method() {}
+ Method() = default;
explicit Method(const QString &c, const QString &s, const QStringList &p = QStringList())
: className(c), signature(s), parameterNames(p) {}
bool isValid() const { return !signature.isEmpty(); }
diff --git a/src/designer/src/lib/shared/shared_settings_p.h b/src/designer/src/lib/shared/shared_settings_p.h
index f08691203..65dcf29bc 100644
--- a/src/designer/src/lib/shared/shared_settings_p.h
+++ b/src/designer/src/lib/shared/shared_settings_p.h
@@ -67,7 +67,7 @@ namespace qdesigner_internal {
class QDESIGNER_SHARED_EXPORT QDesignerSharedSettings {
public:
- typedef QList<DeviceProfile> DeviceProfileList;
+ using DeviceProfileList = QList<DeviceProfile>;
explicit QDesignerSharedSettings(QDesignerFormEditorInterface *core);
diff --git a/src/designer/src/lib/shared/sheet_delegate.cpp b/src/designer/src/lib/shared/sheet_delegate.cpp
index 255110cfb..31afad7f8 100644
--- a/src/designer/src/lib/shared/sheet_delegate.cpp
+++ b/src/designer/src/lib/shared/sheet_delegate.cpp
@@ -118,7 +118,6 @@ void SheetDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
QSize SheetDelegate::sizeHint(const QStyleOptionViewItem &opt, const QModelIndex &index) const
{
- QStyleOptionViewItem option = opt;
QSize sz = QItemDelegate::sizeHint(opt, index) + QSize(2, 2);
return sz;
}
diff --git a/src/designer/src/lib/shared/signalslotdialog.cpp b/src/designer/src/lib/shared/signalslotdialog.cpp
index 6720f97b2..5c0d9e1fe 100644
--- a/src/designer/src/lib/shared/signalslotdialog.cpp
+++ b/src/designer/src/lib/shared/signalslotdialog.cpp
@@ -120,7 +120,7 @@ namespace {
// on closing (adds missing parentheses).
class SignatureDelegate : public QItemDelegate {
public:
- SignatureDelegate(QObject * parent = 0);
+ SignatureDelegate(QObject * parent = nullptr);
QWidget * createEditor (QWidget * parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override;
void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
@@ -189,7 +189,7 @@ namespace {
FakeMethodMetaDBCommand::FakeMethodMetaDBCommand(QDesignerFormWindowInterface *formWindow) :
qdesigner_internal::QDesignerFormWindowCommand(QApplication::translate("Command", "Change signals/slots"), formWindow),
- m_object(0)
+ m_object(nullptr)
{
}
@@ -311,7 +311,7 @@ void SignaturePanel::setData(const SignalSlotDialogData &d)
{
m_model->clear();
- QStandardItem *lastExisting = 0;
+ QStandardItem *lastExisting = nullptr;
for (const QString &s : d.m_existingMethods) {
lastExisting = createDisabledItem(s);
m_model->appendRow(lastExisting);
@@ -455,7 +455,7 @@ bool SignalSlotDialog::editPromotedClass(QDesignerFormEditorInterface *core, con
if (baseClassName.isEmpty())
return false;
- QWidget *widget = core->widgetFactory()->createWidget(baseClassName, 0);
+ QWidget *widget = core->widgetFactory()->createWidget(baseClassName, nullptr);
if (!widget)
return false;
const bool rc = editPromotedClass(core, promotedClassName, widget, parent, mode);
diff --git a/src/designer/src/lib/shared/signalslotdialog_p.h b/src/designer/src/lib/shared/signalslotdialog_p.h
index 5848cd229..e0253bcc5 100644
--- a/src/designer/src/lib/shared/signalslotdialog_p.h
+++ b/src/designer/src/lib/shared/signalslotdialog_p.h
@@ -74,7 +74,7 @@ class SignatureModel : public QStandardItemModel {
Q_OBJECT
public:
- SignatureModel(QObject *parent = 0);
+ SignatureModel(QObject *parent = nullptr);
bool setData (const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
signals:
@@ -127,18 +127,18 @@ class QDESIGNER_SHARED_EXPORT SignalSlotDialog : public QDialog {
public:
enum FocusMode { FocusSlots, FocusSignals };
- explicit SignalSlotDialog(QDesignerDialogGuiInterface *dialogGui, QWidget *parent = 0, FocusMode m = FocusSlots);
+ explicit SignalSlotDialog(QDesignerDialogGuiInterface *dialogGui, QWidget *parent = nullptr, FocusMode m = FocusSlots);
~SignalSlotDialog() override;
DialogCode showDialog(SignalSlotDialogData &slotData, SignalSlotDialogData &signalData);
// Edit fake methods stored in MetaDataBase (per instance, used for main containers)
- static bool editMetaDataBase(QDesignerFormWindowInterface *fw, QObject *object, QWidget *parent = 0, FocusMode m = FocusSlots);
+ static bool editMetaDataBase(QDesignerFormWindowInterface *fw, QObject *object, QWidget *parent = nullptr, FocusMode m = FocusSlots);
// Edit fake methods of a promoted class stored in WidgetDataBase (synthesizes a widget to obtain existing members).
- static bool editPromotedClass(QDesignerFormEditorInterface *core, const QString &promotedClassName, QWidget *parent = 0, FocusMode m = FocusSlots);
+ static bool editPromotedClass(QDesignerFormEditorInterface *core, const QString &promotedClassName, QWidget *parent = nullptr, FocusMode m = FocusSlots);
// Edit fake methods of a promoted class stored in WidgetDataBase on a base class instance.
- static bool editPromotedClass(QDesignerFormEditorInterface *core, QObject *baseObject, QWidget *parent = 0, FocusMode m = FocusSlots);
+ static bool editPromotedClass(QDesignerFormEditorInterface *core, QObject *baseObject, QWidget *parent = nullptr, FocusMode m = FocusSlots);
private slots:
void slotCheckSignature(const QString &signature, bool *ok);
diff --git a/src/designer/src/lib/shared/spacer_widget.cpp b/src/designer/src/lib/shared/spacer_widget.cpp
index f465ba807..15daa9d8c 100644
--- a/src/designer/src/lib/shared/spacer_widget.cpp
+++ b/src/designer/src/lib/shared/spacer_widget.cpp
@@ -50,12 +50,7 @@ QT_BEGIN_NAMESPACE
// should not be applied for pixel-exact design.
Spacer::Spacer(QWidget *parent) :
- QWidget(parent),
- m_SizeOffset(3, 3), // A small offset to ensure the spacer is still visible when reset to size 0,0
- m_orientation(Qt::Vertical),
- m_interactive(true),
- m_layoutState(UnknownLayoutState),
- m_sizeHint(0, 0)
+ QWidget(parent)
{
setAttribute(Qt::WA_MouseNoMask);
m_formWindow = QDesignerFormWindowInterface::findFormWindow(this);
@@ -92,7 +87,7 @@ bool Spacer::isInLayout() const
void Spacer::paintEvent(QPaintEvent *)
{
// Only draw spacers when we're editting widgets
- if (m_formWindow != 0 && m_formWindow->currentTool() != 0)
+ if (m_formWindow != nullptr && m_formWindow->currentTool() != 0)
return;
QPainter p(this);
diff --git a/src/designer/src/lib/shared/spacer_widget_p.h b/src/designer/src/lib/shared/spacer_widget_p.h
index 8dfccc5b3..cbb9dd6d7 100644
--- a/src/designer/src/lib/shared/spacer_widget_p.h
+++ b/src/designer/src/lib/shared/spacer_widget_p.h
@@ -61,7 +61,7 @@ class QDESIGNER_SHARED_EXPORT Spacer: public QWidget
Q_PROPERTY(QSize sizeHint READ sizeHintProperty WRITE setSizeHintProperty DESIGNABLE true STORED true)
public:
- Spacer(QWidget *parent = 0);
+ Spacer(QWidget *parent = nullptr);
QSize sizeHint() const override;
@@ -88,14 +88,14 @@ private:
bool isInLayout() const;
void updateToolTip();
- const QSize m_SizeOffset;
+ const QSize m_SizeOffset = QSize(3, 3); // A small offset to ensure the spacer is still visible when reset to size 0,0
QDesignerFormWindowInterface *m_formWindow;
- Qt::Orientation m_orientation;
- bool m_interactive;
+ Qt::Orientation m_orientation = Qt::Vertical;
+ bool m_interactive = true;
// Cache information about 'being in layout' which is expensive to calculate.
enum LayoutState { InLayout, OutsideLayout, UnknownLayoutState };
- mutable LayoutState m_layoutState;
- QSize m_sizeHint;
+ mutable LayoutState m_layoutState = UnknownLayoutState;
+ QSize m_sizeHint = QSize(0, 0);
};
QT_END_NAMESPACE
diff --git a/src/designer/src/lib/shared/stylesheeteditor.cpp b/src/designer/src/lib/shared/stylesheeteditor.cpp
index f52ac1443..c7b36c422 100644
--- a/src/designer/src/lib/shared/stylesheeteditor.cpp
+++ b/src/designer/src/lib/shared/stylesheeteditor.cpp
@@ -126,7 +126,7 @@ StyleSheetEditorDialog::StyleSheetEditorDialog(QDesignerFormEditorInterface *cor
"background-image",
"border-image",
"image",
- 0
+ nullptr
};
const char * const colorProperties[] = {
@@ -141,7 +141,7 @@ StyleSheetEditorDialog::StyleSheetEditorDialog(QDesignerFormEditorInterface *cor
"gridline-color",
"selection-color",
"selection-background-color",
- 0
+ nullptr
};
QMenu *resourceActionMenu = new QMenu(this);
@@ -390,7 +390,7 @@ StyleSheetPropertyEditorDialog::StyleSheetPropertyEditorDialog(QWidget *parent,
m_fw(fw),
m_widget(widget)
{
- Q_ASSERT(m_fw != 0);
+ Q_ASSERT(m_fw != nullptr);
QPushButton *apply = buttonBox()->addButton(QDialogButtonBox::Apply);
QObject::connect(apply, &QAbstractButton::clicked,
@@ -400,7 +400,7 @@ StyleSheetPropertyEditorDialog::StyleSheetPropertyEditorDialog(QWidget *parent,
QDesignerPropertySheetExtension *sheet =
qt_extension<QDesignerPropertySheetExtension*>(m_fw->core()->extensionManager(), m_widget);
- Q_ASSERT(sheet != 0);
+ Q_ASSERT(sheet != nullptr);
const int index = sheet->indexOf(QLatin1String(styleSheetProperty));
const PropertySheetStringValue value = qvariant_cast<PropertySheetStringValue>(sheet->property(index));
setText(value.value());
diff --git a/src/designer/src/lib/shared/stylesheeteditor_p.h b/src/designer/src/lib/shared/stylesheeteditor_p.h
index a9db798ea..ee6c3bc84 100644
--- a/src/designer/src/lib/shared/stylesheeteditor_p.h
+++ b/src/designer/src/lib/shared/stylesheeteditor_p.h
@@ -59,7 +59,7 @@ class QDESIGNER_SHARED_EXPORT StyleSheetEditor : public QTextEdit
{
Q_OBJECT
public:
- StyleSheetEditor(QWidget *parent = 0);
+ StyleSheetEditor(QWidget *parent = nullptr);
};
// Edit a style sheet.
diff --git a/src/designer/src/lib/shared/textpropertyeditor.cpp b/src/designer/src/lib/shared/textpropertyeditor.cpp
index ba289d3c8..88e8841b6 100644
--- a/src/designer/src/lib/shared/textpropertyeditor.cpp
+++ b/src/designer/src/lib/shared/textpropertyeditor.cpp
@@ -203,10 +203,7 @@ namespace qdesigner_internal {
EmbeddingMode embeddingMode,
TextPropertyValidationMode validationMode) :
QWidget(parent),
- m_validationMode(ValidationSingleLine),
- m_updateMode(UpdateAsYouType),
- m_lineEdit(new PropertyLineEdit(this)),
- m_textEdited(false)
+ m_lineEdit(new PropertyLineEdit(this))
{
switch (embeddingMode) {
case EmbeddingNone:
@@ -237,7 +234,7 @@ namespace qdesigner_internal {
switch (m_validationMode) {
case ValidationStyleSheet:
m_lineEdit->setValidator(new StyleSheetValidator(m_lineEdit));
- m_lineEdit->setCompleter(0);
+ m_lineEdit->setCompleter(nullptr);
break;
case ValidationMultiLine:
case ValidationRichText:
@@ -245,20 +242,20 @@ namespace qdesigner_internal {
// While it is not possible to actually type a newline characters,
// it can be pasted into the line edit.
m_lineEdit->setValidator(new ReplacementValidator(m_lineEdit, NewLineChar, EscapedNewLine));
- m_lineEdit->setCompleter(0);
+ m_lineEdit->setCompleter(nullptr);
break;
case ValidationSingleLine:
// Set a validator that replaces newline characters by a blank.
m_lineEdit->setValidator(new ReplacementValidator(m_lineEdit, NewLineChar, QString(QLatin1Char(' '))));
- m_lineEdit->setCompleter(0);
+ m_lineEdit->setCompleter(nullptr);
break;
case ValidationObjectName:
setRegularExpressionValidator(QStringLiteral("^[_a-zA-Z][_a-zA-Z0-9]{1,1023}$"));
- m_lineEdit->setCompleter(0);
+ m_lineEdit->setCompleter(nullptr);
break;
case ValidationObjectNameScope:
setRegularExpressionValidator(QStringLiteral("^[_a-zA-Z:][_a-zA-Z0-9:]{1,1023}$"));
- m_lineEdit->setCompleter(0);
+ m_lineEdit->setCompleter(nullptr);
break;
case ValidationURL: {
static QStringList urlCompletions;
diff --git a/src/designer/src/lib/shared/textpropertyeditor_p.h b/src/designer/src/lib/shared/textpropertyeditor_p.h
index 7b79166a9..fa899ed9e 100644
--- a/src/designer/src/lib/shared/textpropertyeditor_p.h
+++ b/src/designer/src/lib/shared/textpropertyeditor_p.h
@@ -77,7 +77,7 @@ namespace qdesigner_internal {
UpdateOnFinished
};
- explicit TextPropertyEditor(QWidget *parent = 0, EmbeddingMode embeddingMode = EmbeddingNone, TextPropertyValidationMode validationMode = ValidationMultiLine);
+ explicit TextPropertyEditor(QWidget *parent = nullptr, EmbeddingMode embeddingMode = EmbeddingNone, TextPropertyValidationMode validationMode = ValidationMultiLine);
TextPropertyValidationMode textPropertyValidationMode() const { return m_validationMode; }
void setTextPropertyValidationMode(TextPropertyValidationMode vm);
@@ -128,13 +128,13 @@ namespace qdesigner_internal {
void setRegularExpressionValidator(const QString &pattern);
void markIntermediateState();
- TextPropertyValidationMode m_validationMode;
- UpdateMode m_updateMode;
+ TextPropertyValidationMode m_validationMode = ValidationSingleLine;
+ UpdateMode m_updateMode = UpdateAsYouType;
PropertyLineEdit* m_lineEdit;
// Cached text containing real newline characters.
QString m_cachedText;
- bool m_textEdited;
+ bool m_textEdited = false;
};
}
diff --git a/src/designer/src/lib/shared/widgetdatabase.cpp b/src/designer/src/lib/shared/widgetdatabase.cpp
index 380af73cc..5fecd4c98 100644
--- a/src/designer/src/lib/shared/widgetdatabase.cpp
+++ b/src/designer/src/lib/shared/widgetdatabase.cpp
@@ -348,8 +348,8 @@ static WidgetDataBaseItem *createCustomWidgetItem(const QDesignerCustomWidgetInt
void WidgetDataBase::loadPlugins()
{
typedef QMap<QString, int> NameIndexMap;
- typedef QList<QDesignerWidgetDataBaseItemInterface*> ItemList;
- typedef QSet<QString> NameSet;
+ using ItemList = QList<QDesignerWidgetDataBaseItemInterface *>;
+ using NameSet = QSet<QString>;
// 1) create a map of existing custom classes
NameIndexMap existingCustomClasses;
NameSet nonCustomClasses;
@@ -424,9 +424,9 @@ QList<QVariant> WidgetDataBase::defaultPropertyValues(const QString &name)
WidgetFactory *factory = qobject_cast<WidgetFactory *>(m_core->widgetFactory());
Q_ASSERT(factory);
// Create non-widgets, widgets in order
- QObject* object = factory->createObject(name, 0);
+ QObject* object = factory->createObject(name, nullptr);
if (!object)
- object = factory->createWidget(name, 0);
+ object = factory->createWidget(name, nullptr);
if (!object) {
qDebug() << "** WARNING Factory failed to create " << name;
return QList<QVariant>();
@@ -539,7 +539,7 @@ QStringList WidgetDataBase::customFormWidgetClasses(const QDesignerFormEditorInt
// properties to be suitable for new forms
static QString xmlFromWidgetBox(const QDesignerFormEditorInterface *core, const QString &className, const QString &objectName)
{
- typedef QList<DomProperty*> PropertyList;
+ using PropertyList = QList<DomProperty *>;
QDesignerWidgetBoxInterface::Widget widget;
const bool found = QDesignerWidgetBox::findWidget(core->widgetBox(), className, QString(), &widget);
@@ -601,22 +601,22 @@ static QString xmlFromWidgetBox(const QDesignerFormEditorInterface *core, const
// Generate default standard ui new form xml based on the class passed on as similarClassName.
static QString generateNewFormXML(const QString &className, const QString &similarClassName, const QString &name)
{
- QString rc; {
- QTextStream str(&rc);
- str << QStringLiteral("<ui version=\"4.0\" >\n<class>") << name << QStringLiteral("</class>\n")
- << QStringLiteral("<widget class=\"") << className << QStringLiteral("\" name=\"") << name << QStringLiteral("\" >\n")
- << QStringLiteral("<property name=\"geometry\" >\n<rect><x>0</x><y>0</y><width>")
- << NewFormWidth << QStringLiteral("</width><height>") << NewFormHeight << QStringLiteral("</height></rect>\n</property>\n");
- str << QStringLiteral("<property name=\"windowTitle\" >\n<string>") << name << QStringLiteral("</string>\n</property>\n");
-
- if (similarClassName == QStringLiteral("QMainWindow")) {
- str << QStringLiteral("<widget class=\"QWidget\" name=\"centralwidget\" />\n");
- } else {
- if (similarClassName == QStringLiteral("QWizard"))
- str << QStringLiteral("<widget class=\"QWizardPage\" name=\"wizardPage1\" /><widget class=\"QWizardPage\" name=\"wizardPage2\" />\n");
- }
- str << QStringLiteral("</widget>\n</ui>\n");
+ QString rc;
+ QTextStream str(&rc);
+ str << R"(<ui version="4.0"><class>)" << name << "</class>"
+ << R"(<widget class=")" << className << R"(" name=")" << name << R"(">)"
+ << R"(<property name="geometry" ><rect><x>0</x><y>0</y><width>)"
+ << NewFormWidth << "</width><height>" << NewFormHeight << "</height></rect></property>"
+ << R"(<property name="windowTitle"><string>)" << name << "</string></property>\n";
+
+ if (similarClassName == QLatin1String("QMainWindow")) {
+ str << R"(<widget class="QWidget" name="centralwidget"/>)";
+ } else if (similarClassName == QLatin1String("QWizard")) {
+ str << R"(<widget class="QWizardPage" name="wizardPage1"/><widget class="QWizardPage" name="wizardPage2"/>)";
+ } else if (similarClassName == QLatin1String("QDockWidget")) {
+ str << R"(<widget class="QWidget" name="dockWidgetContents"/>)";
}
+ str << "</widget></ui>\n";
return rc;
}
@@ -655,9 +655,9 @@ QString WidgetDataBase::scaleFormTemplate(const QString &xml, const QSize &size,
const QString geometryPropertyName = QStringLiteral("geometry");
const QString minimumSizePropertyName = QStringLiteral("minimumSize");
const QString maximumSizePropertyName = QStringLiteral("maximumSize");
- DomProperty *geomProperty = 0;
- DomProperty *minimumSizeProperty = 0;
- DomProperty *maximumSizeProperty = 0;
+ DomProperty *geomProperty = nullptr;
+ DomProperty *minimumSizeProperty = nullptr;
+ DomProperty *maximumSizeProperty = nullptr;
auto properties = domWidget->elementProperty();
for (DomProperty *p : properties) {
@@ -768,10 +768,10 @@ QDESIGNER_SHARED_EXPORT QDesignerWidgetDataBaseItemInterface *
if (className.isEmpty() || baseClassName.isEmpty()) {
qWarning("** WARNING %s called with an empty class names: '%s' extends '%s'.",
Q_FUNC_INFO, className.toUtf8().constData(), baseClassName.toUtf8().constData());
- return 0;
+ return nullptr;
}
// Check whether item already exists.
- QDesignerWidgetDataBaseItemInterface *derivedItem = 0;
+ QDesignerWidgetDataBaseItemInterface *derivedItem = nullptr;
const int existingIndex = db->indexOfClassName(className);
if ( existingIndex != -1)
derivedItem = db->item(existingIndex);
@@ -800,7 +800,7 @@ QDESIGNER_SHARED_EXPORT QDesignerWidgetDataBaseItemInterface *
if (baseIndex == -1) {
if (debugWidgetDataBase)
qDebug() << "appendDerived failed due to missing base class";
- return 0;
+ return nullptr;
}
const QDesignerWidgetDataBaseItemInterface *baseItem = db->item(baseIndex);
derivedItem = WidgetDataBaseItem::clone(baseItem);
diff --git a/src/designer/src/lib/shared/widgetdatabase_p.h b/src/designer/src/lib/shared/widgetdatabase_p.h
index 95c363860..73f00b6b6 100644
--- a/src/designer/src/lib/shared/widgetdatabase_p.h
+++ b/src/designer/src/lib/shared/widgetdatabase_p.h
@@ -64,45 +64,45 @@ public:
explicit WidgetDataBaseItem(const QString &name = QString(),
const QString &group = QString());
- QString name() const;
- void setName(const QString &name);
+ QString name() const override;
+ void setName(const QString &name) override;
- QString group() const;
- void setGroup(const QString &group);
+ QString group() const override;
+ void setGroup(const QString &group) override;
- QString toolTip() const;
- void setToolTip(const QString &toolTip);
+ QString toolTip() const override;
+ void setToolTip(const QString &toolTip) override;
- QString whatsThis() const;
- void setWhatsThis(const QString &whatsThis);
+ QString whatsThis() const override;
+ void setWhatsThis(const QString &whatsThis) override;
- QString includeFile() const;
- void setIncludeFile(const QString &includeFile);
+ QString includeFile() const override;
+ void setIncludeFile(const QString &includeFile) override;
- QIcon icon() const;
- void setIcon(const QIcon &icon);
+ QIcon icon() const override;
+ void setIcon(const QIcon &icon) override;
- bool isCompat() const;
- void setCompat(bool compat);
+ bool isCompat() const override;
+ void setCompat(bool compat) override;
- bool isContainer() const;
- void setContainer(bool b);
+ bool isContainer() const override;
+ void setContainer(bool b) override;
- bool isCustom() const;
- void setCustom(bool b);
+ bool isCustom() const override;
+ void setCustom(bool b) override;
- QString pluginPath() const;
- void setPluginPath(const QString &path);
+ QString pluginPath() const override;
+ void setPluginPath(const QString &path) override;
- bool isPromoted() const;
- void setPromoted(bool b);
+ bool isPromoted() const override;
+ void setPromoted(bool b) override;
- QString extends() const;
- void setExtends(const QString &s);
+ QString extends() const override;
+ void setExtends(const QString &s) override;
- void setDefaultPropertyValues(const QList<QVariant> &list);
- QList<QVariant> defaultPropertyValues() const;
+ void setDefaultPropertyValues(const QList<QVariant> &list) override;
+ QList<QVariant> defaultPropertyValues() const override;
static WidgetDataBaseItem *clone(const QDesignerWidgetDataBaseItemInterface *item);
@@ -136,7 +136,7 @@ private:
enum IncludeType { IncludeLocal, IncludeGlobal };
-typedef QPair<QString, IncludeType> IncludeSpecification;
+using IncludeSpecification = QPair<QString, IncludeType>;
QDESIGNER_SHARED_EXPORT IncludeSpecification includeSpecification(QString includeFile);
QDESIGNER_SHARED_EXPORT QString buildIncludeFile(QString includeFile, IncludeType includeType);
@@ -145,7 +145,7 @@ class QDESIGNER_SHARED_EXPORT WidgetDataBase: public QDesignerWidgetDataBaseInte
{
Q_OBJECT
public:
- explicit WidgetDataBase(QDesignerFormEditorInterface *core, QObject *parent = 0);
+ explicit WidgetDataBase(QDesignerFormEditorInterface *core, QObject *parent = nullptr);
~WidgetDataBase() override;
QDesignerFormEditorInterface *core() const override;
@@ -184,7 +184,7 @@ QDESIGNER_SHARED_EXPORT QDesignerWidgetDataBaseItemInterface
bool promoted,
bool custom);
-typedef QList<QDesignerWidgetDataBaseItemInterface*> WidgetDataBaseItemList;
+using WidgetDataBaseItemList = QList<QDesignerWidgetDataBaseItemInterface *>;
QDESIGNER_SHARED_EXPORT WidgetDataBaseItemList
promotionCandidates(const QDesignerWidgetDataBaseInterface *db,
diff --git a/src/designer/src/lib/shared/widgetfactory.cpp b/src/designer/src/lib/shared/widgetfactory.cpp
index c467aeaaf..14cd72124 100644
--- a/src/designer/src/lib/shared/widgetfactory.cpp
+++ b/src/designer/src/lib/shared/widgetfactory.cpp
@@ -194,8 +194,8 @@ const char *WidgetFactory::disableStyleCustomPaintingPropertyC = "_q_custom_styl
WidgetFactory::WidgetFactory(QDesignerFormEditorInterface *core, QObject *parent)
: QDesignerWidgetFactoryInterface(parent),
m_core(core),
- m_formWindow(0),
- m_currentStyle(0)
+ m_formWindow(nullptr),
+ m_currentStyle(nullptr)
{
}
@@ -223,13 +223,13 @@ QObject* WidgetFactory::createObject(const QString &className, QObject* parent)
{
if (className.isEmpty()) {
qWarning("** WARNING %s called with an empty class name", Q_FUNC_INFO);
- return 0;
+ return nullptr;
}
if (className == m_strings.m_qAction)
return new QAction(parent);
if (className == m_strings.m_qButtonGroup)
return new QButtonGroup(parent);
- return 0;
+ return nullptr;
}
// Check for mismatched class names in plugins, which is hard to track.
@@ -256,7 +256,7 @@ QWidget* WidgetFactory::createCustomWidget(const QString &className, QWidget *p
*creationError = false;
CustomWidgetFactoryMap::const_iterator it = m_customFactory.constFind(className);
if (it == m_customFactory.constEnd())
- return 0;
+ return nullptr;
QDesignerCustomWidgetInterface *factory = it.value();
QWidget *rc = factory->createWidget(parentWidget);
@@ -264,7 +264,7 @@ QWidget* WidgetFactory::createCustomWidget(const QString &className, QWidget *p
if (!rc) {
*creationError = true;
designerWarning(tr("The custom widget factory registered for widgets of class %1 returned 0.").arg(className));
- return 0;
+ return nullptr;
}
// Figure out the base class unless it is known
static QSet<QString> knownCustomClasses;
@@ -278,7 +278,7 @@ QWidget* WidgetFactory::createCustomWidget(const QString &className, QWidget *p
// over.
if (mo && mo->className() == className)
mo = mo->superClass();
- while (mo != 0) {
+ while (mo != nullptr) {
if (core()->widgetDataBase()->indexOfClassName(mo->className()) != -1) {
wdb->item(widgetInfoIndex)->setExtends(mo->className());
break;
@@ -310,25 +310,23 @@ QWidget *WidgetFactory::createWidget(const QString &widgetName, QWidget *parentW
{
if (widgetName.isEmpty()) {
qWarning("** WARNING %s called with an empty class name", Q_FUNC_INFO);
- return 0;
+ return nullptr;
}
// Preview or for form window?
QDesignerFormWindowInterface *fw = m_formWindow;
if (! fw)
fw = QDesignerFormWindowInterface::findFormWindow(parentWidget);
- QWidget *w = 0;
+ QWidget *w = nullptr;
do {
// 1) custom. If there is an explicit failure(factory wants to indicate something is wrong),
// return 0, do not try to find fallback, which might be worse in the case of Q3 widget.
bool customWidgetCreationError;
w = createCustomWidget(widgetName, parentWidget, &customWidgetCreationError);
- if (w) {
+ if (w)
break;
- } else {
- if (customWidgetCreationError)
- return 0;
- }
+ if (customWidgetCreationError)
+ return nullptr;
// 2) Special widgets
if (widgetName == m_strings.m_line) {
@@ -392,7 +390,7 @@ QWidget *WidgetFactory::createWidget(const QString &widgetName, QWidget *parentW
const QString fallBackBaseClass = m_strings.m_qWidget;
QDesignerWidgetDataBaseInterface *db = core()->widgetDataBase();
QDesignerWidgetDataBaseItemInterface *item = db->item(db->indexOfClassName(widgetName));
- if (item == 0) {
+ if (item == nullptr) {
// Emergency: Create, derived from QWidget
QString includeFile = widgetName.toLower();
includeFile += QStringLiteral(".h");
@@ -411,7 +409,7 @@ QWidget *WidgetFactory::createWidget(const QString &widgetName, QWidget *parentW
}
} while (false);
- Q_ASSERT(w != 0);
+ Q_ASSERT(w != nullptr);
if (m_currentStyle)
w->setStyle(m_currentStyle);
initializeCommon(w);
@@ -425,7 +423,7 @@ QWidget *WidgetFactory::createWidget(const QString &widgetName, QWidget *parentW
QString WidgetFactory::classNameOf(QDesignerFormEditorInterface *c, const QObject* o)
{
- if (o == 0)
+ if (o == nullptr)
return QString();
const char *className = o->metaObject()->className();
@@ -468,7 +466,7 @@ QLayout *WidgetFactory::createUnmanagedLayout(QWidget *parentWidget, int type)
Q_ASSERT(0);
break;
}
- return 0;
+ return nullptr;
}
@@ -480,7 +478,7 @@ QLayout *WidgetFactory::createLayout(QWidget *widget, QLayout *parentLayout, int
{
QDesignerMetaDataBaseInterface *metaDataBase = core()->metaDataBase();
- if (parentLayout == 0) {
+ if (parentLayout == nullptr) {
QWidget *page = containerOfWidget(widget);
if (page) {
widget = page;
@@ -493,13 +491,13 @@ QLayout *WidgetFactory::createLayout(QWidget *widget, QLayout *parentLayout, int
}
}
- Q_ASSERT(metaDataBase->item(widget) != 0); // ensure the widget is managed
+ Q_ASSERT(metaDataBase->item(widget) != nullptr); // ensure the widget is managed
- if (parentLayout == 0 && metaDataBase->item(widget->layout()) == 0) {
+ if (parentLayout == nullptr && metaDataBase->item(widget->layout()) == nullptr) {
parentLayout = widget->layout();
}
- QWidget *parentWidget = parentLayout != 0 ? 0 : widget;
+ QWidget *parentWidget = parentLayout != nullptr ? nullptr : widget;
QLayout *layout = createUnmanagedLayout(parentWidget, type);
metaDataBase->add(layout); // add the layout in the MetaDataBase
@@ -520,15 +518,15 @@ QLayout *WidgetFactory::createLayout(QWidget *widget, QLayout *parentLayout, int
sheet->setChanged(index, true);
}
- if (metaDataBase->item(widget->layout()) == 0) {
- Q_ASSERT(layout->parent() == 0);
+ if (metaDataBase->item(widget->layout()) == nullptr) {
+ Q_ASSERT(layout->parent() == nullptr);
QBoxLayout *box = qobject_cast<QBoxLayout*>(widget->layout());
if (!box) { // we support only unmanaged box layouts
const QString msg = tr("Attempt to add a layout to a widget '%1' (%2) which already has an unmanaged layout of type %3.\n"
"This indicates an inconsistency in the ui-file.").
arg(widget->objectName(), classNameOf(core(), widget), classNameOf(core(), widget->layout()));
designerWarning(msg);
- return 0;
+ return nullptr;
}
box->addLayout(layout);
}
@@ -565,13 +563,13 @@ QWidget* WidgetFactory::widgetOfContainer(QWidget *w) const
{
// ### cleanup
if (!w)
- return 0;
+ return nullptr;
if (w->parentWidget() && w->parentWidget()->parentWidget() &&
w->parentWidget()->parentWidget()->parentWidget() &&
qobject_cast<QToolBox*>(w->parentWidget()->parentWidget()->parentWidget()))
return w->parentWidget()->parentWidget()->parentWidget();
- while (w != 0) {
+ while (w != nullptr) {
if (core()->widgetDataBase()->isContainer(w) ||
(w && qobject_cast<QDesignerFormWindowInterface*>(w->parentWidget())))
return w;
@@ -708,7 +706,7 @@ static inline bool isApplicationStyle(const QString &styleName)
void WidgetFactory::setStyleName(const QString &styleName)
{
- m_currentStyle = isApplicationStyle(styleName) ? static_cast<QStyle*>(0) : getStyle(styleName);
+ m_currentStyle = isApplicationStyle(styleName) ? nullptr : getStyle(styleName);
}
QStyle *WidgetFactory::style() const
@@ -727,7 +725,7 @@ QStyle *WidgetFactory::getStyle(const QString &styleName)
if (!style) {
const QString msg = tr("Cannot create style '%1'.").arg(styleName);
designerWarning(msg);
- return 0;
+ return nullptr;
}
it = m_styleCache.insert(styleName, style);
}
diff --git a/src/designer/src/lib/shared/widgetfactory_p.h b/src/designer/src/lib/shared/widgetfactory_p.h
index 1d3c17bdf..e9fd4bfe6 100644
--- a/src/designer/src/lib/shared/widgetfactory_p.h
+++ b/src/designer/src/lib/shared/widgetfactory_p.h
@@ -66,7 +66,7 @@ class QDESIGNER_SHARED_EXPORT WidgetFactory: public QDesignerWidgetFactoryInterf
{
Q_OBJECT
public:
- explicit WidgetFactory(QDesignerFormEditorInterface *core, QObject *parent = 0);
+ explicit WidgetFactory(QDesignerFormEditorInterface *core, QObject *parent = nullptr);
~WidgetFactory();
QWidget* containerOfWidget(QWidget *widget) const override;
@@ -154,13 +154,13 @@ private:
const Strings m_strings;
QDesignerFormEditorInterface *m_core;
- typedef QMap<QString, QDesignerCustomWidgetInterface*> CustomWidgetFactoryMap;
+ using CustomWidgetFactoryMap = QMap<QString, QDesignerCustomWidgetInterface*>;
CustomWidgetFactoryMap m_customFactory;
QDesignerFormWindowInterface *m_formWindow;
// Points to the cached style or 0 if the default (qApp) is active
QStyle *m_currentStyle;
- typedef QHash<QString, QStyle *> StyleCache;
+ using StyleCache = QHash<QString, QStyle *>;
StyleCache m_styleCache;
};
diff --git a/src/designer/src/lib/shared/zoomwidget.cpp b/src/designer/src/lib/shared/zoomwidget.cpp
index d3e66ab6d..fef509a39 100644
--- a/src/designer/src/lib/shared/zoomwidget.cpp
+++ b/src/designer/src/lib/shared/zoomwidget.cpp
@@ -43,8 +43,8 @@
QT_BEGIN_NAMESPACE
-typedef QList<QAction*> ActionList;
-typedef QList<QGraphicsItem *> GraphicsItemList;
+using ActionList = QList<QAction *>;
+using GraphicsItemList = QList<QGraphicsItem *>;
enum { debugZoomWidget = 0 };
@@ -120,11 +120,7 @@ QVector<int> ZoomMenu::zoomValues()
// --------- ZoomView
ZoomView::ZoomView(QWidget *parent) :
QGraphicsView(parent),
- m_scene(new QGraphicsScene(this)),
- m_zoom(100),
- m_zoomFactor(1.0),
- m_zoomContextMenuEnabled(false),
- m_zoomMenu(0)
+ m_scene(new QGraphicsScene(this))
{
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@@ -259,7 +255,7 @@ QVariant ZoomProxyWidget::itemChange(GraphicsItemChange change, const QVariant &
static const char *zoomedEventFilterRedirectorNameC = "__qt_ZoomedEventFilterRedirector";
class ZoomedEventFilterRedirector : public QObject {
- Q_DISABLE_COPY(ZoomedEventFilterRedirector)
+ Q_DISABLE_COPY_MOVE(ZoomedEventFilterRedirector)
public:
explicit ZoomedEventFilterRedirector(ZoomWidget *zw, QObject *parent);
@@ -285,11 +281,7 @@ bool ZoomedEventFilterRedirector::eventFilter(QObject *watched, QEvent *event)
// --------- ZoomWidget
ZoomWidget::ZoomWidget(QWidget *parent) :
- ZoomView(parent),
- m_proxy(0),
- m_viewResizeBlocked(false),
- m_widgetResizeBlocked(false),
- m_widgetZoomContextMenuEnabled(false)
+ ZoomView(parent)
{
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@@ -310,7 +302,7 @@ void ZoomWidget::setWidget(QWidget *w, Qt::WindowFlags wFlags)
m_proxy->deleteLater();
}
// Set window flags on the outer proxy for them to take effect
- m_proxy = createProxyWidget(0, Qt::Window);
+ m_proxy = createProxyWidget(nullptr, Qt::Window);
m_proxy->setWidget(w);
m_proxy->setWindowFlags(wFlags);
diff --git a/src/designer/src/lib/shared/zoomwidget_p.h b/src/designer/src/lib/shared/zoomwidget_p.h
index abc3dae0a..774528069 100644
--- a/src/designer/src/lib/shared/zoomwidget_p.h
+++ b/src/designer/src/lib/shared/zoomwidget_p.h
@@ -59,10 +59,10 @@ namespace qdesigner_internal {
class QDESIGNER_SHARED_EXPORT ZoomMenu : public QObject {
Q_OBJECT
- Q_DISABLE_COPY(ZoomMenu)
+ Q_DISABLE_COPY_MOVE(ZoomMenu)
public:
- ZoomMenu(QObject *parent = 0);
+ ZoomMenu(QObject *parent = nullptr);
void addActions(QMenu *m);
int zoom() const;
@@ -92,9 +92,9 @@ class QDESIGNER_SHARED_EXPORT ZoomView : public QGraphicsView
Q_PROPERTY(int zoom READ zoom WRITE setZoom DESIGNABLE true SCRIPTABLE true)
Q_PROPERTY(bool zoomContextMenuEnabled READ isZoomContextMenuEnabled WRITE setZoomContextMenuEnabled DESIGNABLE true SCRIPTABLE true)
Q_OBJECT
- Q_DISABLE_COPY(ZoomView)
+ Q_DISABLE_COPY_MOVE(ZoomView)
public:
- ZoomView(QWidget *parent = 0);
+ ZoomView(QWidget *parent = nullptr);
/* Zoom in percent (for easily implementing menus) and qreal zoomFactor
* in sync */
@@ -120,28 +120,27 @@ public slots:
void showContextMenu(const QPoint &globalPos);
protected:
- void contextMenuEvent(QContextMenuEvent *event);
+ void contextMenuEvent(QContextMenuEvent *event) override;
// Overwrite for implementing additional behaviour when doing setZoom();
virtual void applyZoom();
private:
QGraphicsScene *m_scene;
- int m_zoom;
- qreal m_zoomFactor;
+ int m_zoom = 100;
+ qreal m_zoomFactor = 1;
- bool m_zoomContextMenuEnabled;
- bool m_resizeBlocked;
- ZoomMenu *m_zoomMenu;
+ bool m_zoomContextMenuEnabled = false;
+ ZoomMenu *m_zoomMenu = nullptr;
};
/* The proxy widget used in ZoomWidget. It refuses to move away from 0,0,
* This behaviour is required for Windows only. */
class QDESIGNER_SHARED_EXPORT ZoomProxyWidget : public QGraphicsProxyWidget {
- Q_DISABLE_COPY(ZoomProxyWidget)
+ Q_DISABLE_COPY_MOVE(ZoomProxyWidget)
public:
- explicit ZoomProxyWidget(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
+ explicit ZoomProxyWidget(QGraphicsItem *parent = nullptr, Qt::WindowFlags wFlags = {});
protected:
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
@@ -161,11 +160,11 @@ class QDESIGNER_SHARED_EXPORT ZoomWidget : public ZoomView
Q_PROPERTY(bool widgetZoomContextMenuEnabled READ isWidgetZoomContextMenuEnabled WRITE setWidgetZoomContextMenuEnabled DESIGNABLE true SCRIPTABLE true)
Q_PROPERTY(bool itemAcceptDrops READ itemAcceptDrops WRITE setItemAcceptDrops DESIGNABLE true SCRIPTABLE true)
Q_OBJECT
- Q_DISABLE_COPY(ZoomWidget)
+ Q_DISABLE_COPY_MOVE(ZoomWidget)
public:
- ZoomWidget(QWidget *parent = 0);
- void setWidget(QWidget *w, Qt::WindowFlags wFlags = 0);
+ ZoomWidget(QWidget *parent = nullptr);
+ void setWidget(QWidget *w, Qt::WindowFlags wFlags = {});
const QGraphicsProxyWidget *proxy() const { return m_proxy; }
QGraphicsProxyWidget *proxy() { return m_proxy; }
@@ -197,18 +196,19 @@ protected:
private:
// Factory function for QGraphicsProxyWidgets which can be overwritten. Default creates a ZoomProxyWidget
- virtual QGraphicsProxyWidget *createProxyWidget(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0) const;
- QSize widgetSizeToViewSize(const QSize &s, bool *ptrToValid = 0) const;
+ virtual QGraphicsProxyWidget *createProxyWidget(QGraphicsItem *parent = nullptr,
+ Qt::WindowFlags wFlags = {}) const;
+ QSize widgetSizeToViewSize(const QSize &s, bool *ptrToValid = nullptr) const;
void resizeToWidgetSize();
QSize viewPortMargin() const;
QSize widgetSize() const;
QSizeF widgetDecorationSizeF() const;
- QGraphicsProxyWidget *m_proxy;
- bool m_viewResizeBlocked;
- bool m_widgetResizeBlocked;
- bool m_widgetZoomContextMenuEnabled;
+ QGraphicsProxyWidget *m_proxy = nullptr;
+ bool m_viewResizeBlocked = false;
+ bool m_widgetResizeBlocked = false;
+ bool m_widgetZoomContextMenuEnabled = false;
};
} // namespace qdesigner_internal
diff --git a/src/designer/src/lib/uilib/abstractformbuilder.cpp b/src/designer/src/lib/uilib/abstractformbuilder.cpp
index 683335432..e57237dd0 100644
--- a/src/designer/src/lib/uilib/abstractformbuilder.cpp
+++ b/src/designer/src/lib/uilib/abstractformbuilder.cpp
@@ -199,7 +199,7 @@ QWidget *QAbstractFormBuilder::load(QIODevice *dev, QWidget *parentWidget)
*/
QWidget *QAbstractFormBuilder::create(DomUI *ui, QWidget *parentWidget)
{
- typedef QFormBuilderExtra::ButtonGroupHash ButtonGroupHash;
+ using ButtonGroupHash = QFormBuilderExtra::ButtonGroupHash;
d->clear();
if (const DomLayoutDefault *def = ui->elementLayoutDefault()) {
@@ -209,7 +209,7 @@ QWidget *QAbstractFormBuilder::create(DomUI *ui, QWidget *parentWidget)
DomWidget *ui_widget = ui->elementWidget();
if (!ui_widget)
- return 0;
+ return nullptr;
initialize(ui);
@@ -234,7 +234,7 @@ QWidget *QAbstractFormBuilder::create(DomUI *ui, QWidget *parentWidget)
return widget;
}
d->clear();
- return 0;
+ return nullptr;
}
/*!
@@ -263,7 +263,7 @@ QWidget *QAbstractFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidge
{
QWidget *w = createWidget(ui_widget->attributeClass(), parentWidget, ui_widget->attributeName());
if (!w)
- return 0;
+ return nullptr;
applyProperties(w, ui_widget->elementProperty());
@@ -292,7 +292,7 @@ QWidget *QAbstractFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidge
const auto &elementLayout = ui_widget->elementLayout();
for (DomLayout *ui_lay : elementLayout) {
- QLayout *child_lay = create(ui_lay, 0, w);
+ QLayout *child_lay = create(ui_lay, nullptr, w);
Q_UNUSED( child_lay );
}
@@ -348,7 +348,7 @@ QAction *QAbstractFormBuilder::create(DomAction *ui_action, QObject *parent)
{
QAction *a = createAction(parent, ui_action->attributeName());
if (!a)
- return 0;
+ return nullptr;
d->m_actions.insert(ui_action->attributeName(), a);
applyProperties(a, ui_action->elementProperty());
@@ -362,7 +362,7 @@ QActionGroup *QAbstractFormBuilder::create(DomActionGroup *ui_action_group, QObj
{
QActionGroup *a = createActionGroup(parent, ui_action_group->attributeName());
if (!a)
- return 0;
+ return nullptr;
d->m_actionGroups.insert(ui_action_group->attributeName(), a);
applyProperties(a, ui_action_group->elementProperty());
@@ -391,7 +391,8 @@ Qt::ToolBarArea QAbstractFormBuilder::toolbarAreaFromDOMAttributes(const DomProp
case DomProperty::Number:
return static_cast<Qt::ToolBarArea>(attr->elementNumber());
case DomProperty::Enum:
- return enumKeyOfObjectToValue<QAbstractFormBuilderGadget, Qt::ToolBarArea>("toolBarArea", attr->elementEnum().toLatin1());
+ return enumKeyOfObjectToValue<QAbstractFormBuilderGadget, Qt::ToolBarArea>("toolBarArea",
+ attr->elementEnum().toLatin1().constData());
default:
break;
}
@@ -406,7 +407,7 @@ bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidge
const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
const DomPropertyHash attributes = propertyMap(ui_widget->elementAttribute());
- if (parentWidget == 0)
+ if (parentWidget == nullptr)
return true;
// Check special cases. First: Custom container
const QString className = QLatin1String(parentWidget->metaObject()->className());
@@ -478,7 +479,7 @@ bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidge
#if QT_CONFIG(tabwidget)
else if (QTabWidget *tabWidget = qobject_cast<QTabWidget*>(parentWidget)) {
- widget->setParent(0);
+ widget->setParent(nullptr);
const int tabIndex = tabWidget->count();
if (const DomProperty *titleP = attributes.value(strings.titleAttribute, 0))
@@ -636,10 +637,10 @@ QLayout *QAbstractFormBuilder::create(DomLayout *ui_layout, QLayout *parentLayou
{
QObject *p = parentLayout;
- if (p == 0)
+ if (p == nullptr)
p = parentWidget;
- Q_ASSERT(p != 0);
+ Q_ASSERT(p != nullptr);
bool tracking = false;
@@ -650,10 +651,10 @@ QLayout *QAbstractFormBuilder::create(DomLayout *ui_layout, QLayout *parentLayou
QLayout *layout = createLayout(ui_layout->attributeClass(), p, ui_layout->hasAttributeName() ? ui_layout->attributeName() : QString());
- if (layout == 0)
+ if (layout == nullptr)
return 0;
- if (tracking && layout->parent() == 0) {
+ if (tracking && layout->parent() == nullptr) {
QBoxLayout *box = qobject_cast<QBoxLayout*>(parentWidget->layout());
if (!box) { // only QBoxLayout is supported
const QString widgetClass = QString::fromUtf8(parentWidget->metaObject()->className());
@@ -662,7 +663,7 @@ QLayout *QAbstractFormBuilder::create(DomLayout *ui_layout, QLayout *parentLayou
"This indicates an inconsistency in the ui-file.").
arg(parentWidget->objectName(), widgetClass, layoutClass);
uiLibWarning(msg);
- return 0;
+ return nullptr;
}
box->addLayout(layout);
}
@@ -793,7 +794,7 @@ static inline QString alignmentValue(Qt::Alignment a)
static inline Qt::Alignment alignmentFromDom(const QString &in)
{
- Qt::Alignment rc = 0;
+ Qt::Alignment rc = nullptr;
if (!in.isEmpty()) {
const QVector<QStringRef> flags = in.splitRef(QLatin1Char('|'));
for (const QStringRef &f : flags) {
@@ -871,7 +872,7 @@ QLayoutItem *QAbstractFormBuilder::create(DomLayoutItem *ui_layoutItem, QLayout
return item;
}
qWarning() << QCoreApplication::translate("QAbstractFormBuilder", "Empty widget item in %1 '%2'.").arg(QString::fromUtf8(layout->metaObject()->className()), layout->objectName());
- return 0;
+ return nullptr;
}
case DomLayoutItem::Spacer: {
QSize size(0, 0);
@@ -897,7 +898,7 @@ QLayoutItem *QAbstractFormBuilder::create(DomLayoutItem *ui_layoutItem, QLayout
}
}
- QSpacerItem *spacer = 0;
+ QSpacerItem *spacer = nullptr;
if (isVspacer)
spacer = new QSpacerItem(size.width(), size.height(), QSizePolicy::Minimum, sizeType);
else
@@ -911,7 +912,7 @@ QLayoutItem *QAbstractFormBuilder::create(DomLayoutItem *ui_layoutItem, QLayout
break;
}
- return 0;
+ return nullptr;
}
/*!
@@ -1017,7 +1018,8 @@ QBrush QAbstractFormBuilder::setupBrush(DomBrush *brush)
if (!brush->hasAttributeBrushStyle())
return br;
- const Qt::BrushStyle style = enumKeyOfObjectToValue<QAbstractFormBuilderGadget, Qt::BrushStyle>("brushStyle", brush->attributeBrushStyle().toLatin1());
+ const Qt::BrushStyle style = enumKeyOfObjectToValue<QAbstractFormBuilderGadget, Qt::BrushStyle>("brushStyle",
+ brush->attributeBrushStyle().toLatin1().constData());
if (style == Qt::LinearGradientPattern ||
style == Qt::RadialGradientPattern ||
@@ -1030,7 +1032,7 @@ QBrush QAbstractFormBuilder::setupBrush(DomBrush *brush)
const QGradient::Type type = enumKeyToValue<QGradient::Type>(gradientType_enum, gradient->attributeType().toLatin1());
- QGradient *gr = 0;
+ QGradient *gr = nullptr;
if (type == QGradient::LinearGradient) {
gr = new QLinearGradient(QPointF(gradient->attributeStartX(), gradient->attributeStartY()),
@@ -1159,7 +1161,7 @@ QWidget *QAbstractFormBuilder::createWidget(const QString &widgetName, QWidget *
Q_UNUSED(widgetName);
Q_UNUSED(parentWidget);
Q_UNUSED(name);
- return 0;
+ return nullptr;
}
/*!
@@ -1170,7 +1172,7 @@ QLayout *QAbstractFormBuilder::createLayout(const QString &layoutName, QObject *
Q_UNUSED(layoutName);
Q_UNUSED(parent);
Q_UNUSED(name);
- return 0;
+ return nullptr;
}
/*!
@@ -1199,12 +1201,27 @@ QActionGroup *QAbstractFormBuilder::createActionGroup(QObject *parent, const QSt
Saves an XML representation of the given \a widget to the
specified \a device in the standard UI file format.
+ \note Unlike when saving a form in Qt Designer, all property values are
+ written. This is because, the state of whether a property value was
+ modified or not isn't stored in the Qt property system. The widget that
+ is being saved, could have been created dynamically, not loaded via
+ \l load(), so in this case the form builder isn't aware of the list of
+ changed properties. Also, there's no generic way to do this for widgets
+ that were created dynamically.
+
+ Therefore, you should remove properties that are not required from your
+ resulting XML files, before loading them. Alternatively, if you already
+ know which properties you want to save when you call this method,
+ you can overload \l computeProperties() and return a filtered list of
+ required properties. Otherwise, unexpected behavior may occur as some
+ of these properties may depend on each other.
+
\sa load()
*/
void QAbstractFormBuilder::save(QIODevice *dev, QWidget *widget)
{
- DomWidget *ui_widget = createDom(widget, 0);
- Q_ASSERT( ui_widget != 0 );
+ DomWidget *ui_widget = createDom(widget, nullptr);
+ Q_ASSERT( ui_widget != nullptr );
DomUI *ui = new DomUI();
ui->setAttributeVersion(QStringLiteral("4.0"));
@@ -1270,7 +1287,7 @@ DomWidget *QAbstractFormBuilder::createDom(QWidget *widget, DomWidget *ui_parent
if (recursive) {
if (QLayout *layout = widget->layout()) {
- if (DomLayout *ui_layout = createDom(layout, 0, ui_parentWidget)) {
+ if (DomLayout *ui_layout = createDom(layout, nullptr, ui_parentWidget)) {
QVector<DomLayout *> ui_layouts;
ui_layouts.append(ui_layout);
@@ -1336,7 +1353,7 @@ DomWidget *QAbstractFormBuilder::createDom(QWidget *widget, DomWidget *ui_parent
ui_widgets.append(ui_child);
}
} else if (QAction *childAction = qobject_cast<QAction*>(obj)) {
- if (childAction->actionGroup() != 0) {
+ if (childAction->actionGroup() != nullptr) {
// it will be added later.
continue;
}
@@ -1380,7 +1397,7 @@ DomActionRef *QAbstractFormBuilder::createActionRefDom(QAction *action)
{
QString name = action->objectName();
- if (action->menu() != 0)
+ if (action->menu() != nullptr)
name = action->menu()->objectName();
DomActionRef *ui_action_ref = new DomActionRef();
@@ -1394,16 +1411,16 @@ DomActionRef *QAbstractFormBuilder::createActionRefDom(QAction *action)
// Struct to store layout item parameters for saving layout items
struct FormBuilderSaveLayoutEntry {
- explicit FormBuilderSaveLayoutEntry(QLayoutItem *li = 0) :
- item(li), row(-1), column(-1), rowSpan(0), columnSpan(0), alignment(0) {}
+ explicit FormBuilderSaveLayoutEntry(QLayoutItem *li = nullptr) :
+ item(li) {}
void setAlignment(Qt::Alignment al);
QLayoutItem *item;
- int row;
- int column;
- int rowSpan;
- int columnSpan;
+ int row = -1;
+ int column = -1;
+ int rowSpan = 0;
+ int columnSpan = 0;
Qt::Alignment alignment;
};
@@ -1559,7 +1576,7 @@ DomSpacer *QAbstractFormBuilder::createDom(QSpacerItem *spacer, DomLayout *ui_la
DomSpacer *ui_spacer = new DomSpacer();
QList<DomProperty*> properties;
- DomProperty *prop = 0;
+ DomProperty *prop = nullptr;
const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
// sizeHint property
prop = new DomProperty();
@@ -1585,7 +1602,7 @@ DomSpacer *QAbstractFormBuilder::createDom(QSpacerItem *spacer, DomLayout *ui_la
DomProperty *QAbstractFormBuilder::createProperty(QObject *obj, const QString &pname, const QVariant &v)
{
if (!checkProperty(obj, pname)) {
- return 0;
+ return nullptr;
}
return variantToDomProperty(this, obj->metaObject(), pname, v);
}
@@ -1616,7 +1633,7 @@ QList<DomProperty*> QAbstractFormBuilder::computeProperties(QObject *obj)
const QVariant v = prop.read(obj);
- DomProperty *dom_prop = 0;
+ DomProperty *dom_prop = nullptr;
if (v.type() == QVariant::Int) {
dom_prop = new DomProperty();
@@ -1716,7 +1733,7 @@ void QAbstractFormBuilder::applyTabStops(QWidget *widget, DomTabStops *tabStops)
*/
DomCustomWidgets *QAbstractFormBuilder::saveCustomWidgets()
{
- return 0;
+ return nullptr;
}
/*!
@@ -1724,7 +1741,7 @@ DomCustomWidgets *QAbstractFormBuilder::saveCustomWidgets()
*/
DomTabStops *QAbstractFormBuilder::saveTabStops()
{
- return 0;
+ return nullptr;
}
/*!
@@ -1732,7 +1749,7 @@ DomTabStops *QAbstractFormBuilder::saveTabStops()
*/
DomResources *QAbstractFormBuilder::saveResources()
{
- return 0;
+ return nullptr;
}
/*!
@@ -1745,7 +1762,7 @@ DomButtonGroups *QAbstractFormBuilder::saveButtonGroups(const QWidget *mainConta
// Save fst order buttongroup children of maincontainer
const QObjectList &mchildren = mainContainer->children();
if (mchildren.empty())
- return 0;
+ return nullptr;
QVector<DomButtonGroup *> domGroups;
for (QObject *o : mchildren) {
if (auto bg = qobject_cast<QButtonGroup *>(o))
@@ -1753,7 +1770,7 @@ DomButtonGroups *QAbstractFormBuilder::saveButtonGroups(const QWidget *mainConta
domGroups.push_back(dg);
}
if (domGroups.empty())
- return 0;
+ return nullptr;
DomButtonGroups *rc = new DomButtonGroups;
rc->setElementButtonGroup(domGroups);
return rc;
@@ -2064,7 +2081,7 @@ void QAbstractFormBuilder::saveComboBoxExtraInfo(QComboBox *comboBox, DomWidget
void QAbstractFormBuilder::saveButtonExtraInfo(const QAbstractButton *widget, DomWidget *ui_widget, DomWidget *)
{
- typedef QList<DomProperty*> DomPropertyList;
+ using DomPropertyList = QList<DomProperty *>;
if (const QButtonGroup *buttonGroup = widget->group()) {
DomPropertyList attributes = ui_widget->elementAttribute();
DomString *domString = new DomString();
@@ -2272,7 +2289,7 @@ void QAbstractFormBuilder::loadTreeWidgetExtraInfo(DomWidget *ui_widget, QTreeWi
const DomItem *domItem = pair.first;
QTreeWidgetItem *parentItem = pair.second;
- QTreeWidgetItem *currentItem = 0;
+ QTreeWidgetItem *currentItem = nullptr;
if (parentItem)
currentItem = new QTreeWidgetItem(parentItem);
@@ -2387,7 +2404,7 @@ void QAbstractFormBuilder::loadComboBoxExtraInfo(DomWidget *ui_widget, QComboBox
QVariant textData;
QVariant iconData;
- DomProperty *p = 0;
+ DomProperty *p = nullptr;
p = properties.value(strings.textAttribute);
if (p && p->elementString()) {
@@ -2432,7 +2449,7 @@ static QString buttonGroupName(const DomWidget *ui_widget)
void QAbstractFormBuilder::loadButtonExtraInfo(const DomWidget *ui_widget, QAbstractButton *button, QWidget *)
{
- typedef QFormBuilderExtra::ButtonGroupHash ButtonGroupHash;
+ using ButtonGroupHash = QFormBuilderExtra::ButtonGroupHash;
const QString groupName = buttonGroupName(ui_widget);
if (groupName.isEmpty())
@@ -2448,7 +2465,7 @@ void QAbstractFormBuilder::loadButtonExtraInfo(const DomWidget *ui_widget, QAbst
}
// Create button group on demand?
QButtonGroup *&group = it.value().second;
- if (group == 0) {
+ if (group == nullptr) {
group = new QButtonGroup;
group->setObjectName(groupName);
applyProperties(group, it.value().first->elementProperty());
@@ -2598,7 +2615,7 @@ void QAbstractFormBuilder::setWorkingDirectory(const QDir &directory)
DomAction *QAbstractFormBuilder::createDom(QAction *action)
{
if (action->parentWidget() == action->menu() || action->isSeparator())
- return 0;
+ return nullptr;
DomAction *ui_action = new DomAction;
ui_action->setAttributeName(action->objectName());
@@ -2616,7 +2633,7 @@ DomAction *QAbstractFormBuilder::createDom(QAction *action)
DomButtonGroup *QAbstractFormBuilder::createDom(QButtonGroup *buttonGroup)
{
if (buttonGroup->buttons().count() == 0) // Empty group left over on form?
- return 0;
+ return nullptr;
DomButtonGroup *domButtonGroup = new DomButtonGroup;
domButtonGroup->setAttributeName(buttonGroup->objectName());
@@ -2748,7 +2765,7 @@ DomProperty* QAbstractFormBuilder::iconToDomProperty(const QIcon &icon) const
{
Q_UNUSED(icon);
qWarning() << "QAbstractFormBuilder::iconToDomProperty() is obsoleted";
- return 0;
+ return nullptr;
}
/*!
@@ -2759,7 +2776,7 @@ DomProperty* QAbstractFormBuilder::iconToDomProperty(const QIcon &icon) const
DomProperty *QAbstractFormBuilder::saveResource(const QVariant &v) const
{
if (v.isNull())
- return 0;
+ return nullptr;
DomProperty *p = resourceBuilder()->saveResource(workingDirectory(), v);
if (p)
@@ -2775,7 +2792,7 @@ DomProperty *QAbstractFormBuilder::saveResource(const QVariant &v) const
DomProperty *QAbstractFormBuilder::saveText(const QString &attributeName, const QVariant &v) const
{
if (v.isNull())
- return 0;
+ return nullptr;
DomProperty *p = textBuilder()->saveText(v);
if (p)
@@ -2799,7 +2816,7 @@ const DomResourcePixmap *QAbstractFormBuilder::domPixmap(const DomProperty* p) {
default:
break;
}
- return 0;
+ return nullptr;
}
/*!
diff --git a/src/designer/src/lib/uilib/abstractformbuilder.h b/src/designer/src/lib/uilib/abstractformbuilder.h
index a5431f13b..486359099 100644
--- a/src/designer/src/lib/uilib/abstractformbuilder.h
+++ b/src/designer/src/lib/uilib/abstractformbuilder.h
@@ -118,13 +118,15 @@ class QFormBuilderExtra;
class QDESIGNER_UILIB_EXPORT QAbstractFormBuilder
{
public:
+ Q_DISABLE_COPY(QAbstractFormBuilder)
+
QAbstractFormBuilder();
virtual ~QAbstractFormBuilder();
QDir workingDirectory() const;
void setWorkingDirectory(const QDir &directory);
- virtual QWidget *load(QIODevice *dev, QWidget *parentWidget = Q_NULLPTR);
+ virtual QWidget *load(QIODevice *dev, QWidget *parentWidget = nullptr);
virtual void save(QIODevice *dev, QWidget *widget);
QString errorString() const;
@@ -218,7 +220,7 @@ protected:
QVariant toVariant(const QMetaObject *meta, DomProperty *property);
static QString toString(const DomString *str);
- typedef QHash<QString, DomProperty*> DomPropertyHash;
+ using DomPropertyHash = QHash<QString, DomProperty*>;
static DomPropertyHash propertyMap(const QList<DomProperty*> &properties);
void setupColorGroup(QPalette &palette, QPalette::ColorGroup colorGroup, DomColorGroup *group);
@@ -239,7 +241,7 @@ protected:
// Icon/pixmap stuff
//
// A Pair of icon path/qrc path.
- typedef QPair<QString, QString> IconPaths;
+ using IconPaths = QPair<QString, QString>;
IconPaths iconPaths(const QIcon &) const;
IconPaths pixmapPaths(const QPixmap &) const;
@@ -259,9 +261,6 @@ private:
//
static Qt::ToolBarArea toolbarAreaFromDOMAttributes(const DomPropertyHash &attributeMap);
- QAbstractFormBuilder(const QAbstractFormBuilder &other);
- void operator = (const QAbstractFormBuilder &other);
-
friend QDESIGNER_UILIB_EXPORT DomProperty *variantToDomProperty(QAbstractFormBuilder *abstractFormBuilder, const QMetaObject *meta, const QString &propertyName, const QVariant &value);
friend QDESIGNER_UILIB_EXPORT QVariant domPropertyToVariant(QAbstractFormBuilder *abstractFormBuilder,const QMetaObject *meta, const DomProperty *property);
diff --git a/src/designer/src/lib/uilib/formbuilder.cpp b/src/designer/src/lib/uilib/formbuilder.cpp
index d5defe039..31bfdfde4 100644
--- a/src/designer/src/lib/uilib/formbuilder.cpp
+++ b/src/designer/src/lib/uilib/formbuilder.cpp
@@ -112,16 +112,12 @@ namespace QFormInternal {
Constructs a new form builder.
*/
-QFormBuilder::QFormBuilder()
-{
-}
+QFormBuilder::QFormBuilder() = default;
/*!
Destroys the form builder.
*/
-QFormBuilder::~QFormBuilder()
-{
-}
+QFormBuilder::~QFormBuilder() = default;
/*!
\internal
@@ -173,22 +169,22 @@ QWidget *QFormBuilder::createWidget(const QString &widgetName, QWidget *parentWi
if (widgetName.isEmpty()) {
//: Empty class name passed to widget factory method
qWarning() << QCoreApplication::translate("QFormBuilder", "An empty class name was passed on to %1 (object name: '%2').").arg(QString::fromUtf8(Q_FUNC_INFO), name);
- return 0;
+ return nullptr;
}
- QWidget *w = 0;
+ QWidget *w = nullptr;
#if QT_CONFIG(tabwidget)
if (qobject_cast<QTabWidget*>(parentWidget))
- parentWidget = 0;
+ parentWidget = nullptr;
#endif
#if QT_CONFIG(stackedwidget)
if (qobject_cast<QStackedWidget*>(parentWidget))
- parentWidget = 0;
+ parentWidget = nullptr;
#endif
#if QT_CONFIG(toolbox)
if (qobject_cast<QToolBox*>(parentWidget))
- parentWidget = 0;
+ parentWidget = nullptr;
#endif
// ### special-casing for Line (QFrame) -- fix for 4.2
@@ -220,11 +216,11 @@ QWidget *QFormBuilder::createWidget(const QString &widgetName, QWidget *parentWi
// try with a registered custom widget
QDesignerCustomWidgetInterface *factory = d->m_customWidgets.value(widgetName);
- if (factory != 0)
+ if (factory != nullptr)
w = factory->createWidget(parentWidget);
} while(false);
- if (w == 0) { // Attempt to instantiate base class of promoted/custom widgets
+ if (w == nullptr) { // Attempt to instantiate base class of promoted/custom widgets
const QString baseClassName = d->customWidgetBaseClass(widgetName);
if (!baseClassName.isEmpty()) {
qWarning() << QCoreApplication::translate("QFormBuilder", "QFormBuilder was unable to create a custom widget of the class '%1'; defaulting to base class '%2'.").arg(widgetName, baseClassName);
@@ -232,9 +228,9 @@ QWidget *QFormBuilder::createWidget(const QString &widgetName, QWidget *parentWi
}
}
- if (w == 0) { // nothing to do
+ if (w == nullptr) { // nothing to do
qWarning() << QCoreApplication::translate("QFormBuilder", "QFormBuilder was unable to create a widget of the class '%1'.").arg(widgetName);
- return 0;
+ return nullptr;
}
w->setObjectName(name);
@@ -250,7 +246,7 @@ QWidget *QFormBuilder::createWidget(const QString &widgetName, QWidget *parentWi
*/
QLayout *QFormBuilder::createLayout(const QString &layoutName, QObject *parent, const QString &name)
{
- QLayout *l = 0;
+ QLayout *l = nullptr;
QWidget *parentWidget = qobject_cast<QWidget*>(parent);
QLayout *parentLayout = qobject_cast<QLayout*>(parent);
@@ -325,9 +321,9 @@ static QObject *objectByName(QWidget *topLevel, const QString &name)
*/
void QFormBuilder::createConnections(DomConnections *ui_connections, QWidget *widget)
{
- Q_ASSERT(widget != 0);
+ Q_ASSERT(widget != nullptr);
- if (ui_connections == 0)
+ if (ui_connections == nullptr)
return;
const auto &connections = ui_connections->elementConnection();
diff --git a/src/designer/src/lib/uilib/formbuilderextra.cpp b/src/designer/src/lib/uilib/formbuilderextra.cpp
index 7025ee479..01d79c557 100644
--- a/src/designer/src/lib/uilib/formbuilderextra.cpp
+++ b/src/designer/src/lib/uilib/formbuilderextra.cpp
@@ -78,10 +78,7 @@ void uiLibWarning(const QString &message) {
}
-QFormBuilderExtra::CustomWidgetData::CustomWidgetData() :
- isContainer(false)
-{
-}
+QFormBuilderExtra::CustomWidgetData::CustomWidgetData() = default;
QFormBuilderExtra::CustomWidgetData::CustomWidgetData(const DomCustomWidget *dcw) :
addPageMethod(dcw->elementAddPageMethod()),
@@ -93,10 +90,7 @@ QFormBuilderExtra::CustomWidgetData::CustomWidgetData(const DomCustomWidget *dcw
QFormBuilderExtra::QFormBuilderExtra() :
m_defaultMargin(INT_MIN),
m_defaultSpacing(INT_MIN),
- m_language(QStringLiteral("c++")),
- m_layoutWidget(false),
- m_resourceBuilder(0),
- m_textBuilder(0)
+ m_language(QStringLiteral("c++"))
{
}
@@ -109,7 +103,7 @@ QFormBuilderExtra::~QFormBuilderExtra()
void QFormBuilderExtra::clear()
{
m_buddies.clear();
- m_parentWidget = 0;
+ m_parentWidget = nullptr;
m_parentWidgetIsSet = false;
m_customWidgetDataHash.clear();
m_buttonGroups.clear();
@@ -223,13 +217,13 @@ void QFormBuilderExtra::applyInternalProperties() const
bool QFormBuilderExtra::applyBuddy(const QString &buddyName, BuddyMode applyMode, QLabel *label)
{
if (buddyName.isEmpty()) {
- label->setBuddy(0);
+ label->setBuddy(nullptr);
return false;
}
const QWidgetList widgets = label->topLevelWidget()->findChildren<QWidget*>(buddyName);
if (widgets.empty()) {
- label->setBuddy(0);
+ label->setBuddy(nullptr);
return false;
}
@@ -241,7 +235,7 @@ bool QFormBuilderExtra::applyBuddy(const QString &buddyName, BuddyMode applyMode
}
}
- label->setBuddy(0);
+ label->setBuddy(nullptr);
return false;
}
@@ -318,7 +312,7 @@ void QFormBuilderExtra::clearResourceBuilder()
{
if (m_resourceBuilder) {
delete m_resourceBuilder;
- m_resourceBuilder = 0;
+ m_resourceBuilder = nullptr;
}
}
@@ -339,7 +333,7 @@ void QFormBuilderExtra::clearTextBuilder()
{
if (m_textBuilder) {
delete m_textBuilder;
- m_textBuilder = 0;
+ m_textBuilder = nullptr;
}
}
diff --git a/src/designer/src/lib/uilib/formbuilderextra_p.h b/src/designer/src/lib/uilib/formbuilderextra_p.h
index 5c06dc3dc..54fbfbe66 100644
--- a/src/designer/src/lib/uilib/formbuilderextra_p.h
+++ b/src/designer/src/lib/uilib/formbuilderextra_p.h
@@ -111,7 +111,7 @@ public:
QString addPageMethod;
QString script;
QString baseClass;
- bool isContainer;
+ bool isContainer = false;
};
void clear();
@@ -147,8 +147,8 @@ public:
// --- Hash used in creating button groups on demand. Store a map of name and pair of dom group and real group
void registerButtonGroups(const DomButtonGroups *groups);
- typedef QPair<DomButtonGroup *, QButtonGroup*> ButtonGroupEntry;
- typedef QHash<QString, ButtonGroupEntry> ButtonGroupHash;
+ using ButtonGroupEntry = QPair<DomButtonGroup *, QButtonGroup*>;
+ using ButtonGroupHash = QHash<QString, ButtonGroupEntry>;
const ButtonGroupHash &buttonGroups() const { return m_buttonGroups; }
ButtonGroupHash &buttonGroups() { return m_buttonGroups; }
@@ -191,19 +191,19 @@ private:
void clearResourceBuilder();
void clearTextBuilder();
- typedef QHash<QLabel*, QString> BuddyHash;
+ using BuddyHash = QHash<QLabel*, QString>;
BuddyHash m_buddies;
QHash<QString, CustomWidgetData> m_customWidgetDataHash;
ButtonGroupHash m_buttonGroups;
- bool m_layoutWidget;
- QResourceBuilder *m_resourceBuilder;
- QTextBuilder *m_textBuilder;
+ bool m_layoutWidget = false;
+ QResourceBuilder *m_resourceBuilder = nullptr;
+ QTextBuilder *m_textBuilder = nullptr;
QPointer<QWidget> m_parentWidget;
- bool m_parentWidgetIsSet;
+ bool m_parentWidgetIsSet = false;
};
void uiLibWarning(const QString &message);
@@ -256,14 +256,14 @@ struct QDESIGNER_UILIB_EXPORT QFormBuilderStrings {
const QString scriptWidgetVariable;
const QString scriptChildWidgetsVariable;
- typedef QPair<Qt::ItemDataRole, QString> RoleNName;
+ using RoleNName = QPair<Qt::ItemDataRole, QString>;
QList<RoleNName> itemRoles;
QHash<QString, Qt::ItemDataRole> treeItemRoleHash;
// first.first is primary role, first.second is shadow role.
// Shadow is used for either the translation source or the designer
// representation of the string value.
- typedef QPair<QPair<Qt::ItemDataRole, Qt::ItemDataRole>, QString> TextRoleNName;
+ using TextRoleNName = QPair<QPair<Qt::ItemDataRole, Qt::ItemDataRole>, QString>;
QList<TextRoleNName> itemTextRoles;
QHash<QString, QPair<Qt::ItemDataRole, Qt::ItemDataRole> > treeItemTextRoleHash;
};
diff --git a/src/designer/src/lib/uilib/properties.cpp b/src/designer/src/lib/uilib/properties.cpp
index dafd1ee14..0e18d3ca9 100644
--- a/src/designer/src/lib/uilib/properties.cpp
+++ b/src/designer/src/lib/uilib/properties.cpp
@@ -254,7 +254,8 @@ QVariant domPropertyToVariant(const DomProperty *p)
if (font->hasElementAntialiasing())
f.setStyleStrategy(font->elementAntialiasing() ? QFont::PreferDefault : QFont::NoAntialias);
if (font->hasElementStyleStrategy()) {
- f.setStyleStrategy(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QFont::StyleStrategy>("styleStrategy", font->elementStyleStrategy().toLatin1()));
+ f.setStyleStrategy(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QFont::StyleStrategy>("styleStrategy",
+ font->elementStyleStrategy().toLatin1().constData()));
}
return QVariant::fromValue(f);
}
@@ -286,13 +287,16 @@ QVariant domPropertyToVariant(const DomProperty *p)
return QVariant::fromValue(QCursor(static_cast<Qt::CursorShape>(p->elementCursor())));
case DomProperty::CursorShape:
- return QVariant::fromValue(QCursor(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, Qt::CursorShape>("cursorShape", p->elementCursorShape().toLatin1())));
+ return QVariant::fromValue(QCursor(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, Qt::CursorShape>("cursorShape",
+ p->elementCursorShape().toLatin1().constData())));
#endif
case DomProperty::Locale: {
const DomLocale *locale = p->elementLocale();
- return QVariant::fromValue(QLocale(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Language>("language", locale->attributeLanguage().toLatin1()),
- enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Country>("country", locale->attributeCountry().toLatin1())));
+ return QVariant::fromValue(QLocale(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Language>("language",
+ locale->attributeLanguage().toLatin1().constData()),
+ enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Country>("country",
+ locale->attributeCountry().toLatin1().constData())));
}
case DomProperty::SizePolicy: {
const DomSizePolicy *sizep = p->elementSizePolicy();
@@ -677,7 +681,7 @@ DomProperty *variantToDomProperty(QAbstractFormBuilder *afb, const QMetaObject *
break;
}
uiLibWarning(msgCannotWriteProperty(pname, v));
- } return 0;
+ } return nullptr;
}
return dom_prop;
}
diff --git a/src/designer/src/lib/uilib/properties_p.h b/src/designer/src/lib/uilib/properties_p.h
index f2ac5222a..aa707b323 100644
--- a/src/designer/src/lib/uilib/properties_p.h
+++ b/src/designer/src/lib/uilib/properties_p.h
@@ -133,7 +133,7 @@ public:
// Convert key to value for a given QMetaEnum
template <class EnumType>
-inline EnumType enumKeyToValue(const QMetaEnum &metaEnum,const char *key, const EnumType* = 0)
+inline EnumType enumKeyToValue(const QMetaEnum &metaEnum,const char *key, const EnumType* = nullptr)
{
int val = metaEnum.keyToValue(key);
if (val == -1) {
@@ -147,7 +147,7 @@ inline EnumType enumKeyToValue(const QMetaEnum &metaEnum,const char *key, const
// Convert keys to value for a given QMetaEnum
template <class EnumType>
-inline EnumType enumKeysToValue(const QMetaEnum &metaEnum,const char *keys, const EnumType* = 0)
+inline EnumType enumKeysToValue(const QMetaEnum &metaEnum,const char *keys, const EnumType* = nullptr)
{
int val = metaEnum.keysToValue(keys);
if (val == -1) {
@@ -161,7 +161,7 @@ inline EnumType enumKeysToValue(const QMetaEnum &metaEnum,const char *keys, cons
// Access meta enumeration object of a qobject
template <class QObjectType>
-inline QMetaEnum metaEnum(const char *name, const QObjectType* = 0)
+inline QMetaEnum metaEnum(const char *name)
{
const int e_index = QObjectType::staticMetaObject.indexOfProperty(name);
Q_ASSERT(e_index != -1);
@@ -170,7 +170,7 @@ inline QMetaEnum metaEnum(const char *name, const QObjectType* = 0)
// Convert key to value for enumeration by name
template <class QObjectType, class EnumType>
-inline EnumType enumKeyOfObjectToValue(const char *enumName, const char *key, const QObjectType* = 0, const EnumType* = 0)
+inline EnumType enumKeyOfObjectToValue(const char *enumName, const char *key)
{
const QMetaEnum me = metaEnum<QObjectType>(enumName);
return enumKeyToValue<EnumType>(me, key);
diff --git a/src/designer/src/lib/uilib/resourcebuilder.cpp b/src/designer/src/lib/uilib/resourcebuilder.cpp
index cdf7b0244..f6bdaed5e 100644
--- a/src/designer/src/lib/uilib/resourcebuilder.cpp
+++ b/src/designer/src/lib/uilib/resourcebuilder.cpp
@@ -107,7 +107,7 @@ QVariant QResourceBuilder::loadResource(const QDir &workingDirectory, const DomP
if (themeDebug)
qDebug("Theme %s known %d", qPrintable(theme), known);
if (known)
- return qVariantFromValue(QIcon::fromTheme(dpi->attributeTheme()));
+ return QVariant::fromValue(QIcon::fromTheme(dpi->attributeTheme()));
} // non-empty theme
if (const int flags = iconStateFlags(dpi)) { // new, post 4.4 format
QIcon icon;
@@ -149,7 +149,7 @@ DomProperty *QResourceBuilder::saveResource(const QDir &workingDirectory, const
{
Q_UNUSED(workingDirectory);
Q_UNUSED(value);
- return 0;
+ return nullptr;
}
bool QResourceBuilder::isResourceProperty(const DomProperty *p) const
diff --git a/src/designer/src/lib/uilib/textbuilder.cpp b/src/designer/src/lib/uilib/textbuilder.cpp
index a33062f26..abf148a93 100644
--- a/src/designer/src/lib/uilib/textbuilder.cpp
+++ b/src/designer/src/lib/uilib/textbuilder.cpp
@@ -77,7 +77,7 @@ QVariant QTextBuilder::toNativeValue(const QVariant &value) const
DomProperty *QTextBuilder::saveText(const QVariant &value) const
{
Q_UNUSED(value);
- return 0;
+ return nullptr;
}
#ifdef QFORMINTERNAL_NAMESPACE
diff --git a/src/designer/src/lib/uilib/ui4.cpp b/src/designer/src/lib/uilib/ui4.cpp
index 4afa1dce5..879426b0d 100644
--- a/src/designer/src/lib/uilib/ui4.cpp
+++ b/src/designer/src/lib/uilib/ui4.cpp
@@ -98,6 +98,10 @@ void DomUI::read(QXmlStreamReader &reader)
setAttributeIdbasedtr(attribute.value() == QLatin1String("true"));
continue;
}
+ if (name == QLatin1String("connectslotsbyname")) {
+ setAttributeConnectslotsbyname(attribute.value() == QLatin1String("true"));
+ continue;
+ }
if (name == QLatin1String("stdsetdef")) {
setAttributeStdsetdef(attribute.value().toInt());
continue;
@@ -231,6 +235,9 @@ void DomUI::write(QXmlStreamWriter &writer, const QString &tagName) const
if (hasAttributeIdbasedtr())
writer.writeAttribute(QStringLiteral("idbasedtr"), (attributeIdbasedtr() ? QLatin1String("true") : QLatin1String("false")));
+ if (hasAttributeConnectslotsbyname())
+ writer.writeAttribute(QStringLiteral("connectslotsbyname"), (attributeConnectslotsbyname() ? QLatin1String("true") : QLatin1String("false")));
+
if (hasAttributeStdsetdef())
writer.writeAttribute(QStringLiteral("stdsetdef"), QString::number(attributeStdsetdef()));
diff --git a/src/designer/src/lib/uilib/ui4_p.h b/src/designer/src/lib/uilib/ui4_p.h
index 7ca311ca4..cbd5120c0 100644
--- a/src/designer/src/lib/uilib/ui4_p.h
+++ b/src/designer/src/lib/uilib/ui4_p.h
@@ -162,7 +162,7 @@ class DomStringPropertySpecification;
*/
class QDESIGNER_UILIB_EXPORT DomUI {
- Q_DISABLE_COPY(DomUI)
+ Q_DISABLE_COPY_MOVE(DomUI)
public:
DomUI() = default;
~DomUI();
@@ -191,6 +191,11 @@ public:
inline void setAttributeIdbasedtr(bool a) { m_attr_idbasedtr = a; m_has_attr_idbasedtr = true; }
inline void clearAttributeIdbasedtr() { m_has_attr_idbasedtr = false; }
+ inline bool hasAttributeConnectslotsbyname() const { return m_has_attr_connectslotsbyname; }
+ inline bool attributeConnectslotsbyname() const { return m_attr_connectslotsbyname; }
+ inline void setAttributeConnectslotsbyname(bool a) { m_attr_connectslotsbyname = a; m_has_attr_connectslotsbyname = true; }
+ inline void clearAttributeConnectslotsbyname() { m_has_attr_connectslotsbyname = false; }
+
inline bool hasAttributeStdsetdef() const { return m_has_attr_stdsetdef; }
inline int attributeStdsetdef() const { return m_attr_stdsetdef; }
inline void setAttributeStdsetdef(int a) { m_attr_stdsetdef = a; m_has_attr_stdsetdef = true; }
@@ -307,6 +312,9 @@ private:
bool m_attr_idbasedtr = false;
bool m_has_attr_idbasedtr = false;
+ bool m_attr_connectslotsbyname = false;
+ bool m_has_attr_connectslotsbyname = false;
+
int m_attr_stdsetdef = 0;
bool m_has_attr_stdsetdef = false;
@@ -353,7 +361,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomIncludes {
- Q_DISABLE_COPY(DomIncludes)
+ Q_DISABLE_COPY_MOVE(DomIncludes)
public:
DomIncludes() = default;
~DomIncludes();
@@ -377,7 +385,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomInclude {
- Q_DISABLE_COPY(DomInclude)
+ Q_DISABLE_COPY_MOVE(DomInclude)
public:
DomInclude() = default;
~DomInclude();
@@ -411,7 +419,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomResources {
- Q_DISABLE_COPY(DomResources)
+ Q_DISABLE_COPY_MOVE(DomResources)
public:
DomResources() = default;
~DomResources();
@@ -444,7 +452,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomResource {
- Q_DISABLE_COPY(DomResource)
+ Q_DISABLE_COPY_MOVE(DomResource)
public:
DomResource() = default;
~DomResource();
@@ -465,7 +473,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomActionGroup {
- Q_DISABLE_COPY(DomActionGroup)
+ Q_DISABLE_COPY_MOVE(DomActionGroup)
public:
DomActionGroup() = default;
~DomActionGroup();
@@ -513,7 +521,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomAction {
- Q_DISABLE_COPY(DomAction)
+ Q_DISABLE_COPY_MOVE(DomAction)
public:
DomAction() = default;
~DomAction();
@@ -559,7 +567,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomActionRef {
- Q_DISABLE_COPY(DomActionRef)
+ Q_DISABLE_COPY_MOVE(DomActionRef)
public:
DomActionRef() = default;
~DomActionRef();
@@ -580,7 +588,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomButtonGroup {
- Q_DISABLE_COPY(DomButtonGroup)
+ Q_DISABLE_COPY_MOVE(DomButtonGroup)
public:
DomButtonGroup() = default;
~DomButtonGroup();
@@ -618,7 +626,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomButtonGroups {
- Q_DISABLE_COPY(DomButtonGroups)
+ Q_DISABLE_COPY_MOVE(DomButtonGroups)
public:
DomButtonGroups() = default;
~DomButtonGroups();
@@ -642,7 +650,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomCustomWidgets {
- Q_DISABLE_COPY(DomCustomWidgets)
+ Q_DISABLE_COPY_MOVE(DomCustomWidgets)
public:
DomCustomWidgets() = default;
~DomCustomWidgets();
@@ -666,7 +674,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomHeader {
- Q_DISABLE_COPY(DomHeader)
+ Q_DISABLE_COPY_MOVE(DomHeader)
public:
DomHeader() = default;
~DomHeader();
@@ -692,7 +700,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomCustomWidget {
- Q_DISABLE_COPY(DomCustomWidget)
+ Q_DISABLE_COPY_MOVE(DomCustomWidget)
public:
DomCustomWidget() = default;
~DomCustomWidget();
@@ -778,7 +786,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomLayoutDefault {
- Q_DISABLE_COPY(DomLayoutDefault)
+ Q_DISABLE_COPY_MOVE(DomLayoutDefault)
public:
DomLayoutDefault() = default;
~DomLayoutDefault();
@@ -807,7 +815,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomLayoutFunction {
- Q_DISABLE_COPY(DomLayoutFunction)
+ Q_DISABLE_COPY_MOVE(DomLayoutFunction)
public:
DomLayoutFunction() = default;
~DomLayoutFunction();
@@ -836,7 +844,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomTabStops {
- Q_DISABLE_COPY(DomTabStops)
+ Q_DISABLE_COPY_MOVE(DomTabStops)
public:
DomTabStops() = default;
~DomTabStops();
@@ -860,7 +868,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomLayout {
- Q_DISABLE_COPY(DomLayout)
+ Q_DISABLE_COPY_MOVE(DomLayout)
public:
DomLayout() = default;
~DomLayout();
@@ -951,7 +959,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomLayoutItem {
- Q_DISABLE_COPY(DomLayoutItem)
+ Q_DISABLE_COPY_MOVE(DomLayoutItem)
public:
DomLayoutItem() = default;
~DomLayoutItem();
@@ -1028,7 +1036,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomRow {
- Q_DISABLE_COPY(DomRow)
+ Q_DISABLE_COPY_MOVE(DomRow)
public:
DomRow() = default;
~DomRow();
@@ -1052,7 +1060,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomColumn {
- Q_DISABLE_COPY(DomColumn)
+ Q_DISABLE_COPY_MOVE(DomColumn)
public:
DomColumn() = default;
~DomColumn();
@@ -1076,7 +1084,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomItem {
- Q_DISABLE_COPY(DomItem)
+ Q_DISABLE_COPY_MOVE(DomItem)
public:
DomItem() = default;
~DomItem();
@@ -1122,7 +1130,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomWidget {
- Q_DISABLE_COPY(DomWidget)
+ Q_DISABLE_COPY_MOVE(DomWidget)
public:
DomWidget() = default;
~DomWidget();
@@ -1226,7 +1234,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomSpacer {
- Q_DISABLE_COPY(DomSpacer)
+ Q_DISABLE_COPY_MOVE(DomSpacer)
public:
DomSpacer() = default;
~DomSpacer();
@@ -1259,7 +1267,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomColor {
- Q_DISABLE_COPY(DomColor)
+ Q_DISABLE_COPY_MOVE(DomColor)
public:
DomColor() = default;
~DomColor();
@@ -1308,7 +1316,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomGradientStop {
- Q_DISABLE_COPY(DomGradientStop)
+ Q_DISABLE_COPY_MOVE(DomGradientStop)
public:
DomGradientStop() = default;
~DomGradientStop();
@@ -1344,7 +1352,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomGradient {
- Q_DISABLE_COPY(DomGradient)
+ Q_DISABLE_COPY_MOVE(DomGradient)
public:
DomGradient() = default;
~DomGradient();
@@ -1473,7 +1481,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomBrush {
- Q_DISABLE_COPY(DomBrush)
+ Q_DISABLE_COPY_MOVE(DomBrush)
public:
DomBrush() = default;
~DomBrush();
@@ -1518,7 +1526,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomColorRole {
- Q_DISABLE_COPY(DomColorRole)
+ Q_DISABLE_COPY_MOVE(DomColorRole)
public:
DomColorRole() = default;
~DomColorRole();
@@ -1554,7 +1562,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomColorGroup {
- Q_DISABLE_COPY(DomColorGroup)
+ Q_DISABLE_COPY_MOVE(DomColorGroup)
public:
DomColorGroup() = default;
~DomColorGroup();
@@ -1583,7 +1591,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomPalette {
- Q_DISABLE_COPY(DomPalette)
+ Q_DISABLE_COPY_MOVE(DomPalette)
public:
DomPalette() = default;
~DomPalette();
@@ -1626,7 +1634,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomFont {
- Q_DISABLE_COPY(DomFont)
+ Q_DISABLE_COPY_MOVE(DomFont)
public:
DomFont() = default;
~DomFont();
@@ -1715,7 +1723,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomPoint {
- Q_DISABLE_COPY(DomPoint)
+ Q_DISABLE_COPY_MOVE(DomPoint)
public:
DomPoint() = default;
~DomPoint();
@@ -1748,7 +1756,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomRect {
- Q_DISABLE_COPY(DomRect)
+ Q_DISABLE_COPY_MOVE(DomRect)
public:
DomRect() = default;
~DomRect();
@@ -1795,7 +1803,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomLocale {
- Q_DISABLE_COPY(DomLocale)
+ Q_DISABLE_COPY_MOVE(DomLocale)
public:
DomLocale() = default;
~DomLocale();
@@ -1824,7 +1832,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomSizePolicy {
- Q_DISABLE_COPY(DomSizePolicy)
+ Q_DISABLE_COPY_MOVE(DomSizePolicy)
public:
DomSizePolicy() = default;
~DomSizePolicy();
@@ -1888,7 +1896,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomSize {
- Q_DISABLE_COPY(DomSize)
+ Q_DISABLE_COPY_MOVE(DomSize)
public:
DomSize() = default;
~DomSize();
@@ -1921,7 +1929,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomDate {
- Q_DISABLE_COPY(DomDate)
+ Q_DISABLE_COPY_MOVE(DomDate)
public:
DomDate() = default;
~DomDate();
@@ -1961,7 +1969,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomTime {
- Q_DISABLE_COPY(DomTime)
+ Q_DISABLE_COPY_MOVE(DomTime)
public:
DomTime() = default;
~DomTime();
@@ -2001,7 +2009,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomDateTime {
- Q_DISABLE_COPY(DomDateTime)
+ Q_DISABLE_COPY_MOVE(DomDateTime)
public:
DomDateTime() = default;
~DomDateTime();
@@ -2062,7 +2070,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomStringList {
- Q_DISABLE_COPY(DomStringList)
+ Q_DISABLE_COPY_MOVE(DomStringList)
public:
DomStringList() = default;
~DomStringList();
@@ -2119,7 +2127,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomResourcePixmap {
- Q_DISABLE_COPY(DomResourcePixmap)
+ Q_DISABLE_COPY_MOVE(DomResourcePixmap)
public:
DomResourcePixmap() = default;
~DomResourcePixmap();
@@ -2153,7 +2161,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomResourceIcon {
- Q_DISABLE_COPY(DomResourceIcon)
+ Q_DISABLE_COPY_MOVE(DomResourceIcon)
public:
DomResourceIcon() = default;
~DomResourceIcon();
@@ -2258,7 +2266,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomString {
- Q_DISABLE_COPY(DomString)
+ Q_DISABLE_COPY_MOVE(DomString)
public:
DomString() = default;
~DomString();
@@ -2308,7 +2316,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomPointF {
- Q_DISABLE_COPY(DomPointF)
+ Q_DISABLE_COPY_MOVE(DomPointF)
public:
DomPointF() = default;
~DomPointF();
@@ -2341,7 +2349,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomRectF {
- Q_DISABLE_COPY(DomRectF)
+ Q_DISABLE_COPY_MOVE(DomRectF)
public:
DomRectF() = default;
~DomRectF();
@@ -2388,7 +2396,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomSizeF {
- Q_DISABLE_COPY(DomSizeF)
+ Q_DISABLE_COPY_MOVE(DomSizeF)
public:
DomSizeF() = default;
~DomSizeF();
@@ -2421,7 +2429,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomChar {
- Q_DISABLE_COPY(DomChar)
+ Q_DISABLE_COPY_MOVE(DomChar)
public:
DomChar() = default;
~DomChar();
@@ -2447,7 +2455,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomUrl {
- Q_DISABLE_COPY(DomUrl)
+ Q_DISABLE_COPY_MOVE(DomUrl)
public:
DomUrl() = default;
~DomUrl();
@@ -2474,7 +2482,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomProperty {
- Q_DISABLE_COPY(DomProperty)
+ Q_DISABLE_COPY_MOVE(DomProperty)
public:
DomProperty() = default;
~DomProperty();
@@ -2665,7 +2673,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomConnections {
- Q_DISABLE_COPY(DomConnections)
+ Q_DISABLE_COPY_MOVE(DomConnections)
public:
DomConnections() = default;
~DomConnections();
@@ -2689,7 +2697,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomConnection {
- Q_DISABLE_COPY(DomConnection)
+ Q_DISABLE_COPY_MOVE(DomConnection)
public:
DomConnection() = default;
~DomConnection();
@@ -2744,7 +2752,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomConnectionHints {
- Q_DISABLE_COPY(DomConnectionHints)
+ Q_DISABLE_COPY_MOVE(DomConnectionHints)
public:
DomConnectionHints() = default;
~DomConnectionHints();
@@ -2768,7 +2776,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomConnectionHint {
- Q_DISABLE_COPY(DomConnectionHint)
+ Q_DISABLE_COPY_MOVE(DomConnectionHint)
public:
DomConnectionHint() = default;
~DomConnectionHint();
@@ -2810,7 +2818,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomDesignerData {
- Q_DISABLE_COPY(DomDesignerData)
+ Q_DISABLE_COPY_MOVE(DomDesignerData)
public:
DomDesignerData() = default;
~DomDesignerData();
@@ -2834,7 +2842,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomSlots {
- Q_DISABLE_COPY(DomSlots)
+ Q_DISABLE_COPY_MOVE(DomSlots)
public:
DomSlots() = default;
~DomSlots();
@@ -2863,7 +2871,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomPropertySpecifications {
- Q_DISABLE_COPY(DomPropertySpecifications)
+ Q_DISABLE_COPY_MOVE(DomPropertySpecifications)
public:
DomPropertySpecifications() = default;
~DomPropertySpecifications();
@@ -2892,7 +2900,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomPropertyToolTip {
- Q_DISABLE_COPY(DomPropertyToolTip)
+ Q_DISABLE_COPY_MOVE(DomPropertyToolTip)
public:
DomPropertyToolTip() = default;
~DomPropertyToolTip();
@@ -2913,7 +2921,7 @@ private:
};
class QDESIGNER_UILIB_EXPORT DomStringPropertySpecification {
- Q_DISABLE_COPY(DomStringPropertySpecification)
+ Q_DISABLE_COPY_MOVE(DomStringPropertySpecification)
public:
DomStringPropertySpecification() = default;
~DomStringPropertySpecification();
diff --git a/src/designer/src/plugins/activeqt/qdesigneraxwidget.h b/src/designer/src/plugins/activeqt/qdesigneraxwidget.h
index 3344e49e5..3c15763da 100644
--- a/src/designer/src/plugins/activeqt/qdesigneraxwidget.h
+++ b/src/designer/src/plugins/activeqt/qdesigneraxwidget.h
@@ -53,7 +53,7 @@ class QDesignerAxWidget : public QWidget
{
Q_OBJECT
Q_PROPERTY(QString control READ control WRITE setControl RESET resetControl DESIGNABLE true)
- Q_DISABLE_COPY(QDesignerAxWidget)
+ Q_DISABLE_COPY_MOVE(QDesignerAxWidget)
protected:
explicit QDesignerAxWidget(QWidget *parent);
diff --git a/src/designer/src/plugins/qquickwidget/qquickwidget_plugin.cpp b/src/designer/src/plugins/qquickwidget/qquickwidget_plugin.cpp
index a843e1052..8e1721a93 100644
--- a/src/designer/src/plugins/qquickwidget/qquickwidget_plugin.cpp
+++ b/src/designer/src/plugins/qquickwidget/qquickwidget_plugin.cpp
@@ -39,7 +39,6 @@ QT_BEGIN_NAMESPACE
QQuickWidgetPlugin::QQuickWidgetPlugin(QObject *parent)
: QObject(parent)
- , m_initialized(false)
{
}
diff --git a/src/designer/src/plugins/qquickwidget/qquickwidget_plugin.h b/src/designer/src/plugins/qquickwidget/qquickwidget_plugin.h
index 1dcc09134..009492547 100644
--- a/src/designer/src/plugins/qquickwidget/qquickwidget_plugin.h
+++ b/src/designer/src/plugins/qquickwidget/qquickwidget_plugin.h
@@ -40,7 +40,7 @@ class QQuickWidgetPlugin: public QObject, public QDesignerCustomWidgetInterface
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDesignerCustomWidgetInterface")
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
- explicit QQuickWidgetPlugin(QObject *parent = 0);
+ explicit QQuickWidgetPlugin(QObject *parent = nullptr);
QString name() const override;
QString group() const override;
@@ -58,7 +58,7 @@ private slots:
void sceneGraphError(QQuickWindow::SceneGraphError, const QString &);
private:
- bool m_initialized;
+ bool m_initialized = false;
};
QT_END_NAMESPACE
diff --git a/src/designer/src/uitools/quiloader.cpp b/src/designer/src/uitools/quiloader.cpp
index 98bebe731..e5f157fb1 100644
--- a/src/designer/src/uitools/quiloader.cpp
+++ b/src/designer/src/uitools/quiloader.cpp
@@ -119,9 +119,6 @@ public:
explicit TranslatingTextBuilder(bool idBased, bool trEnabled, const QByteArray &className) :
m_idBased(idBased), m_trEnabled(trEnabled), m_className(className) {}
- TranslatingTextBuilder(bool trEnabled, const QByteArray &className) :
- m_trEnabled(trEnabled), m_className(className) {}
-
QVariant loadText(const DomProperty *icon) const override;
QVariant toNativeValue(const QVariant &value) const override;
@@ -333,16 +330,15 @@ class FormBuilderPrivate: public QFormBuilder
{
friend class QT_PREPEND_NAMESPACE(QUiLoader);
friend class QT_PREPEND_NAMESPACE(QUiLoaderPrivate);
- typedef QFormBuilder ParentClass;
+ using ParentClass = QFormBuilder;
public:
- QUiLoader *loader;
+ QUiLoader *loader = nullptr;
- bool dynamicTr;
- bool trEnabled;
+ bool dynamicTr = false;
+ bool trEnabled = true;
- FormBuilderPrivate(): loader(nullptr), dynamicTr(false), trEnabled(true),
- m_trwatch(nullptr), m_idBased(false) {}
+ FormBuilderPrivate() = default;
QWidget *defaultCreateWidget(const QString &className, QWidget *parent, const QString &name)
{
@@ -371,7 +367,7 @@ public:
return widget;
}
- return 0;
+ return nullptr;
}
QLayout *createLayout(const QString &className, QObject *parent, const QString &name) override
@@ -381,7 +377,7 @@ public:
return layout;
}
- return 0;
+ return nullptr;
}
QActionGroup *createActionGroup(QObject *parent, const QString &name) override
@@ -391,7 +387,7 @@ public:
return actionGroup;
}
- return 0;
+ return nullptr;
}
QAction *createAction(QObject *parent, const QString &name) override
@@ -401,7 +397,7 @@ public:
return action;
}
- return 0;
+ return nullptr;
}
void applyProperties(QObject *o, const QList<DomProperty*> &properties) override;
@@ -411,8 +407,8 @@ public:
private:
QByteArray m_class;
- TranslationWatcher *m_trwatch;
- bool m_idBased;
+ TranslationWatcher *m_trwatch = nullptr;
+ bool m_idBased = false;
};
static QString convertTranslatable(const DomProperty *p, const QByteArray &className,
@@ -469,7 +465,7 @@ void FormBuilderPrivate::applyProperties(QObject *o, const QList<DomProperty*> &
QWidget *FormBuilderPrivate::create(DomUI *ui, QWidget *parentWidget)
{
m_class = ui->elementClass().toUtf8();
- m_trwatch = 0;
+ m_trwatch = nullptr;
m_idBased = ui->attributeIdbasedtr();
setTextBuilder(new TranslatingTextBuilder(m_idBased, trEnabled, m_class));
return QFormBuilder::create(ui, parentWidget);
@@ -478,8 +474,8 @@ QWidget *FormBuilderPrivate::create(DomUI *ui, QWidget *parentWidget)
QWidget *FormBuilderPrivate::create(DomWidget *ui_widget, QWidget *parentWidget)
{
QWidget *w = QFormBuilder::create(ui_widget, parentWidget);
- if (w == 0)
- return 0;
+ if (w == nullptr)
+ return nullptr;
if (0) {
#if QT_CONFIG(tabwidget)
@@ -525,7 +521,7 @@ QWidget *FormBuilderPrivate::create(DomWidget *ui_widget, QWidget *parentWidget)
bool FormBuilderPrivate::addItem(DomWidget *ui_widget, QWidget *widget, QWidget *parentWidget)
{
- if (parentWidget == 0)
+ if (parentWidget == nullptr)
return true;
if (!ParentClass::addItem(ui_widget, widget, parentWidget))
@@ -685,9 +681,7 @@ QUiLoader::QUiLoader(QObject *parent)
/*!
Destroys the loader.
*/
-QUiLoader::~QUiLoader()
-{
-}
+QUiLoader::~QUiLoader() = default;
/*!
Loads a form from the given \a device and creates a new widget with the
diff --git a/src/designer/src/uitools/quiloader.h b/src/designer/src/uitools/quiloader.h
index fb77993c0..82a01210b 100644
--- a/src/designer/src/uitools/quiloader.h
+++ b/src/designer/src/uitools/quiloader.h
@@ -99,7 +99,7 @@ public:
private:
QScopedPointer<QUiLoaderPrivate> d_ptr;
Q_DECLARE_PRIVATE(QUiLoader)
- Q_DISABLE_COPY(QUiLoader)
+ Q_DISABLE_COPY_MOVE(QUiLoader)
};
QT_END_NAMESPACE
diff --git a/src/kmap2qmap/main.cpp b/src/kmap2qmap/main.cpp
index 84125497e..0cff817c5 100644
--- a/src/kmap2qmap/main.cpp
+++ b/src/kmap2qmap/main.cpp
@@ -503,9 +503,7 @@ bool KeymapParser::generateHeader(QFile *f)
for (int i = 0; i < m_keymap.size(); ++i) {
const QEvdevKeyboardMap::Mapping &m = m_keymap.at(i);
- QString s;
- s.sprintf(" { %3d, 0x%04x, 0x%08x, 0x%02x, 0x%02x, 0x%04x },\n", m.keycode, m.unicode, m.qtcode, m.modifiers, m.flags, m.special);
- ts << s;
+ ts << QString::asprintf(" { %3d, 0x%04x, 0x%08x, 0x%02x, 0x%02x, 0x%04x },\n", m.keycode, m.unicode, m.qtcode, m.modifiers, m.flags, m.special);
}
ts << "};" << endl << endl;
@@ -514,9 +512,7 @@ bool KeymapParser::generateHeader(QFile *f)
for (int i = 0; i < m_keycompose.size(); ++i) {
const QEvdevKeyboardMap::Composing &c = m_keycompose.at(i);
- QString s;
- s.sprintf(" { 0x%04x, 0x%04x, 0x%04x },\n", c.first, c.second, c.result);
- ts << s;
+ ts << QString::asprintf(" { 0x%04x, 0x%04x, 0x%04x },\n", c.first, c.second, c.result);
}
ts << "};" << endl << endl;
@@ -622,7 +618,7 @@ bool KeymapParser::parseKmap(QFile *f)
else
parseWarning("keymaps has an invalid range");
}
- qSort(keymaps);
+ std::sort(keymaps.begin(), keymaps.end());
}
else
parseWarning("keymaps with more than one argument");
@@ -784,7 +780,7 @@ bool KeymapParser::parseKmap(QFile *f)
}
}
}
- qSort(m_keymap);
+ std::sort(m_keymap.begin(), m_keymap.end());
return !m_keymap.isEmpty();
}
diff --git a/src/linguist/linguist/main.cpp b/src/linguist/linguist/main.cpp
index 0b549b6e0..e4eb514a5 100644
--- a/src/linguist/linguist/main.cpp
+++ b/src/linguist/linguist/main.cpp
@@ -32,13 +32,11 @@
#include <QtCore/QFile>
#include <QtCore/QLibraryInfo>
#include <QtCore/QLocale>
-#include <QtCore/QSettings>
#include <QtCore/QTranslator>
#include <QtWidgets/QApplication>
#include <QtWidgets/QDesktopWidget>
#include <QtGui/QPixmap>
-#include <QtWidgets/QSplashScreen>
#ifdef Q_OS_MAC
#include <QtCore/QUrl>
@@ -134,28 +132,11 @@ int main(int argc, char **argv)
app.setOrganizationName(QLatin1String("QtProject"));
app.setApplicationName(QLatin1String("Linguist"));
- QSettings config;
-
- QWidget tmp;
- tmp.restoreGeometry(config.value(settingPath("Geometry/WindowGeometry")).toByteArray());
-
- QSplashScreen *splash = 0;
- int screenId = QApplication::desktop()->screenNumber(tmp.geometry().center());
- splash = new QSplashScreen(QApplication::desktop()->screen(screenId),
- QPixmap(QLatin1String(":/images/icons/linguist-128-32.png")));
- if (QApplication::desktop()->isVirtualDesktop()) {
- QRect srect(0, 0, splash->width(), splash->height());
- splash->move(QApplication::desktop()->availableGeometry(screenId).center() - srect.center());
- }
- splash->setAttribute(Qt::WA_DeleteOnClose);
- splash->show();
-
MainWindow mw;
#ifdef Q_OS_MAC
eventFilter.setMainWindow(&mw);
#endif // Q_OS_MAC
mw.show();
- splash->finish(&mw);
QApplication::restoreOverrideCursor();
mw.openFiles(files, true);
diff --git a/src/linguist/linguist/mainwindow.cpp b/src/linguist/linguist/mainwindow.cpp
index f443d25ea..235efd747 100644
--- a/src/linguist/linguist/mainwindow.cpp
+++ b/src/linguist/linguist/mainwindow.cpp
@@ -2809,7 +2809,7 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event)
} else if (event->type() == QEvent::Wheel) {
QWheelEvent *we = static_cast<QWheelEvent *>(event);
if (we->modifiers() & Qt::ControlModifier) {
- if (we->delta() > 0)
+ if (we->angleDelta().y() > 0)
m_messageEditor->increaseFontSize();
else
m_messageEditor->decreaseFontSize();
diff --git a/src/linguist/linguist/messagemodel.cpp b/src/linguist/linguist/messagemodel.cpp
index 1033940e7..74c49cf83 100644
--- a/src/linguist/linguist/messagemodel.cpp
+++ b/src/linguist/linguist/messagemodel.cpp
@@ -1367,9 +1367,7 @@ QVariant MessageModel::data(const QModelIndex &index, int role) const
return tr("%n unfinished message(s) left.", 0,
mci->getNumEditable() - mci->getNumFinished());
}
- QString s;
- s.sprintf("%d/%d", mci->getNumFinished(), mci->getNumEditable());
- return s;
+ return QString::asprintf("%d/%d", mci->getNumFinished(), mci->getNumEditable());
}
default:
return QVariant(); // Status => no text
diff --git a/src/linguist/lupdate/cpp.cpp b/src/linguist/lupdate/cpp.cpp
index e96e102af..9fe4ed710 100644
--- a/src/linguist/lupdate/cpp.cpp
+++ b/src/linguist/lupdate/cpp.cpp
@@ -26,29 +26,16 @@
**
****************************************************************************/
-#include "lupdate.h"
+#include "cpp.h"
#include <translator.h>
-
#include <QtCore/QBitArray>
-#include <QtCore/QDebug>
-#include <QtCore/QFileInfo>
-#include <QtCore/QRegExp>
#include <QtCore/QStack>
-#include <QtCore/QString>
#include <QtCore/QTextCodec>
#include <QtCore/QTextStream>
-#include <QtCore/QCoreApplication>
-
-#include <iostream>
-
-#include <ctype.h> // for isXXX()
QT_BEGIN_NAMESPACE
-class LU {
- Q_DECLARE_TR_FUNCTIONS(LUpdate)
-};
/* qmake ignore Q_OBJECT */
@@ -58,18 +45,6 @@ static QString MagicComment(QLatin1String("TRANSLATOR"));
//#define DIAGNOSE_RETRANSLATABILITY // FIXME: should make a runtime option of this
-class HashString {
-public:
- HashString() : m_hash(0x80000000) {}
- explicit HashString(const QString &str) : m_str(str), m_hash(0x80000000) {}
- void setValue(const QString &str) { m_str = str; m_hash = 0x80000000; }
- const QString &value() const { return m_str; }
- bool operator==(const HashString &other) const { return m_str == other.m_str; }
-private:
- QString m_str;
- mutable uint m_hash; // We use the highest bit as a validity indicator (set => invalid)
- friend uint qHash(const HashString &str);
-};
uint qHash(const HashString &str)
{
@@ -78,16 +53,6 @@ uint qHash(const HashString &str)
return str.m_hash;
}
-class HashStringList {
-public:
- explicit HashStringList(const QList<HashString> &list) : m_list(list), m_hash(0x80000000) {}
- const QList<HashString> &value() const { return m_list; }
- bool operator==(const HashStringList &other) const { return m_list == other.m_list; }
-private:
- QList<HashString> m_list;
- mutable uint m_hash; // We use the highest bit as a validity indicator (set => invalid)
- friend uint qHash(const HashStringList &list);
-};
uint qHash(const HashStringList &list)
{
@@ -102,42 +67,6 @@ uint qHash(const HashStringList &list)
return list.m_hash;
}
-typedef QList<HashString> NamespaceList;
-
-struct Namespace {
-
- Namespace() :
- classDef(this),
- hasTrFunctions(false), complained(false)
- {}
- ~Namespace()
- {
- qDeleteAll(children);
- }
-
- QHash<HashString, Namespace *> children;
- QHash<HashString, NamespaceList> aliases;
- QList<HashStringList> usings;
-
- // Class declarations set no flags and create no namespaces, so they are ignored.
- // Class definitions may appear multiple times - but only because we are trying to
- // "compile" all sources irrespective of build configuration.
- // Nested classes may be forward-declared inside a definition, and defined in another file.
- // The latter will detach the class' child list, so clones need a backlink to the original
- // definition (either one in case of multiple definitions).
- // Namespaces can have tr() functions as well, so we need to track parent definitions for
- // them as well. The complication is that we may have to deal with a forrest instead of
- // a tree - in that case the parent will be arbitrary. However, it seem likely that
- // Q_DECLARE_TR_FUNCTIONS would be used either in "class-like" namespaces with a central
- // header or only locally in a file.
- Namespace *classDef;
-
- QString trQualification;
-
- bool hasTrFunctions;
- bool complained; // ... that tr functions are missing.
-};
-
static int nextFileId;
class VisitRecorder {
@@ -157,37 +86,6 @@ private:
QBitArray m_ba;
};
-struct ParseResults {
- int fileId;
- Namespace rootNamespace;
- QSet<const ParseResults *> includes;
-};
-
-struct IncludeCycle {
- QSet<QString> fileNames;
- QSet<const ParseResults *> results;
-};
-
-typedef QHash<QString, IncludeCycle *> IncludeCycleHash;
-typedef QHash<QString, const Translator *> TranslatorHash;
-
-class CppFiles {
-
-public:
- static QSet<const ParseResults *> getResults(const QString &cleanFile);
- static void setResults(const QString &cleanFile, const ParseResults *results);
- static const Translator *getTranslator(const QString &cleanFile);
- static void setTranslator(const QString &cleanFile, const Translator *results);
- static bool isBlacklisted(const QString &cleanFile);
- static void setBlacklisted(const QString &cleanFile);
- static void addIncludeCycle(const QSet<QString> &fileNames);
-
-private:
- static IncludeCycleHash &includeCycles();
- static TranslatorHash &translatedFiles();
- static QSet<QString> &blacklistedFiles();
-};
-
class CppParser {
public:
@@ -1376,7 +1274,7 @@ void CppParser::processInclude(const QString &file, ConversionData &cd, const QS
const int index = includeStack.indexOf(cleanFile);
if (index != -1) {
- CppFiles::addIncludeCycle(includeStack.mid(index).toSet());
+ CppFiles::addIncludeCycle(QSet<QString>(includeStack.cbegin() + index, includeStack.cend()));
return;
}
diff --git a/src/linguist/lupdate/cpp.h b/src/linguist/lupdate/cpp.h
new file mode 100644
index 000000000..d12c5e924
--- /dev/null
+++ b/src/linguist/lupdate/cpp.h
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Linguist of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CPP_H
+#define CPP_H
+
+#include "lupdate.h"
+
+#include <QtCore/QSet>
+
+#include <iostream>
+
+QT_BEGIN_NAMESPACE
+
+struct HashString {
+ HashString() : m_hash(0x80000000) {}
+ explicit HashString(const QString &str) : m_str(str), m_hash(0x80000000) {}
+ void setValue(const QString &str) { m_str = str; m_hash = 0x80000000; }
+ const QString &value() const { return m_str; }
+ bool operator==(const HashString &other) const { return m_str == other.m_str; }
+ QString m_str;
+
+ mutable uint m_hash; // We use the highest bit as a validity indicator (set => invalid)
+};
+
+struct HashStringList {
+ explicit HashStringList(const QList<HashString> &list) : m_list(list), m_hash(0x80000000) {}
+ const QList<HashString> &value() const { return m_list; }
+ bool operator==(const HashStringList &other) const { return m_list == other.m_list; }
+
+ QList<HashString> m_list;
+ mutable uint m_hash; // We use the highest bit as a validity indicator (set => invalid)
+};
+
+typedef QList<HashString> NamespaceList;
+
+struct Namespace {
+
+ Namespace() :
+ classDef(this),
+ hasTrFunctions(false), complained(false)
+ {}
+ ~Namespace()
+ {
+ qDeleteAll(children);
+ }
+
+ QHash<HashString, Namespace *> children;
+ QHash<HashString, NamespaceList> aliases;
+ QList<HashStringList> usings;
+
+ // Class declarations set no flags and create no namespaces, so they are ignored.
+ // Class definitions may appear multiple times - but only because we are trying to
+ // "compile" all sources irrespective of build configuration.
+ // Nested classes may be forward-declared inside a definition, and defined in another file.
+ // The latter will detach the class' child list, so clones need a backlink to the original
+ // definition (either one in case of multiple definitions).
+ // Namespaces can have tr() functions as well, so we need to track parent definitions for
+ // them as well. The complication is that we may have to deal with a forrest instead of
+ // a tree - in that case the parent will be arbitrary. However, it seem likely that
+ // Q_DECLARE_TR_FUNCTIONS would be used either in "class-like" namespaces with a central
+ // header or only locally in a file.
+ Namespace *classDef;
+
+ QString trQualification;
+
+ bool hasTrFunctions;
+ bool complained; // ... that tr functions are missing.
+};
+
+struct ParseResults {
+ int fileId;
+ Namespace rootNamespace;
+ QSet<const ParseResults *> includes;
+};
+
+struct IncludeCycle {
+ QSet<QString> fileNames;
+ QSet<const ParseResults *> results;
+};
+
+typedef QHash<QString, IncludeCycle *> IncludeCycleHash;
+typedef QHash<QString, const Translator *> TranslatorHash;
+
+class CppFiles {
+
+public:
+ static QSet<const ParseResults *> getResults(const QString &cleanFile);
+ static void setResults(const QString &cleanFile, const ParseResults *results);
+ static const Translator *getTranslator(const QString &cleanFile);
+ static void setTranslator(const QString &cleanFile, const Translator *results);
+ static bool isBlacklisted(const QString &cleanFile);
+ static void setBlacklisted(const QString &cleanFile);
+ static void addIncludeCycle(const QSet<QString> &fileNames);
+
+private:
+ static IncludeCycleHash &includeCycles();
+ static TranslatorHash &translatedFiles();
+ static QSet<QString> &blacklistedFiles();
+};
+
+QT_END_NAMESPACE
+
+#endif // CPP_H
diff --git a/src/linguist/lupdate/java.cpp b/src/linguist/lupdate/java.cpp
index 40f5b9af1..3c00af40c 100644
--- a/src/linguist/lupdate/java.cpp
+++ b/src/linguist/lupdate/java.cpp
@@ -45,10 +45,6 @@
QT_BEGIN_NAMESPACE
-class LU {
- Q_DECLARE_TR_FUNCTIONS(LUpdate)
-};
-
enum { Tok_Eof, Tok_class, Tok_return, Tok_tr,
Tok_translate, Tok_Ident, Tok_Package,
Tok_Comment, Tok_String, Tok_Colon, Tok_Dot,
@@ -108,11 +104,11 @@ std::ostream &yyMsg(int line = 0)
static QChar getChar()
{
if (yyInPos >= yyInStr.size())
- return EOF;
+ return QChar(EOF);
QChar c = yyInStr[yyInPos++];
- if (c.unicode() == '\n')
+ if (c == QLatin1Char('\n'))
++yyCurLineNo;
- return c.unicode();
+ return c;
}
static int getToken()
@@ -124,7 +120,7 @@ static int getToken()
yyComment.clear();
yyString.clear();
- while ( yyCh != EOF ) {
+ while (yyCh != QChar(EOF)) {
yyLineNo = yyCurLineNo;
if ( yyCh.isLetter() || yyCh.toLatin1() == '_' ) {
@@ -169,7 +165,7 @@ static int getToken()
if ( yyCh == QLatin1Char('/') ) {
do {
yyCh = getChar();
- if (yyCh == EOF)
+ if (yyCh == QChar(EOF))
break;
yyComment.append(yyCh);
} while (yyCh != QLatin1Char('\n'));
@@ -181,7 +177,7 @@ static int getToken()
while ( !metAsterSlash ) {
yyCh = getChar();
- if ( yyCh == EOF ) {
+ if (yyCh == QChar(EOF)) {
yyMsg() << qPrintable(LU::tr("Unterminated Java comment.\n"));
return Tok_Comment;
}
@@ -204,7 +200,7 @@ static int getToken()
case '"':
yyCh = getChar();
- while ( yyCh != EOF && yyCh != QLatin1Char('\n') && yyCh != QLatin1Char('"') ) {
+ while (yyCh != QChar(EOF) && yyCh != QLatin1Char('\n') && yyCh != QLatin1Char('"')) {
if ( yyCh == QLatin1Char('\\') ) {
yyCh = getChar();
if ( yyCh == QLatin1Char('u') ) {
@@ -257,7 +253,7 @@ static int getToken()
yyCh = getChar();
do {
yyCh = getChar();
- } while ( yyCh != EOF && yyCh != QLatin1Char('\'') );
+ } while (yyCh != QChar(EOF) && yyCh != QLatin1Char('\''));
yyCh = getChar();
break;
case '{':
diff --git a/src/linguist/lupdate/lupdate.h b/src/linguist/lupdate/lupdate.h
index bb58cbd1e..80076afbe 100644
--- a/src/linguist/lupdate/lupdate.h
+++ b/src/linguist/lupdate/lupdate.h
@@ -31,10 +31,12 @@
#include "qglobal.h"
-#include <QList>
-#include <QString>
-#include <QStringList>
-#include <QHash>
+#include <QtCore/QList>
+#include <QtCore/QHash>
+#include <QtCore/QCoreApplication>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QTranslator>
QT_BEGIN_NAMESPACE
@@ -137,6 +139,10 @@ private:
mutable QHash<QString,TrFunction> m_nameToTrFunctionMap;
};
+class LU {
+ Q_DECLARE_TR_FUNCTIONS(LUpdate)
+};
+
QT_END_NAMESPACE
extern QT_PREPEND_NAMESPACE(TrFunctionAliasManager) trFunctionAliasManager;
diff --git a/src/linguist/lupdate/lupdate.pro b/src/linguist/lupdate/lupdate.pro
index 121717f03..e69703da2 100644
--- a/src/linguist/lupdate/lupdate.pro
+++ b/src/linguist/lupdate/lupdate.pro
@@ -27,6 +27,7 @@ qtHaveModule(qmldevtools-private): SOURCES += qdeclarative.cpp
HEADERS += \
lupdate.h \
+ cpp.h \
../shared/projectdescriptionreader.h \
../shared/qrcreader.h \
../shared/runqttool.h \
diff --git a/src/linguist/lupdate/main.cpp b/src/linguist/lupdate/main.cpp
index ad99d95d5..712b95550 100644
--- a/src/linguist/lupdate/main.cpp
+++ b/src/linguist/lupdate/main.cpp
@@ -197,10 +197,6 @@ static void printErr(const QString & out)
std::cerr << qPrintable(out);
}
-class LU {
- Q_DECLARE_TR_FUNCTIONS(LUpdate)
-};
-
static void recursiveFileInfoList(const QDir &dir,
const QSet<QString> &nameFilters, QDir::Filters filter,
QFileInfoList *fileinfolist)
@@ -529,14 +525,14 @@ static QSet<QString> projectRoots(const QString &projectFile, const QStringList
sourceDirs.insert(proPath + QLatin1Char('/'));
for (const QString &sf : sourceFiles)
sourceDirs.insert(sf.left(sf.lastIndexOf(QLatin1Char('/')) + 1));
- QStringList rootList = sourceDirs.toList();
+ QStringList rootList = sourceDirs.values();
rootList.sort();
for (int prev = 0, curr = 1; curr < rootList.length(); )
if (rootList.at(curr).startsWith(rootList.at(prev)))
rootList.removeAt(curr);
else
prev = curr++;
- return rootList.toSet();
+ return QSet<QString>(rootList.cbegin(), rootList.cend());
}
class ProjectProcessor
@@ -853,7 +849,7 @@ int main(int argc, char **argv)
while (!lstFile.atEnd()) {
QString lineContent = QString::fromLocal8Bit(lstFile.readLine().trimmed());
- if (lineContent.startsWith(QLatin1Literal("-I"))) {
+ if (lineContent.startsWith(QLatin1String("-I"))) {
if (lineContent.length() == 2) {
printErr(LU::tr("The -I option should be followed by a path.\n"));
return 1;
diff --git a/src/linguist/lupdate/merge.cpp b/src/linguist/lupdate/merge.cpp
index f413610f9..0a5a9c1f5 100644
--- a/src/linguist/lupdate/merge.cpp
+++ b/src/linguist/lupdate/merge.cpp
@@ -39,10 +39,6 @@
QT_BEGIN_NAMESPACE
-class LU {
- Q_DECLARE_TR_FUNCTIONS(LUpdate)
-};
-
static bool isDigitFriendly(QChar c)
{
return c.isPunct() || c.isSpace();
diff --git a/src/linguist/lupdate/qdeclarative.cpp b/src/linguist/lupdate/qdeclarative.cpp
index 707ea0b79..7a453aa32 100644
--- a/src/linguist/lupdate/qdeclarative.cpp
+++ b/src/linguist/lupdate/qdeclarative.cpp
@@ -52,10 +52,6 @@
QT_BEGIN_NAMESPACE
-class LU {
- Q_DECLARE_TR_FUNCTIONS(LUpdate)
-};
-
using namespace QQmlJS;
static QString MagicComment(QLatin1String("TRANSLATOR"));
@@ -278,28 +274,23 @@ QString createErrorString(const QString &filename, const QString &code, Parser &
if (m.isWarning())
continue;
- QString error = filename + QLatin1Char(':') + QString::number(m.loc.startLine)
- + QLatin1Char(':') + QString::number(m.loc.startColumn) + QLatin1String(": error: ")
- + m.message + QLatin1Char('\n');
-
- int line = 0;
- if (m.loc.startLine > 0)
- line = m.loc.startLine - 1;
-
- const QString textLine = lines.at(line);
-
+#if Q_QML_PRIVATE_API_VERSION < 5
+ const int line = m.loc.startLine;
+ const int column = m.loc.startColumn;
+#else
+ const int line = m.line;
+ const int column = m.column;
+#endif
+ QString error = filename + QLatin1Char(':')
+ + QString::number(line) + QLatin1Char(':') + QString::number(column)
+ + QLatin1String(": error: ") + m.message + QLatin1Char('\n');
+
+ const QString textLine = lines.at(line > 0 ? line - 1 : 0);
error += textLine + QLatin1Char('\n');
-
- int column = m.loc.startColumn - 1;
- if (column < 0)
- column = 0;
-
- column = qMin(column, textLine.length());
-
- for (int i = 0; i < column; ++i) {
+ for (int i = 0, end = qMin(column > 0 ? column - 1 : 0, textLine.length()); i < end; ++i) {
const QChar ch = textLine.at(i);
if (ch.isSpace())
- error += ch.unicode();
+ error += ch;
else
error += QLatin1Char(' ');
}
diff --git a/src/linguist/lupdate/ui.cpp b/src/linguist/lupdate/ui.cpp
index 417f32cc6..ce4ecc045 100644
--- a/src/linguist/lupdate/ui.cpp
+++ b/src/linguist/lupdate/ui.cpp
@@ -43,10 +43,6 @@
QT_BEGIN_NAMESPACE
-class LU {
- Q_DECLARE_TR_FUNCTIONS(LUpdate)
-};
-
class UiReader : public QXmlDefaultHandler
{
public:
diff --git a/src/linguist/shared/profileevaluator.cpp b/src/linguist/shared/profileevaluator.cpp
index 7eb843a9d..aa32b9e01 100644
--- a/src/linguist/shared/profileevaluator.cpp
+++ b/src/linguist/shared/profileevaluator.cpp
@@ -81,7 +81,7 @@ QStringList ProFileEvaluator::values(const QString &variableName) const
QStringList ProFileEvaluator::values(const QString &variableName, const ProFile *pro) const
{
// It makes no sense to put any kind of magic into expanding these
- const ProStringList &values = d->m_valuemapStack.first().value(ProKey(variableName));
+ const ProStringList &values = d->m_valuemapStack.front().value(ProKey(variableName));
QStringList ret;
ret.reserve(values.size());
foreach (const ProString &str, values)
diff --git a/src/linguist/shared/projectdescriptionreader.cpp b/src/linguist/shared/projectdescriptionreader.cpp
index 5b4a53f25..e61b81e09 100644
--- a/src/linguist/shared/projectdescriptionreader.cpp
+++ b/src/linguist/shared/projectdescriptionreader.cpp
@@ -72,18 +72,20 @@ private:
<< QStringLiteral("sources")
<< QStringLiteral("subProjects")
<< QStringLiteral("translations");
- const QSet<QString> actualKeys = project.keys().toSet();
+ QSet<QString> actualKeys;
+ for (auto it = project.constBegin(), end = project.constEnd(); it != end; ++it)
+ actualKeys.insert(it.key());
const QSet<QString> missingKeys = requiredKeys - actualKeys;
if (!missingKeys.isEmpty()) {
*m_errorString = FMT::tr("Missing keys in project description: %1.").arg(
- missingKeys.toList().join(QLatin1String(", ")));
+ missingKeys.values().join(QLatin1String(", ")));
return false;
}
const QSet<QString> unexpected = actualKeys - allowedKeys;
if (!unexpected.isEmpty()) {
*m_errorString = FMT::tr("Unexpected keys in project %1: %2").arg(
project.value(QStringLiteral("projectFile")).toString(),
- unexpected.toList().join(QLatin1String(", ")));
+ unexpected.values().join(QLatin1String(", ")));
return false;
}
return isValidProjectDescription(project.value(QStringLiteral("subProjects")).toArray());
diff --git a/src/linguist/shared/qmakebuiltins.cpp b/src/linguist/shared/qmakebuiltins.cpp
index b8eafa0b3..92366b9f7 100644
--- a/src/linguist/shared/qmakebuiltins.cpp
+++ b/src/linguist/shared/qmakebuiltins.cpp
@@ -878,8 +878,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
ret += values(map(args.at(0)));
break;
case E_LIST: {
- QString tmp;
- tmp.sprintf(".QMAKE_INTERNAL_TMP_variableName_%d", m_listCount++);
+ QString tmp = QString::asprintf(".QMAKE_INTERNAL_TMP_variableName_%d", m_listCount++);
ret = ProStringList(ProString(tmp));
ProStringList lst;
for (const ProString &arg : args)
@@ -1420,15 +1419,15 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
}
case T_EXPORT: {
const ProKey &var = map(args.at(0));
- for (ProValueMapStack::Iterator vmi = m_valuemapStack.end();
+ for (ProValueMapStack::iterator vmi = m_valuemapStack.end();
--vmi != m_valuemapStack.begin(); ) {
ProValueMap::Iterator it = (*vmi).find(var);
if (it != (*vmi).end()) {
if (it->constBegin() == statics.fakeValue.constBegin()) {
// This is stupid, but qmake doesn't propagate deletions
- m_valuemapStack.first()[var] = ProStringList();
+ m_valuemapStack.front()[var] = ProStringList();
} else {
- m_valuemapStack.first()[var] = *it;
+ m_valuemapStack.front()[var] = *it;
}
(*vmi).erase(it);
while (--vmi != m_valuemapStack.begin())
@@ -1439,7 +1438,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
return ReturnTrue;
}
case T_DISCARD_FROM: {
- if (m_valuemapStack.count() != 1) {
+ if (m_valuemapStack.size() != 1) {
evalError(fL1S("discard_from() cannot be called from functions."));
return ReturnFalse;
}
@@ -1449,7 +1448,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
int pro = m_vfs->idForFileName(fn, flags | QMakeVfs::VfsAccessedOnly);
if (!pro)
return ReturnFalse;
- ProValueMap &vmap = m_valuemapStack.first();
+ ProValueMap &vmap = m_valuemapStack.front();
for (auto vit = vmap.begin(); vit != vmap.end(); ) {
if (!vit->isEmpty()) {
auto isFrom = [pro](const ProString &s) {
@@ -1477,7 +1476,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
else
++fit;
}
- ProStringList &iif = m_valuemapStack.first()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")];
+ ProStringList &iif = m_valuemapStack.front()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")];
int idx = iif.indexOf(ProString(fn));
if (idx >= 0)
iif.removeAt(idx);
diff --git a/src/linguist/shared/qmakeevaluator.cpp b/src/linguist/shared/qmakeevaluator.cpp
index a3022765f..639114d20 100644
--- a/src/linguist/shared/qmakeevaluator.cpp
+++ b/src/linguist/shared/qmakeevaluator.cpp
@@ -601,14 +601,16 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProBlock(
case TokBypassNesting:
blockLen = getBlockLen(tokPtr);
if ((m_cumulative || okey != or_op) && blockLen) {
- ProValueMapStack savedValuemapStack = m_valuemapStack;
+ ProValueMapStack savedValuemapStack = std::move(m_valuemapStack);
m_valuemapStack.clear();
- m_valuemapStack.append(savedValuemapStack.takeFirst());
+ m_valuemapStack.splice(m_valuemapStack.end(),
+ savedValuemapStack, savedValuemapStack.begin());
traceMsg("visiting nesting-bypassing block");
ret = visitProBlock(tokPtr);
traceMsg("visited nesting-bypassing block");
- savedValuemapStack.prepend(m_valuemapStack.first());
- m_valuemapStack = savedValuemapStack;
+ savedValuemapStack.splice(savedValuemapStack.begin(),
+ m_valuemapStack, m_valuemapStack.begin());
+ m_valuemapStack = std::move(savedValuemapStack);
} else {
traceMsg("skipped nesting-bypassing block");
ret = ReturnTrue;
@@ -1439,7 +1441,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
for (ProValueMap::ConstIterator it = m_extraVars.constBegin();
it != m_extraVars.constEnd(); ++it)
- m_valuemapStack.first().insert(it.key(), it.value());
+ m_valuemapStack.front().insert(it.key(), it.value());
// In case default_pre needs to make decisions based on the current
// build pass configuration.
@@ -1707,7 +1709,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFunction(
{
VisitReturn vr;
- if (m_valuemapStack.count() >= 100) {
+ if (m_valuemapStack.size() >= 100) {
evalError(fL1S("Ran into infinite recursion (depth > 100)."));
vr = ReturnFalse;
} else {
@@ -1859,7 +1861,7 @@ static bool isFunctParam(const ProKey &variableName)
ProValueMap *QMakeEvaluator::findValues(const ProKey &variableName, ProValueMap::Iterator *rit)
{
- ProValueMapStack::Iterator vmi = m_valuemapStack.end();
+ ProValueMapStack::iterator vmi = m_valuemapStack.end();
for (bool first = true; ; first = false) {
--vmi;
ProValueMap::Iterator it = (*vmi).find(variableName);
@@ -1886,7 +1888,7 @@ ProStringList &QMakeEvaluator::valuesRef(const ProKey &variableName)
return *it;
}
if (!isFunctParam(variableName)) {
- ProValueMapStack::Iterator vmi = m_valuemapStack.end();
+ ProValueMapStack::iterator vmi = m_valuemapStack.end();
if (--vmi != m_valuemapStack.begin()) {
do {
--vmi;
@@ -1905,7 +1907,7 @@ ProStringList &QMakeEvaluator::valuesRef(const ProKey &variableName)
ProStringList QMakeEvaluator::values(const ProKey &variableName) const
{
- ProValueMapStack::ConstIterator vmi = m_valuemapStack.constEnd();
+ ProValueMapStack::const_iterator vmi = m_valuemapStack.cend();
for (bool first = true; ; first = false) {
--vmi;
ProValueMap::ConstIterator it = (*vmi).constFind(variableName);
@@ -1914,7 +1916,7 @@ ProStringList QMakeEvaluator::values(const ProKey &variableName) const
break;
return *it;
}
- if (vmi == m_valuemapStack.constBegin())
+ if (vmi == m_valuemapStack.cbegin())
break;
if (first && isFunctParam(variableName))
break;
@@ -1942,7 +1944,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFile(
m_current = m_locationStack.pop();
pro->deref();
if (ok == ReturnTrue && !(flags & LoadHidden)) {
- ProStringList &iif = m_valuemapStack.first()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")];
+ ProStringList &iif = m_valuemapStack.front()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")];
ProString ifn(fileName);
if (!iif.contains(ifn))
iif << ifn;
@@ -2082,7 +2084,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFileInto(
return ret;
*values = visitor.m_valuemapStack.top();
ProKey qiif("QMAKE_INTERNAL_INCLUDED_FILES");
- ProStringList &iif = m_valuemapStack.first()[qiif];
+ ProStringList &iif = m_valuemapStack.front()[qiif];
const auto ifns = values->value(qiif);
for (const ProString &ifn : ifns)
if (!iif.contains(ifn))
diff --git a/src/linguist/shared/qmakeevaluator.h b/src/linguist/shared/qmakeevaluator.h
index 83adda3f6..201275305 100644
--- a/src/linguist/shared/qmakeevaluator.h
+++ b/src/linguist/shared/qmakeevaluator.h
@@ -38,7 +38,6 @@
#include "ioutils.h"
#include <qlist.h>
-#include <qlinkedlist.h>
#include <qmap.h>
#include <qset.h>
#include <qstack.h>
@@ -54,6 +53,8 @@
# include <qmutex.h>
#endif
+#include <list>
+
QT_BEGIN_NAMESPACE
class QMakeGlobals;
@@ -94,15 +95,15 @@ public:
#endif
};
-// We use a QLinkedList based stack instead of a QVector based one (QStack), so that
+// We use a list-based stack instead of a vector-based one, so that
// the addresses of value maps stay constant. The qmake generators rely on that.
-class QMAKE_EXPORT ProValueMapStack : public QLinkedList<ProValueMap>
+class QMAKE_EXPORT ProValueMapStack : public std::list<ProValueMap>
{
public:
- inline void push(const ProValueMap &t) { append(t); }
- inline ProValueMap pop() { return takeLast(); }
- ProValueMap &top() { return last(); }
- const ProValueMap &top() const { return last(); }
+ inline void push(const ProValueMap &t) { push_back(t); }
+ inline ProValueMap pop() { auto r = std::move(back()); pop_back(); return r; }
+ ProValueMap &top() { return back(); }
+ const ProValueMap &top() const { return back(); }
};
namespace QMakeInternal { struct QMakeBuiltin; }
diff --git a/src/linguist/shared/ts.cpp b/src/linguist/shared/ts.cpp
index 153f9708b..8d394766a 100644
--- a/src/linguist/shared/ts.cpp
+++ b/src/linguist/shared/ts.cpp
@@ -464,7 +464,7 @@ static QString protect(const QString &str)
result += QLatin1String("&apos;");
break;
default:
- if ((c < 0x20 || (ch > 0x7f && ch.isSpace())) && c != '\n' && c != '\t')
+ if ((c < 0x20 || (ch > QChar(0x7f) && ch.isSpace())) && c != '\n' && c != '\t')
result += numericEntity(c);
else // this also covers surrogates
result += QChar(c);
diff --git a/src/linguist/shared/xliff.cpp b/src/linguist/shared/xliff.cpp
index 338768875..c499e9ea5 100644
--- a/src/linguist/shared/xliff.cpp
+++ b/src/linguist/shared/xliff.cpp
@@ -732,10 +732,9 @@ bool XLIFFHandler::finalizeMessage(bool isPlural)
bool XLIFFHandler::fatalError(const QXmlParseException &exception)
{
- QString msg;
- msg.sprintf("XML error: Parse error at line %d, column %d (%s).\n",
- exception.lineNumber(), exception.columnNumber(),
- exception.message().toLatin1().data() );
+ QString msg = QString::asprintf("XML error: Parse error at line %d, column %d (%s).\n",
+ exception.lineNumber(), exception.columnNumber(),
+ exception.message().toLatin1().data());
m_cd.appendError(msg);
return false;
}
diff --git a/src/macdeployqt/shared/shared.cpp b/src/macdeployqt/shared/shared.cpp
index 3abc31c72..69d0ce8ca 100644
--- a/src/macdeployqt/shared/shared.cpp
+++ b/src/macdeployqt/shared/shared.cpp
@@ -530,12 +530,11 @@ QSet<QString> getBinaryRPaths(const QString &path, bool resolve = true, QString
QString output = otool.readAllStandardOutput();
QStringList outputLines = output.split("\n");
- QStringListIterator i(outputLines);
- while (i.hasNext()) {
- if (i.next().contains("cmd LC_RPATH") && i.hasNext() &&
- i.next().contains("cmdsize") && i.hasNext()) {
- const QString &rpathCmd = i.next();
+ for (auto i = outputLines.cbegin(), end = outputLines.cend(); i != end; ++i) {
+ if (i->contains("cmd LC_RPATH") && ++i != end &&
+ i->contains("cmdsize") && ++i != end) {
+ const QString &rpathCmd = *i;
int pathStart = rpathCmd.indexOf("path ");
int pathEnd = rpathCmd.indexOf(" (");
if (pathStart >= 0 && pathEnd >= 0 && pathStart < pathEnd) {
@@ -1294,7 +1293,7 @@ bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf
// deployQmlImports can consider the module deployed if it has already
// deployed one of its sub-module)
QVariantList array = doc.array().toVariantList();
- qSort(array.begin(), array.end(), importLessThan);
+ std::sort(array.begin(), array.end(), importLessThan);
// deploy each import
foreach (const QVariant &importValue, array) {
diff --git a/src/makeqpf/mainwindow.cpp b/src/makeqpf/mainwindow.cpp
index 3e74a54c1..215df6d47 100644
--- a/src/makeqpf/mainwindow.cpp
+++ b/src/makeqpf/mainwindow.cpp
@@ -219,7 +219,7 @@ void MainWindow::on_sampleFile_editingFinished()
coverage.insert(text.at(i));
QList<QChar> sortedCoverage = QList<QChar>::fromSet(coverage);
- qSort(sortedCoverage);
+ std::sort(sortedCoverage.begin(), sortedCoverage.end());
// play simple :)
for (QChar ch : qAsConst(sortedCoverage)) {
QPF::CharacterRange r;
diff --git a/src/pixeltool/qpixeltool.cpp b/src/pixeltool/qpixeltool.cpp
index 0e2745a5d..b41f5e942 100644
--- a/src/pixeltool/qpixeltool.cpp
+++ b/src/pixeltool/qpixeltool.cpp
@@ -33,7 +33,7 @@
#include <qdir.h>
#include <qapplication.h>
#include <qscreen.h>
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
#include <qclipboard.h>
#endif
#include <qpainter.h>
@@ -67,14 +67,6 @@ static QPoint initialPos(const QSettings &settings, const QSize &initialSize)
QPixelTool::QPixelTool(QWidget *parent)
: QWidget(parent)
- , m_freeze(false)
- , m_displayZoom(false)
- , m_displayGridSize(false)
- , m_mouseDown(false)
- , m_preview_mode(false)
- , m_displayZoomId(0)
- , m_displayGridSizeId(0)
- , m_currentColor(0)
{
setWindowTitle(QCoreApplication::applicationName());
QSettings settings(QLatin1String("QtProject"), QLatin1String("QPixelTool"));
@@ -88,7 +80,7 @@ QPixelTool::QPixelTool(QWidget *parent)
move(initialPos(settings, m_initialSize));
setMouseTracking(true);
- setAttribute(Qt::WA_NoBackground);
+ setAttribute(Qt::WA_OpaquePaintEvent);
m_updateId = startTimer(30);
}
@@ -255,13 +247,12 @@ void QPixelTool::paintEvent(QPaintEvent *)
}
if (m_freeze) {
- QString str;
- str.sprintf("%8X (%3d,%3d,%3d,%3d)",
- m_currentColor,
- (0xff000000 & m_currentColor) >> 24,
- (0x00ff0000 & m_currentColor) >> 16,
- (0x0000ff00 & m_currentColor) >> 8,
- (0x000000ff & m_currentColor));
+ QString str = QString::asprintf("%8X (%3d,%3d,%3d,%3d)",
+ m_currentColor,
+ (0xff000000 & m_currentColor) >> 24,
+ (0x00ff0000 & m_currentColor) >> 16,
+ (0x0000ff00 & m_currentColor) >> 8,
+ (0x000000ff & m_currentColor));
render_string(&p, w, h,
str,
Qt::AlignBottom | Qt::AlignRight);
@@ -279,12 +270,11 @@ void QPixelTool::paintEvent(QPaintEvent *)
p.setPen(QPen(Qt::black, 1, Qt::SolidLine));
p.drawRect(r);
- QString str;
- str.sprintf("Rect: x=%d, y=%d, w=%d, h=%d",
- r.x() / m_zoom,
- r.y() / m_zoom,
- r.width() / m_zoom,
- r.height() / m_zoom);
+ QString str = QString::asprintf("Rect: x=%d, y=%d, w=%d, h=%d",
+ r.x() / m_zoom,
+ r.y() / m_zoom,
+ r.width() / m_zoom,
+ r.height() / m_zoom);
render_string(&p, w, h, str, Qt::AlignBottom | Qt::AlignLeft);
}
@@ -315,12 +305,14 @@ void QPixelTool::keyPressEvent(QKeyEvent *e)
case Qt::Key_A:
m_autoUpdate = !m_autoUpdate;
break;
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
case Qt::Key_C:
- if (e->modifiers() & Qt::ControlModifier)
+ if (e->modifiers().testFlag(Qt::ControlModifier))
copyToClipboard();
+ else
+ copyColorToClipboard();
break;
-#endif
+#endif // QT_CONFIG(clipboard)
case Qt::Key_S:
if (e->modifiers() & Qt::ControlModifier) {
releaseKeyboard();
@@ -455,10 +447,12 @@ void QPixelTool::contextMenuEvent(QContextMenuEvent *e)
// Copy to clipboard / save
menu.addAction(QLatin1String("Save as image..."),
this, &QPixelTool::saveToFile, QKeySequence::SaveAs);
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
menu.addAction(QLatin1String("Copy to clipboard"),
this, &QPixelTool::copyToClipboard, QKeySequence::Copy);
-#endif
+ menu.addAction(QLatin1String("Copy color value to clipboard"),
+ this, &QPixelTool::copyColorToClipboard, Qt::Key_C);
+#endif // QT_CONFIG(clipboard)
menu.addSeparator();
menu.addAction(QLatin1String("About Qt"), qApp, &QApplication::aboutQt);
@@ -499,7 +493,7 @@ QSize QPixelTool::sizeHint() const
return m_initialSize;
}
-static inline QString pixelToolTitle(QPoint pos)
+static inline QString pixelToolTitle(QPoint pos, const QColor &currentColor)
{
if (QHighDpiScaling::isActive()) {
if (auto screen = QGuiApplication::screenAt(pos))
@@ -507,7 +501,8 @@ static inline QString pixelToolTitle(QPoint pos)
}
return QCoreApplication::applicationName() + QLatin1String(" [")
+ QString::number(pos.x())
- + QLatin1String(", ") + QString::number(pos.y()) + QLatin1Char(']');
+ + QLatin1String(", ") + QString::number(pos.y()) + QLatin1String("] ")
+ + currentColor.name();
}
void QPixelTool::grabScreen()
@@ -525,7 +520,7 @@ void QPixelTool::grabScreen()
return;
if (m_lastMousePos != mousePos)
- setWindowTitle(pixelToolTitle(mousePos));
+ setWindowTitle(pixelToolTitle(mousePos, m_currentColor));
int w = int(width() / float(m_zoom));
int h = int(height() / float(m_zoom));
@@ -563,6 +558,7 @@ void QPixelTool::grabScreen()
update();
+ m_currentColor = m_buffer.toImage().pixel(m_buffer.rect().center());
m_lastMousePos = mousePos;
}
@@ -644,12 +640,17 @@ void QPixelTool::setGridSize(int gridSize)
}
}
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void QPixelTool::copyToClipboard()
{
QGuiApplication::clipboard()->setPixmap(m_buffer);
}
-#endif
+
+void QPixelTool::copyColorToClipboard()
+{
+ QGuiApplication::clipboard()->setText(QColor(m_currentColor).name());
+}
+#endif // QT_CONFIG(clipboard)
void QPixelTool::saveToFile()
{
diff --git a/src/pixeltool/qpixeltool.h b/src/pixeltool/qpixeltool.h
index ecf912353..3fa9f1e7e 100644
--- a/src/pixeltool/qpixeltool.h
+++ b/src/pixeltool/qpixeltool.h
@@ -51,8 +51,9 @@ public slots:
void toggleGrid();
void toggleFreeze();
void setZoomVisible(bool visible);
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void copyToClipboard();
+ void copyColorToClipboard();
#endif
void saveToFile();
void increaseGridSize() { setGridSize(m_gridSize + 1); }
@@ -78,12 +79,12 @@ private:
void startGridSizeVisibleTimer();
QString aboutText() const;
- bool m_freeze;
- bool m_displayZoom;
- bool m_displayGridSize;
- bool m_mouseDown;
+ bool m_freeze = false;
+ bool m_displayZoom = false;
+ bool m_displayGridSize = false;
+ bool m_mouseDown = false;
bool m_autoUpdate;
- bool m_preview_mode;
+ bool m_preview_mode = false;
int m_gridActive;
int m_zoom;
@@ -92,9 +93,9 @@ private:
int m_updateId;
int m_displayZoomId;
- int m_displayGridSizeId;
+ int m_displayGridSizeId = 0;
- int m_currentColor;
+ QRgb m_currentColor = 0;
QPoint m_lastMousePos;
QPoint m_dragStart;
diff --git a/src/qdoc/Qt5DocToolsConfig.cmake.in b/src/qdoc/Qt5DocToolsConfig.cmake.in
new file mode 100644
index 000000000..daa336127
--- /dev/null
+++ b/src/qdoc/Qt5DocToolsConfig.cmake.in
@@ -0,0 +1,56 @@
+if (CMAKE_VERSION VERSION_LESS 2.8.3)
+ message(FATAL_ERROR \"Qt 5 requires at least CMake version 2.8.3\")
+endif()
+
+!!IF !isEmpty(CMAKE_USR_MOVE_WORKAROUND)
+!!IF !isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+set(_qt5_qdoctools_install_prefix \"$$[QT_INSTALL_PREFIX]\")
+!!ELSE
+get_filename_component(_IMPORT_PREFIX \"${CMAKE_CURRENT_LIST_FILE}\" PATH)
+# Use original install prefix when loaded through a
+# cross-prefix symbolic link such as /lib -> /usr/lib.
+get_filename_component(_realCurr \"${_IMPORT_PREFIX}\" REALPATH)
+get_filename_component(_realOrig \"$$CMAKE_INSTALL_LIBS_DIR/cmake/Qt5DocTools\" REALPATH)
+if(_realCurr STREQUAL _realOrig)
+ get_filename_component(_qt5_qdoctools_install_prefix \"$$CMAKE_INSTALL_LIBS_DIR/$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}\" ABSOLUTE)
+else()
+ get_filename_component(_qt5_qdoctools_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+endif()
+unset(_realOrig)
+unset(_realCurr)
+unset(_IMPORT_PREFIX)
+!!ENDIF
+!!ELIF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+get_filename_component(_qt5_qdoctools_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+!!ELSE
+set(_qt5_qdoctools_install_prefix \"$$[QT_INSTALL_PREFIX]\")
+!!ENDIF
+
+macro(_qt5_DocTools_check_file_exists file)
+ if(NOT EXISTS \"${file}\" )
+ message(FATAL_ERROR \"The package \\\"Qt5DocTools\\\" references the file
+ \\\"${file}\\\"
+but this file does not exist. Possible reasons include:
+* The file was deleted, renamed, or moved to another location.
+* An install or uninstall procedure did not complete successfully.
+* The installation package was faulty and contained
+ \\\"${CMAKE_CURRENT_LIST_FILE}\\\"
+but not all the files it references.
+\")
+ endif()
+endmacro()
+
+if (NOT TARGET Qt5::qdoc)
+ add_executable(Qt5::qdoc IMPORTED)
+
+!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+ set(imported_location \"${_qt5_qdoctools_install_prefix}/$${CMAKE_BIN_DIR}qdoc$$CMAKE_BIN_SUFFIX\")
+!!ELSE
+ set(imported_location \"$${CMAKE_BIN_DIR}qdoc$$CMAKE_BIN_SUFFIX\")
+!!ENDIF
+ _qt5_DocTools_check_file_exists(${imported_location})
+
+ set_target_properties(Qt5::qdoc PROPERTIES
+ IMPORTED_LOCATION ${imported_location}
+ )
+endif()
diff --git a/src/qdoc/atom.cpp b/src/qdoc/atom.cpp
index 43a164ada..dff90b299 100644
--- a/src/qdoc/atom.cpp
+++ b/src/qdoc/atom.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -26,12 +26,15 @@
**
****************************************************************************/
-#include <qregexp.h>
#include "atom.h"
+
#include "location.h"
#include "qdocdatabase.h"
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qregexp.h>
+
#include <stdio.h>
-#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -235,27 +238,27 @@ static const struct {
{ nullptr, 0 }
};
-/*! \fn Atom::Atom(AtomType type, const QString& string)
+/*! \fn Atom::Atom(AtomType type, const QString &string)
Constructs an atom of the specified \a type with the single
parameter \a string and does not put the new atom in a list.
*/
-/*! \fn Atom::Atom(AtomType type, const QString& p1, const QString& p2)
+/*! \fn Atom::Atom(AtomType type, const QString &p1, const QString &p2)
Constructs an atom of the specified \a type with the two
parameters \a p1 and \a p2 and does not put the new atom
in a list.
*/
-/*! \fn Atom(Atom *previous, AtomType type, const QString& string)
+/*! \fn Atom(Atom *previous, AtomType type, const QString &string)
Constructs an atom of the specified \a type with the single
parameter \a string and inserts the new atom into the list
after the \a previous atom.
*/
-/*! \fn Atom::Atom(Atom* previous, AtomType type, const QString& p1, const QString& p2)
+/*! \fn Atom::Atom(Atom *previous, AtomType type, const QString &p1, const QString &p2)
Constructs an atom of the specified \a type with the two
parameters \a p1 and \a p2 and inserts the new atom into
@@ -269,7 +272,7 @@ static const struct {
\also string()
*/
-/*! \fn void Atom::appendString(const QString& string)
+/*! \fn void Atom::appendString(const QString &string)
Appends \a string to the string parameter of this atom.
@@ -290,7 +293,7 @@ static const struct {
Return the next Atom in the list if it is of AtomType \a t.
Otherwise return 0.
*/
-const Atom* Atom::next(AtomType t) const
+const Atom *Atom::next(AtomType t) const
{
return (next_ && (next_->type() == t)) ? next_ : nullptr;
}
@@ -299,7 +302,7 @@ const Atom* Atom::next(AtomType t) const
Return the next Atom in the list if it is of AtomType \a t
and its string part is \a s. Otherwise return 0.
*/
-const Atom* Atom::next(AtomType t, const QString& s) const
+const Atom *Atom::next(AtomType t, const QString &s) const
{
return (next_ && (next_->type() == t) && (next_->string() == s)) ? next_ : nullptr;
}
@@ -342,7 +345,7 @@ QString Atom::typeString() const
return QLatin1String(atms[i].english);
}
-/*! \fn const QString& Atom::string() const
+/*! \fn const QString &Atom::string() const
Returns the string parameter that together with the type
characterizes this atom.
@@ -376,7 +379,7 @@ void Atom::dump() const
words separated by spaces. The constructor splits \a p2 on
the space character.
*/
-LinkAtom::LinkAtom(const QString& p1, const QString& p2)
+LinkAtom::LinkAtom(const QString &p1, const QString &p2)
: Atom(p1),
resolved_(false),
genus_(Node::DontCare),
@@ -396,28 +399,28 @@ void LinkAtom::resolveSquareBracketParams()
{
if (resolved_)
return;
- QStringList params = squareBracketParams_.toLower().split(QLatin1Char(' '));
- foreach (const QString& p, params) {
+ const QStringList params = squareBracketParams_.toLower().split(QLatin1Char(' '));
+ for (const auto &param : params) {
if (!domain_) {
- domain_ = QDocDatabase::qdocDB()->findTree(p);
+ domain_ = QDocDatabase::qdocDB()->findTree(param);
if (domain_) {
continue;
}
}
if (goal_ == Node::NoType) {
- goal_ = Node::goal(p);
+ goal_ = Node::goal(param);
if (goal_ != Node::NoType)
continue;
}
- if (p == "qml") {
+ if (param == "qml") {
genus_ = Node::QML;
continue;
}
- if (p == "cpp") {
+ if (param == "cpp") {
genus_ = Node::CPP;
continue;
}
- if (p == "doc") {
+ if (param == "doc") {
genus_ = Node::DOC;
continue;
}
@@ -430,7 +433,7 @@ void LinkAtom::resolveSquareBracketParams()
/*!
Standard copy constructor of LinkAtom \a t.
*/
-LinkAtom::LinkAtom(const LinkAtom& t)
+LinkAtom::LinkAtom(const LinkAtom &t)
: Atom(Link, t.string()),
resolved_(t.resolved_),
genus_(t.genus_),
@@ -447,7 +450,7 @@ LinkAtom::LinkAtom(const LinkAtom& t)
where the new LinkAtom will not be the first one
in the list.
*/
-LinkAtom::LinkAtom(Atom* previous, const LinkAtom& t)
+LinkAtom::LinkAtom(Atom *previous, const LinkAtom &t)
: Atom(previous, Link, t.string()),
resolved_(t.resolved_),
genus_(t.genus_),
diff --git a/src/qdoc/atom.h b/src/qdoc/atom.h
index b72264d18..70a639158 100644
--- a/src/qdoc/atom.h
+++ b/src/qdoc/atom.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -29,9 +29,10 @@
#ifndef ATOM_H
#define ATOM_H
-#include <qstringlist.h>
#include "node.h"
-#include <qdebug.h>
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE
@@ -133,19 +134,19 @@ public:
friend class LinkAtom;
- Atom(const QString& string)
+ Atom(const QString &string)
: next_(nullptr), type_(Link)
{
strs << string;
}
- Atom(AtomType type, const QString& string = "")
+ Atom(AtomType type, const QString &string = "")
: next_(nullptr), type_(type)
{
strs << string;
}
- Atom(AtomType type, const QString& p1, const QString& p2)
+ Atom(AtomType type, const QString &p1, const QString &p2)
: next_(nullptr), type_(type)
{
strs << p1;
@@ -153,14 +154,14 @@ public:
strs << p2;
}
- Atom(Atom* previous, AtomType type, const QString& string = "")
+ Atom(Atom *previous, AtomType type, const QString &string = "")
: next_(previous->next_), type_(type)
{
strs << string;
previous->next_ = this;
}
- Atom(Atom* previous, AtomType type, const QString& p1, const QString& p2)
+ Atom(Atom *previous, AtomType type, const QString &p1, const QString &p2)
: next_(previous->next_), type_(type)
{
strs << p1;
@@ -172,34 +173,34 @@ public:
virtual ~Atom() { }
void appendChar(QChar ch) { strs[0] += ch; }
- void appendString(const QString& string) { strs[0] += string; }
+ void appendString(const QString &string) { strs[0] += string; }
void chopString() { strs[0].chop(1); }
- void setString(const QString& string) { strs[0] = string; }
- Atom* next() { return next_; }
- void setNext(Atom* newNext) { next_ = newNext; }
+ void setString(const QString &string) { strs[0] = string; }
+ Atom *next() { return next_; }
+ void setNext(Atom *newNext) { next_ = newNext; }
- const Atom* next() const { return next_; }
- const Atom* next(AtomType t) const;
- const Atom* next(AtomType t, const QString& s) const;
+ const Atom *next() const { return next_; }
+ const Atom *next(AtomType t) const;
+ const Atom *next(AtomType t, const QString &s) const;
AtomType type() const { return type_; }
QString typeString() const;
- const QString& string() const { return strs[0]; }
- const QString& string(int i) const { return strs[i]; }
+ const QString &string() const { return strs[0]; }
+ const QString &string(int i) const { return strs[i]; }
int count() const { return strs.size(); }
void dump() const;
- const QStringList& strings() const { return strs; }
+ const QStringList &strings() const { return strs; }
virtual bool isLinkAtom() const { return false; }
virtual Node::Genus genus() { return Node::DontCare; }
virtual bool specifiesDomain() { return false; }
- virtual Tree* domain() { return nullptr; }
+ virtual Tree *domain() { return nullptr; }
virtual Node::NodeType goal() { return Node::NoType; }
- virtual const QString& error() { return noError_; }
+ virtual const QString &error() { return noError_; }
virtual void resolveSquareBracketParams() { }
protected:
static QString noError_;
- Atom* next_;
+ Atom *next_;
AtomType type_;
QStringList strs;
};
@@ -207,26 +208,26 @@ public:
class LinkAtom : public Atom
{
public:
- LinkAtom(const QString& p1, const QString& p2);
- LinkAtom(const LinkAtom& t);
- LinkAtom(Atom* previous, const LinkAtom& t);
- virtual ~LinkAtom() { }
+ LinkAtom(const QString &p1, const QString &p2);
+ LinkAtom(const LinkAtom &t);
+ LinkAtom(Atom *previous, const LinkAtom &t);
+ ~LinkAtom() override { }
bool isLinkAtom() const override { return true; }
Node::Genus genus() override { resolveSquareBracketParams(); return genus_; }
bool specifiesDomain() override { resolveSquareBracketParams(); return (domain_ != nullptr); }
- Tree* domain() override { resolveSquareBracketParams(); return domain_; }
+ Tree *domain() override { resolveSquareBracketParams(); return domain_; }
Node::NodeType goal() override { resolveSquareBracketParams(); return goal_; }
- const QString& error() override { return error_; }
+ const QString &error() override { return error_; }
void resolveSquareBracketParams() override;
protected:
- bool resolved_;
+ bool resolved_;
Node::Genus genus_;
- Node::NodeType goal_;
- Tree* domain_;
- QString error_;
- QString squareBracketParams_;
+ Node::NodeType goal_;
+ Tree *domain_;
+ QString error_;
+ QString squareBracketParams_;
};
#define ATOM_FORMATTING_BOLD "bold"
diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp
index b628c4cd1..475becf4d 100644
--- a/src/qdoc/clangcodeparser.cpp
+++ b/src/qdoc/clangcodeparser.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2018 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -41,23 +41,26 @@
clangcodeparser.cpp
*/
-#include <qfile.h>
-#include <stdio.h>
-#include <errno.h>
+#include "clangcodeparser.h"
+
#include "codechunk.h"
#include "config.h"
-#include "clangcodeparser.h"
#include "generator.h"
#include "loggingcategory.h"
#include "qdocdatabase.h"
-#include <qdebug.h>
-#include <qscopedvaluerollback.h>
-#include <qelapsedtimer.h>
-#include <qtemporarydir.h>
-#include "generator.h"
+#include "utilities.h"
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qelapsedtimer.h>
+#include <QtCore/qfile.h>
+#include <QtCore/qscopedvaluerollback.h>
+#include <QtCore/qtemporarydir.h>
#include <clang-c/Index.h>
+#include <errno.h>
+#include <stdio.h>
+
QT_BEGIN_NAMESPACE
static CXTranslationUnit_Flags flags_ = static_cast<CXTranslationUnit_Flags>(0);
@@ -90,7 +93,7 @@ static QDebug operator<<(QDebug debug, const std::vector<T> &v)
template <typename T> bool visitChildrenLambda(CXCursor cursor, T &&lambda)
{
CXCursorVisitor visitor = [](CXCursor c, CXCursor , CXClientData client_data) -> CXChildVisitResult
- { return (*static_cast<T*>(client_data))(c); };
+ { return (*static_cast<T *>(client_data))(c); };
return clang_visitChildren(cursor, visitor, &lambda);
}
@@ -216,7 +219,7 @@ static QString reconstructQualifiedPathForCursor(CXCursor cur) {
Find the node from the QDocDatabase \a qdb that corrseponds to the declaration
represented by the cursor \a cur, if it exists.
*/
-static Node *findNodeForCursor(QDocDatabase* qdb, CXCursor cur) {
+static Node *findNodeForCursor(QDocDatabase *qdb, CXCursor cur) {
auto kind = clang_getCursorKind(cur);
if (clang_isInvalid(kind))
return nullptr;
@@ -256,7 +259,7 @@ static Node *findNodeForCursor(QDocDatabase* qdb, CXCursor cur) {
for (Node *candidate : qAsConst(candidates)) {
if (!candidate->isFunction(Node::CPP))
continue;
- auto fn = static_cast<FunctionNode*>(candidate);
+ auto fn = static_cast<FunctionNode *>(candidate);
const Parameters &parameters = fn->parameters();
const int actualArg = numArg - parameters.isPrivateSignal();
if (parameters.count() != actualArg + isVariadic)
@@ -305,7 +308,7 @@ static Node *findNodeForCursor(QDocDatabase* qdb, CXCursor cur) {
corrseponds to the declaration represented by the cursor
\a cur, if it exists.
*/
-static Node *findFunctionNodeForCursor(QDocDatabase* qdb, CXCursor cur) {
+static Node *findFunctionNodeForCursor(QDocDatabase *qdb, CXCursor cur) {
auto kind = clang_getCursorKind(cur);
if (clang_isInvalid(kind))
return nullptr;
@@ -335,7 +338,7 @@ static Node *findFunctionNodeForCursor(QDocDatabase* qdb, CXCursor cur) {
for (Node *candidate : qAsConst(candidates)) {
if (!candidate->isFunction(Node::CPP))
continue;
- auto fn = static_cast<FunctionNode*>(candidate);
+ auto fn = static_cast<FunctionNode *>(candidate);
const Parameters &parameters = fn->parameters();
if (parameters.count() != (numArg + isVariadic))
continue;
@@ -377,7 +380,7 @@ public:
ClangVisitor(QDocDatabase *qdb, const QHash<QString, QString> &allHeaders)
: qdb_(qdb), parent_(qdb->primaryTreeRoot()), allHeaders_(allHeaders) { }
- QDocDatabase* qdocDB() { return qdb_; }
+ QDocDatabase *qdocDB() { return qdb_; }
CXChildVisitResult visitChildren(CXCursor cursor)
{
@@ -410,7 +413,7 @@ public:
Not sure about all the possibilities, when the cursor
location is not in the main file.
*/
- CXChildVisitResult visitFnArg(CXCursor cursor, Node** fnNode, bool &ignoreSignature)
+ CXChildVisitResult visitFnArg(CXCursor cursor, Node **fnNode, bool &ignoreSignature)
{
auto ret = visitChildrenLambda(cursor, [&](CXCursor cur) {
auto loc = clang_getCursorLocation(cur);
@@ -441,7 +444,7 @@ private:
*/
QMap<SimpleLoc, CXCursor> declMap_;
- QDocDatabase* qdb_;
+ QDocDatabase *qdb_;
Aggregate *parent_;
const QHash<QString, QString> allHeaders_;
QHash<CXFile, bool> isInterestingCache_; // doing a canonicalFilePath is slow, so keep a cache.
@@ -481,9 +484,9 @@ private:
CXChildVisitResult visitSource(CXCursor cursor, CXSourceLocation loc);
CXChildVisitResult visitHeader(CXCursor cursor, CXSourceLocation loc);
- CXChildVisitResult visitFnSignature(CXCursor cursor, CXSourceLocation loc, Node** fnNode, bool &ignoreSignature);
+ CXChildVisitResult visitFnSignature(CXCursor cursor, CXSourceLocation loc, Node **fnNode, bool &ignoreSignature);
void parseProperty(const QString &spelling, const Location &loc);
- void readParameterNamesAndAttributes(FunctionNode* fn, CXCursor cursor);
+ void readParameterNamesAndAttributes(FunctionNode *fn, CXCursor cursor);
Aggregate *getSemanticParent(CXCursor cursor);
};
@@ -513,15 +516,15 @@ Aggregate *ClangVisitor::getSemanticParent(CXCursor cursor)
CXCursor sp = clang_getCursorSemanticParent(cursor);
CXCursor lp = clang_getCursorLexicalParent(cursor);
if (!clang_equalCursors(sp, lp) && clang_isDeclaration(clang_getCursorKind(sp))) {
- Node* spn = findNodeForCursor(qdb_, sp);
+ Node *spn = findNodeForCursor(qdb_, sp);
if (spn && spn->isAggregate()) {
- return static_cast<Aggregate*>(spn);
+ return static_cast<Aggregate *>(spn);
}
}
return parent_;
}
-CXChildVisitResult ClangVisitor::visitFnSignature(CXCursor cursor, CXSourceLocation , Node** fnNode, bool &ignoreSignature)
+CXChildVisitResult ClangVisitor::visitFnSignature(CXCursor cursor, CXSourceLocation , Node **fnNode, bool &ignoreSignature)
{
switch (clang_getCursorKind(cursor)) {
case CXCursor_FunctionDecl:
@@ -537,7 +540,7 @@ CXChildVisitResult ClangVisitor::visitFnSignature(CXCursor cursor, CXSourceLocat
} else {
*fnNode = findFunctionNodeForCursor(qdb_, cursor);
if (*fnNode && (*fnNode)->isFunction(Node::CPP)) {
- FunctionNode* fn = static_cast<FunctionNode*>(*fnNode);
+ FunctionNode *fn = static_cast<FunctionNode *>(*fnNode);
readParameterNamesAndAttributes(fn, cursor);
}
}
@@ -562,7 +565,7 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l
int lastBlank = typeAlias[0].lastIndexOf(QChar(' '));
if (lastBlank > 0) {
typeAlias[0] = typeAlias[0].right(typeAlias[0].size() - (lastBlank + 1));
- TypeAliasNode* ta = new TypeAliasNode(parent_, typeAlias[0], typeAlias[1]);
+ TypeAliasNode *ta = new TypeAliasNode(parent_, typeAlias[0], typeAlias[1]);
ta->setAccess(fromCX_CXXAccessSpecifier(clang_getCXXAccessSpecifier(cursor)));
ta->setLocation(fromCXSourceLocation(clang_getCursorLocation(cursor)));
}
@@ -584,7 +587,7 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l
QString className = fromCXString(clang_getCursorSpelling(cursor));
- Aggregate* semanticParent = getSemanticParent(cursor);
+ Aggregate *semanticParent = getSemanticParent(cursor);
if (semanticParent && semanticParent->findNonfunctionChild(className, &Node::isClassNode)) {
return CXChildVisit_Continue;
}
@@ -616,21 +619,21 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l
auto type = clang_getCursorType(cursor);
auto baseCursor = clang_getTypeDeclaration(type);
auto baseNode = findNodeForCursor(qdb_, baseCursor);
- auto classe = static_cast<ClassNode*>(parent_);
+ auto classe = static_cast<ClassNode *>(parent_);
if (baseNode == nullptr || !baseNode->isClassNode()) {
QString bcName = fromCXString(clang_getCursorSpelling(baseCursor));
classe->addUnresolvedBaseClass(access, QStringList(bcName), bcName);
return CXChildVisit_Continue;
}
- auto baseClasse = static_cast<ClassNode*>(baseNode);
+ auto baseClasse = static_cast<ClassNode *>(baseNode);
classe->addResolvedBaseClass(access, baseClasse);
return CXChildVisit_Continue;
}
case CXCursor_Namespace: {
QString namespaceName = fromCXString(clang_getCursorDisplayName(cursor));
- NamespaceNode* ns = nullptr;
+ NamespaceNode *ns = nullptr;
if (parent_)
- ns = static_cast<NamespaceNode*>(parent_->findNonfunctionChild(namespaceName, &Node::isNamespace));
+ ns = static_cast<NamespaceNode *>(parent_->findNonfunctionChild(namespaceName, &Node::isNamespace));
if (!ns) {
ns = new NamespaceNode(parent_, namespaceName);
ns->setAccess(Node::Public);
@@ -653,7 +656,7 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l
CXType funcType = clang_getCursorType(cursor);
- FunctionNode* fn = new FunctionNode(parent_, name);
+ FunctionNode *fn = new FunctionNode(parent_, name);
CXSourceRange range = clang_Cursor_getCommentRange(cursor);
if (!clang_Range_isNull(range)) {
@@ -743,7 +746,7 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l
Aggregate *ns = parent_;
while (ns && ns->isClassNode())
ns = ns->parent();
- QScopedValueRollback<Aggregate *> setParent(parent_, ns);
+ QScopedValueRollback<Aggregate *>setParent(parent_, ns);
// Visit the friend functions
return visitChildren(cursor);
}
@@ -752,13 +755,13 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l
if (findNodeForCursor(qdb_, cursor)) // Was already parsed, propably in another tu
return CXChildVisit_Continue;
QString enumTypeName = fromCXString(clang_getCursorSpelling(cursor));
- EnumNode* en = nullptr;
+ EnumNode *en = nullptr;
if (enumTypeName.isEmpty()) {
enumTypeName = "anonymous";
if (parent_ && (parent_->isClassNode() || parent_->isNamespace())) {
- Node* n = parent_->findNonfunctionChild(enumTypeName, &Node::isEnumType);
+ Node *n = parent_->findNonfunctionChild(enumTypeName, &Node::isEnumType);
if (n)
- en = static_cast<EnumNode*>(n);
+ en = static_cast<EnumNode *>(n);
}
}
if (!en) {
@@ -809,7 +812,7 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l
case CXCursor_TypedefDecl: {
if (findNodeForCursor(qdb_, cursor)) // Was already parsed, propably in another translation unit
return CXChildVisit_Continue;
- TypedefNode* td = new TypedefNode(parent_, fromCXString(clang_getCursorSpelling(cursor)));
+ TypedefNode *td = new TypedefNode(parent_, fromCXString(clang_getCursorSpelling(cursor)));
td->setAccess(fromCX_CXXAccessSpecifier(clang_getCXXAccessSpecifier(cursor)));
td->setLocation(fromCXSourceLocation(clang_getCursorLocation(cursor)));
// Search to see if this is a Q_DECLARE_FLAGS (if the type is QFlags<ENUM>)
@@ -823,7 +826,7 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l
return CXChildVisit_Continue;
auto *en = findNodeForCursor(qdb_, clang_getTypeDeclaration(clang_getCursorType(cur)));
if (en && en->isEnumType())
- static_cast<EnumNode*>(en)->setFlagsType(td);
+ static_cast<EnumNode *>(en)->setFlagsType(td);
return CXChildVisit_Break;
});
return CXChildVisit_Break;
@@ -844,7 +847,7 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l
}
}
-void ClangVisitor::readParameterNamesAndAttributes(FunctionNode* fn, CXCursor cursor)
+void ClangVisitor::readParameterNamesAndAttributes(FunctionNode *fn, CXCursor cursor)
{
Parameters &parameters = fn->parameters();
// Visit the parameters and attributes
@@ -887,7 +890,7 @@ void ClangVisitor::readParameterNamesAndAttributes(FunctionNode* fn, CXCursor cu
});
}
-void ClangVisitor::parseProperty(const QString& spelling, const Location& loc)
+void ClangVisitor::parseProperty(const QString &spelling, const Location &loc)
{
int lpIdx = spelling.indexOf(QChar('('));
int rpIdx = spelling.lastIndexOf(QChar(')'));
@@ -969,7 +972,7 @@ void ClangVisitor::parseProperty(const QString& spelling, const Location& loc)
must be inbetween.
Returns nullptr if no suitable declaration was found between the two comments.
*/
-Node* ClangVisitor::nodeForCommentAtLocation(CXSourceLocation loc, CXSourceLocation nextCommentLoc)
+Node *ClangVisitor::nodeForCommentAtLocation(CXSourceLocation loc, CXSourceLocation nextCommentLoc)
{
ClangVisitor::SimpleLoc docloc;
clang_getPresumedLocation(loc, nullptr, &docloc.line, &docloc.column);
@@ -999,7 +1002,7 @@ Node* ClangVisitor::nodeForCommentAtLocation(CXSourceLocation loc, CXSourceLocat
auto *node = findNodeForCursor(qdb_, *decl_it);
// borrow the parameter name from the definition
if (node && node->isFunction(Node::CPP))
- readParameterNamesAndAttributes(static_cast<FunctionNode*>(node), *decl_it);
+ readParameterNamesAndAttributes(static_cast<FunctionNode *>(node), *decl_it);
return node;
}
@@ -1121,7 +1124,6 @@ static const char *defaultArgs_[] = {
#else
"-fms-compatibility-version=19",
#endif
- "-fno-exceptions", // Workaround for clang bug http://reviews.llvm.org/D17988
"-DQ_QDOC",
"-DQ_CLANG_QDOC",
"-DQT_DISABLE_DEPRECATED_BEFORE=0",
@@ -1369,7 +1371,7 @@ static float getUnpatchedVersion(QString t)
Call matchDocsAndStuff() to do all the parsing and tree building.
*/
-void ClangCodeParser::parseSourceFile(const Location& /*location*/, const QString& filePath)
+void ClangCodeParser::parseSourceFile(const Location &/*location*/, const QString &filePath)
{
/*
The set of open namespaces is cleared before parsing
@@ -1429,7 +1431,7 @@ void ClangCodeParser::parseSourceFile(const Location& /*location*/, const QStrin
DocList docs;
QString topic;
NodeList nodes;
- const TopicList& topics = doc.topicsUsed();
+ const TopicList &topics = doc.topicsUsed();
if (!topics.isEmpty())
topic = topics[0].topic;
@@ -1480,9 +1482,9 @@ void ClangCodeParser::parseSourceFile(const Location& /*location*/, const QStrin
command. \a location is used for reporting errors. \a fnArg
is the string to parse. It is always a function decl.
*/
-Node* ClangCodeParser::parseFnArg(const Location& location, const QString& fnArg)
+Node *ClangCodeParser::parseFnArg(const Location &location, const QString &fnArg)
{
- Node* fnNode = nullptr;
+ Node *fnNode = nullptr;
/*
If the \fn command begins with a tag, then don't try to
parse the \fn command with clang. Use the tag to search
@@ -1502,7 +1504,7 @@ Node* ClangCodeParser::parseFnArg(const Location& location, const QString& fnArg
parameter names from the \FN command, because
they will be the names used in the documentation.
*/
- FunctionNode* fn = static_cast<FunctionNode*>(fnNode);
+ FunctionNode *fn = static_cast<FunctionNode *>(fnNode);
QStringList leftParenSplit = fnArg.split('(');
if (leftParenSplit.size() > 1) {
QStringList rightParenSplit = leftParenSplit[1].split(')');
@@ -1537,7 +1539,7 @@ Node* ClangCodeParser::parseFnArg(const Location& location, const QString& fnArg
CXTranslationUnit_SkipFunctionBodies |
CXTranslationUnit_KeepGoing);
// Change 2nd parameter to 1 to make clang report errors.
- CXIndex index = clang_createIndex(1, Generator::debugging() ? 1 : 0);
+ CXIndex index = clang_createIndex(1, Utilities::debugging() ? 1 : 0);
std::vector<const char *> args(std::begin(defaultArgs_), std::end(defaultArgs_));
// Add the defines from the qdocconf file.
@@ -1563,7 +1565,7 @@ Node* ClangCodeParser::parseFnArg(const Location& location, const QString& fnArg
flags,
&tu);
qCDebug(lcQdoc) << __FUNCTION__ << "clang_parseTranslationUnit2("
- << dummyFileName << args_ << ") returns" << err;
+ << dummyFileName << args << ") returns" << err;
if (err || !tu) {
location.error(ClangCodeParser::tr("clang could not parse \\fn %1").arg(fnArg));
clang_disposeTranslationUnit(tu);
@@ -1600,7 +1602,7 @@ Node* ClangCodeParser::parseFnArg(const Location& location, const QString& fnArg
qualifier[i++] = QChar(' ');
if (i > 0)
qualifier = qualifier.simplified();
- ClassNode* cn = qdb_->findClassNode(QStringList(qualifier));
+ ClassNode *cn = qdb_->findClassNode(QStringList(qualifier));
if (cn && cn->isInternal())
report = false;
}
diff --git a/src/qdoc/clangcodeparser.h b/src/qdoc/clangcodeparser.h
index a022ca9d3..e0ca2fba1 100644
--- a/src/qdoc/clangcodeparser.h
+++ b/src/qdoc/clangcodeparser.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2018 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -40,10 +40,10 @@
#ifndef CLANGCODEPARSER_H
#define CLANGCODEPARSER_H
-#include <QTemporaryDir>
-
#include "cppcodeparser.h"
+#include <QtCore/qtemporarydir.h>
+
QT_BEGIN_NAMESPACE
class ClangCodeParser : public CppCodeParser
@@ -51,15 +51,15 @@ class ClangCodeParser : public CppCodeParser
Q_DECLARE_TR_FUNCTIONS(QDoc::ClangCodeParser)
public:
- ~ClangCodeParser();
+ ~ClangCodeParser() override;
- void initializeParser(const Config& config) override;
+ void initializeParser(const Config &config) override;
void terminateParser() override;
QString language() override;
QStringList headerFileNameFilter() override;
QStringList sourceFileNameFilter() override;
- void parseHeaderFile(const Location& location, const QString& filePath) override;
- void parseSourceFile(const Location& location, const QString& filePath) override;
+ void parseHeaderFile(const Location &location, const QString &filePath) override;
+ void parseSourceFile(const Location &location, const QString &filePath) override;
void precompileHeaders() override;
Node *parseFnArg(const Location &location, const QString &fnArg) override;
diff --git a/src/qdoc/codechunk.cpp b/src/qdoc/codechunk.cpp
index 54d7f3131..27f26fdd6 100644
--- a/src/qdoc/codechunk.cpp
+++ b/src/qdoc/codechunk.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -30,11 +30,11 @@
codechunk.cpp
*/
-#include <qregexp.h>
-#include <qstringlist.h>
-
#include "codechunk.h"
+#include <QtCore/qregexp.h>
+#include <QtCore/qstringlist.h>
+
QT_BEGIN_NAMESPACE
enum { Other, Alnum, Gizmo, Comma, LBrace, RBrace, RAngle, Colon, Paren };
@@ -84,7 +84,7 @@ static const bool needSpace[9][9] = {
/* ( */ { false, false, false, false, false, false, false, false, false },
};
-static int category( QChar ch )
+static int category(QChar ch)
{
return charCategory[static_cast<int>(ch.toLatin1())];
}
@@ -120,17 +120,17 @@ static int category( QChar ch )
Appends \a lexeme to the current string contents, inserting
a space if appropriate.
*/
-void CodeChunk::append( const QString& lexeme )
+void CodeChunk::append(const QString &lexeme)
{
- if ( !s.isEmpty() && !lexeme.isEmpty() ) {
+ if (!s.isEmpty() && !lexeme.isEmpty()) {
/*
Should there be a space or not between the code chunk so far and the
new lexeme?
*/
int cat1 = category(s.at(s.size() - 1));
int cat2 = category(lexeme[0]);
- if ( needSpace[cat1][cat2] )
- s += QLatin1Char( ' ' );
+ if (needSpace[cat1][cat2])
+ s += QLatin1Char(' ');
}
s += lexeme;
}
diff --git a/src/qdoc/codechunk.h b/src/qdoc/codechunk.h
index 0e1d3d2b4..b7cda1324 100644
--- a/src/qdoc/codechunk.h
+++ b/src/qdoc/codechunk.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -33,7 +33,7 @@
#ifndef CODECHUNK_H
#define CODECHUNK_H
-#include <qstring.h>
+#include <QtCore/qstring.h>
QT_BEGIN_NAMESPACE
@@ -43,9 +43,9 @@ class CodeChunk
{
public:
CodeChunk() : hotspot(-1) {}
- CodeChunk(const QString& str) : s(str), hotspot(-1) {}
+ CodeChunk(const QString &str) : s(str), hotspot(-1) {}
- void append( const QString& lexeme );
+ void append(const QString &lexeme);
void appendHotspot() { if (hotspot == -1) hotspot = s.length(); }
bool isEmpty() const { return s.isEmpty(); }
@@ -60,28 +60,28 @@ private:
int hotspot;
};
-inline bool operator==( const CodeChunk& c, const CodeChunk& d ) {
+inline bool operator==(const CodeChunk& c, const CodeChunk& d) {
return c.toString() == d.toString();
}
-inline bool operator!=( const CodeChunk& c, const CodeChunk& d ) {
- return !( c == d );
+inline bool operator!=(const CodeChunk& c, const CodeChunk& d) {
+ return !(c == d);
}
-inline bool operator<( const CodeChunk& c, const CodeChunk& d ) {
+inline bool operator<(const CodeChunk& c, const CodeChunk& d) {
return c.toString() < d.toString();
}
-inline bool operator>( const CodeChunk& c, const CodeChunk& d ) {
+inline bool operator>(const CodeChunk& c, const CodeChunk& d) {
return d < c;
}
-inline bool operator<=( const CodeChunk& c, const CodeChunk& d ) {
- return !( c > d );
+inline bool operator<=(const CodeChunk& c, const CodeChunk& d) {
+ return !(c > d);
}
-inline bool operator>=( const CodeChunk& c, const CodeChunk& d ) {
- return !( c < d );
+inline bool operator>=(const CodeChunk& c, const CodeChunk& d) {
+ return !(c < d);
}
QT_END_NAMESPACE
diff --git a/src/qdoc/codemarker.cpp b/src/qdoc/codemarker.cpp
index 3c88edf03..7c8843c65 100644
--- a/src/qdoc/codemarker.cpp
+++ b/src/qdoc/codemarker.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -26,11 +26,14 @@
**
****************************************************************************/
-#include <qobjectdefs.h>
#include "codemarker.h"
+
#include "config.h"
#include "node.h"
-#include <qdebug.h>
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qobjectdefs.h>
+
#include <stdio.h>
QT_BEGIN_NAMESPACE
@@ -63,7 +66,7 @@ CodeMarker::~CodeMarker()
A code market performs no initialization by default. Marker-specific
initialization is performed in subclasses.
*/
-void CodeMarker::initializeMarker(const Config& ) // config
+void CodeMarker::initializeMarker(const Config &) // config
{
}
@@ -79,7 +82,7 @@ void CodeMarker::terminateMarker()
All the code markers in the static list are initialized
here, after the qdoc configuration file has been loaded.
*/
-void CodeMarker::initialize(const Config& config)
+void CodeMarker::initialize(const Config &config)
{
defaultLang = config.getString(CONFIG_LANGUAGE);
QList<CodeMarker *>::ConstIterator m = markers.constBegin();
@@ -101,7 +104,7 @@ void CodeMarker::terminate()
}
}
-CodeMarker *CodeMarker::markerForCode(const QString& code)
+CodeMarker *CodeMarker::markerForCode(const QString &code)
{
CodeMarker *defaultMarker = markerForLanguage(defaultLang);
if (defaultMarker != nullptr && defaultMarker->recognizeCode(code))
@@ -116,7 +119,7 @@ CodeMarker *CodeMarker::markerForCode(const QString& code)
return defaultMarker;
}
-CodeMarker *CodeMarker::markerForFileName(const QString& fileName)
+CodeMarker *CodeMarker::markerForFileName(const QString &fileName)
{
CodeMarker *defaultMarker = markerForLanguage(defaultLang);
int dot = -1;
@@ -135,7 +138,7 @@ CodeMarker *CodeMarker::markerForFileName(const QString& fileName)
return defaultMarker;
}
-CodeMarker *CodeMarker::markerForLanguage(const QString& lang)
+CodeMarker *CodeMarker::markerForLanguage(const QString &lang)
{
QList<CodeMarker *>::ConstIterator m = markers.constBegin();
while (m != markers.constEnd()) {
@@ -146,7 +149,7 @@ CodeMarker *CodeMarker::markerForLanguage(const QString& lang)
return nullptr;
}
-const Node *CodeMarker::nodeForString(const QString& string)
+const Node *CodeMarker::nodeForString(const QString &string)
{
#if QT_POINTER_SIZE == 4
const quintptr n = string.toUInt();
@@ -171,7 +174,7 @@ static const QString slt = QLatin1String("&lt;");
static const QString sgt = QLatin1String("&gt;");
static const QString squot = QLatin1String("&quot;");
-QString CodeMarker::protect(const QString& str)
+QString CodeMarker::protect(const QString &str)
{
int n = str.length();
QString marked;
@@ -257,7 +260,7 @@ QString CodeMarker::typified(const QString &string, bool trailingSpace)
return result;
}
-QString CodeMarker::taggedNode(const Node* node)
+QString CodeMarker::taggedNode(const Node *node)
{
QString tag;
QString name = node->name();
@@ -307,11 +310,11 @@ QString CodeMarker::taggedNode(const Node* node)
+ QLatin1String("</") + tag + QLatin1Char('>'));
}
-QString CodeMarker::taggedQmlNode(const Node* node)
+QString CodeMarker::taggedQmlNode(const Node *node)
{
QString tag;
if (node->isFunction()) {
- const FunctionNode* fn = static_cast<const FunctionNode*>(node);
+ const FunctionNode *fn = static_cast<const FunctionNode *>(node);
switch (fn->metaness()) {
case FunctionNode::JsSignal:
case FunctionNode::QmlSignal:
@@ -338,7 +341,7 @@ QString CodeMarker::taggedQmlNode(const Node* node)
+ QLatin1String("</") + tag + QLatin1Char('>');
}
-QString CodeMarker::linkTag(const Node *node, const QString& body)
+QString CodeMarker::linkTag(const Node *node, const QString &body)
{
return QLatin1String("<@link node=\"") + stringForNode(node)
+ QLatin1String("\">") + body + QLatin1String("</@link>");
@@ -366,10 +369,11 @@ QStringList CodeMarker::macRefsForNode(Node *node)
{
QStringList stringList;
stringList << encode(result + QLatin1String("tag/") + macName(node));
- foreach (const QString &enumName, node->doc().enumItemNames()) {
+ const auto enumItemNames = node->doc().enumItemNames();
+ for (const auto &name : enumItemNames) {
// ### Write a plainEnumValue() and use it here
stringList << encode(result + QLatin1String("econst/") +
- macName(node->parent(), enumName));
+ macName(node->parent(), name));
}
return stringList;
}
@@ -409,9 +413,9 @@ QStringList CodeMarker::macRefsForNode(Node *node)
break;
case Node::Property:
{
- NodeList list = static_cast<const PropertyNode*>(node)->functions();
+ const NodeList list = static_cast<const PropertyNode *>(node)->functions();
QStringList stringList;
- foreach (Node* node, list) {
+ for (auto *node : list) {
stringList += macRefsForNode(node);
}
return stringList;
diff --git a/src/qdoc/codemarker.h b/src/qdoc/codemarker.h
index c7f58ab42..687d808df 100644
--- a/src/qdoc/codemarker.h
+++ b/src/qdoc/codemarker.h
@@ -42,35 +42,35 @@ public:
CodeMarker();
virtual ~CodeMarker();
- virtual void initializeMarker(const Config& config);
+ virtual void initializeMarker(const Config &config);
virtual void terminateMarker();
- virtual bool recognizeCode(const QString& /*code*/) { return true; }
- virtual bool recognizeExtension(const QString& /*extension*/) { return true; }
- virtual bool recognizeLanguage(const QString& /*language*/) { return false; }
+ virtual bool recognizeCode(const QString & /*code*/) { return true; }
+ virtual bool recognizeExtension(const QString & /*extension*/) { return true; }
+ virtual bool recognizeLanguage(const QString & /*language*/) { return false; }
virtual Atom::AtomType atomType() const { return Atom::Code; }
virtual QString markedUpCode(const QString &code,
- const Node* /*relative*/,
- const Location& /*location*/) { return protect(code); }
- virtual QString markedUpSynopsis(const Node* /*node*/,
- const Node* /*relative*/,
- Section::Style /*style*/) { return QString(); }
- virtual QString markedUpQmlItem(const Node* , bool) { return QString(); }
- virtual QString markedUpName(const Node* /*node*/) { return QString(); }
- virtual QString markedUpFullName(const Node* /*node*/,
- const Node* /*relative*/) { return QString(); }
- virtual QString markedUpEnumValue(const QString& /*enumValue*/,
- const Node* /*relative*/) { return QString(); }
- virtual QString markedUpIncludes(const QStringList& /*includes*/) { return QString(); }
- virtual QString functionBeginRegExp(const QString& /*funcName*/) { return QString(); }
- virtual QString functionEndRegExp(const QString& /*funcName*/) { return QString(); }
- virtual QStringList macRefsForNode(Node* node);
+ const Node * /*relative*/,
+ const Location & /*location*/) { return protect(code); }
+ virtual QString markedUpSynopsis(const Node * /*node*/,
+ const Node * /*relative*/,
+ Section::Style /*style*/) { return QString(); }
+ virtual QString markedUpQmlItem(const Node *, bool) { return QString(); }
+ virtual QString markedUpName(const Node * /*node*/) { return QString(); }
+ virtual QString markedUpFullName(const Node * /*node*/,
+ const Node * /*relative*/) { return QString(); }
+ virtual QString markedUpEnumValue(const QString & /*enumValue*/,
+ const Node * /*relative*/) { return QString(); }
+ virtual QString markedUpIncludes(const QStringList & /*includes*/) { return QString(); }
+ virtual QString functionBeginRegExp(const QString & /*funcName*/) { return QString(); }
+ virtual QString functionEndRegExp(const QString & /*funcName*/) { return QString(); }
+ virtual QStringList macRefsForNode(Node *node);
- static void initialize(const Config& config);
+ static void initialize(const Config &config);
static void terminate();
- static CodeMarker *markerForCode(const QString& code);
- static CodeMarker *markerForFileName(const QString& fileName);
- static CodeMarker *markerForLanguage(const QString& lang);
- static const Node *nodeForString(const QString& string);
+ static CodeMarker *markerForCode(const QString &code);
+ static CodeMarker *markerForFileName(const QString &fileName);
+ static CodeMarker *markerForLanguage(const QString &lang);
+ static const Node *nodeForString(const QString &string);
static QString stringForNode(const Node *node);
QString typified(const QString &string, bool trailingSpace = false);
@@ -78,9 +78,9 @@ public:
protected:
static QString protect(const QString &string);
static void appendProtectedString(QString *output, const QStringRef &str);
- QString taggedNode(const Node* node);
- QString taggedQmlNode(const Node* node);
- QString linkTag(const Node *node, const QString& body);
+ QString taggedNode(const Node *node);
+ QString taggedQmlNode(const Node *node);
+ QString linkTag(const Node *node, const QString &body);
private:
QString macName(const Node *parent, const QString &name = QString());
@@ -89,13 +89,6 @@ private:
static QList<CodeMarker *> markers;
};
-class PlainCodeMarker : public CodeMarker
-{
- public:
- PlainCodeMarker() { }
- ~PlainCodeMarker() { }
-};
-
QT_END_NAMESPACE
#endif
diff --git a/src/qdoc/codeparser.cpp b/src/qdoc/codeparser.cpp
index 860836c3d..99bd5b1c8 100644
--- a/src/qdoc/codeparser.cpp
+++ b/src/qdoc/codeparser.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -31,12 +31,14 @@
*/
#include "codeparser.h"
-#include "node.h"
-#include "tree.h"
+
#include "config.h"
#include "generator.h"
+#include "node.h"
#include "qdocdatabase.h"
-#include <qdebug.h>
+#include "tree.h"
+
+#include <QtCore/qdebug.h>
QT_BEGIN_NAMESPACE
@@ -66,7 +68,7 @@ CodeParser::~CodeParser()
/*!
Initialize the code parser base class.
*/
-void CodeParser::initializeParser(const Config& config)
+void CodeParser::initializeParser(const Config &config)
{
showInternal_ = config.getBool(CONFIG_SHOWINTERNAL);
singleExec_ = config.getBool(CONFIG_SINGLEEXEC);
@@ -85,7 +87,7 @@ QStringList CodeParser::headerFileNameFilter()
return sourceFileNameFilter();
}
-void CodeParser::parseHeaderFile(const Location& location, const QString& filePath)
+void CodeParser::parseHeaderFile(const Location &location, const QString &filePath)
{
parseSourceFile(location, filePath);
}
@@ -94,13 +96,10 @@ void CodeParser::parseHeaderFile(const Location& location, const QString& filePa
All the code parsers in the static list are initialized here,
after the qdoc configuration variables have been set.
*/
-void CodeParser::initialize(const Config& config)
+void CodeParser::initialize(const Config &config)
{
- QList<CodeParser *>::ConstIterator p = parsers.constBegin();
- while (p != parsers.constEnd()) {
- (*p)->initializeParser(config);
- ++p;
- }
+ for (const auto &parser : qAsConst(parsers))
+ parser->initializeParser(config);
}
/*!
@@ -108,20 +107,15 @@ void CodeParser::initialize(const Config& config)
*/
void CodeParser::terminate()
{
- QList<CodeParser *>::ConstIterator p = parsers.constBegin();
- while (p != parsers.constEnd()) {
- (*p)->terminateParser();
- ++p;
- }
+ for (const auto parser : parsers)
+ parser->terminateParser();
}
-CodeParser *CodeParser::parserForLanguage(const QString& language)
+CodeParser *CodeParser::parserForLanguage(const QString &language)
{
- QList<CodeParser *>::ConstIterator p = parsers.constBegin();
- while (p != parsers.constEnd()) {
- if ((*p)->language() == language)
- return *p;
- ++p;
+ for (const auto parser : qAsConst(parsers)) {
+ if (parser->language() == language)
+ return parser;
}
return nullptr;
}
@@ -130,16 +124,13 @@ CodeParser *CodeParser::parserForHeaderFile(const QString &filePath)
{
QString fileName = QFileInfo(filePath).fileName();
- QList<CodeParser *>::ConstIterator p = parsers.constBegin();
- while (p != parsers.constEnd()) {
-
- QStringList headerPatterns = (*p)->headerFileNameFilter();
- foreach (const QString &pattern, headerPatterns) {
+ for (const auto &parser : qAsConst(parsers)) {
+ const QStringList headerPatterns = parser->headerFileNameFilter();
+ for (const auto &pattern : headerPatterns) {
QRegExp re(pattern, Qt::CaseInsensitive, QRegExp::Wildcard);
if (re.exactMatch(fileName))
- return *p;
+ return parser;
}
- ++p;
}
return nullptr;
}
@@ -148,16 +139,13 @@ CodeParser *CodeParser::parserForSourceFile(const QString &filePath)
{
QString fileName = QFileInfo(filePath).fileName();
- QList<CodeParser *>::ConstIterator p = parsers.constBegin();
- while (p != parsers.constEnd()) {
-
- QStringList sourcePatterns = (*p)->sourceFileNameFilter();
- foreach (const QString &pattern, sourcePatterns) {
+ for (const auto &parser : parsers) {
+ const QStringList sourcePatterns = parser->sourceFileNameFilter();
+ for (const QString &pattern : sourcePatterns) {
QRegExp re(pattern, Qt::CaseInsensitive, QRegExp::Wildcard);
if (re.exactMatch(fileName))
- return *p;
+ return parser;
}
- ++p;
}
return nullptr;
}
@@ -166,7 +154,7 @@ static QSet<QString> commonMetaCommands_;
/*!
Returns the set of strings representing the common metacommands.
*/
-const QSet<QString>& CodeParser::commonMetaCommands()
+const QSet<QString> &CodeParser::commonMetaCommands()
{
if (commonMetaCommands_.isEmpty()) {
commonMetaCommands_ << COMMAND_ABSTRACT
@@ -202,9 +190,9 @@ const QSet<QString>& CodeParser::commonMetaCommands()
/*!
\internal
*/
-void CodeParser::extractPageLinkAndDesc(const QString& arg,
- QString* link,
- QString* desc)
+void CodeParser::extractPageLinkAndDesc(const QString &arg,
+ QString *link,
+ QString *desc)
{
QRegExp bracedRegExp(QLatin1String("\\{([^{}]*)\\}(?:\\{([^{}]*)\\})?"));
@@ -230,7 +218,7 @@ void CodeParser::extractPageLinkAndDesc(const QString& arg,
/*!
\internal
*/
-void CodeParser::setLink(Node* node, Node::LinkType linkType, const QString& arg)
+void CodeParser::setLink(Node *node, Node::LinkType linkType, const QString &arg)
{
QString link;
QString desc;
@@ -299,7 +287,7 @@ bool CodeParser::isParsingQdoc() const
In some cases it prints a qdoc warning that it has done this. Namely,
for C++ classes and namespaces.
*/
-void CodeParser::checkModuleInclusion(Node* n)
+void CodeParser::checkModuleInclusion(Node *n)
{
if (n->physicalModuleName().isEmpty()) {
n->setPhysicalModuleName(Generator::defaultModuleName());
diff --git a/src/qdoc/codeparser.h b/src/qdoc/codeparser.h
index 56183a2f8..78ef8c931 100644
--- a/src/qdoc/codeparser.h
+++ b/src/qdoc/codeparser.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -29,9 +29,10 @@
#ifndef CODEPARSER_H
#define CODEPARSER_H
-#include <qset.h>
#include "node.h"
+#include <QtCore/qset.h>
+
QT_BEGIN_NAMESPACE
class Config;
@@ -47,41 +48,41 @@ public:
CodeParser();
virtual ~CodeParser();
- virtual void initializeParser(const Config& config);
+ virtual void initializeParser(const Config &config);
virtual void terminateParser();
virtual QString language() = 0;
virtual QStringList headerFileNameFilter();
virtual QStringList sourceFileNameFilter() = 0;
- virtual void parseHeaderFile(const Location& location, const QString& filePath);
- virtual void parseSourceFile(const Location& location, const QString& filePath) = 0;
+ virtual void parseHeaderFile(const Location &location, const QString &filePath);
+ virtual void parseSourceFile(const Location &location, const QString &filePath) = 0;
virtual void precompileHeaders() { }
virtual Node *parseFnArg(const Location &, const QString &) { return nullptr; }
bool isParsingH() const;
bool isParsingCpp() const;
bool isParsingQdoc() const;
- const QString& currentFile() const { return currentFile_; }
- const QString& moduleHeader() const { return moduleHeader_; }
- void setModuleHeader(const QString& t) { moduleHeader_ = t; }
- void checkModuleInclusion(Node* n);
+ const QString &currentFile() const { return currentFile_; }
+ const QString &moduleHeader() const { return moduleHeader_; }
+ void setModuleHeader(const QString &t) { moduleHeader_ = t; }
+ void checkModuleInclusion(Node *n);
- static void initialize(const Config& config);
+ static void initialize(const Config &config);
static void terminate();
- static CodeParser *parserForLanguage(const QString& language);
+ static CodeParser *parserForLanguage(const QString &language);
static CodeParser *parserForHeaderFile(const QString &filePath);
static CodeParser *parserForSourceFile(const QString &filePath);
- static void setLink(Node* node, Node::LinkType linkType, const QString& arg);
+ static void setLink(Node *node, Node::LinkType linkType, const QString &arg);
static bool isWorthWarningAbout(const Doc &doc);
protected:
- const QSet<QString>& commonMetaCommands();
- static void extractPageLinkAndDesc(const QString& arg,
- QString* link,
- QString* desc);
+ const QSet<QString> &commonMetaCommands();
+ static void extractPageLinkAndDesc(const QString &arg,
+ QString *link,
+ QString *desc);
static bool showInternal() { return showInternal_; }
QString moduleHeader_;
QString currentFile_;
- QDocDatabase* qdb_;
+ QDocDatabase *qdb_;
private:
static QList<CodeParser *> parsers;
diff --git a/src/qdoc/config.cpp b/src/qdoc/config.cpp
index 64c8786f6..1ffcdd39a 100644
--- a/src/qdoc/config.cpp
+++ b/src/qdoc/config.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -30,22 +30,22 @@
config.cpp
*/
-#include <qdir.h>
-#include <qvariant.h>
-#include <qfile.h>
-#include <qtemporaryfile.h>
-#include <qtextstream.h>
-#include <qdebug.h>
#include "config.h"
#include "generator.h"
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qdir.h>
+#include <QtCore/qfile.h>
+#include <QtCore/qtemporaryfile.h>
+#include <QtCore/qtextstream.h>
+#include <QtCore/qvariant.h>
+
#include <stdlib.h>
QT_BEGIN_NAMESPACE
QString ConfigStrings::ALIAS = QStringLiteral("alias");
QString ConfigStrings::AUTOLINKERRORS = QStringLiteral("autolinkerrors");
-QString ConfigStrings::BASE = QStringLiteral("base");
-QString ConfigStrings::BASEDIR = QStringLiteral("basedir");
QString ConfigStrings::BUILDVERSION = QStringLiteral("buildversion");
QString ConfigStrings::CLANGDEFINES = QStringLiteral("clangdefines");
QString ConfigStrings::CODEINDENT = QStringLiteral("codeindent");
@@ -66,7 +66,6 @@ QString ConfigStrings::EXCLUDEFILES = QStringLiteral("excludefiles");
QString ConfigStrings::EXTRAIMAGES = QStringLiteral("extraimages");
QString ConfigStrings::FALSEHOODS = QStringLiteral("falsehoods");
QString ConfigStrings::FORMATTING = QStringLiteral("formatting");
-QString ConfigStrings::GENERATEINDEX = QStringLiteral("generateindex");
QString ConfigStrings::HEADERDIRS = QStringLiteral("headerdirs");
QString ConfigStrings::HEADERS = QStringLiteral("headers");
QString ConfigStrings::HEADERSCRIPTS = QStringLiteral("headerscripts");
@@ -91,7 +90,6 @@ QString ConfigStrings::NOLINKERRORS = QStringLiteral("nolinkerrors");
QString ConfigStrings::OBSOLETELINKS = QStringLiteral("obsoletelinks");
QString ConfigStrings::OUTPUTDIR = QStringLiteral("outputdir");
QString ConfigStrings::OUTPUTENCODING = QStringLiteral("outputencoding");
-QString ConfigStrings::OUTPUTLANGUAGE = QStringLiteral("outputlanguage");
QString ConfigStrings::OUTPUTFORMATS = QStringLiteral("outputformats");
QString ConfigStrings::OUTPUTPREFIXES = QStringLiteral("outputprefixes");
QString ConfigStrings::OUTPUTSUFFIXES = QStringLiteral("outputsuffixes");
@@ -112,7 +110,6 @@ QString ConfigStrings::STYLE = QStringLiteral("style");
QString ConfigStrings::STYLES = QStringLiteral("styles");
QString ConfigStrings::STYLESHEETS = QStringLiteral("stylesheets");
QString ConfigStrings::SYNTAXHIGHLIGHTING = QStringLiteral("syntaxhighlighting");
-QString ConfigStrings::TEMPLATEDIR = QStringLiteral("templatedir");
QString ConfigStrings::TABSIZE = QStringLiteral("tabsize");
QString ConfigStrings::TAGFILE = QStringLiteral("tagfile");
QString ConfigStrings::TRANSLATORS = QStringLiteral("translators");
@@ -174,8 +171,8 @@ class MetaStack : private QStack<MetaStackEntry>
public:
MetaStack();
- void process(QChar ch, const Location& location);
- QStringList getExpanded(const Location& location);
+ void process(QChar ch, const Location &location);
+ QStringList getExpanded(const Location &location);
};
/*!
@@ -193,7 +190,7 @@ MetaStack::MetaStack()
It really just builds up a name by appending \a ch to
it.
*/
-void MetaStack::process(QChar ch, const Location& location)
+void MetaStack::process(QChar ch, const Location &location)
{
if (ch == QLatin1Char('{')) {
push(MetaStackEntry());
@@ -234,7 +231,7 @@ void MetaStack::process(QChar ch, const Location& location)
/*!
Returns the accumulated string values.
*/
-QStringList MetaStack::getExpanded(const Location& location)
+QStringList MetaStack::getExpanded(const Location &location)
{
if (count() > 1)
location.fatal(tr("Missing '}'"));
@@ -264,63 +261,185 @@ QMap<QString, QStringList> Config::includeFilesMap_;
/*!
The constructor sets the \a programName and initializes all
- internal state variables to empty values.
+ internal state variables to either default values or to ones
+ defined in command line arguments \a args.
*/
-Config::Config(const QString& programName)
+Config::Config(const QString &programName, const QStringList &args)
: prog(programName)
{
- loc = Location::null;
- lastLocation_ = Location::null;
- configVars_.clear();
numInstances++;
- includeFilesMap_.clear();
+ processCommandLineOptions(args);
+ reset();
+}
+
+Config::~Config()
+{
+ clear();
}
/*!
- The destructor has nothing special to do.
+ Clears the location and internal maps for config variables.
*/
-Config::~Config()
+void Config::clear()
{
+ loc = lastLocation_ = Location::null;
+ configVars_.clear();
includeFilesMap_.clear();
}
/*!
- Loads and parses the qdoc configuration file \a fileName.
- This function calls the other load() function, which does
- the loading, parsing, and processing of the configuration
- file.
+ Resets the Config instance - used by load()
+ */
+void Config::reset()
+{
+ clear();
+
+ // Default values
+ setStringList(CONFIG_CODEINDENT, QStringList("0"));
+ setStringList(CONFIG_FALSEHOODS, QStringList("0"));
+ setStringList(CONFIG_FILEEXTENSIONS, QStringList("*.cpp *.h *.qdoc *.qml"));
+ setStringList(CONFIG_LANGUAGE, QStringList("Cpp")); // i.e. C++
+ setStringList(CONFIG_OUTPUTFORMATS, QStringList("HTML"));
+ setStringList(CONFIG_TABSIZE, QStringList("8"));
+
+ // Publish options from the command line as config variables
+ const auto setListFlag = [this](const QString &key, bool test) {
+ setStringList(key, QStringList(test ? QStringLiteral("true") : QStringLiteral("false")));
+ };
+#define SET(opt, test) setListFlag(opt, m_parser.isSet(m_parser.test))
+ SET(CONFIG_SYNTAXHIGHLIGHTING, highlightingOption);
+ SET(CONFIG_SHOWINTERNAL, showInternalOption);
+ SET(CONFIG_SINGLEEXEC, singleExecOption);
+ SET(CONFIG_WRITEQAPAGES, writeQaPagesOption);
+ SET(CONFIG_REDIRECTDOCUMENTATIONTODEVNULL, redirectDocumentationToDevNullOption);
+ SET(CONFIG_AUTOLINKERRORS, autoLinkErrorsOption);
+ SET(CONFIG_OBSOLETELINKS, obsoleteLinksOption);
+#undef SET
+ setListFlag(CONFIG_NOLINKERRORS,
+ m_parser.isSet(m_parser.noLinkErrorsOption)
+ || qEnvironmentVariableIsSet("QDOC_NOLINKERRORS"));
+
+ // CONFIG_DEFINES and CONFIG_INCLUDEPATHS are set in load()
+}
- Intializes the location variables returned by location()
- and lastLocation().
+/*!
+ Loads and parses the qdoc configuration file \a fileName.
+ If a previous project was loaded, this function first resets the
+ Config instance. Then it calls the other load() function, which
+ does the loading, parsing, and processing of the configuration file.
*/
-void Config::load(const QString& fileName)
+void Config::load(const QString &fileName)
{
+ // Reset if a previous project was loaded
+ if (configVars_.contains(CONFIG_PROJECT))
+ reset();
+
load(Location::null, fileName);
if (loc.isEmpty())
loc = Location(fileName);
else
loc.setEtc(true);
lastLocation_ = Location::null;
+
+ // Add defines and includepaths from command line to their
+ // respective configuration variables. Values set here are
+ // always added to what's defined in configuration file.
+ insertStringList(CONFIG_DEFINES, m_defines);
+ insertStringList(CONFIG_INCLUDEPATHS, m_includePaths);
+}
+
+/*!
+ Sets the \a values of a configuration variable \a var from a string list.
+ */
+void Config::setStringList(const QString &var, const QStringList &values)
+{
+ configVars_.replace(var, ConfigVar(var, values, QDir::currentPath()));
+}
+
+/*!
+ Adds the \a values from a string list to the configuration variable \a var.
+ Existing value(s) are kept.
+*/
+void Config::insertStringList(const QString &var, const QStringList &values)
+{
+ configVars_.insert(var, ConfigVar(var, values, QDir::currentPath()));
}
/*!
- Joins all the strings in \a values into a single string with the
- individual \a values separated by ' '. Then it inserts the result
- into the string list map with \a var as the key.
+ Process and store variables from the command line.
+ */
+void Config::processCommandLineOptions(const QStringList &args)
+{
+ m_parser.process(args);
+
+ m_defines = m_parser.values(m_parser.defineOption);
+ m_dependModules = m_parser.values(m_parser.dependsOption);
+ setIndexDirs();
+ setIncludePaths();
+
+ generateExamples = !m_parser.isSet(m_parser.noExamplesOption);
+ if (m_parser.isSet(m_parser.installDirOption))
+ installDir = m_parser.value(m_parser.installDirOption);
+ if (m_parser.isSet(m_parser.outputDirOption))
+ overrideOutputDir = m_parser.value(m_parser.outputDirOption);
+
+ const auto outputFormats = m_parser.values(m_parser.outputFormatOption);
+ for (const auto &format : outputFormats)
+ overrideOutputFormats.insert(format);
+
+ debug_ = m_parser.isSet(m_parser.debugOption);
+
+ // TODO: Make Generator use Config instead of storing these separately
+ if (m_parser.isSet(m_parser.prepareOption))
+ Generator::setQDocPass(Generator::Prepare);
+ if (m_parser.isSet(m_parser.generateOption))
+ Generator::setQDocPass(Generator::Generate);
+ if (m_parser.isSet(m_parser.singleExecOption))
+ Generator::setSingleExec();
+ if (m_parser.isSet(m_parser.writeQaPagesOption))
+ Generator::setWriteQaPages();
+ if (m_parser.isSet(m_parser.logProgressOption))
+ Location::startLoggingProgress();
+ if (m_parser.isSet(m_parser.timestampsOption))
+ Generator::setUseTimestamps();
+}
+
+void Config::setIncludePaths()
+{
+ QDir currentDir = QDir::current();
+ const auto addIncludePaths = [this, currentDir](const char *flag, const QStringList &paths) {
+ for (const auto &path : paths)
+ m_includePaths << currentDir.absoluteFilePath(path).insert(0, flag);
+ };
+
+ addIncludePaths("-I", m_parser.values(m_parser.includePathOption));
+#ifdef QDOC_PASS_ISYSTEM
+ addIncludePaths("-isystem", m_parser.values(m_parser.includePathSystemOption));
+#endif
+ addIncludePaths("-F", m_parser.values(m_parser.frameworkOption));
+}
- It also inserts the \a values string list into a separate map,
- also with \a var as the key.
+/*!
+ Stores paths from -indexdir command line option(s).
*/
-void Config::setStringList(const QString& var, const QStringList& values)
+void Config::setIndexDirs()
{
- configVars_.insert(var,ConfigVar(var, values, QDir::currentPath()));
+ m_indexDirs = m_parser.values(m_parser.indexDirOption);
+ auto it = std::remove_if(m_indexDirs.begin(), m_indexDirs.end(),
+ [](const QString &s) { return !QFile::exists(s); });
+
+ std::for_each(it, m_indexDirs.end(),
+ [](const QString &s) {
+ Location::logToStdErrAlways(tr("Cannot find index directory: %1").arg(s));
+ });
+ m_indexDirs.erase(it, m_indexDirs.end());
}
/*!
- Looks up the configuarion variable \a var in the string
+ Looks up the configuration variable \a var in the string
map and returns the boolean value.
*/
-bool Config::getBool(const QString& var) const
+bool Config::getBool(const QString &var) const
{
return QVariant(getString(var)).toBool();
}
@@ -331,7 +450,7 @@ bool Config::getBool(const QString& var) const
string in the list as an integer and adding it to a total sum.
Returns the sum or \c -1 if \a var is not set.
*/
-int Config::getInt(const QString& var) const
+int Config::getInt(const QString &var) const
{
QStringList strs = getStringList(var);
if (strs.isEmpty())
@@ -403,7 +522,7 @@ QSet<QString> Config::getOutputFormats() const
This allows determining whether a configuration variable is
undefined (null string) or defined as empty (empty string).
*/
-QString Config::getString(const QString& var, const QString& defaultString) const
+QString Config::getString(const QString &var, const QString &defaultString) const
{
QList<ConfigVar> configVars = configVars_.values(var);
if (!configVars.empty()) {
@@ -434,9 +553,10 @@ QString Config::getString(const QString& var, const QString& defaultString) cons
list map, converts the string list it maps to into a set
of strings, and returns the set.
*/
-QSet<QString> Config::getStringSet(const QString& var) const
+QSet<QString> Config::getStringSet(const QString &var) const
{
- return QSet<QString>::fromList(getStringList(var));
+ const auto &stringList = getStringList(var);
+ return QSet<QString>(stringList.cbegin(), stringList.cend());
}
/*!
@@ -452,7 +572,7 @@ QSet<QString> Config::getStringSet(const QString& var) const
before the values are appended. \note '+=' should always be used.
The final list is returned.
*/
-QStringList Config::getStringList(const QString& var) const
+QStringList Config::getStringList(const QString &var) const
{
QList<ConfigVar> configVars = configVars_.values(var);
QStringList values;
@@ -486,7 +606,7 @@ QStringList Config::getStringList(const QString& var) const
\sa Location::canonicalRelativePath()
*/
-QStringList Config::getCanonicalPathList(const QString& var, bool validate) const
+QStringList Config::getCanonicalPathList(const QString &var, bool validate) const
{
QStringList t;
QList<ConfigVar> configVars = configVars_.values(var);
@@ -499,7 +619,7 @@ QStringList Config::getCanonicalPathList(const QString& var, bool validate) cons
if (!cv.plus_)
t.clear();
const QString d = cv.currentPath_;
- const QStringList& sl = cv.values_;
+ const QStringList &sl = cv.values_;
if (!sl.isEmpty()) {
t.reserve(t.size() + sl.size());
for (int i=0; i<sl.size(); ++i) {
@@ -532,7 +652,7 @@ QStringList Config::getCanonicalPathList(const QString& var, bool validate) cons
\sa getRegExpList()
*/
-QRegExp Config::getRegExp(const QString& var) const
+QRegExp Config::getRegExp(const QString &var) const
{
QString pattern;
QList<QRegExp> subRegExps = getRegExpList(var);
@@ -556,7 +676,7 @@ QRegExp Config::getRegExp(const QString& var) const
map, converts the string list to a list of regular expressions,
and returns it.
*/
-QList<QRegExp> Config::getRegExpList(const QString& var) const
+QList<QRegExp> Config::getRegExpList(const QString &var) const
{
QStringList strs = getStringList(var);
QStringList::ConstIterator s = strs.constBegin();
@@ -575,7 +695,7 @@ QList<QRegExp> Config::getRegExpList(const QString& var) const
the matching keys in a set, stripped of the matching prefix
and dot.
*/
-QSet<QString> Config::subVars(const QString& var) const
+QSet<QString> Config::subVars(const QString &var) const
{
QSet<QString> result;
QString varDot = var + QLatin1Char('.');
@@ -599,7 +719,7 @@ QSet<QString> Config::subVars(const QString& var) const
multimap with the matching keys (stripped of the prefix \a var
and mapped to their values. The pairs are inserted into \a t
*/
-void Config::subVarsAndValues(const QString& var, ConfigVarMultimap& t) const
+void Config::subVarsAndValues(const QString &var, ConfigVarMultimap &t) const
{
QString varDot = var + QLatin1Char('.');
ConfigVarMultimap::ConstIterator v = configVars_.constBegin();
@@ -618,7 +738,7 @@ void Config::subVarsAndValues(const QString& var, ConfigVarMultimap& t) const
/*!
Get all .qdocinc files.
*/
-QString Config::getIncludeFilePath(const QString& fileName) const
+QString Config::getIncludeFilePath(const QString &fileName) const
{
QString ext = fileName.mid(fileName.lastIndexOf('.'));
ext.prepend('*');
@@ -634,7 +754,7 @@ QString Config::getIncludeFilePath(const QString& fileName) const
}
includeFilesMap_.insert(ext, result);
}
- const QStringList& paths = (*includeFilesMap_.find(ext));
+ const QStringList &paths = (*includeFilesMap_.find(ext));
for (int i=0; i<paths.size(); ++i) {
if (paths[i].endsWith(fileName))
return paths[i];
@@ -708,10 +828,10 @@ QStringList Config::getExampleImageFiles(const QSet<QString> &excludedDirs,
\a location is used for obtaining the file and line numbers
for report qdoc errors.
*/
-QString Config::findFile(const Location& location,
- const QStringList& files,
- const QStringList& dirs,
- const QString& fileName,
+QString Config::findFile(const Location &location,
+ const QStringList &files,
+ const QStringList &dirs,
+ const QString &fileName,
QString *userFriendlyFilePath)
{
if (fileName.isEmpty() || fileName.startsWith(QLatin1Char('/'))) {
@@ -773,11 +893,11 @@ QString Config::findFile(const Location& location,
/*!
*/
-QString Config::findFile(const Location& location,
- const QStringList& files,
- const QStringList& dirs,
- const QString& fileBase,
- const QStringList& fileExtensions,
+QString Config::findFile(const Location &location,
+ const QStringList &files,
+ const QStringList &dirs,
+ const QString &fileBase,
+ const QStringList &fileExtensions,
QString *userFriendlyFilePath)
{
QStringList::ConstIterator e = fileExtensions.constBegin();
@@ -801,10 +921,10 @@ QString Config::findFile(const Location& location,
the file and line number where a qdoc error occurred. The
constructed output file name is returned.
*/
-QString Config::copyFile(const Location& location,
- const QString& sourceFilePath,
- const QString& userFriendlySourceFilePath,
- const QString& targetDirPath)
+QString Config::copyFile(const Location &location,
+ const QString &sourceFilePath,
+ const QString &userFriendlySourceFilePath,
+ const QString &targetDirPath)
{
QFile inFile(sourceFilePath);
if (!inFile.open(QFile::ReadOnly)) {
@@ -839,13 +959,13 @@ QString Config::copyFile(const Location& location,
Finds the largest unicode digit in \a value in the range
1..7 and returns it.
*/
-int Config::numParams(const QString& value)
+int Config::numParams(const QString &value)
{
int max = 0;
for (int i = 0; i != value.length(); i++) {
uint c = value[i].unicode();
if (c > 0 && c < 8)
- max = qMax(max, (int)c);
+ max = qMax(max, static_cast<int>(c));
}
return max;
}
@@ -855,7 +975,7 @@ int Config::numParams(const QString& value)
It doesn't remove \a dir itself, but if it was called
recursively, then the caller will remove \a dir.
*/
-bool Config::removeDirContents(const QString& dir)
+bool Config::removeDirContents(const QString &dir)
{
QDir dirInfo(dir);
QFileInfoList entries = dirInfo.entryInfoList();
@@ -902,7 +1022,7 @@ bool Config::isMetaKeyChar(QChar ch)
\a fileName is a master qdocconf file. It contains a list of
qdocconf files and nothing else. Read the list and return it.
*/
-QStringList Config::loadMaster(const QString& fileName)
+QStringList Config::loadMaster(const QString &fileName)
{
Location location = Location::null;
QFile fin(fileName);
@@ -934,7 +1054,7 @@ QStringList Config::loadMaster(const QString& fileName)
this one is recursive, i.e., it calls itself when it sees
an \c{include} statement in the qdoc configuration file.
*/
-void Config::load(Location location, const QString& fileName)
+void Config::load(Location location, const QString &fileName)
{
QFileInfo fileInfo(fileName);
QString path = fileInfo.canonicalPath();
@@ -986,7 +1106,7 @@ void Config::load(Location location, const QString& fileName)
int i = 0;
QChar c = text.at(0);
uint cc = c.unicode();
- while (i < (int) text.length()) {
+ while (i < text.length()) {
if (cc == 0) {
++i;
} else if (c.isSpace()) {
@@ -1103,11 +1223,6 @@ void Config::load(Location location, const QString& fileName)
if (metWord)
stringValue += QLatin1Char(' ');
stringValue += word;
-#if 0
- if (metWord)
- rhsValues << QString(" " + word);
- else
-#endif
rhsValues << word;
metWord = true;
word.clear();
@@ -1178,7 +1293,7 @@ void Config::load(Location location, const QString& fileName)
bool Config::isFileExcluded(const QString &fileName, const QSet<QString> &excludedFiles)
{
- foreach (const QString &entry, excludedFiles) {
+ for (const QString &entry : excludedFiles) {
if (entry.contains(QLatin1Char('*')) || entry.contains(QLatin1Char('?'))) {
QRegExp re(entry, Qt::CaseSensitive, QRegExp::Wildcard);
if (re.exactMatch(fileName))
@@ -1188,8 +1303,8 @@ bool Config::isFileExcluded(const QString &fileName, const QSet<QString> &exclud
return excludedFiles.contains(fileName);
}
-QStringList Config::getFilesHere(const QString& uncleanDir,
- const QString& nameFilter,
+QStringList Config::getFilesHere(const QString &uncleanDir,
+ const QString &nameFilter,
const Location &location,
const QSet<QString> &excludedDirs,
const QSet<QString> &excludedFiles)
@@ -1232,7 +1347,7 @@ QStringList Config::getFilesHere(const QString& uncleanDir,
/*!
Push \a dir onto the stack of working directories.
*/
-void Config::pushWorkingDir(const QString& dir)
+void Config::pushWorkingDir(const QString &dir)
{
workingDirs_.push(dir);
}
diff --git a/src/qdoc/config.h b/src/qdoc/config.h
index 0de7076eb..61ed53d87 100644
--- a/src/qdoc/config.h
+++ b/src/qdoc/config.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -33,12 +33,14 @@
#ifndef CONFIG_H
#define CONFIG_H
-#include <qmap.h>
-#include <qset.h>
-#include <qstringlist.h>
-#include <qstack.h>
-#include <qpair.h>
#include "location.h"
+#include "qdoccommandlineparser.h"
+
+#include <QtCore/qmap.h>
+#include <QtCore/qpair.h>
+#include <QtCore/qset.h>
+#include <QtCore/qstack.h>
+#include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE
@@ -55,10 +57,10 @@ struct ConfigVar {
ConfigVar() : plus_(false) { }
- ConfigVar(const QString& name, const QStringList& values, const QString& dir)
+ ConfigVar(const QString &name, const QStringList &values, const QString &dir)
: plus_(true), name_(name), values_(values), currentPath_(dir) { }
- ConfigVar(const QString& name, const QStringList& values, const QString& dir, const Location& loc)
+ ConfigVar(const QString &name, const QStringList &values, const QString &dir, const Location &loc)
: plus_(false), name_(name), values_(values), currentPath_(dir), location_(loc) { }
};
@@ -72,48 +74,54 @@ class Config
Q_DECLARE_TR_FUNCTIONS(QDoc::Config)
public:
- Config(const QString& programName);
+ Config(const QString &programName, const QStringList &args);
~Config();
- static bool debug_;
+ bool getDebug() const { return debug_; }
+
+ void clear();
+ void reset();
+ void load(const QString &fileName);
+ void setStringList(const QString &var, const QStringList &values);
+ void insertStringList(const QString &var, const QStringList &values);
- void load(const QString& fileName);
- void setStringList(const QString& var, const QStringList& values);
+ void showHelp(int exitCode = 0) { m_parser.showHelp(exitCode); }
+ QStringList qdocFiles() const { return m_parser.positionalArguments(); }
+ const QString &programName() const { return prog; }
+ const Location &location() const { return loc; }
+ const Location &lastLocation() const { return lastLocation_; }
+ bool getBool(const QString &var) const;
+ int getInt(const QString &var) const;
- const QString& programName() const { return prog; }
- const Location& location() const { return loc; }
- const Location& lastLocation() const { return lastLocation_; }
- bool getBool(const QString& var) const;
- int getInt(const QString& var) const;
QString getOutputDir(const QString &format = QString("HTML")) const;
QSet<QString> getOutputFormats() const;
- QString getString(const QString& var, const QString& defaultString = QString()) const;
- QSet<QString> getStringSet(const QString& var) const;
- QStringList getStringList(const QString& var) const;
- QStringList getCanonicalPathList(const QString& var, bool validate = false) const;
- QRegExp getRegExp(const QString& var) const;
- QList<QRegExp> getRegExpList(const QString& var) const;
- QSet<QString> subVars(const QString& var) const;
- void subVarsAndValues(const QString& var, ConfigVarMultimap& t) const;
- QStringList getAllFiles(const QString& filesVar,
- const QString& dirsVar,
+ QString getString(const QString &var, const QString &defaultString = QString()) const;
+ QSet<QString> getStringSet(const QString &var) const;
+ QStringList getStringList(const QString &var) const;
+ QStringList getCanonicalPathList(const QString &var, bool validate = false) const;
+ QRegExp getRegExp(const QString &var) const;
+ QList<QRegExp> getRegExpList(const QString &var) const;
+ QSet<QString> subVars(const QString &var) const;
+ void subVarsAndValues(const QString &var, ConfigVarMultimap &t) const;
+ QStringList getAllFiles(const QString &filesVar,
+ const QString &dirsVar,
const QSet<QString> &excludedDirs = QSet<QString>(),
const QSet<QString> &excludedFiles = QSet<QString>());
- QString getIncludeFilePath(const QString& fileName) const;
+ QString getIncludeFilePath(const QString &fileName) const;
QStringList getExampleQdocFiles(const QSet<QString> &excludedDirs, const QSet<QString> &excludedFiles);
QStringList getExampleImageFiles(const QSet<QString> &excludedDirs, const QSet<QString> &excludedFiles);
- static QStringList loadMaster(const QString& fileName);
+ static QStringList loadMaster(const QString &fileName);
static bool isFileExcluded(const QString &fileName, const QSet<QString> &excludedFiles);
- static QStringList getFilesHere(const QString& dir,
- const QString& nameFilter,
+ static QStringList getFilesHere(const QString &dir,
+ const QString &nameFilter,
const Location &location = Location(),
const QSet<QString> &excludedDirs = QSet<QString>(),
const QSet<QString> &excludedFiles = QSet<QString>());
- static QString findFile(const Location& location,
+ static QString findFile(const Location &location,
const QStringList &files,
- const QStringList& dirs,
- const QString& fileName,
+ const QStringList &dirs,
+ const QString &fileName,
QString *userFriendlyFilePath = nullptr);
static QString findFile(const Location &location,
const QStringList &files,
@@ -121,13 +129,13 @@ public:
const QString &fileBase,
const QStringList &fileExtensions,
QString *userFriendlyFilePath = nullptr);
- static QString copyFile(const Location& location,
- const QString& sourceFilePath,
- const QString& userFriendlySourceFilePath,
- const QString& targetDirPath);
- static int numParams(const QString& value);
- static bool removeDirContents(const QString& dir);
- static void pushWorkingDir(const QString& dir);
+ static QString copyFile(const Location &location,
+ const QString &sourceFilePath,
+ const QString &userFriendlySourceFilePath,
+ const QString &targetDirPath);
+ static int numParams(const QString &value);
+ static bool removeDirContents(const QString &dir);
+ static void pushWorkingDir(const QString &dir);
static QString popWorkingDir();
static const QString dot;
@@ -137,9 +145,31 @@ public:
static QString overrideOutputDir;
static QSet<QString> overrideOutputFormats;
+ inline bool singleExec() const;
+ QStringList &defines() { return m_defines; }
+ QStringList &dependModules() { return m_dependModules; }
+ QStringList &includePaths() { return m_includePaths; }
+ QStringList &indexDirs() { return m_indexDirs; }
+ QString currentDir() const { return m_currentDir; }
+ void setCurrentDir(const QString &path) { m_currentDir = path; }
+ QString previousCurrentDir() const { return m_previousCurrentDir; }
+ void setPreviousCurrentDir(const QString &path) { m_previousCurrentDir = path; }
+
private:
+ void processCommandLineOptions(const QStringList &args);
+ void setIncludePaths();
+ void setIndexDirs();
+
+ QStringList m_dependModules;
+ QStringList m_defines;
+ QStringList m_includePaths;
+ QStringList m_indexDirs;
+ QString m_currentDir;
+ QString m_previousCurrentDir;
+
+ static bool debug_;
static bool isMetaKeyChar(QChar ch);
- void load(Location location, const QString& fileName);
+ void load(Location location, const QString &fileName);
QString prog;
Location loc;
@@ -151,14 +181,13 @@ private:
static int numInstances;
static QStack<QString> workingDirs_;
static QMap<QString, QStringList> includeFilesMap_;
+ QDocCommandLineParser m_parser;
};
struct ConfigStrings
{
static QString ALIAS;
static QString AUTOLINKERRORS;
- static QString BASE;
- static QString BASEDIR;
static QString BUILDVERSION;
static QString CLANGDEFINES;
static QString CODEINDENT;
@@ -179,7 +208,6 @@ struct ConfigStrings
static QString EXTRAIMAGES;
static QString FALSEHOODS;
static QString FORMATTING;
- static QString GENERATEINDEX;
static QString HEADERDIRS;
static QString HEADERS;
static QString HEADERSCRIPTS;
@@ -204,7 +232,6 @@ struct ConfigStrings
static QString OBSOLETELINKS;
static QString OUTPUTDIR;
static QString OUTPUTENCODING;
- static QString OUTPUTLANGUAGE;
static QString OUTPUTFORMATS;
static QString OUTPUTPREFIXES;
static QString OUTPUTSUFFIXES;
@@ -225,7 +252,6 @@ struct ConfigStrings
static QString STYLES;
static QString STYLESHEETS;
static QString SYNTAXHIGHLIGHTING;
- static QString TEMPLATEDIR;
static QString TABSIZE;
static QString TAGFILE;
static QString TRANSLATORS;
@@ -243,8 +269,6 @@ struct ConfigStrings
#define CONFIG_ALIAS ConfigStrings::ALIAS
#define CONFIG_AUTOLINKERRORS ConfigStrings::AUTOLINKERRORS
-#define CONFIG_BASE ConfigStrings::BASE
-#define CONFIG_BASEDIR ConfigStrings::BASEDIR
#define CONFIG_BUILDVERSION ConfigStrings::BUILDVERSION
#define CONFIG_CLANGDEFINES ConfigStrings::CLANGDEFINES
#define CONFIG_CODEINDENT ConfigStrings::CODEINDENT
@@ -265,7 +289,6 @@ struct ConfigStrings
#define CONFIG_EXTRAIMAGES ConfigStrings::EXTRAIMAGES
#define CONFIG_FALSEHOODS ConfigStrings::FALSEHOODS
#define CONFIG_FORMATTING ConfigStrings::FORMATTING
-#define CONFIG_GENERATEINDEX ConfigStrings::GENERATEINDEX
#define CONFIG_HEADERDIRS ConfigStrings::HEADERDIRS
#define CONFIG_HEADERS ConfigStrings::HEADERS
#define CONFIG_HEADERSCRIPTS ConfigStrings::HEADERSCRIPTS
@@ -290,7 +313,6 @@ struct ConfigStrings
#define CONFIG_OBSOLETELINKS ConfigStrings::OBSOLETELINKS
#define CONFIG_OUTPUTDIR ConfigStrings::OUTPUTDIR
#define CONFIG_OUTPUTENCODING ConfigStrings::OUTPUTENCODING
-#define CONFIG_OUTPUTLANGUAGE ConfigStrings::OUTPUTLANGUAGE
#define CONFIG_OUTPUTFORMATS ConfigStrings::OUTPUTFORMATS
#define CONFIG_OUTPUTPREFIXES ConfigStrings::OUTPUTPREFIXES
#define CONFIG_OUTPUTSUFFIXES ConfigStrings::OUTPUTSUFFIXES
@@ -311,7 +333,6 @@ struct ConfigStrings
#define CONFIG_STYLES ConfigStrings::STYLES
#define CONFIG_STYLESHEETS ConfigStrings::STYLESHEETS
#define CONFIG_SYNTAXHIGHLIGHTING ConfigStrings::SYNTAXHIGHLIGHTING
-#define CONFIG_TEMPLATEDIR ConfigStrings::TEMPLATEDIR
#define CONFIG_TABSIZE ConfigStrings::TABSIZE
#define CONFIG_TAGFILE ConfigStrings::TAGFILE
#define CONFIG_TRANSLATORS ConfigStrings::TRANSLATORS
@@ -326,6 +347,11 @@ struct ConfigStrings
#define CONFIG_WARNINGLIMIT ConfigStrings::WARNINGLIMIT
#define CONFIG_WRITEQAPAGES ConfigStrings::WRITEQAPAGES
+inline bool Config::singleExec() const
+{
+ return getBool(CONFIG_SINGLEEXEC);
+}
+
QT_END_NAMESPACE
#endif
diff --git a/src/qdoc/cppcodemarker.cpp b/src/qdoc/cppcodemarker.cpp
index 63969426c..a59654cfa 100644
--- a/src/qdoc/cppcodemarker.cpp
+++ b/src/qdoc/cppcodemarker.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -31,12 +31,15 @@
*/
#include "cppcodemarker.h"
+
+#include "generator.h"
#include "text.h"
#include "tree.h"
-#include <qdebug.h>
-#include <qregexp.h>
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qregexp.h>
+
#include <ctype.h>
-#include "generator.h"
QT_BEGIN_NAMESPACE
@@ -59,7 +62,7 @@ CppCodeMarker::~CppCodeMarker()
/*!
Returns \c true.
*/
-bool CppCodeMarker::recognizeCode(const QString & /* code */)
+bool CppCodeMarker::recognizeCode(const QString &/* code */)
{
return true;
}
@@ -68,7 +71,7 @@ bool CppCodeMarker::recognizeCode(const QString & /* code */)
Returns \c true if \a ext is any of a list of file extensions
for the C++ language.
*/
-bool CppCodeMarker::recognizeExtension(const QString& extension)
+bool CppCodeMarker::recognizeExtension(const QString &extension)
{
QByteArray ext = extension.toLatin1();
return ext == "c" ||
@@ -242,11 +245,12 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node,
QStringList documentedItems = enume->doc().enumItemNames();
if (documentedItems.isEmpty()) {
- foreach (const EnumItem &item, enume->items())
+ const auto enumItems = enume->items();
+ for (const auto &item : enumItems)
documentedItems << item.name();
}
- QStringList omitItems = enume->doc().omitEnumItemNames();
- foreach (const QString &item, omitItems)
+ const QStringList omitItems = enume->doc().omitEnumItemNames();
+ for (const auto &item : omitItems)
documentedItems.removeAll(item);
if (documentedItems.size() <= MaxEnumValues) {
@@ -318,23 +322,23 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node,
/*!
*/
-QString CppCodeMarker::markedUpQmlItem(const Node* node, bool summary)
+QString CppCodeMarker::markedUpQmlItem(const Node *node, bool summary)
{
QString name = taggedQmlNode(node);
if (summary)
name = linkTag(node,name);
else if (node->isQmlProperty() || node->isJsProperty()) {
- const QmlPropertyNode* pn = static_cast<const QmlPropertyNode*>(node);
+ const QmlPropertyNode *pn = static_cast<const QmlPropertyNode *>(node);
if (pn->isAttached())
name.prepend(pn->element() + QLatin1Char('.'));
}
name = "<@name>" + name + "</@name>";
QString synopsis;
if (node->isQmlProperty() || node->isJsProperty()) {
- const QmlPropertyNode* pn = static_cast<const QmlPropertyNode*>(node);
+ const QmlPropertyNode *pn = static_cast<const QmlPropertyNode *>(node);
synopsis = name + " : " + typified(pn->dataType());
} else if (node->isFunction(Node::QML) || node->isFunction(Node::JS)) {
- const FunctionNode* func = static_cast<const FunctionNode*>(node);
+ const FunctionNode *func = static_cast<const FunctionNode *>(node);
if (!func->returnType().isEmpty())
synopsis = typified(func->returnType(), true) + name;
else
@@ -424,7 +428,7 @@ QString CppCodeMarker::markedUpEnumValue(const QString &enumValue, const Node *r
return fullName;
}
-QString CppCodeMarker::markedUpIncludes(const QStringList& includes)
+QString CppCodeMarker::markedUpIncludes(const QStringList &includes)
{
QString code;
@@ -436,13 +440,13 @@ QString CppCodeMarker::markedUpIncludes(const QStringList& includes)
return code;
}
-QString CppCodeMarker::functionBeginRegExp(const QString& funcName)
+QString CppCodeMarker::functionBeginRegExp(const QString &funcName)
{
return QLatin1Char('^') + QRegExp::escape(funcName) + QLatin1Char('$');
}
-QString CppCodeMarker::functionEndRegExp(const QString& /* funcName */)
+QString CppCodeMarker::functionEndRegExp(const QString &/* funcName */)
{
return "^\\}$";
}
diff --git a/src/qdoc/cppcodemarker.h b/src/qdoc/cppcodemarker.h
index 23a54ca79..2a8456103 100644
--- a/src/qdoc/cppcodemarker.h
+++ b/src/qdoc/cppcodemarker.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -39,24 +39,24 @@ class CppCodeMarker : public CodeMarker
public:
CppCodeMarker();
- ~CppCodeMarker();
+ ~CppCodeMarker() override;
- bool recognizeCode(const QString& code) override;
- bool recognizeExtension(const QString& ext) override;
- bool recognizeLanguage(const QString& lang) override;
+ bool recognizeCode(const QString &code) override;
+ bool recognizeExtension(const QString &ext) override;
+ bool recognizeLanguage(const QString &lang) override;
Atom::AtomType atomType() const override;
- QString markedUpCode(const QString& code, const Node *relative, const Location &location) override;
+ QString markedUpCode(const QString &code, const Node *relative, const Location &location) override;
QString markedUpSynopsis(const Node *node, const Node *relative, Section::Style style) override;
QString markedUpQmlItem(const Node *node, bool summary) override;
QString markedUpName(const Node *node) override;
QString markedUpFullName(const Node *node, const Node *relative) override;
QString markedUpEnumValue(const QString &enumValue, const Node *relative) override;
- QString markedUpIncludes(const QStringList& includes) override;
- QString functionBeginRegExp(const QString& funcName) override;
- QString functionEndRegExp(const QString& funcName) override;
+ QString markedUpIncludes(const QStringList &includes) override;
+ QString functionBeginRegExp(const QString &funcName) override;
+ QString functionEndRegExp(const QString &funcName) override;
private:
- QString addMarkUp(const QString& protectedCode, const Node *relative, const Location &location);
+ QString addMarkUp(const QString &protectedCode, const Node *relative, const Location &location);
};
QT_END_NAMESPACE
diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp
index f6f2eb5f2..b05e2ab3c 100644
--- a/src/qdoc/cppcodeparser.cpp
+++ b/src/qdoc/cppcodeparser.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -30,15 +30,19 @@
cppcodeparser.cpp
*/
-#include <qfile.h>
-#include <stdio.h>
-#include <errno.h>
-#include "config.h"
#include "cppcodeparser.h"
+
+#include "config.h"
#include "qdocdatabase.h"
-#include <qdebug.h>
#include "generator.h"
+#include <QtCore/qdebug.h>
+#include <QtCore/qfile.h>
+
+#include <algorithm>
+#include <errno.h>
+#include <stdio.h>
+
QT_BEGIN_NAMESPACE
/* qmake ignore Q_OBJECT */
@@ -151,8 +155,10 @@ void CppCodeParser::initializeParser(const Config &config)
CONFIG_EXAMPLES + Config::dot + CONFIG_FILEEXTENSIONS);
// Used for excluding dirs and files from the list of example files
- excludeDirs = QSet<QString>::fromList(config.getCanonicalPathList(CONFIG_EXCLUDEDIRS));
- excludeFiles = QSet<QString>::fromList(config.getCanonicalPathList(CONFIG_EXCLUDEFILES));
+ const auto &excludeDirsList = config.getCanonicalPathList(CONFIG_EXCLUDEDIRS);
+ excludeDirs = QSet<QString>(excludeDirsList.cbegin(), excludeDirsList.cend());
+ const auto &excludeFilesList = config.getCanonicalPathList(CONFIG_EXCLUDEDIRS);
+ excludeFiles = QSet<QString>(excludeFilesList.cbegin(), excludeFilesList.cend());
if (!exampleFilePatterns.isEmpty())
exampleNameFilter = exampleFilePatterns.join(' ');
@@ -201,7 +207,7 @@ QStringList CppCodeParser::sourceFileNameFilter()
/*!
Returns the set of strings reopresenting the topic commands.
*/
-const QSet<QString>& CppCodeParser::topicCommands()
+const QSet<QString> &CppCodeParser::topicCommands()
{
return topicCommands_;
}
@@ -209,9 +215,9 @@ const QSet<QString>& CppCodeParser::topicCommands()
/*!
Process the topic \a command found in the \a doc with argument \a arg.
*/
-Node* CppCodeParser::processTopicCommand(const Doc& doc,
- const QString& command,
- const ArgLocPair& arg)
+Node *CppCodeParser::processTopicCommand(const Doc &doc,
+ const QString &command,
+ const ArgLocPair &arg)
{
ExtraFuncData extra;
if (command == COMMAND_FN) {
@@ -247,7 +253,7 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
}
else if (node->isAggregate()) {
if (type == Node::Namespace) {
- NamespaceNode* ns = static_cast<NamespaceNode*>(node);
+ NamespaceNode *ns = static_cast<NamespaceNode *>(node);
ns->markSeen();
ns->setWhereDocumented(ns->tree()->camelCaseModuleName());
}
@@ -269,37 +275,37 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
}
else if (command == COMMAND_EXAMPLE) {
if (Config::generateExamples) {
- ExampleNode* en = new ExampleNode(qdb_->primaryTreeRoot(), arg.first);
+ ExampleNode *en = new ExampleNode(qdb_->primaryTreeRoot(), arg.first);
en->setLocation(doc.startLocation());
setExampleFileLists(en);
return en;
}
}
else if (command == COMMAND_EXTERNALPAGE) {
- ExternalPageNode* epn = new ExternalPageNode(qdb_->primaryTreeRoot(), arg.first);
+ ExternalPageNode *epn = new ExternalPageNode(qdb_->primaryTreeRoot(), arg.first);
epn->setLocation(doc.startLocation());
return epn;
}
else if (command == COMMAND_HEADERFILE) {
- HeaderNode* hn = new HeaderNode(qdb_->primaryTreeRoot(), arg.first);
+ HeaderNode *hn = new HeaderNode(qdb_->primaryTreeRoot(), arg.first);
hn->setLocation(doc.startLocation());
return hn;
}
else if (command == COMMAND_GROUP) {
- CollectionNode* cn = qdb_->addGroup(arg.first);
+ CollectionNode *cn = qdb_->addGroup(arg.first);
cn->setLocation(doc.startLocation());
cn->markSeen();
return cn;
}
else if (command == COMMAND_MODULE) {
- CollectionNode* cn = qdb_->addModule(arg.first);
+ CollectionNode *cn = qdb_->addModule(arg.first);
cn->setLocation(doc.startLocation());
cn->markSeen();
return cn;
}
else if (command == COMMAND_QMLMODULE) {
QStringList blankSplit = arg.first.split(QLatin1Char(' '));
- CollectionNode* cn = qdb_->addQmlModule(blankSplit[0]);
+ CollectionNode *cn = qdb_->addQmlModule(blankSplit[0]);
cn->setLogicalModuleInfo(blankSplit);
cn->setLocation(doc.startLocation());
cn->markSeen();
@@ -307,7 +313,7 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
}
else if (command == COMMAND_JSMODULE) {
QStringList blankSplit = arg.first.split(QLatin1Char(' '));
- CollectionNode* cn = qdb_->addJsModule(blankSplit[0]);
+ CollectionNode *cn = qdb_->addJsModule(blankSplit[0]);
cn->setLogicalModuleInfo(blankSplit);
cn->setLocation(doc.startLocation());
cn->markSeen();
@@ -333,14 +339,14 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
else if (t == "attribution")
ptype = Node::AttributionPage;
}
- PageNode* pn = new PageNode(qdb_->primaryTreeRoot(), args[0], ptype);
+ PageNode *pn = new PageNode(qdb_->primaryTreeRoot(), args[0], ptype);
pn->setLocation(doc.startLocation());
return pn;
} else if (command == COMMAND_QMLTYPE) {
QmlTypeNode *qcn = nullptr;
Node *candidate = qdb_->primaryTreeRoot()->findChildNode(arg.first, Node::QML);
if (candidate != nullptr && candidate->isQmlType())
- qcn = static_cast<QmlTypeNode*>(candidate);
+ qcn = static_cast<QmlTypeNode *>(candidate);
else
qcn = new QmlTypeNode(qdb_->primaryTreeRoot(), arg.first);
qcn->setLocation(doc.startLocation());
@@ -349,17 +355,17 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
QmlTypeNode *qcn = nullptr;
Node *candidate = qdb_->primaryTreeRoot()->findChildNode(arg.first, Node::JS);
if (candidate != nullptr && candidate->isJsType())
- qcn = static_cast<QmlTypeNode*>(candidate);
+ qcn = static_cast<QmlTypeNode *>(candidate);
else
qcn = new QmlTypeNode(qdb_->primaryTreeRoot(), arg.first, Node::JsType);
qcn->setLocation(doc.startLocation());
return qcn;
} else if (command == COMMAND_QMLBASICTYPE) {
- QmlBasicTypeNode* n = new QmlBasicTypeNode(qdb_->primaryTreeRoot(), arg.first);
+ QmlBasicTypeNode *n = new QmlBasicTypeNode(qdb_->primaryTreeRoot(), arg.first);
n->setLocation(doc.startLocation());
return n;
} else if (command == COMMAND_JSBASICTYPE) {
- QmlBasicTypeNode* n = new QmlBasicTypeNode(qdb_->primaryTreeRoot(), arg.first, Node::JsBasicType);
+ QmlBasicTypeNode *n = new QmlBasicTypeNode(qdb_->primaryTreeRoot(), arg.first, Node::JsBasicType);
n->setLocation(doc.startLocation());
return n;
}
@@ -395,11 +401,11 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
\note The two QML types \e{Component} and \e{QtObject}
never have a module qualifier.
*/
-bool CppCodeParser::splitQmlPropertyArg(const QString& arg,
- QString& type,
- QString& module,
- QString& qmlTypeName,
- QString& name,
+bool CppCodeParser::splitQmlPropertyArg(const QString &arg,
+ QString &type,
+ QString &module,
+ QString &qmlTypeName,
+ QString &name,
const Location &location)
{
QStringList blankSplit = arg.split(QLatin1Char(' '));
@@ -432,7 +438,7 @@ bool CppCodeParser::splitQmlPropertyArg(const QString& arg,
*/
void CppCodeParser::processQmlProperties(const Doc &doc, NodeList &nodes, DocList &docs)
{
- const TopicList& topics = doc.topicsUsed();
+ const TopicList &topics = doc.topicsUsed();
if (topics.isEmpty())
return;
@@ -452,22 +458,11 @@ void CppCodeParser::processQmlProperties(const Doc &doc, NodeList &nodes, DocLis
group = property.left(i);
}
- QmlTypeNode* qmlType = qdb_->findQmlType(module, qmlTypeName);
+ NodeList sharedNodes;
+ QmlTypeNode *qmlType = qdb_->findQmlType(module, qmlTypeName);
if (qmlType == nullptr)
qmlType = new QmlTypeNode(qdb_->primaryTreeRoot(), qmlTypeName);
- SharedCommentNode* scn = nullptr;
- if (topics.size() > 1) {
- scn = new SharedCommentNode(qmlType, topics.size(), group);
- scn->setLocation(doc.startLocation());
- if (jsProps)
- scn->setGenus(Node::JS);
- else
- scn->setGenus(Node::QML);
- nodes.append(scn);
- docs.append(doc);
- }
-
for (int i=0; i<topics.size(); ++i) {
QString cmd = topics.at(i).topic;
arg = topics.at(i).args;
@@ -485,28 +480,37 @@ void CppCodeParser::processQmlProperties(const Doc &doc, NodeList &nodes, DocLis
doc.startLocation().warning(msg);
continue;
}
- QmlPropertyNode* qpn = new QmlPropertyNode(qmlType, property, type, attached);
- if (scn != nullptr)
- qpn->setSharedCommentNode(scn);
+ QmlPropertyNode *qpn = new QmlPropertyNode(qmlType, property, type, attached);
qpn->setLocation(doc.startLocation());
- if (jsProps)
- qpn->setGenus(Node::JS);
- else
- qpn->setGenus(Node::QML);
+ qpn->setGenus(jsProps ? Node::JS : Node::QML);
nodes.append(qpn);
docs.append(doc);
+ sharedNodes << qpn;
}
} else {
doc.startLocation().warning(tr("Command '\\%1'; not allowed with QML/JS property commands").arg(cmd));
}
}
+
+ // Construct a SharedCommentNode (scn) if multiple topics generated
+ // valid nodes. Note that it's important to do this *after* constructing
+ // the topic nodes - which need to be written to index before the related
+ // scn.
+ if (sharedNodes.count() > 1) {
+ SharedCommentNode *scn = new SharedCommentNode(qmlType, sharedNodes.count(), group);
+ scn->setLocation(doc.startLocation());
+ nodes.append(scn);
+ docs.append(doc);
+ for (const auto n : sharedNodes)
+ scn->append(n);
+ }
}
/*!
Returns the set of strings representing the common metacommands
plus some other metacommands.
*/
-const QSet<QString>& CppCodeParser::metaCommands()
+const QSet<QString> &CppCodeParser::metaCommands()
{
return metaCommands_;
}
@@ -526,7 +530,7 @@ void CppCodeParser::processMetaCommand(const Doc &doc,
QString arg = argLocPair.first;
if (command == COMMAND_INHEADERFILE) {
if (node->isAggregate())
- static_cast<Aggregate*>(node)->addIncludeFile(arg);
+ static_cast<Aggregate *>(node)->addIncludeFile(arg);
else
doc.location().warning(tr("Ignored '\\%1'").arg(COMMAND_INHEADERFILE));
}
@@ -538,16 +542,16 @@ void CppCodeParser::processMetaCommand(const Doc &doc,
in Aggregate::normalizeOverloads().
*/
if (node->isFunction())
- static_cast<FunctionNode*>(node)->setOverloadFlag();
+ static_cast<FunctionNode *>(node)->setOverloadFlag();
else if (node->isSharedCommentNode())
- static_cast<SharedCommentNode*>(node)->setOverloadFlags();
+ static_cast<SharedCommentNode *>(node)->setOverloadFlags();
else
doc.location().warning(tr("Ignored '\\%1'").arg(COMMAND_OVERLOAD));
}
else if (command == COMMAND_REIMP) {
if (node->parent() && !node->parent()->isInternal()) {
if (node->isFunction()) {
- FunctionNode *fn = static_cast<FunctionNode*>(node);
+ FunctionNode *fn = static_cast<FunctionNode *>(node);
// The clang visitor class will have set the
// qualified name of the ovverridden function.
// If the name of the overridden function isn't
@@ -622,13 +626,13 @@ void CppCodeParser::processMetaCommand(const Doc &doc,
if (node->name() == arg)
doc.location().warning(tr("%1 tries to inherit itself").arg(arg));
else if (node->isQmlType() || node->isJsType()) {
- QmlTypeNode* qmlType = static_cast<QmlTypeNode*>(node);
+ QmlTypeNode *qmlType = static_cast<QmlTypeNode *>(node);
qmlType->setQmlBaseName(arg);
}
}
else if (command == COMMAND_QMLINSTANTIATES) {
if (node->isQmlType() || node->isJsType()) {
- ClassNode* classNode = qdb_->findClassNode(arg.split("::"));
+ ClassNode *classNode = qdb_->findClassNode(arg.split("::"));
if (classNode)
node->setClassNode(classNode);
else
@@ -684,14 +688,14 @@ void CppCodeParser::processMetaCommand(const Doc &doc,
if (!node->setTitle(arg))
doc.location().warning(tr("Ignored '\\%1'").arg(COMMAND_TITLE));
else if (node->isExample())
- qdb_->addExampleNode(static_cast<ExampleNode*>(node));
+ qdb_->addExampleNode(static_cast<ExampleNode *>(node));
} else if (command == COMMAND_SUBTITLE) {
if (!node->setSubtitle(arg))
doc.location().warning(tr("Ignored '\\%1'").arg(COMMAND_SUBTITLE));
} else if (command == COMMAND_QTVARIABLE) {
node->setQtVariable(arg);
if (!node->isModule() && !node->isQmlModule())
- doc.location().warning(tr("Command '\\%1' is only meanigfule in '\\module' and '\\qmlmodule'.")
+ doc.location().warning(tr("Command '\\%1' is only meaningful in '\\module' and '\\qmlmodule'.")
.arg(COMMAND_QTVARIABLE));
} else if (command == COMMAND_NOAUTOLIST) {
node->setNoAutoList(true);
@@ -706,7 +710,7 @@ void CppCodeParser::processMetaCommand(const Doc &doc,
*/
void CppCodeParser::processMetaCommands(const Doc &doc, Node *node)
{
- QStringList metaCommandsUsed = doc.metaCommandsUsed().toList();
+ QStringList metaCommandsUsed = doc.metaCommandsUsed().values();
metaCommandsUsed.sort(); // TODO: why are these sorted? mws 24/12/2018
QStringList::ConstIterator cmd = metaCommandsUsed.constBegin();
while (cmd != metaCommandsUsed.constEnd()) {
@@ -791,7 +795,7 @@ FunctionNode *CppCodeParser::parseMacroArg(const Location &location, const QStri
if (leftParenSplit.isEmpty())
return nullptr;
QString macroName;
- FunctionNode* oldMacroNode = nullptr;
+ FunctionNode *oldMacroNode = nullptr;
QStringList blankSplit = leftParenSplit[0].split(' ');
if (blankSplit.size() > 0) {
macroName = blankSplit.last();
@@ -819,7 +823,7 @@ FunctionNode *CppCodeParser::parseMacroArg(const Location &location, const QStri
FunctionNode::Metaness metaness = FunctionNode::MacroWithParams;
if (params.isEmpty())
metaness = FunctionNode::MacroWithoutParams;
- FunctionNode* macro = new FunctionNode(metaness, qdb_->primaryTreeRoot(), macroName);
+ FunctionNode *macro = new FunctionNode(metaness, qdb_->primaryTreeRoot(), macroName);
macro->setAccess(Node::Public);
macro->setLocation(location);
macro->setReturnType(returnType);
@@ -884,18 +888,20 @@ void CppCodeParser::setExampleFileLists(PageNode *pn)
if (!exampleFiles.isEmpty()) {
// move main.cpp and to the end, if it exists
QString mainCpp;
- QMutableStringListIterator i(exampleFiles);
- i.toBack();
- while (i.hasPrevious()) {
- QString fileName = i.previous();
+
+ const auto isGeneratedOrMainCpp = [&mainCpp](const QString &fileName) {
if (fileName.endsWith("/main.cpp")) {
- mainCpp = fileName;
- i.remove();
+ if (mainCpp.isEmpty())
+ mainCpp = fileName;
+ return true;
}
- else if (fileName.contains("/qrc_") || fileName.contains("/moc_")
- || fileName.contains("/ui_"))
- i.remove();
- }
+ return fileName.contains("/qrc_") || fileName.contains("/moc_") || fileName.contains("/ui_");
+ };
+
+ exampleFiles.erase(std::remove_if(exampleFiles.begin(), exampleFiles.end(),
+ isGeneratedOrMainCpp),
+ exampleFiles.end());
+
if (!mainCpp.isEmpty())
exampleFiles.append(mainCpp);
@@ -903,13 +909,11 @@ void CppCodeParser::setExampleFileLists(PageNode *pn)
exampleFiles += Config::getFilesHere(fullPath, "*.qrc *.pro *.qmlproject qmldir");
}
- int i = 0;
- foreach (const QString &exampleFile, exampleFiles)
- exampleFiles[i++] = exampleFile.mid(sizeOfBoringPartOfName);
- i = 0;
- foreach (const QString &imageFile, imageFiles)
- imageFiles[i++] = imageFile.mid(sizeOfBoringPartOfName);
- ExampleNode* en = static_cast<ExampleNode*>(pn);
+ for (auto &file : exampleFiles)
+ file = file.mid(sizeOfBoringPartOfName);
+ for (auto &file : imageFiles)
+ file = file.mid(sizeOfBoringPartOfName);
+ ExampleNode *en = static_cast<ExampleNode *>(pn);
en->setFiles(exampleFiles);
en->setImages(imageFiles);
}
@@ -981,7 +985,7 @@ void CppCodeParser::processTopicArgs(const Doc &doc, const QString &topic, NodeL
docs.append(doc);
}
} else if (args.size() > 1) {
- QVector<SharedCommentNode*> sharedCommentNodes;
+ QVector<SharedCommentNode *> sharedCommentNodes;
ArgList::ConstIterator arg = args.constBegin();
while (arg != args.constEnd()) {
node = nullptr;
@@ -999,7 +1003,7 @@ void CppCodeParser::processTopicArgs(const Doc &doc, const QString &topic, NodeL
bool found = false;
for (SharedCommentNode *scn : sharedCommentNodes) {
if (scn->parent() == node->parent()) {
- node->setSharedCommentNode(scn);
+ scn->append(node);
found = true;
break;
}
diff --git a/src/qdoc/cppcodeparser.h b/src/qdoc/cppcodeparser.h
index 3d3f6a52c..c6d6ca788 100644
--- a/src/qdoc/cppcodeparser.h
+++ b/src/qdoc/cppcodeparser.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -42,20 +42,19 @@ class CppCodeParser : public CodeParser
Q_DECLARE_TR_FUNCTIONS(QDoc::CppCodeParser)
struct ExtraFuncData {
- Aggregate* root; // Used as the parent.
+ Aggregate *root; // Used as the parent.
Node::NodeType type; // The node type: Function, etc.
bool isAttached; // If true, the method is attached.
bool isMacro; // If true, we are parsing a macro signature.
ExtraFuncData() : root(nullptr), type(Node::Function), isAttached(false), isMacro(false) { }
- ExtraFuncData(Aggregate* r, Node::NodeType t, bool a)
+ ExtraFuncData(Aggregate *r, Node::NodeType t, bool a)
: root(r), type(t), isAttached(a), isMacro(false) { }
};
public:
CppCodeParser();
- ~CppCodeParser() = default;
- void initializeParser(const Config& config) override;
+ void initializeParser(const Config &config) override;
void terminateParser() override;
QString language() override { return QStringLiteral("Cpp"); }
QStringList headerFileNameFilter() override;
@@ -68,18 +67,18 @@ public:
static bool isQMLPropertyTopic(const QString &t);
protected:
- static const QSet<QString>& topicCommands();
- static const QSet<QString>& metaCommands();
- virtual Node* processTopicCommand(const Doc& doc,
- const QString& command,
- const ArgLocPair& arg);
+ static const QSet<QString> &topicCommands();
+ static const QSet<QString> &metaCommands();
+ virtual Node *processTopicCommand(const Doc &doc,
+ const QString &command,
+ const ArgLocPair &arg);
void processQmlProperties(const Doc &doc, NodeList &nodes, DocList &docs);
- bool splitQmlPropertyArg(const QString& arg,
- QString& type,
- QString& module,
- QString& element,
- QString& name,
- const Location& location);
+ bool splitQmlPropertyArg(const QString &arg,
+ QString &type,
+ QString &module,
+ QString &element,
+ QString &name,
+ const Location &location);
void processMetaCommand(const Doc &doc, const QString &command, const ArgLocPair &argLocPair, Node *node);
void processMetaCommands(const Doc &doc, Node *node);
void processMetaCommands(NodeList &nodes, DocList &docs);
diff --git a/src/qdoc/doc.cpp b/src/qdoc/doc.cpp
index b31125597..90799bd8c 100644
--- a/src/qdoc/doc.cpp
+++ b/src/qdoc/doc.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -26,26 +26,29 @@
**
****************************************************************************/
-#include "config.h"
#include "doc.h"
+
+#include "atom.h"
+#include "config.h"
#include "codemarker.h"
#include "editdistance.h"
+#include "generator.h"
+#include "loggingcategory.h"
#include "openedlist.h"
#include "quoter.h"
#include "text.h"
-#include "atom.h"
#include "tokenizer.h"
-#include "loggingcategory.h"
-#include <qdatetime.h>
-#include <qfile.h>
-#include <qfileinfo.h>
-#include <qhash.h>
-#include <qtextstream.h>
-#include <qregexp.h>
+
+#include <QtCore/qdatetime.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qfile.h>
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qhash.h>
+#include <QtCore/qregexp.h>
+#include <QtCore/qtextstream.h>
+
#include <ctype.h>
#include <limits.h>
-#include <qdebug.h>
-#include "generator.h"
QT_BEGIN_NAMESPACE
@@ -295,10 +298,10 @@ class DocPrivateExtra
public:
Doc::Sections granularity_;
Doc::Sections section_; // ###
- QList<Atom*> tableOfContents_;
+ QList<Atom *> tableOfContents_;
QVector<int> tableOfContentsLevels_;
- QList<Atom*> keywords_;
- QList<Atom*> targets_;
+ QList<Atom *> keywords_;
+ QList<Atom *> targets_;
QStringMultiMap metaMap_;
DocPrivateExtra()
@@ -331,12 +334,12 @@ typedef QMap<QString, ArgList> CommandMap;
class DocPrivate : public Shared
{
public:
- DocPrivate(const Location& start = Location::null,
- const Location& end = Location::null,
- const QString& source = QString());
+ DocPrivate(const Location &start = Location::null,
+ const Location &end = Location::null,
+ const QString &source = QString());
~DocPrivate();
- void addAlso(const Text& also);
+ void addAlso(const Text &also);
void constructExtra();
bool isEnumDocSimplifiable() const;
@@ -358,9 +361,9 @@ public:
DitaRefList ditamap_;
};
-DocPrivate::DocPrivate(const Location& start,
- const Location& end,
- const QString& source)
+DocPrivate::DocPrivate(const Location &start,
+ const Location &end,
+ const QString &source)
: start_loc(start),
end_loc(end),
src(source),
@@ -378,12 +381,10 @@ DocPrivate::DocPrivate(const Location& start,
DocPrivate::~DocPrivate()
{
delete extra;
- foreach (DitaRef* t, ditamap_) {
- delete t;
- }
+ qDeleteAll(ditamap_);
}
-void DocPrivate::addAlso(const Text& also)
+void DocPrivate::addAlso(const Text &also)
{
alsoList.append(also);
}
@@ -423,15 +424,15 @@ public:
void parse(const QString &source,
DocPrivate *docPrivate,
const QSet<QString> &metaCommandSet,
- const QSet<QString>& possibleTopics);
+ const QSet<QString> &possibleTopics);
static int endCmdFor(int cmd);
static QString cmdName(int cmd);
static QString endCmdName(int cmd);
- static QString untabifyEtc(const QString& str);
- static int indentLevel(const QString& str);
- static QString unindent(int level, const QString& str);
- static QString slashed(const QString& str);
+ static QString untabifyEtc(const QString &str);
+ static int indentLevel(const QString &str);
+ static QString unindent(int level, const QString &str);
+ static QString slashed(const QString &str);
static int tabSize;
static QStringList exampleFiles;
@@ -441,21 +442,21 @@ public:
static bool quoting;
private:
- Location& location();
- QString detailsUnknownCommand(const QSet<QString>& metaCommandSet,
- const QString& str);
- void insertTarget(const QString& target, bool keyword);
- void include(const QString& fileName, const QString& identifier);
- void startFormat(const QString& format, int cmd);
+ Location &location();
+ QString detailsUnknownCommand(const QSet<QString> &metaCommandSet,
+ const QString &str);
+ void insertTarget(const QString &target, bool keyword);
+ void include(const QString &fileName, const QString &identifier);
+ void startFormat(const QString &format, int cmd);
bool openCommand(int cmd);
bool closeCommand(int endCmd);
void startSection(Doc::Sections unit, int cmd);
void endSection(int unit, int endCmd);
void parseAlso();
void append(const QString &string);
- void append(Atom::AtomType type, const QString& string = QString());
- void append(Atom::AtomType type, const QString& p1, const QString& p2);
- void append(const QString& p1, const QString& p2);
+ void append(Atom::AtomType type, const QString &string = QString());
+ void append(Atom::AtomType type, const QString &p1, const QString &p2);
+ void append(const QString &p1, const QString &p2);
void appendChar(QChar ch);
void appendWord(const QString &word);
void appendToCode(const QString &code);
@@ -463,14 +464,14 @@ private:
void startNewPara();
void enterPara(Atom::AtomType leftType = Atom::ParaLeft,
Atom::AtomType rightType = Atom::ParaRight,
- const QString& string = QString());
+ const QString &string = QString());
void leavePara();
void leaveValue();
void leaveValueList();
void leaveTableRow();
CodeMarker *quoteFromFile();
bool expandMacro();
- void expandMacro(const QString& name, const QString& def, int numParams);
+ void expandMacro(const QString &name, const QString &def, int numParams);
QString expandMacroToString(const QString &name, const QString &def, int numParams, const QString &matchExpr);
Doc::Sections getSectioningUnit();
QString getArgument(bool verbatim = false);
@@ -525,7 +526,7 @@ private:
QStack<int> openedCommands;
QStack<OpenedList> openedLists;
Quoter quoter;
- QStack<DitaRef*> ditarefs_;
+ QStack<DitaRef *> ditarefs_;
Atom *lastAtom;
};
@@ -545,10 +546,10 @@ bool DocParser::quoting = false;
found in \a source. These metacommands are not markup text
commands. They are topic commands and related metacommands.
*/
-void DocParser::parse(const QString& source,
+void DocParser::parse(const QString &source,
DocPrivate *docPrivate,
- const QSet<QString>& metaCommandSet,
- const QSet<QString>& possibleTopics)
+ const QSet<QString> &metaCommandSet,
+ const QSet<QString> &possibleTopics)
{
input_ = source;
pos = 0;
@@ -975,7 +976,7 @@ void DocParser::parse(const QString& source,
case CMD_TOPICREF:
case CMD_MAPREF:
if (openCommand(cmd)) {
- DitaRef* t = nullptr;
+ DitaRef *t = nullptr;
if (cmd == CMD_MAPREF)
t = new MapRef();
else
@@ -1679,20 +1680,13 @@ void DocParser::insertTarget(const QString &target, bool keyword)
}
}
-void DocParser::include(const QString& fileName, const QString& identifier)
+void DocParser::include(const QString &fileName, const QString &identifier)
{
if (location().depth() > 16)
location().fatal(tr("Too many nested '\\%1's").arg(cmdName(CMD_INCLUDE)));
QString userFriendlyFilePath;
QString filePath = Doc::config()->getIncludeFilePath(fileName);
-#if 0
- QString filePath = Config::findFile(location(),
- sourceFiles,
- sourceDirs,
- fileName,
- userFriendlyFilePath);
-#endif
if (filePath.isEmpty()) {
location().warning(tr("Cannot find qdoc include file '%1'").arg(fileName));
}
@@ -1763,7 +1757,7 @@ void DocParser::include(const QString& fileName, const QString& identifier)
}
}
-void DocParser::startFormat(const QString& format, int cmd)
+void DocParser::startFormat(const QString &format, int cmd)
{
enterPara();
@@ -1963,7 +1957,7 @@ void DocParser::append(const QString &string)
priv->text << Atom(string); // The Atom type is Link.
}
-void DocParser::append(Atom::AtomType type, const QString& p1, const QString& p2)
+void DocParser::append(Atom::AtomType type, const QString &p1, const QString &p2)
{
Atom::AtomType lastType = priv->text.lastAtom()->type();
if ((lastType == Atom::Code) && priv->text.lastAtom()->string().endsWith(QLatin1String("\n\n")))
@@ -1971,7 +1965,7 @@ void DocParser::append(Atom::AtomType type, const QString& p1, const QString& p2
priv->text << Atom(type, p1, p2);
}
-void DocParser::append(const QString& p1, const QString& p2)
+void DocParser::append(const QString &p1, const QString &p2)
{
Atom::AtomType lastType = priv->text.lastAtom()->type();
if ((lastType == Atom::Code) && priv->text.lastAtom()->string().endsWith(QLatin1String("\n\n")))
@@ -2004,7 +1998,7 @@ void DocParser::appendWord(const QString &word)
priv->text.lastAtom()->appendString(word);
}
-void DocParser::appendToCode(const QString& markedCode)
+void DocParser::appendToCode(const QString &markedCode)
{
if (!isCode(lastAtom)) {
append(Atom::Code);
@@ -2031,7 +2025,7 @@ void DocParser::startNewPara()
void DocParser::enterPara(Atom::AtomType leftType,
Atom::AtomType rightType,
- const QString& string)
+ const QString &string)
{
if (paraState == OutsideParagraph) {
@@ -2746,7 +2740,7 @@ QString DocParser::endCmdName(int cmd)
return cmdName(endCmdFor(cmd));
}
-QString DocParser::untabifyEtc(const QString& str)
+QString DocParser::untabifyEtc(const QString &str)
{
QString result;
result.reserve(str.length());
@@ -2780,7 +2774,7 @@ QString DocParser::untabifyEtc(const QString& str)
return result;
}
-int DocParser::indentLevel(const QString& str)
+int DocParser::indentLevel(const QString &str)
{
int minIndent = INT_MAX;
int column = 0;
@@ -2798,7 +2792,7 @@ int DocParser::indentLevel(const QString& str)
return minIndent;
}
-QString DocParser::unindent(int level, const QString& str)
+QString DocParser::unindent(int level, const QString &str)
{
if (level == 0)
return str;
@@ -2820,7 +2814,7 @@ QString DocParser::unindent(int level, const QString& str)
return t;
}
-QString DocParser::slashed(const QString& str)
+QString DocParser::slashed(const QString &str)
{
QString result = str;
result.replace(QLatin1Char('/'), "\\/");
@@ -2859,18 +2853,18 @@ bool DocParser::isQuote(const Atom *atom)
QML documentation, there is the case where the qdoc \e{qmlproperty}
command can appear multiple times in a qdoc comment.
*/
-Doc::Doc(const Location& start_loc,
- const Location& end_loc,
- const QString& source,
- const QSet<QString>& metaCommandSet,
- const QSet<QString>& topics)
+Doc::Doc(const Location &start_loc,
+ const Location &end_loc,
+ const QString &source,
+ const QSet<QString> &metaCommandSet,
+ const QSet<QString> &topics)
{
- priv = new DocPrivate(start_loc,end_loc,source);
+ priv = new DocPrivate(start_loc, end_loc, source);
DocParser parser;
- parser.parse(source,priv,metaCommandSet,topics);
+ parser.parse(source, priv, metaCommandSet, topics);
}
-Doc::Doc(const Doc& doc)
+Doc::Doc(const Doc &doc)
: priv(nullptr)
{
operator=(doc);
@@ -2882,7 +2876,7 @@ Doc::~Doc()
delete priv;
}
-Doc &Doc::operator=(const Doc& doc)
+Doc &Doc::operator=(const Doc &doc)
{
if (doc.priv)
doc.priv->ref();
@@ -2938,7 +2932,7 @@ const Location &Doc::location() const
/*!
Returns the starting location of a qdoc comment.
*/
-const Location& Doc::startLocation() const
+const Location &Doc::startLocation() const
{
return location();
}
@@ -2946,7 +2940,7 @@ const Location& Doc::startLocation() const
/*!
Returns the ending location of a qdoc comment.
*/
-const Location& Doc::endLocation() const
+const Location &Doc::endLocation() const
{
static const Location dummy;
return priv == nullptr ? dummy : priv->end_loc;
@@ -2963,7 +2957,7 @@ bool Doc::isEmpty() const
return priv == nullptr || priv->src.isEmpty();
}
-const Text& Doc::body() const
+const Text &Doc::body() const
{
static const Text dummy;
return priv == nullptr ? dummy : priv->text;
@@ -3100,12 +3094,12 @@ bool Doc::isMarkedReimp() const
current qdoc comment. Normally there is only one, but there
can be multiple \e{qmlproperty} commands, for example.
*/
-const TopicList& Doc::topicsUsed() const
+const TopicList &Doc::topicsUsed() const
{
return priv == nullptr ? *nullTopicList() : priv->topics_;
}
-ArgList Doc::metaCommandArgs(const QString& metacommand) const
+ArgList Doc::metaCommandArgs(const QString &metacommand) const
{
return priv == nullptr ? ArgList() : priv->metaCommandMap.value(metacommand);
}
@@ -3159,9 +3153,9 @@ const QStringMultiMap &Doc::metaTagMap() const
return priv && priv->extra ? priv->extra->metaMap_ : *null_QStringMultiMap();
}
-const Config* Doc::config_ = nullptr;
+const Config *Doc::config_ = nullptr;
-void Doc::initialize(const Config& config)
+void Doc::initialize(const Config &config)
{
DocParser::tabSize = config.getInt(CONFIG_TABSIZE);
DocParser::exampleFiles = config.getCanonicalPathList(CONFIG_EXAMPLES);
@@ -3277,7 +3271,7 @@ QString Doc::alias(const QString &english)
Trims the deadwood out of \a str. i.e., this function
cleans up \a str.
*/
-void Doc::trimCStyleComment(Location& location, QString& str)
+void Doc::trimCStyleComment(Location &location, QString &str)
{
QString cleaned;
Location m = location;
@@ -3420,9 +3414,7 @@ void Doc::detach()
*/
TopicRef::~TopicRef()
{
- foreach (DitaRef* t, subrefs_) {
- delete t;
- }
+ qDeleteAll(subrefs_);
}
/*!
diff --git a/src/qdoc/doc.h b/src/qdoc/doc.h
index ee3221a2d..d67275565 100644
--- a/src/qdoc/doc.h
+++ b/src/qdoc/doc.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -33,12 +33,12 @@
#ifndef DOC_H
#define DOC_H
-#include <qset.h>
-#include <qstring.h>
-#include <qmap.h>
-
#include "location.h"
+#include <QtCore/qmap.h>
+#include <QtCore/qset.h>
+#include <QtCore/qstring.h>
+
QT_BEGIN_NAMESPACE
class Atom;
@@ -59,13 +59,13 @@ struct Topic
QString topic;
QString args;
Topic() { }
- Topic(QString& t, const QString &a) : topic(t), args(a) { }
+ Topic(QString &t, const QString &a) : topic(t), args(a) { }
bool isEmpty() const { return topic.isEmpty(); }
void clear() { topic.clear(); args.clear(); }
};
typedef QList<Topic> TopicList;
-typedef QList<DitaRef*> DitaRefList;
+typedef QList<DitaRef *> DitaRefList;
class DitaRef
{
@@ -73,13 +73,13 @@ public:
DitaRef() { }
virtual ~DitaRef() { }
- const QString& navtitle() const { return navtitle_; }
- const QString& href() const { return href_; }
- void setNavtitle(const QString& t) { navtitle_ = t; }
- void setHref(const QString& t) { href_ = t; }
+ const QString &navtitle() const { return navtitle_; }
+ const QString &href() const { return href_; }
+ void setNavtitle(const QString &t) { navtitle_ = t; }
+ void setHref(const QString &t) { href_ = t; }
virtual bool isMapRef() const = 0;
- virtual const DitaRefList* subrefs() const { return nullptr; }
- virtual void appendSubref(DitaRef* ) { }
+ virtual const DitaRefList *subrefs() const { return nullptr; }
+ virtual void appendSubref(DitaRef *) { }
private:
QString navtitle_;
@@ -90,11 +90,11 @@ class TopicRef : public DitaRef
{
public:
TopicRef() { }
- ~TopicRef();
+ ~TopicRef() override;
bool isMapRef() const override { return false; }
- const DitaRefList* subrefs() const override { return &subrefs_; }
- void appendSubref(DitaRef* t) override { subrefs_.append(t); }
+ const DitaRefList *subrefs() const override { return &subrefs_; }
+ void appendSubref(DitaRef *t) override { subrefs_.append(t); }
private:
DitaRefList subrefs_;
@@ -104,7 +104,6 @@ class MapRef : public DitaRef
{
public:
MapRef() { }
- ~MapRef() { }
bool isMapRef() const override { return true; }
};
@@ -126,25 +125,25 @@ public:
};
Doc() : priv(nullptr) {}
- Doc(const Location& start_loc,
- const Location& end_loc,
- const QString& source,
- const QSet<QString>& metaCommandSet,
- const QSet<QString>& topics);
+ Doc(const Location &start_loc,
+ const Location &end_loc,
+ const QString &source,
+ const QSet<QString> &metaCommandSet,
+ const QSet<QString> &topics);
Doc(const Doc &doc);
~Doc();
- Doc& operator=( const Doc& doc );
+ Doc &operator=(const Doc &doc);
void simplifyEnumDoc();
void setBody(const Text &body);
const DitaRefList& ditamap() const;
const Location &location() const;
- const Location& startLocation() const;
- const Location& endLocation() const;
+ const Location &startLocation() const;
+ const Location &endLocation() const;
bool isEmpty() const;
- const QString& source() const;
- const Text& body() const;
+ const QString &source() const;
+ const Text &body() const;
Text briefText(bool inclusive = false) const;
Text trimmedBriefText(const QString &className) const;
Text legaleseText() const;
@@ -153,8 +152,8 @@ public:
const QStringList &enumItemNames() const;
const QStringList &omitEnumItemNames() const;
const QSet<QString> &metaCommandsUsed() const;
- const TopicList& topicsUsed() const;
- ArgList metaCommandArgs(const QString& metaCommand) const;
+ const TopicList &topicsUsed() const;
+ ArgList metaCommandArgs(const QString &metaCommand) const;
const QList<Text> &alsoList() const;
bool hasTableOfContents() const;
bool hasKeywords() const;
@@ -167,22 +166,22 @@ public:
const QList<Atom *> &targets() const;
const QStringMultiMap &metaTagMap() const;
- static void initialize( const Config &config );
+ static void initialize(const Config &config);
static void terminate();
- static QString alias( const QString &english );
- static void trimCStyleComment( Location& location, QString& str );
- static QString resolveFile(const Location &location,const QString &fileName,
+ static QString alias(const QString &english);
+ static void trimCStyleComment(Location &location, QString &str);
+ static QString resolveFile(const Location &location, const QString &fileName,
QString *userFriendlyFilePath = nullptr);
static CodeMarker *quoteFromFile(const Location &location,
Quoter &quoter,
const QString &fileName);
static QString canonicalTitle(const QString &title);
- static const Config* config() { return config_; }
+ static const Config *config() { return config_; }
private:
void detach();
DocPrivate *priv;
- static const Config* config_;
+ static const Config *config_;
};
Q_DECLARE_TYPEINFO(Doc, Q_MOVABLE_TYPE);
typedef QList<Doc> DocList;
diff --git a/src/qdoc/doc/examples/cpp.qdoc.sample b/src/qdoc/doc/examples/cpp.qdoc.sample
index 892e9c30d..0524a6756 100644
--- a/src/qdoc/doc/examples/cpp.qdoc.sample
+++ b/src/qdoc/doc/examples/cpp.qdoc.sample
@@ -46,7 +46,7 @@
\snippet code/doc_src_qcache.cpp 1
- ... detailed description ommitted
+ ... detailed description omitted
\sa QPixmapCache, QHash, QMap
*/
diff --git a/src/qdoc/editdistance.cpp b/src/qdoc/editdistance.cpp
index aa7e16b3f..c96071bf0 100644
--- a/src/qdoc/editdistance.cpp
+++ b/src/qdoc/editdistance.cpp
@@ -34,7 +34,7 @@
QT_BEGIN_NAMESPACE
-int editDistance( const QString& s, const QString& t )
+int editDistance(const QString &s, const QString &t)
{
#define D( i, j ) d[(i) * n + (j)]
int i;
@@ -66,7 +66,7 @@ int editDistance( const QString& s, const QString& t )
#undef D
}
-QString nearestName( const QString& actual, const QSet<QString>& candidates )
+QString nearestName(const QString &actual, const QSet<QString> &candidates)
{
if (actual.isEmpty())
return QString();
@@ -76,26 +76,24 @@ QString nearestName( const QString& actual, const QSet<QString>& candidates )
QString best;
QSet<QString>::ConstIterator c = candidates.constBegin();
- while ( c != candidates.constEnd() ) {
- if ( (*c)[0] == actual[0] ) {
- int delta = editDistance( actual, *c );
- if ( delta < deltaBest ) {
+ while (c != candidates.constEnd()) {
+ if ((*c)[0] == actual[0]) {
+ int delta = editDistance(actual, *c);
+ if (delta < deltaBest) {
deltaBest = delta;
numBest = 1;
best = *c;
- } else if ( delta == deltaBest ) {
+ } else if (delta == deltaBest) {
numBest++;
}
}
++c;
}
- if ( numBest == 1 && deltaBest <= 2 &&
- actual.length() + best.length() >= 5 ) {
+ if (numBest == 1 && deltaBest <= 2 && actual.length() + best.length() >= 5)
return best;
- } else {
- return QString();
- }
+
+ return QString();
}
QT_END_NAMESPACE
diff --git a/src/qdoc/editdistance.h b/src/qdoc/editdistance.h
index e67095fdd..c7ea080cd 100644
--- a/src/qdoc/editdistance.h
+++ b/src/qdoc/editdistance.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -33,13 +33,13 @@
#ifndef EDITDISTANCE_H
#define EDITDISTANCE_H
-#include <qset.h>
-#include <qstring.h>
+#include <QtCore/qset.h>
+#include <QtCore/qstring.h>
QT_BEGIN_NAMESPACE
-int editDistance( const QString& s, const QString& t );
-QString nearestName( const QString& actual, const QSet<QString>& candidates );
+int editDistance(const QString &s, const QString &t);
+QString nearestName(const QString &actual, const QSet<QString> &candidates);
QT_END_NAMESPACE
diff --git a/src/qdoc/generator.cpp b/src/qdoc/generator.cpp
index 3bb3ab13a..fb02f3cc9 100644
--- a/src/qdoc/generator.cpp
+++ b/src/qdoc/generator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -29,26 +29,29 @@
/*
generator.cpp
*/
-#include <qdir.h>
-#include <qdebug.h>
+#include "generator.h"
+
#include "codemarker.h"
#include "config.h"
#include "doc.h"
#include "editdistance.h"
-#include "generator.h"
#include "loggingcategory.h"
#include "openedlist.h"
+#include "qdocdatabase.h"
#include "quoter.h"
#include "separator.h"
#include "tokenizer.h"
-#include "qdocdatabase.h"
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qdir.h>
+
#ifndef QT_BOOTSTRAPPED
# include "QtCore/qurl.h"
#endif
QT_BEGIN_NAMESPACE
-Generator* Generator::currentGenerator_;
+Generator *Generator::currentGenerator_;
QStringList Generator::exampleDirs;
QStringList Generator::exampleImgExts;
QMap<QString, QMap<QString, QString> > Generator::fmtLeftMaps;
@@ -76,7 +79,7 @@ bool Generator::qdocSingleExec_ = false;
bool Generator::qdocWriteQaPages_ = false;
bool Generator::useOutputSubdirs_ = true;
bool Generator::useTimestamps_ = false;
-QmlTypeNode* Generator::qmlTypeContext_ = nullptr;
+QmlTypeNode *Generator::qmlTypeContext_ = nullptr;
static QRegExp tag("</?@[^>]*>");
static QLatin1String amp("&amp;");
@@ -84,28 +87,6 @@ static QLatin1String gt("&gt;");
static QLatin1String lt("&lt;");
static QLatin1String quot("&quot;");
-static inline void setDebugEnabled(bool v)
-{
- const_cast<QLoggingCategory &>(lcQdoc()).setEnabled(QtDebugMsg, v);
-}
-
-void Generator::startDebugging(const QString& message)
-{
- setDebugEnabled(true);
- qCDebug(lcQdoc, "START DEBUGGING: %s", qPrintable(message));
-}
-
-void Generator::stopDebugging(const QString& message)
-{
- qCDebug(lcQdoc, "STOP DEBUGGING: %s", qPrintable(message));
- setDebugEnabled(false);
-}
-
-bool Generator::debugging()
-{
- return lcQdoc().isEnabled(QtDebugMsg);
-}
-
/*!
Constructs the generator base class. Prepends the newly
constructed generator to the list of output generators.
@@ -135,7 +116,7 @@ Generator::~Generator()
generators.removeAll(this);
}
-void Generator::appendFullName(Text& text,
+void Generator::appendFullName(Text &text,
const Node *apparentNode,
const Node *relative,
const Node *actualNode)
@@ -148,9 +129,9 @@ void Generator::appendFullName(Text& text,
<< Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
}
-void Generator::appendFullName(Text& text,
+void Generator::appendFullName(Text &text,
const Node *apparentNode,
- const QString& fullName,
+ const QString &fullName,
const Node *actualNode)
{
if (actualNode == nullptr)
@@ -161,7 +142,7 @@ void Generator::appendFullName(Text& text,
<< Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
}
-void Generator::appendFullNames(Text& text, const NodeList& nodes, const Node* relative)
+void Generator::appendFullNames(Text &text, const NodeList &nodes, const Node *relative)
{
NodeList::ConstIterator n = nodes.constBegin();
int index = 0;
@@ -177,7 +158,7 @@ void Generator::appendFullNames(Text& text, const NodeList& nodes, const Node* r
\a text, so that is is a link to the documentation for that
function.
*/
-void Generator::appendSignature(Text& text, const Node* node)
+void Generator::appendSignature(Text &text, const Node *node)
{
text << Atom(Atom::LinkNode, CodeMarker::stringForNode(node))
<< Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
@@ -190,7 +171,7 @@ void Generator::appendSignature(Text& text, const Node* node)
nodes are in \a nodes. It uses the \a relative node and the
\a marker for the generation.
*/
-void Generator::signatureList(const NodeList& nodes, const Node* relative, CodeMarker* marker)
+void Generator::signatureList(const NodeList &nodes, const Node *relative, CodeMarker *marker)
{
Text text;
int count = 0;
@@ -207,7 +188,7 @@ void Generator::signatureList(const NodeList& nodes, const Node* relative, CodeM
generateText(text, relative, marker);
}
-int Generator::appendSortedNames(Text& text, const ClassNode* cn, const QList<RelatedClass>& rc)
+int Generator::appendSortedNames(Text &text, const ClassNode *cn, const QList<RelatedClass> &rc)
{
QList<RelatedClass>::ConstIterator r;
QMap<QString,Text> classMap;
@@ -215,7 +196,7 @@ int Generator::appendSortedNames(Text& text, const ClassNode* cn, const QList<Re
r = rc.constBegin();
while (r != rc.constEnd()) {
- ClassNode* rcn = (*r).node_;
+ ClassNode *rcn = (*r).node_;
if (rcn && rcn->isInAPI()) {
Text className;
appendFullName(className, rcn, cn);
@@ -224,17 +205,15 @@ int Generator::appendSortedNames(Text& text, const ClassNode* cn, const QList<Re
++r;
}
- QStringList classNames = classMap.keys();
- classNames.sort();
-
- foreach (const QString &className, classNames) {
+ const QStringList classNames = classMap.keys();
+ for (const auto &className : classNames) {
text << classMap[className];
text << comma(index++, classNames.count());
}
return index;
}
-int Generator::appendSortedQmlNames(Text& text, const Node* base, const NodeList& subs)
+int Generator::appendSortedQmlNames(Text &text, const Node *base, const NodeList &subs)
{
QMap<QString,Text> classMap;
int index = 0;
@@ -248,10 +227,8 @@ int Generator::appendSortedQmlNames(Text& text, const Node* base, const NodeList
}
}
- QStringList names = classMap.keys();
- names.sort();
-
- foreach (const QString &name, names) {
+ const QStringList names = classMap.keys();
+ for (const auto &name : names) {
text << classMap[name];
text << comma(index++, names.count());
}
@@ -267,7 +244,8 @@ void Generator::writeOutFileNames()
if (!files.open(QFile::WriteOnly))
return;
QTextStream filesout(&files);
- foreach (const QString &file, outFileNames_) {
+ const auto names = outFileNames_;
+ for (const auto &file : names) {
filesout << file << "\n";
}
}
@@ -280,7 +258,7 @@ void Generator::writeOutFileNames()
\sa beginSubPage()
*/
-void Generator::beginFilePage(const Node* node, const QString& fileName)
+void Generator::beginFilePage(const Node *node, const QString &fileName)
{
QString path = outputDir() + QLatin1Char('/');
if (Generator::useOutputSubdirs() && !node->outputSubdirectory().isEmpty() &&
@@ -315,10 +293,10 @@ void Generator::beginFilePage(const Node* node, const QString& fileName)
\sa beginFilePage()
*/
-void Generator::beginSubPage(const Node* node, const QString& fileName)
+void Generator::beginSubPage(const Node *node, const QString &fileName)
{
beginFilePage(node, fileName);
- const_cast<Node*>(node)->setOutputFileName(fileName);
+ const_cast<Node *>(node)->setOutputFileName(fileName);
}
/*!
@@ -430,7 +408,7 @@ QString Generator::fileBase(const Node *node) const
p = pp;
}
if (node->isNamespace() && !node->name().isEmpty()) {
- const NamespaceNode* ns = static_cast<const NamespaceNode*>(node);
+ const NamespaceNode *ns = static_cast<const NamespaceNode *>(node);
if (!ns->isDocumentedHere()) {
base.append(QLatin1String("-sub-"));
base.append(ns->tree()->camelCaseModuleName());
@@ -440,7 +418,7 @@ QString Generator::fileBase(const Node *node) const
QString res;
transmogrify(base, res);
- Node* n = const_cast<Node*>(node);
+ Node *n = const_cast<Node *>(node);
n->setFileNameBase(res);
return res;
}
@@ -494,7 +472,7 @@ QString Generator::exampleFileTitle(const ExampleNode *relative,
either the provided \a extension or fileExtension(), and
return the constructed name.
*/
-QString Generator::fileName(const Node* node, const QString &extension) const
+QString Generator::fileName(const Node *node, const QString &extension) const
{
if (!node->url().isEmpty())
return node->url();
@@ -503,7 +481,7 @@ QString Generator::fileName(const Node* node, const QString &extension) const
return extension.isNull() ? name + fileExtension() : name + extension;
}
-QString Generator::cleanRef(const QString& ref)
+QString Generator::cleanRef(const QString &ref)
{
QString clean;
@@ -526,7 +504,7 @@ QString Generator::cleanRef(const QString& ref)
clean += QLatin1Char('A');
}
- for (int i = 1; i < (int) ref.length(); i++) {
+ for (int i = 1; i < ref.length(); i++) {
const QChar c = ref[i];
const uint u = c.unicode();
if ((u >= 'a' && u <= 'z') ||
@@ -550,18 +528,18 @@ QString Generator::cleanRef(const QString& ref)
clean += QLatin1Char('#');
} else {
clean += QLatin1Char('-');
- clean += QString::number((int)u, 16);
+ clean += QString::number(static_cast<int>(u), 16);
}
}
return clean;
}
-QMap<QString, QString>& Generator::formattingLeftMap()
+QMap<QString, QString> &Generator::formattingLeftMap()
{
return fmtLeftMaps[format()];
}
-QMap<QString, QString>& Generator::formattingRightMap()
+QMap<QString, QString> &Generator::formattingRightMap()
{
return fmtRightMaps[format()];
}
@@ -816,7 +794,7 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
that has no documentation.
*/
if (node->isFunction()) {
- const FunctionNode* func = static_cast<const FunctionNode*>(node);
+ const FunctionNode *func = static_cast<const FunctionNode *>(node);
if (func->isDtor()) {
Text text;
text << "Destroys the instance of ";
@@ -886,7 +864,7 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
}
if (node->isEnumType()) {
- const EnumNode *enume = (const EnumNode *) node;
+ const EnumNode *enume = static_cast<const EnumNode *>(node);
QSet<QString> definedItems;
QList<EnumItem>::ConstIterator it = enume->items().constBegin();
@@ -895,7 +873,8 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
++it;
}
- QSet<QString> documentedItems = enume->doc().enumItemNames().toSet();
+ const auto &documentedItemList = enume->doc().enumItemNames();
+ QSet<QString> documentedItems(documentedItemList.cbegin(), documentedItemList.cend());
QSet<QString> allItems = definedItems + documentedItems;
if (allItems.count() > definedItems.count() ||
allItems.count() > documentedItems.count()) {
@@ -1031,7 +1010,7 @@ void Generator::generateLinkToExample(const ExampleNode *en,
<< Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK)
<< Atom::ParaRight;
- generateText(text, 0, marker);
+ generateText(text, nullptr, marker);
}
/*!
@@ -1041,7 +1020,7 @@ void Generator::generateLinkToExample(const ExampleNode *en,
example. The images are copied into a subtree of
\c{...doc/html/images/used-in-examples/...}
*/
-void Generator::generateFileList(const ExampleNode* en, CodeMarker* marker, bool images)
+void Generator::generateFileList(const ExampleNode *en, CodeMarker *marker, bool images)
{
Text text;
OpenedList openedList(OpenedList::Bullet);
@@ -1063,7 +1042,7 @@ void Generator::generateFileList(const ExampleNode* en, CodeMarker* marker, bool
text << Atom(Atom::ListLeft, openedList.styleString());
QString path;
- foreach (QString file, paths) {
+ for (const auto &file : qAsConst(paths)) {
if (images) {
if (!file.isEmpty()) {
QDir dirInfo;
@@ -1156,7 +1135,7 @@ void Generator::generateInherits(const ClassNode *classe, CodeMarker *marker)
/*!
Recursive writing of HTML files from the root \a node.
*/
-void Generator::generateDocumentation(Node* node)
+void Generator::generateDocumentation(Node *node)
{
if (!node->url().isNull())
return;
@@ -1196,7 +1175,7 @@ void Generator::generateDocumentation(Node* node)
members of cn in the other modules and add them
to the members list.
*/
- CollectionNode* cn = static_cast<CollectionNode*>(node);
+ CollectionNode *cn = static_cast<CollectionNode *>(node);
if (cn->wasSeen()) {
qdb_->mergeCollections(cn);
beginSubPage(node, fileName(node));
@@ -1215,38 +1194,38 @@ void Generator::generateDocumentation(Node* node)
}
} else if (node->isTextPageNode()) {
beginSubPage(node, fileName(node));
- generatePageNode(static_cast<PageNode*>(node), marker);
+ generatePageNode(static_cast<PageNode *>(node), marker);
endSubPage();
} else if (node->isAggregate()) {
if ((node->isClassNode() || node->isHeader() || node->isNamespace()) &&
node->docMustBeGenerated()) {
beginSubPage(node, fileName(node));
- generateCppReferencePage(static_cast<Aggregate*>(node), marker);
+ generateCppReferencePage(static_cast<Aggregate *>(node), marker);
endSubPage();
} else if (node->isQmlType() || node->isJsType()) {
beginSubPage(node, fileName(node));
- QmlTypeNode* qcn = static_cast<QmlTypeNode*>(node);
+ QmlTypeNode *qcn = static_cast<QmlTypeNode *>(node);
generateQmlTypePage(qcn, marker);
endSubPage();
} else if (node->isQmlBasicType() || node->isJsBasicType()) {
beginSubPage(node, fileName(node));
- QmlBasicTypeNode* qbtn = static_cast<QmlBasicTypeNode*>(node);
+ QmlBasicTypeNode *qbtn = static_cast<QmlBasicTypeNode *>(node);
generateQmlBasicTypePage(qbtn, marker);
endSubPage();
} else if (node->isProxyNode()) {
beginSubPage(node, fileName(node));
- generateProxyPage(static_cast<Aggregate*>(node), marker);
+ generateProxyPage(static_cast<Aggregate *>(node), marker);
endSubPage();
}
}
}
if (node->isAggregate()) {
- Aggregate* aggregate = static_cast<Aggregate*>(node);
+ Aggregate *aggregate = static_cast<Aggregate *>(node);
const NodeList &children = aggregate->childNodes();
- foreach (Node *n, children) {
- if (n->isPageNode() && !n->isPrivate())
- generateDocumentation(n);
+ for (auto *node : children) {
+ if (node->isPageNode() && !node->isPrivate())
+ generateDocumentation(node);
}
}
}
@@ -1254,7 +1233,7 @@ void Generator::generateDocumentation(Node* node)
/*!
Generate a list of maintainers in the output
*/
-void Generator::generateMaintainerList(const Aggregate* node, CodeMarker* marker)
+void Generator::generateMaintainerList(const Aggregate *node, CodeMarker *marker)
{
QStringList sl = getMetadataElements(node,"maintainer");
@@ -1277,8 +1256,8 @@ void Generator::generateMaintainerList(const Aggregate* node, CodeMarker* marker
Output the "Inherit by" list for the QML element,
if it is inherited by any other elements.
*/
-void Generator::generateQmlInheritedBy(const QmlTypeNode* qcn,
- CodeMarker* marker)
+void Generator::generateQmlInheritedBy(const QmlTypeNode *qcn,
+ CodeMarker *marker)
{
if (qcn) {
NodeList subs;
@@ -1297,12 +1276,12 @@ void Generator::generateQmlInheritedBy(const QmlTypeNode* qcn,
Extract sections of markup text surrounded by \e qmltext
and \e endqmltext and output them.
*/
-bool Generator::generateQmlText(const Text& text,
+bool Generator::generateQmlText(const Text &text,
const Node *relative,
CodeMarker *marker,
- const QString& /* qmlName */ )
+ const QString &/* qmlName */ )
{
- const Atom* atom = text.firstAtom();
+ const Atom *atom = text.firstAtom();
bool result = false;
if (atom != nullptr) {
@@ -1328,7 +1307,7 @@ void Generator::generateReimplementsClause(const FunctionNode *fn, CodeMarker *m
{
if (!fn->overridesThis().isEmpty()) {
if (fn->parent()->isClassNode()) {
- ClassNode* cn = static_cast<ClassNode*>(fn->parent());
+ ClassNode *cn = static_cast<ClassNode *>(fn->parent());
const FunctionNode *overrides = cn->findOverriddenFunction(fn);
if (overrides && !overrides->isPrivate() && !overrides->parent()->isPrivate()) {
if (overrides->hasDoc()) {
@@ -1341,7 +1320,7 @@ void Generator::generateReimplementsClause(const FunctionNode *fn, CodeMarker *m
return;
}
}
- const PropertyNode* sameName = cn->findOverriddenProperty(fn);
+ const PropertyNode *sameName = cn->findOverriddenProperty(fn);
if (sameName && sameName->hasDoc()) {
Text text;
text << Atom::ParaLeft << "Reimplements an access function for property: ";
@@ -1432,7 +1411,7 @@ void Generator::generateStatus(const Node *node, CodeMarker *marker)
"The signal is private, not emitted by the user.
The function is public so the user can pass it to connect()."
*/
-void Generator::generatePrivateSignalNote(const Node* node, CodeMarker* marker)
+void Generator::generatePrivateSignalNote(const Node *node, CodeMarker *marker)
{
Text text;
text << Atom::ParaLeft
@@ -1448,7 +1427,7 @@ void Generator::generatePrivateSignalNote(const Node* node, CodeMarker* marker)
Generates a bold line that says:
"This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE."
*/
-void Generator::generateInvokableNote(const Node* node, CodeMarker* marker)
+void Generator::generateInvokableNote(const Node *node, CodeMarker *marker)
{
Text text;
text << Atom::ParaLeft
@@ -1470,7 +1449,7 @@ void Generator::generateInvokableNote(const Node* node, CodeMarker* marker)
is the node that represents the entity where a qdoc comment
was found, and \a text represents the qdoc comment.
*/
-bool Generator::generateText(const Text& text,
+bool Generator::generateText(const Text &text,
const Node *relative,
CodeMarker *marker)
{
@@ -1497,29 +1476,29 @@ bool Generator::generateText(const Text& text,
nonreentrant, and true is returned. If there are no exceptions,
the three node lists remain empty and false is returned.
*/
-static bool hasExceptions(const Node* node,
- NodeList& reentrant,
- NodeList& threadsafe,
- NodeList& nonreentrant)
+static bool hasExceptions(const Node *node,
+ NodeList &reentrant,
+ NodeList &threadsafe,
+ NodeList &nonreentrant)
{
bool result = false;
Node::ThreadSafeness ts = node->threadSafeness();
- const NodeList &children = static_cast<const Aggregate*>(node)->childNodes();
- foreach (Node *n, children) {
- if (!n->isObsolete()){
- switch (n->threadSafeness()) {
+ const NodeList &children = static_cast<const Aggregate *>(node)->childNodes();
+ for (auto *node : children) {
+ if (!node->isObsolete()){
+ switch (node->threadSafeness()) {
case Node::Reentrant:
- reentrant.append(n);
+ reentrant.append(node);
if (ts == Node::ThreadSafe)
result = true;
break;
case Node::ThreadSafe:
- threadsafe.append(n);
+ threadsafe.append(node);
if (ts == Node::Reentrant)
result = true;
break;
case Node::NonReentrant:
- nonreentrant.append(n);
+ nonreentrant.append(node);
result = true;
break;
default:
@@ -1530,7 +1509,7 @@ static bool hasExceptions(const Node* node,
return result;
}
-static void startNote(Text& text)
+static void startNote(Text &text)
{
text << Atom::ParaLeft
<< Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD)
@@ -1659,7 +1638,7 @@ void Generator::generateThreadSafeness(const Node *node, CodeMarker *marker)
function is supposed to do, so I have not tried to complete the comment
yet.
*/
-void Generator::generateOverloadedSignal(const Node* node, CodeMarker* marker)
+void Generator::generateOverloadedSignal(const Node *node, CodeMarker *marker)
{
if (!node->isFunction())
return;
@@ -1715,7 +1694,7 @@ void Generator::generateDocs()
generateDocumentation(qdb_->primaryTreeRoot());
}
-Generator *Generator::generatorForFormat(const QString& format)
+Generator *Generator::generatorForFormat(const QString &format)
{
QList<Generator *>::ConstIterator g = generators.constBegin();
while (g != generators.constEnd()) {
@@ -1735,7 +1714,7 @@ Generator *Generator::generatorForFormat(const QString& format)
i.e. Once you call this function for a particular \a t,
you consume \a t.
*/
-QString Generator::getMetadataElement(const Aggregate* inner, const QString& t)
+QString Generator::getMetadataElement(const Aggregate *inner, const QString &t)
{
QString s;
QStringMultiMap& metaTagMap = const_cast<QStringMultiMap&>(inner->doc().metaTagMap());
@@ -1756,7 +1735,7 @@ QString Generator::getMetadataElement(const Aggregate* inner, const QString& t)
having the key \a t are erased. i.e. Once you call this
function for a particular \a t, you consume \a t.
*/
-QStringList Generator::getMetadataElements(const Aggregate* inner, const QString& t)
+QStringList Generator::getMetadataElements(const Aggregate *inner, const QString &t)
{
QStringList s;
QStringMultiMap& metaTagMap = const_cast<QStringMultiMap&>(inner->doc().metaTagMap());
@@ -1769,7 +1748,7 @@ QStringList Generator::getMetadataElements(const Aggregate* inner, const QString
/*!
Returns a relative path name for an image.
*/
-QString Generator::imageFileName(const Node *relative, const QString& fileBase)
+QString Generator::imageFileName(const Node *relative, const QString &fileBase)
{
QString userFriendlyFilePath;
QString filePath = Config::findFile(relative->doc().location(),
@@ -1793,7 +1772,7 @@ QString Generator::imageFileName(const Node *relative, const QString& fileBase)
return relImagePath;
}
-QString Generator::indent(int level, const QString& markedCode)
+QString Generator::indent(int level, const QString &markedCode)
{
if (level == 0)
return markedCode;
@@ -1802,7 +1781,7 @@ QString Generator::indent(int level, const QString& markedCode)
int column = 0;
int i = 0;
- while (i < (int) markedCode.length()) {
+ while (i < markedCode.length()) {
if (markedCode.at(i) == QLatin1Char('\n')) {
column = 0;
}
@@ -1971,7 +1950,7 @@ void Generator::initializeFormat(const Config &config)
Appends each directory path in \a moreImageDirs to the
list of image directories.
*/
-void Generator::augmentImageDirs(QSet<QString>& moreImageDirs)
+void Generator::augmentImageDirs(QSet<QString> &moreImageDirs)
{
if (moreImageDirs.isEmpty())
return;
@@ -1985,7 +1964,7 @@ void Generator::augmentImageDirs(QSet<QString>& moreImageDirs)
/*!
Sets the generator's pointer to the Config instance.
*/
-void Generator::initializeGenerator(const Config& config)
+void Generator::initializeGenerator(const Config &config)
{
config_ = &config;
showInternal_ = config.getBool(CONFIG_SHOWINTERNAL);
@@ -2009,7 +1988,7 @@ QTextStream &Generator::out()
QString Generator::outFileName()
{
- return QFileInfo(static_cast<QFile*>(out().device())->fileName()).fileName();
+ return QFileInfo(static_cast<QFile *>(out().device())->fileName()).fileName();
}
QString Generator::outputPrefix(const Node *node)
@@ -2033,12 +2012,12 @@ QString Generator::outputSuffix(const Node *node)
return QString();
}
-bool Generator::parseArg(const QString& src,
- const QString& tag,
- int* pos,
+bool Generator::parseArg(const QString &src,
+ const QString &tag,
+ int *pos,
int n,
- QStringRef* contents,
- QStringRef* par1,
+ QStringRef *contents,
+ QStringRef *par1,
bool debug)
{
#define SKIP_CHAR(c) \
@@ -2064,8 +2043,6 @@ bool Generator::parseArg(const QString& src,
//SKIP_CHAR('@');
if (tag != QStringRef(&src, i, tag.length())) {
- if (0 && debug)
- qDebug() << "tag " << tag << " not found at " << i;
return false;
}
@@ -2131,7 +2108,7 @@ bool Generator::parseArg(const QString& src,
#undef SKIP_CHAR
}
-QString Generator::plainCode(const QString& markedCode)
+QString Generator::plainCode(const QString &markedCode)
{
QString t = markedCode;
t.replace(tag, QString());
@@ -2142,12 +2119,12 @@ QString Generator::plainCode(const QString& markedCode)
return t;
}
-void Generator::setImageFileExtensions(const QStringList& extensions)
+void Generator::setImageFileExtensions(const QStringList &extensions)
{
imgFileExts[format()] = extensions;
}
-void Generator::singularPlural(Text& text, const NodeList& nodes)
+void Generator::singularPlural(Text &text, const NodeList &nodes)
{
if (nodes.count() == 1)
text << " is";
@@ -2257,7 +2234,7 @@ void Generator::terminateGenerator()
Trims trailing whitespace off the \a string and returns
the trimmed string.
*/
-QString Generator::trimmedTrailing(const QString& string, const QString &prefix, const QString &suffix)
+QString Generator::trimmedTrailing(const QString &string, const QString &prefix, const QString &suffix)
{
QString trimmed = string;
while (trimmed.length() > 0 && trimmed[trimmed.length() - 1].isSpace())
@@ -2290,7 +2267,7 @@ QString Generator::typeString(const Node *node)
case Node::Typedef:
return "typedef";
case Node::Function: {
- const FunctionNode *fn = static_cast<const FunctionNode*>(node);
+ const FunctionNode *fn = static_cast<const FunctionNode *>(node);
switch (fn->metaness()) {
case FunctionNode::JsSignal:
case FunctionNode::QmlSignal:
diff --git a/src/qdoc/generator.h b/src/qdoc/generator.h
index 61478b2f6..f9bb4d53b 100644
--- a/src/qdoc/generator.h
+++ b/src/qdoc/generator.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -29,22 +29,19 @@
#ifndef GENERATOR_H
#define GENERATOR_H
-#include <qfile.h>
-#include <qfileinfo.h>
-#include <qlist.h>
-#include <qmap.h>
-#include <qregexp.h>
-#include <qstring.h>
-#include <qstringlist.h>
-#include <qtextstream.h>
-#include "config.h"
#include "node.h"
#include "text.h"
+#include <QtCore/qlist.h>
+#include <QtCore/qmap.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qstringlist.h>
+#include <QtCore/qtextstream.h>
+
QT_BEGIN_NAMESPACE
-typedef QMultiMap<QString, Node*> NodeMultiMap;
-typedef QMap<Node*, NodeMultiMap> ParentMaps;
+typedef QMultiMap<QString, Node *> NodeMultiMap;
+typedef QMap<Node *, NodeMultiMap> ParentMaps;
class Config;
class CodeMarker;
@@ -77,17 +74,14 @@ public:
static QString exampleFileTitle(const ExampleNode *relative,
const QString &fileName);
static Generator *currentGenerator() { return currentGenerator_; }
- static Generator *generatorForFormat(const QString& format);
- static void initialize(const Config& config);
- static const QString& outputDir() { return outDir_; }
- static const QString& outputSubdir() { return outSubdir_; }
+ static Generator *generatorForFormat(const QString &format);
+ static void initialize(const Config &config);
+ static const QString &outputDir() { return outDir_; }
+ static const QString &outputSubdir() { return outSubdir_; }
static void terminate();
- static const QStringList& outputFileNames() { return outFileNames_; }
+ static const QStringList &outputFileNames() { return outFileNames_; }
static void writeOutFileNames();
- static void augmentImageDirs(QSet<QString>& moreImageDirs);
- static void startDebugging(const QString& message);
- static void stopDebugging(const QString& message);
- static bool debugging();
+ static void augmentImageDirs(QSet<QString> &moreImageDirs);
static bool noLinkErrors() { return noLinkErrors_; }
static bool autolinkErrors() { return autolinkErrors_; }
static void setQDocPass(QDocPass t) { qdocPass_ = t; }
@@ -102,18 +96,18 @@ public:
static QString defaultModuleName() { return project_; }
static void resetUseOutputSubdirs() { useOutputSubdirs_ = false; }
static bool useOutputSubdirs() { return useOutputSubdirs_; }
- static void setQmlTypeContext(QmlTypeNode* t) { qmlTypeContext_ = t; }
- static QmlTypeNode* qmlTypeContext() { return qmlTypeContext_; }
- static QString cleanRef(const QString& ref);
- static QString plainCode(const QString& markedCode);
+ static void setQmlTypeContext(QmlTypeNode *t) { qmlTypeContext_ = t; }
+ static QmlTypeNode *qmlTypeContext() { return qmlTypeContext_; }
+ static QString cleanRef(const QString &ref);
+ static QString plainCode(const QString &markedCode);
static bool useTimestamps() { return useTimestamps_; }
protected:
- void beginFilePage(const Node* node, const QString& fileName);
+ void beginFilePage(const Node *node, const QString &fileName);
void endFilePage() { endSubPage(); } // for symmetry
- void beginSubPage(const Node* node, const QString& fileName);
+ void beginSubPage(const Node *node, const QString &fileName);
void endSubPage();
- virtual QString fileBase(const Node* node) const;
+ virtual QString fileBase(const Node *node) const;
virtual QString fileExtension() const = 0;
virtual void generateQAPage() { }
virtual void generateExampleFilePage(const Node *, const QString &, CodeMarker *) {}
@@ -129,32 +123,32 @@ protected:
virtual void generateGenericCollectionPage(CollectionNode *, CodeMarker *) {}
virtual void generateInheritedBy(const ClassNode *classe, CodeMarker *marker);
virtual void generateInherits(const ClassNode *classe, CodeMarker *marker);
- virtual void generateDocumentation(Node* node);
- virtual void generateMaintainerList(const Aggregate* node, CodeMarker* marker);
- virtual void generateQmlInheritedBy(const QmlTypeNode* qcn, CodeMarker* marker);
+ virtual void generateDocumentation(Node *node);
+ virtual void generateMaintainerList(const Aggregate *node, CodeMarker *marker);
+ virtual void generateQmlInheritedBy(const QmlTypeNode *qcn, CodeMarker *marker);
virtual void generateQmlInherits(QmlTypeNode *, CodeMarker *) {}
- virtual bool generateQmlText(const Text& text,
+ virtual bool generateQmlText(const Text &text,
const Node *relative,
CodeMarker *marker,
- const QString& qmlName);
- virtual bool generateText(const Text& text, const Node *relative, CodeMarker *marker);
- virtual QString imageFileName(const Node *relative, const QString& fileBase);
+ const QString &qmlName);
+ virtual bool generateText(const Text &text, const Node *relative, CodeMarker *marker);
+ virtual QString imageFileName(const Node *relative, const QString &fileBase);
virtual int skipAtoms(const Atom *atom, Atom::AtomType type) const;
virtual QString typeString(const Node *node);
static bool matchAhead(const Atom *atom, Atom::AtomType expectedAtomType);
- static QString outputPrefix(const Node* node);
- static QString outputSuffix(const Node* node);
- static void singularPlural(Text& text, const NodeList& nodes);
+ static QString outputPrefix(const Node *node);
+ static QString outputSuffix(const Node *node);
+ static void singularPlural(Text &text, const NodeList &nodes);
static void supplementAlsoList(const Node *node, QList<Text> &alsoList);
static QString trimmedTrailing(const QString &string,
const QString &prefix,
const QString &suffix);
void initializeTextOutput();
- QString fileName(const Node* node, const QString &extension = QString()) const;
+ QString fileName(const Node *node, const QString &extension = QString()) const;
QMap<QString, QString> &formattingLeftMap();
QMap<QString, QString> &formattingRightMap();
- const Atom* generateAtomList(const Atom *atom,
+ const Atom *generateAtomList(const Atom *atom,
const Node *relative,
CodeMarker *marker,
bool generate,
@@ -164,25 +158,25 @@ protected:
virtual void generateFileList(const ExampleNode *en, CodeMarker *marker, bool images);
void generateSince(const Node *node, CodeMarker *marker);
void generateStatus(const Node *node, CodeMarker *marker);
- void generatePrivateSignalNote(const Node* node, CodeMarker* marker);
- void generateInvokableNote(const Node* node, CodeMarker* marker);
+ void generatePrivateSignalNote(const Node *node, CodeMarker *marker);
+ void generateInvokableNote(const Node *node, CodeMarker *marker);
void generateThreadSafeness(const Node *node, CodeMarker *marker);
- QString getMetadataElement(const Aggregate* inner, const QString& t);
- QStringList getMetadataElements(const Aggregate* inner, const QString& t);
+ QString getMetadataElement(const Aggregate *inner, const QString &t);
+ QStringList getMetadataElements(const Aggregate *inner, const QString &t);
void generateOverloadedSignal(const Node *node, CodeMarker *marker);
- QString indent(int level, const QString& markedCode);
+ QString indent(int level, const QString &markedCode);
QTextStream& out();
QString outFileName();
- bool parseArg(const QString& src,
- const QString& tag,
- int* pos,
+ bool parseArg(const QString &src,
+ const QString &tag,
+ int *pos,
int n,
- QStringRef* contents,
- QStringRef* par1 = nullptr,
+ QStringRef *contents,
+ QStringRef *par1 = nullptr,
bool debug = false);
- void setImageFileExtensions(const QStringList& extensions);
+ void setImageFileExtensions(const QStringList &extensions);
void unknownAtom(const Atom *atom);
- int appendSortedQmlNames(Text& text, const Node* base, const NodeList& subs);
+ int appendSortedQmlNames(Text &text, const Node *base, const NodeList &subs);
QMap<QString, QStringList> editionGroupMap;
QMap<QString, QStringList> editionModuleMap;
@@ -192,23 +186,23 @@ protected:
QString outputEncoding;
#endif
QString tagFile_;
- QStack<QTextStream*> outStreamStack;
+ QStack<QTextStream *> outStreamStack;
- void appendFullName(Text& text,
+ void appendFullName(Text &text,
const Node *apparentNode,
const Node *relative,
const Node *actualNode = nullptr);
- void appendFullName(Text& text,
+ void appendFullName(Text &text,
const Node *apparentNode,
- const QString& fullName,
+ const QString &fullName,
const Node *actualNode);
- void appendFullNames(Text& text, const NodeList& nodes, const Node* relative);
- int appendSortedNames(Text& text, const ClassNode *classe, const QList<RelatedClass> &classes);
- void appendSignature(Text& text, const Node* node);
- void signatureList(const NodeList& nodes, const Node* relative, CodeMarker* marker);
+ void appendFullNames(Text &text, const NodeList &nodes, const Node *relative);
+ int appendSortedNames(Text &text, const ClassNode *classe, const QList<RelatedClass> &classes);
+ void appendSignature(Text &text, const Node *node);
+ void signatureList(const NodeList &nodes, const Node *relative, CodeMarker *marker);
private:
- static Generator* currentGenerator_;
+ static Generator *currentGenerator_;
static QStringList exampleDirs;
static QStringList exampleImgExts;
static QMap<QString, QMap<QString, QString> > fmtLeftMaps;
@@ -236,7 +230,7 @@ private:
static bool qdocWriteQaPages_;
static bool useOutputSubdirs_;
static bool useTimestamps_;
- static QmlTypeNode* qmlTypeContext_;
+ static QmlTypeNode *qmlTypeContext_;
void generateReimplementsClause(const FunctionNode *fn, CodeMarker *marker);
static bool compareNodes(Node *a, Node *b) { return (a->name() < b->name()); }
@@ -246,8 +240,8 @@ private:
const QString &subDir);
protected:
- const Config* config_;
- QDocDatabase* qdb_;
+ const Config *config_;
+ QDocDatabase *qdb_;
bool inLink_;
bool inContents_;
bool inSectionHeading_;
diff --git a/src/qdoc/helpprojectwriter.cpp b/src/qdoc/helpprojectwriter.cpp
index 226ca4154..3d45b60a4 100644
--- a/src/qdoc/helpprojectwriter.cpp
+++ b/src/qdoc/helpprojectwriter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -26,31 +26,31 @@
**
****************************************************************************/
-#include <qcryptographichash.h>
-#include <qdebug.h>
-#include <qhash.h>
-#include <qmap.h>
+#include "helpprojectwriter.h"
#include "atom.h"
-#include "helpprojectwriter.h"
-#include "htmlgenerator.h"
#include "config.h"
+#include "htmlgenerator.h"
#include "node.h"
#include "qdocdatabase.h"
-#include <qdebug.h>
+
+#include <QtCore/qcryptographichash.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qhash.h>
+#include <QtCore/qmap.h>
QT_BEGIN_NAMESPACE
HelpProjectWriter::HelpProjectWriter(const Config &config,
const QString &defaultFileName,
- Generator* g)
+ Generator *g)
{
reset(config, defaultFileName, g);
}
void HelpProjectWriter::reset(const Config &config,
const QString &defaultFileName,
- Generator* g)
+ Generator *g)
{
projects.clear();
gen_ = g;
@@ -65,9 +65,9 @@ void HelpProjectWriter::reset(const Config &config,
// generator.
outputDir = config.getOutputDir();
- QStringList names = config.getStringList(CONFIG_QHP + Config::dot + "projects");
+ const QStringList names = config.getStringList(CONFIG_QHP + Config::dot + "projects");
- foreach (const QString &projectName, names) {
+ for (const auto &projectName : names) {
HelpProject project;
project.name = projectName;
@@ -82,20 +82,23 @@ void HelpProjectWriter::reset(const Config &config,
project.extraFiles += config.getStringSet(CONFIG_QHP + Config::dot + "extraFiles");
project.indexTitle = config.getString(prefix + "indexTitle");
project.indexRoot = config.getString(prefix + "indexRoot");
- project.filterAttributes = config.getStringList(prefix + "filterAttributes").toSet();
+ const auto &filterAttributes = config.getStringList(prefix + "filterAttributes");
+ project.filterAttributes = QSet<QString>(filterAttributes.cbegin(), filterAttributes.cend());
project.includeIndexNodes = config.getBool(prefix + "includeIndexNodes");
- QSet<QString> customFilterNames = config.subVars(prefix + "customFilters");
- foreach (const QString &filterName, customFilterNames) {
+ const QSet<QString> customFilterNames = config.subVars(prefix + "customFilters");
+ for (const auto &filterName : customFilterNames) {
QString name = config.getString(prefix + "customFilters" + Config::dot + filterName + Config::dot + "name");
- QSet<QString> filters = config.getStringList(prefix + "customFilters" + Config::dot + filterName + Config::dot + "filterAttributes").toSet();
- project.customFilters[name] = filters;
+ const auto &filters = config.getStringList(prefix + "customFilters" + Config::dot + filterName + Config::dot + "filterAttributes");
+ project.customFilters[name] = QSet<QString>(filters.cbegin(), filters.cend());
}
//customFilters = config.defs.
- foreach (QString name, config.getStringSet(prefix + "excluded"))
+ const auto excludedPrefixes = config.getStringSet(prefix + "excluded");
+ for (auto name : excludedPrefixes)
project.excluded.insert(name.replace(QLatin1Char('\\'), QLatin1Char('/')));
- foreach (const QString &name, config.getStringList(prefix + "subprojects")) {
+ const auto subprojectPrefixes = config.getStringList(prefix + "subprojects");
+ for (const auto &name : subprojectPrefixes) {
SubProject subproject;
QString subprefix = prefix + "subprojects" + Config::dot + name + Config::dot;
subproject.title = config.getString(subprefix + "title");
@@ -157,7 +160,7 @@ void HelpProjectWriter::readSelectors(SubProject &subproject, const QStringList
for (auto it = pageTypeHash.cbegin(), end = pageTypeHash.cend(); it != end; ++it)
fullSubset.insert(it.value());
- foreach (const QString &selector, selectors) {
+ for (const QString &selector : selectors) {
QStringList pieces = selector.split(QLatin1Char(':'));
if (pieces.size() == 1) {
QString lower = selector.toLower();
@@ -273,8 +276,9 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
// Add all group members for '[group|module|qmlmodule]:name' selector
if (node->isGroup() || node->isModule() || node->isQmlModule()) {
if (project.subprojects[i].groups.contains(node->name().toLower())) {
- const CollectionNode* cn = static_cast<const CollectionNode*>(node);
- foreach (const Node* m, cn->members()) {
+ const CollectionNode *cn = static_cast<const CollectionNode *>(node);
+ const auto members = cn->members();
+ for (const Node *m : members) {
QString memberName = m->isTextPageNode()
? m->fullTitle() : m->fullDocumentName();
project.subprojects[i].nodes[memberName] = m;
@@ -308,7 +312,8 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
case Node::JsType:
case Node::JsBasicType:
if (node->doc().hasKeywords()) {
- foreach (const Atom* keyword, node->doc().keywords()) {
+ const auto keywords = node->doc().keywords();
+ for (const Atom *keyword : keywords) {
if (!keyword->string().isEmpty()) {
QStringList details;
details << keyword->string()
@@ -330,8 +335,9 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
case Node::Enum:
project.keywords.append(keywordDetails(node));
{
- const EnumNode *enumNode = static_cast<const EnumNode*>(node);
- foreach (const EnumItem &item, enumNode->items()) {
+ const EnumNode *enumNode = static_cast<const EnumNode *>(node);
+ const auto items = enumNode->items();
+ for (const auto &item : items) {
QStringList details;
if (enumNode->itemAccess(item.name()) == Node::Private)
@@ -355,10 +361,11 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
case Node::QmlModule:
case Node::JsModule:
{
- const CollectionNode* cn = static_cast<const CollectionNode*>(node);
+ const CollectionNode *cn = static_cast<const CollectionNode *>(node);
if (!cn->fullTitle().isEmpty()) {
if (cn->doc().hasKeywords()) {
- foreach (const Atom* keyword, cn->doc().keywords()) {
+ const auto keywords = cn->doc().keywords();
+ for (const Atom *keyword : keywords) {
if (!keyword->string().isEmpty()) {
QStringList details;
details << keyword->string()
@@ -438,10 +445,11 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
// Page nodes (such as manual pages) contain subtypes, titles and other
// attributes.
case Node::Page: {
- const PageNode *pn = static_cast<const PageNode*>(node);
+ const PageNode *pn = static_cast<const PageNode *>(node);
if (!pn->fullTitle().isEmpty()) {
if (pn->doc().hasKeywords()) {
- foreach (const Atom *keyword, pn->doc().keywords()) {
+ const auto keywords = pn->doc().keywords();
+ for (const Atom *keyword : keywords) {
if (!keyword->string().isEmpty()) {
QStringList details;
details << keyword->string()
@@ -491,9 +499,9 @@ void HelpProjectWriter::generateSections(HelpProject &project, QXmlStreamWriter
const Aggregate *aggregate = static_cast<const Aggregate *>(node);
// Ensure that we don't visit nodes more than once.
- QSet<const Node*> childSet;
+ QSet<const Node *> childSet;
const NodeList &children = aggregate->childNodes();
- foreach (const Node *child, children) {
+ for (const auto *child : children) {
// Skip related non-members adopted by some other aggregate
if (child->parent() != aggregate)
continue;
@@ -504,12 +512,12 @@ void HelpProjectWriter::generateSections(HelpProject &project, QXmlStreamWriter
} else {
// Store member status of children
project.memberStatus[node].insert(child->status());
- if (child->isFunction() && static_cast<const FunctionNode*>(child)->isOverload())
+ if (child->isFunction() && static_cast<const FunctionNode *>(child)->isOverload())
continue;
childSet << child;
}
}
- foreach (const Node *child, childSet)
+ for (const auto *child : qAsConst(childSet))
generateSections(project, writer, child);
}
}
@@ -617,7 +625,7 @@ void HelpProjectWriter::writeNode(HelpProject &project, QXmlStreamWriter &writer
case Node::Page: {
// Page nodes (such as manual pages) contain subtypes, titles and other
// attributes.
- const PageNode *pn = static_cast<const PageNode*>(node);
+ const PageNode *pn = static_cast<const PageNode *>(node);
writer.writeStartElement("section");
writer.writeAttribute("ref", href);
@@ -631,7 +639,7 @@ void HelpProjectWriter::writeNode(HelpProject &project, QXmlStreamWriter &writer
case Node::JsModule:
case Node::QmlModule:
{
- const CollectionNode* cn = static_cast<const CollectionNode*>(node);
+ const CollectionNode *cn = static_cast<const CollectionNode *>(node);
writer.writeStartElement("section");
writer.writeAttribute("ref", href);
writer.writeAttribute("title", cn->fullTitle());
@@ -648,7 +656,7 @@ void HelpProjectWriter::generateProject(HelpProject &project)
const Node *rootNode;
// Restrict searching only to the local (primary) tree
- QVector<Tree*> searchOrder = qdb_->searchOrder();
+ QVector<Tree *> searchOrder = qdb_->searchOrder();
qdb_->setLocalSearch();
if (!project.indexRoot.isEmpty())
@@ -685,9 +693,9 @@ void HelpProjectWriter::generateProject(HelpProject &project)
for (it = project.customFilters.constBegin(); it != project.customFilters.constEnd(); ++it) {
writer.writeStartElement("customFilter");
writer.writeAttribute("name", it.key());
- QStringList sortedAttributes = it.value().toList();
+ QStringList sortedAttributes = it.value().values();
sortedAttributes.sort();
- foreach (const QString &filter, sortedAttributes)
+ for (const auto &filter : qAsConst(sortedAttributes))
writer.writeTextElement("filterAttribute", filter);
writer.writeEndElement(); // customFilter
}
@@ -696,14 +704,14 @@ void HelpProjectWriter::generateProject(HelpProject &project)
writer.writeStartElement("filterSection");
// Write filterAttribute elements.
- QStringList sortedFilterAttributes = project.filterAttributes.toList();
+ QStringList sortedFilterAttributes = project.filterAttributes.values();
sortedFilterAttributes.sort();
- foreach (const QString &filterName, sortedFilterAttributes)
+ for (const auto &filterName : qAsConst(sortedFilterAttributes))
writer.writeTextElement("filterAttribute", filterName);
writer.writeStartElement("toc");
writer.writeStartElement("section");
- const Node* node = qdb_->findPageNodeByTitle(project.indexTitle);
+ const Node *node = qdb_->findPageNodeByTitle(project.indexTitle);
if (node == nullptr)
node = qdb_->findNodeByNameAndType(QStringList("index.html"), &Node::isPageNode);
QString indexPath;
@@ -785,14 +793,14 @@ void HelpProjectWriter::generateProject(HelpProject &project)
if (subproject.sortPages) {
QStringList titles = subproject.nodes.keys();
titles.sort();
- foreach (const QString &title, titles) {
+ for (const auto &title : qAsConst(titles)) {
writeNode(project, writer, subproject.nodes[title]);
}
} else {
// Find a contents node and navigate from there, using the NextLink values.
QSet<QString> visited;
bool contentsFound = false;
- foreach (const Node *node, subproject.nodes) {
+ for (const auto *node : qAsConst(subproject.nodes)) {
QString nextTitle = node->links().value(Node::NextLink).first;
if (!nextTitle.isEmpty() &&
node->links().value(Node::ContentsLink).first.isEmpty()) {
@@ -816,11 +824,11 @@ void HelpProjectWriter::generateProject(HelpProject &project)
}
// No contents/nextpage links found, write all nodes unsorted
if (!contentsFound) {
- QList<const Node*> subnodes = subproject.nodes.values();
+ QList<const Node *> subnodes = subproject.nodes.values();
std::sort(subnodes.begin(), subnodes.end(), Node::nodeNameLessThan);
- foreach (const Node *node, subnodes)
+ for (const auto *node : qAsConst(subnodes))
writeNode(project, writer, node);
}
}
@@ -837,7 +845,7 @@ void HelpProjectWriter::generateProject(HelpProject &project)
writer.writeStartElement("keywords");
std::sort(project.keywords.begin(), project.keywords.end());
- foreach (const QStringList &details, project.keywords) {
+ for (const QStringList &details : qAsConst(project.keywords)) {
writer.writeStartElement("keyword");
writer.writeAttribute("name", details[0]);
writer.writeAttribute("id", details[1]);
@@ -850,12 +858,12 @@ void HelpProjectWriter::generateProject(HelpProject &project)
// The list of files to write is the union of generated files and
// other files (images and extras) included in the project
- QSet<QString> files = QSet<QString>::fromList(gen_->outputFileNames());
+ QSet<QString> files = QSet<QString>(gen_->outputFileNames().cbegin(), gen_->outputFileNames().cend());
files.unite(project.files);
files.unite(project.extraFiles);
- QStringList sortedFiles = files.toList();
+ QStringList sortedFiles = files.values();
sortedFiles.sort();
- foreach (const QString &usedFile, sortedFiles) {
+ for (const auto &usedFile : qAsConst(sortedFiles)) {
if (!usedFile.isEmpty())
writer.writeTextElement("file", usedFile);
}
diff --git a/src/qdoc/helpprojectwriter.h b/src/qdoc/helpprojectwriter.h
index bee6620ec..64ad3aaec 100644
--- a/src/qdoc/helpprojectwriter.h
+++ b/src/qdoc/helpprojectwriter.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -29,17 +29,17 @@
#ifndef HELPPROJECTWRITER_H
#define HELPPROJECTWRITER_H
-#include <qstring.h>
-#include <qxmlstream.h>
-
#include "config.h"
#include "node.h"
+#include <QtCore/qstring.h>
+#include <QtCore/qxmlstream.h>
+
QT_BEGIN_NAMESPACE
class QDocDatabase;
class Generator;
-typedef QPair<QString, const Node*> QStringNodePair;
+typedef QPair<QString, const Node *> QStringNodePair;
using NodeTypeSet = QSet<unsigned char>;
@@ -71,7 +71,7 @@ struct HelpProject
QSet<QString> files;
QSet<QString> extraFiles;
QSet<QString> filterAttributes;
- QHash<QString, QSet<QString> > customFilters;
+ QHash<QString, QSet<QString>> customFilters;
QSet<QString> excluded;
QList<SubProject> subprojects;
QHash<const Node *, NodeStatusSet> memberStatus;
@@ -85,10 +85,10 @@ class HelpProjectWriter
public:
HelpProjectWriter(const Config &config,
const QString &defaultFileName,
- Generator* g);
+ Generator *g);
void reset(const Config &config,
const QString &defaultFileName,
- Generator* g);
+ Generator *g);
void addExtraFile(const QString &file);
void addExtraFiles(const QSet<QString> &files);
void generate();
@@ -108,8 +108,8 @@ private:
void writeSection(QXmlStreamWriter &writer, const QString &path,
const QString &value);
- QDocDatabase* qdb_;
- Generator* gen_;
+ QDocDatabase *qdb_;
+ Generator *gen_;
QString outputDir;
QList<HelpProject> projects;
diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp
index 3b1de12ae..97222ef13 100644
--- a/src/qdoc/htmlgenerator.cpp
+++ b/src/qdoc/htmlgenerator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -30,24 +30,27 @@
htmlgenerator.cpp
*/
+#include "htmlgenerator.h"
+
#include "codemarker.h"
#include "codeparser.h"
#include "helpprojectwriter.h"
-#include "htmlgenerator.h"
#include "node.h"
#include "qdocdatabase.h"
#include "separator.h"
#include "tree.h"
#include "quoter.h"
-#include <ctype.h>
-#include <qdebug.h>
-#include <qlist.h>
-#include <qiterator.h>
-#include <qtextcodec.h>
-#include <quuid.h>
-#include <qmap.h>
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qiterator.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qmap.h>
+#include <QtCore/qtextcodec.h>
+#include <QtCore/quuid.h>
#include <QtCore/qversionnumber.h>
+#include <ctype.h>
+
QT_BEGIN_NAMESPACE
int HtmlGenerator::id = 0;
@@ -299,19 +302,11 @@ QString HtmlGenerator::format()
Generate targets for any \keyword commands that were seen
in the qdoc comment for the \a node.
*/
-void HtmlGenerator::generateKeywordAnchors(const Node* node)
+void HtmlGenerator::generateKeywordAnchors(const Node *node)
{
Q_UNUSED(node);
// Disabled: keywords always link to the top of the QDoc
// comment they appear in, and do not use a dedicated anchor.
-#if 0
- if (!node->doc().isEmpty()) {
- const QList<Atom*>& keywords = node->doc().keywords();
- foreach (Atom* a, keywords) {
- out() << QLatin1String("<a name=\"") << Doc::canonicalTitle(a->string()) << QLatin1String("\"></a>");
- }
- }
-#endif
}
/*!
@@ -324,7 +319,7 @@ void HtmlGenerator::generateKeywordAnchors(const Node* node)
*/
void HtmlGenerator::generateDocs()
{
- Node* qflags = qdb_->findClassNode(QStringList("QFlags"));
+ Node *qflags = qdb_->findClassNode(QStringList("QFlags"));
if (qflags)
qflagsHref_ = linkForNode(qflags, nullptr);
if (!preparing())
@@ -355,9 +350,9 @@ void HtmlGenerator::generateDocs()
*/
void HtmlGenerator::generateQAPage()
{
- NamespaceNode* node = qdb_->primaryTreeRoot();
+ NamespaceNode *node = qdb_->primaryTreeRoot();
beginSubPage(node, "aaa-" + defaultModuleName().toLower() + "-qa-page.html");
- CodeMarker* marker = CodeMarker::markerForFileName(node->location().filePath());
+ CodeMarker *marker = CodeMarker::markerForFileName(node->location().filePath());
QString title = "Quality Assurance Page for " + defaultModuleName();
QString t = "Quality assurance information for checking the " + defaultModuleName() + " documentation.";
generateHeader(title, node, marker);
@@ -442,9 +437,9 @@ void HtmlGenerator::generateExampleFilePage(const Node *en,
go to targets in the specified \a module. The \a marker
is used for the same thing the marker is always used for.
*/
-QString HtmlGenerator::generateLinksToLinksPage(const QString& module, CodeMarker* marker)
+QString HtmlGenerator::generateLinksToLinksPage(const QString &module, CodeMarker *marker)
{
- NamespaceNode* node = qdb_->primaryTreeRoot();
+ NamespaceNode *node = qdb_->primaryTreeRoot();
QString fileName = "aaa-links-to-" + module + ".html";
beginSubPage(node, fileName);
QString title = "Links from " + defaultModuleName() + " to " + module;
@@ -455,10 +450,10 @@ QString HtmlGenerator::generateLinksToLinksPage(const QString& module, CodeMarke
out() << "Click on a link to go to the location of the link. The link is marked ";
out() << "with red asterisks. ";
out() << "Click on the marked link to see if it goes to the right place.</p>\n";
- TargetList* tlist = qdb_->getTargetList(module);
+ const TargetList *tlist = qdb_->getTargetList(module);
if (tlist) {
out() << "<table class=\"valuelist\"><tr valign=\"top\" class=\"odd\"><th class=\"tblConst\">Link to link...</th><th class=\"tblval\">In file...</th><th class=\"tbldscr\">Somewhere after line number...</th></tr>\n";
- foreach (TargetLoc* t, *tlist) {
+ for (const TargetLoc *t : *tlist) {
// e.g.: <a name="link-8421"></a><a href="layout.html">Layout Management</a>
out() << "<tr><td class=\"topAlign\">";
out() << "<a href=\"" << t->fileName_ << "#" << t->target_ << "\">";
@@ -484,11 +479,11 @@ QString HtmlGenerator::generateLinksToLinksPage(const QString& module, CodeMarke
broken links that were found. The \a marker is used for
the same thing the marker is always used for.
*/
-QString HtmlGenerator::generateLinksToBrokenLinksPage(CodeMarker* marker, int& count)
+QString HtmlGenerator::generateLinksToBrokenLinksPage(CodeMarker *marker, int &count)
{
QString fileName;
- NamespaceNode* node = qdb_->primaryTreeRoot();
- TargetList* tlist = qdb_->getTargetList("broken");
+ NamespaceNode *node = qdb_->primaryTreeRoot();
+ const TargetList *tlist = qdb_->getTargetList("broken");
if (tlist && !tlist->isEmpty()) {
count = tlist->size();
fileName = "aaa-links-to-broken-links.html";
@@ -500,7 +495,7 @@ QString HtmlGenerator::generateLinksToBrokenLinksPage(CodeMarker* marker, int& c
out() << "Click on a link to go to the broken link. ";
out() << "The link's target could not be found.</p>\n";
out() << "<table class=\"valuelist\"><tr valign=\"top\" class=\"odd\"><th class=\"tblConst\">Link to broken link...</th><th class=\"tblval\">In file...</th><th class=\"tbldscr\">Somewhere after line number...</th></tr>\n";
- foreach (TargetLoc* t, *tlist) {
+ for (const TargetLoc *t : *tlist) {
// e.g.: <a name="link-8421"></a><a href="layout.html">Layout Management</a>
out() << "<tr><td class=\"topAlign\">";
out() << "<a href=\"" << t->fileName_ << "#" << t->target_ << "\">";
@@ -528,6 +523,14 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
switch (atom->type()) {
case Atom::AutoLink:
+ {
+ QString name = atom->string();
+ if (relative && relative->name() == name.replace(QLatin1String("()"), QLatin1String())) {
+ out() << protectEnc(atom->string());
+ break;
+ }
+ }
+ Q_FALLTHROUGH();
case Atom::NavAutoLink:
if (!inLink_ && !inContents_ && !inSectionHeading_) {
const Node *node = nullptr;
@@ -695,7 +698,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
break;
case Atom::AnnotatedList:
{
- const CollectionNode* cn = qdb_->getCollectionNode(atom->string(), Node::Group);
+ const CollectionNode *cn = qdb_->getCollectionNode(atom->string(), Node::Group);
if (cn)
generateList(cn, marker, atom->string());
}
@@ -732,8 +735,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
type = Node::JsModule;
else if (atom->string().startsWith(QLatin1String("groups")))
type = Node::Group;
- QDocDatabase* qdb = QDocDatabase::qdocDB();
- const CollectionNode* cn = qdb->getCollectionNode(moduleName, type);
+ QDocDatabase *qdb = QDocDatabase::qdocDB();
+ const CollectionNode *cn = qdb->getCollectionNode(moduleName, type);
if (cn) {
if (type == Node::Module) {
NodeMap m;
@@ -749,22 +752,6 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
else if (atom->string().startsWith("examplefiles") ||
atom->string().startsWith("exampleimages")) {
if (relative->isExample()) {
-#if 0
- /*
- The removed code will be physically removed if and
- when this update is determined to be successful.
- This overload of generateFileList() should no longer
- be needed, so there is a qDebug() there to tell me
- if it would have been called. So far, it hasn't
- happened. mws 18/08/2018
- */
- Node::NodeSubtype subType = (atom->string().mid(7,5) == "image") ? Node::Image : Node::File;
- QString regExp;
- int secondArg = atom->string().indexOf(" ");
- if (secondArg != -1)
- regExp = atom->string().mid(++secondArg);
- generateFileList(static_cast<const PageNode*>(relative), marker, subType, regExp);
-#endif
qDebug() << "GENERATE FILE LIST CALLED" << relative->name() << atom->string();
}
else
@@ -809,9 +796,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
else if (atom->string() == QLatin1String("related")) {
generateList(relative, marker, "related");
} else {
- const CollectionNode* cn = qdb_->getCollectionNode(atom->string(), Node::Group);
+ const CollectionNode *cn = qdb_->getCollectionNode(atom->string(), Node::Group);
if (cn) {
- if (!generateGroupList(const_cast<CollectionNode*>(cn)))
+ if (!generateGroupList(const_cast<CollectionNode *>(cn)))
relative->location().warning(QString("'\\generatelist \1' group is empty").arg(atom->string()));
} else {
relative->location().warning(QString("'\\generatelist \1' no such group").arg(atom->string()));
@@ -820,12 +807,12 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
break;
case Atom::SinceList:
{
- const NodeMultiMap& nsmap = qdb_->getSinceMap(atom->string());
+ const NodeMultiMap &nsmap = qdb_->getSinceMap(atom->string());
if (nsmap.isEmpty())
break;
- const NodeMap& ncmap = qdb_->getClassMap(atom->string());
- const NodeMap& nqcmap = qdb_->getQmlTypeMap(atom->string());
+ const NodeMap &ncmap = qdb_->getClassMap(atom->string());
+ const NodeMap &nqcmap = qdb_->getQmlTypeMap(atom->string());
Sections sections(nsmap);
out() << "<ul>\n";
@@ -860,7 +847,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
ParentMaps::iterator pmap;
NodeVector::const_iterator i = s->members().constBegin();
while (i != s->members().constEnd()) {
- Node* p = (*i)->parent();
+ Node *p = (*i)->parent();
pmap = parentmaps.find(p);
if (pmap == parentmaps.end())
pmap = parentmaps.insert(p,NodeMultiMap());
@@ -922,9 +909,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
out() << " />";
helpProjectWriter->addExtraFile(fileName);
if (relative->isExample()) {
- const ExampleNode* cen = static_cast<const ExampleNode*>(relative);
+ const ExampleNode *cen = static_cast<const ExampleNode *>(relative);
if (cen->imageFileName().isEmpty()) {
- ExampleNode* en = const_cast<ExampleNode*>(cen);
+ ExampleNode *en = const_cast<ExampleNode *>(cen);
en->setImageFileName(fileName);
}
}
@@ -1095,7 +1082,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
out() << "<dt>";
}
else { // (atom->string() == ATOM_LIST_VALUE)
- const Atom* lookAhead = atom->next();
+ const Atom *lookAhead = atom->next();
QString t = lookAhead->string();
lookAhead = lookAhead->next();
Q_ASSERT(lookAhead->type() == Atom::ListTagRight);
@@ -1373,7 +1360,7 @@ void HtmlGenerator::generateCppReferencePage(Aggregate *aggregate, CodeMarker *m
QString title;
QString rawTitle;
QString fullTitle;
- NamespaceNode* ns = nullptr;
+ NamespaceNode *ns = nullptr;
SectionVector *summarySections = nullptr;
SectionVector *detailsSections = nullptr;
@@ -1383,7 +1370,7 @@ void HtmlGenerator::generateCppReferencePage(Aggregate *aggregate, CodeMarker *m
rawTitle = aggregate->plainName();
fullTitle = aggregate->plainFullName();
title = rawTitle + " Namespace";
- ns = static_cast<NamespaceNode*>(aggregate);
+ ns = static_cast<NamespaceNode *>(aggregate);
summarySections = &sections.stdSummarySections();
detailsSections = &sections.stdDetailsSections();
}
@@ -1421,7 +1408,7 @@ void HtmlGenerator::generateCppReferencePage(Aggregate *aggregate, CodeMarker *m
generateKeywordAnchors(aggregate);
generateTitle(title, subtitleText, SmallSubTitle, aggregate, marker);
if (ns && !ns->hasDoc() && ns->docNode()) {
- NamespaceNode* NS = ns->docNode();
+ NamespaceNode *NS = ns->docNode();
Text brief;
brief << "The " << ns->name() << " namespace includes the following elements from module "
<< ns->tree()->camelCaseModuleName() << ". The full namespace is "
@@ -1567,15 +1554,17 @@ void HtmlGenerator::generateCppReferencePage(Aggregate *aggregate, CodeMarker *m
if (!prop->notifiers().isEmpty())
names << prop->notifiers().first()->name();
} else if ((*m)->isEnumType()) {
- const EnumNode *enume = reinterpret_cast<const EnumNode*>(*m);
+ const EnumNode *enume = reinterpret_cast<const EnumNode *>(*m);
if (enume->flagsType())
names << enume->flagsType()->name();
-
- foreach (const QString &enumName,
- enume->doc().enumItemNames().toSet() -
- enume->doc().omitEnumItemNames().toSet())
+ const auto &enumItemNameList = enume->doc().enumItemNames();
+ const auto &omitEnumItemNameList = enume->doc().omitEnumItemNames();
+ const auto items = QSet<QString>(enumItemNameList.cbegin(), enumItemNameList.cend())
+ - QSet<QString>(omitEnumItemNameList.cbegin(), omitEnumItemNameList.cend());
+ for (const QString &enumName : items) {
names << plainCode(marker->markedUpEnumValue(enumName,
enume));
+ }
}
++m;
}
@@ -1663,15 +1652,17 @@ void HtmlGenerator::generateProxyPage(Aggregate *aggregate, CodeMarker *marker)
if (func->isSomeCtor() || func->isDtor() || func->overloadNumber() != 0)
names.clear();
} else if ((*m)->isEnumType()) {
- const EnumNode *enume = reinterpret_cast<const EnumNode*>(*m);
+ const EnumNode *enume = reinterpret_cast<const EnumNode *>(*m);
if (enume->flagsType())
names << enume->flagsType()->name();
-
- foreach (const QString &enumName,
- enume->doc().enumItemNames().toSet() -
- enume->doc().omitEnumItemNames().toSet())
+ const auto &enumItemNameList = enume->doc().enumItemNames();
+ const auto &omitEnumItemNameList = enume->doc().omitEnumItemNames();
+ const auto items = QSet<QString>(enumItemNameList.cbegin(), enumItemNameList.cend())
+ - QSet<QString>(omitEnumItemNameList.cbegin(), omitEnumItemNameList.cend());
+ for (const QString &enumName : items) {
names << plainCode(marker->markedUpEnumValue(enumName,
enume));
+ }
}
}
++m;
@@ -1687,7 +1678,7 @@ void HtmlGenerator::generateProxyPage(Aggregate *aggregate, CodeMarker *marker)
Generate the HTML page for a QML type. \qcn is the QML type.
\marker is the code markeup object.
*/
-void HtmlGenerator::generateQmlTypePage(QmlTypeNode* qcn, CodeMarker* marker)
+void HtmlGenerator::generateQmlTypePage(QmlTypeNode *qcn, CodeMarker *marker)
{
Generator::setQmlTypeContext(qcn);
SubTitleSize subTitleSize = LargeSubTitle;
@@ -1738,7 +1729,7 @@ void HtmlGenerator::generateQmlTypePage(QmlTypeNode* qcn, CodeMarker* marker)
out() << "<a name=\"" << detailsRef << "\"></a>" << divNavTop << '\n';
out() << "<h2 id=\"" << detailsRef << "\">" << "Detailed Description" << "</h2>\n";
generateBody(qcn, marker);
- ClassNode* cn = qcn->classNode();
+ ClassNode *cn = qcn->classNode();
if (cn)
generateQmlText(cn->doc().body(), cn, marker, qcn->name());
generateAlsoList(qcn, marker);
@@ -1766,7 +1757,7 @@ void HtmlGenerator::generateQmlTypePage(QmlTypeNode* qcn, CodeMarker* marker)
Generate the HTML page for the QML basic type represented
by the QML basic type node \a qbtn.
*/
-void HtmlGenerator::generateQmlBasicTypePage(QmlBasicTypeNode* qbtn, CodeMarker* marker)
+void HtmlGenerator::generateQmlBasicTypePage(QmlBasicTypeNode *qbtn, CodeMarker *marker)
{
SubTitleSize subTitleSize = LargeSubTitle;
QString htmlTitle = qbtn->fullTitle();
@@ -1827,7 +1818,7 @@ void HtmlGenerator::generateQmlBasicTypePage(QmlBasicTypeNode* qbtn, CodeMarker*
Generate the HTML page for an entity that doesn't map
to any underlying parsable C++, QML, or Javascript element.
*/
-void HtmlGenerator::generatePageNode(PageNode* pn, CodeMarker* marker)
+void HtmlGenerator::generatePageNode(PageNode *pn, CodeMarker *marker)
{
SubTitleSize subTitleSize = LargeSubTitle;
QString fullTitle = pn->fullTitle();
@@ -1864,7 +1855,7 @@ void HtmlGenerator::generatePageNode(PageNode* pn, CodeMarker* marker)
/*!
Generate the HTML page for a group, module, or QML module.
*/
-void HtmlGenerator::generateCollectionNode(CollectionNode* cn, CodeMarker* marker)
+void HtmlGenerator::generateCollectionNode(CollectionNode *cn, CodeMarker *marker)
{
SubTitleSize subTitleSize = LargeSubTitle;
QString fullTitle = cn->fullTitle();
@@ -1947,12 +1938,6 @@ void HtmlGenerator::generateGenericCollectionPage(CollectionNode *cn, CodeMarker
<< "namespace that is documented in a different module. The reference "
<< "page for that class or namespace will link to the function or type "
<< "on this page.";
-#if 0
- << Atom(Atom::LinkNode, CodeMarker::stringForNode(NS))
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
- << Atom(Atom::String, " here.")
- << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK);
-#endif
out() << "<p>";
generateText(brief, cn, marker);
out() << "</p>\n";
@@ -2041,7 +2026,7 @@ void HtmlGenerator::generateNavigationBar(const QString &title,
}
else {
if (node->isAggregate()) {
- QStringList groups = static_cast<const Aggregate*>(node)->groupNames();
+ QStringList groups = static_cast<const Aggregate *>(node)->groupNames();
if (groups.length() == 1) {
const Node *groupNode = qdb_->findNodeByNameAndType(QStringList(groups[0]), &Node::isGroup);
if (groupNode && !groupNode->title().isEmpty()) {
@@ -2091,7 +2076,7 @@ void HtmlGenerator::generateNavigationBar(const QString &title,
out() << "</li>\n";
}
-void HtmlGenerator::generateHeader(const QString& title,
+void HtmlGenerator::generateHeader(const QString &title,
const Node *node,
CodeMarker *marker)
{
@@ -2244,7 +2229,7 @@ void HtmlGenerator::generateHeader(const QString& title,
out() << "<p class=\"naviNextPrevious headerNavi\">\n" << navigationLinks << "</p><p/>\n";
}
-void HtmlGenerator::generateTitle(const QString& title,
+void HtmlGenerator::generateTitle(const QString &title,
const Text &subtitle,
SubTitleSize subTitleSize,
const Node *relative,
@@ -2328,7 +2313,7 @@ void HtmlGenerator::generateRequisites(Aggregate *aggregate, CodeMarker *marker)
if (aggregate->isClassNode() || aggregate->isNamespace()) {
//add the QT variable to the map
if (!aggregate->physicalModuleName().isEmpty()) {
- const CollectionNode* cn = qdb_->getCollectionNode(aggregate->physicalModuleName(), Node::Module);
+ const CollectionNode *cn = qdb_->getCollectionNode(aggregate->physicalModuleName(), Node::Module);
if (cn && !cn->qtVariable().isEmpty()) {
text.clear();
text << "QT += " + cn->qtVariable();
@@ -2338,7 +2323,7 @@ void HtmlGenerator::generateRequisites(Aggregate *aggregate, CodeMarker *marker)
}
if (aggregate->isClassNode()) {
- ClassNode* classe = static_cast<ClassNode*>(aggregate);
+ ClassNode *classe = static_cast<ClassNode *>(aggregate);
if (classe->qmlElement() != nullptr && !classe->isInternal()) {
text.clear();
text << Atom(Atom::LinkNode, CodeMarker::stringForNode(classe->qmlElement()))
@@ -2437,11 +2422,18 @@ void HtmlGenerator::generateQmlRequisites(QmlTypeNode *qcn, CodeMarker *marker)
//add the module name and version to the map
QString logicalModuleVersion;
- const CollectionNode* collection = qdb_->getCollectionNode(qcn->logicalModuleName(), qcn->nodeType());
+ const CollectionNode *collection = qdb_->getCollectionNode(qcn->logicalModuleName(), qcn->nodeType());
if (collection != nullptr)
logicalModuleVersion = collection->logicalModuleVersion();
else
logicalModuleVersion = qcn->logicalModuleVersion();
+
+ if (logicalModuleVersion.isEmpty() || qcn->logicalModuleName().isEmpty())
+ qcn->doc().location().warning(tr("Could not resolve QML import "
+ "statement for type '%1'").arg(qcn->name()),
+ tr("Maybe you forgot to use the "
+ "'\\%1' command?").arg(COMMAND_INQMLMODULE));
+
text.clear();
text << "import " + qcn->logicalModuleName() + QLatin1Char(' ') + logicalModuleVersion;
requisites.insert(importText, text);
@@ -2463,7 +2455,7 @@ void HtmlGenerator::generateQmlRequisites(QmlTypeNode *qcn, CodeMarker *marker)
}
//add the instantiates to the map
- ClassNode* cn = qcn->classNode();
+ ClassNode *cn = qcn->classNode();
if (cn && !cn->isInternal()) {
text.clear();
text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn));
@@ -2476,7 +2468,7 @@ void HtmlGenerator::generateQmlRequisites(QmlTypeNode *qcn, CodeMarker *marker)
}
//add the inherits to the map
- QmlTypeNode* base = qcn->qmlBaseNode();
+ QmlTypeNode *base = qcn->qmlBaseNode();
while (base && base->isInternal()) {
base = base->qmlBaseNode();
}
@@ -2560,9 +2552,9 @@ void HtmlGenerator::generateBrief(const Node *node, CodeMarker *marker,
*/
void HtmlGenerator::generateTableOfContents(const Node *node,
CodeMarker *marker,
- QVector<Section>* sections)
+ QVector<Section> *sections)
{
- QList<Atom*> toc;
+ QList<Atom *> toc;
if (node->doc().hasTableOfContents())
toc = node->doc().tableOfContents();
if (tocDepth == 0 || (toc.isEmpty() && !sections && !node->isModule())) {
@@ -2715,7 +2707,7 @@ QString HtmlGenerator::generateAllMembersFile(const Section &section, CodeMarker
including the inherited members. The \a marker is used for
formatting stuff.
*/
-QString HtmlGenerator::generateAllQmlMembersFile(const Sections &sections, CodeMarker* marker)
+QString HtmlGenerator::generateAllQmlMembersFile(const Sections &sections, CodeMarker *marker)
{
if (sections.allMembersSection().isEmpty())
@@ -2736,10 +2728,10 @@ QString HtmlGenerator::generateAllQmlMembersFile(const Sections &sections, CodeM
if (!cknl.isEmpty()) {
for (int i=0; i<cknl.size(); i++) {
ClassKeysNodes* ckn = cknl[i];
- const QmlTypeNode* qcn = ckn->first;
+ const QmlTypeNode *qcn = ckn->first;
KeysAndNodes& kn = ckn->second;
- QStringList& keys = kn.first;
- NodeVector& nodes = kn.second;
+ QStringList &keys = kn.first;
+ NodeVector &nodes = kn.second;
if (nodes.isEmpty())
continue;
if (i != 0) {
@@ -2749,20 +2741,30 @@ QString HtmlGenerator::generateAllQmlMembersFile(const Sections &sections, CodeM
}
out() << "<ul>\n";
for (int j=0; j<keys.size(); j++) {
- if (nodes[j]->access() == Node::Private || nodes[j]->isInternal()) {
+ Node *node = nodes[j];
+ if (node->access() == Node::Private || node->isInternal())
continue;
- }
- out() << "<li class=\"fn\">";
- QString prefix;
- if (!keys.isEmpty()) {
- prefix = keys.at(j).mid(1);
- prefix = prefix.left(keys.at(j).indexOf("::")+1);
- }
- generateQmlItem(nodes[j], aggregate, marker, true);
- if (nodes[j]->isAttached())
- out() << " [attached]";
- //generateSynopsis(nodes[j], qcn, marker, Section::AllMembers, false, &prefix);
- out() << "</li>\n";
+ if (node->isSharingComment() &&
+ node->sharedCommentNode()->isPropertyGroup())
+ continue;
+
+ std::function<void(Node *)> generate = [&](Node *n) {
+ out() << "<li class=\"fn\">";
+ generateQmlItem(n, aggregate, marker, true);
+ if (n->isDefault())
+ out() << " [default]";
+ else if (n->isAttached())
+ out() << " [attached]";
+ // Indent property group members
+ if (n->isPropertyGroup()) {
+ out() << "<ul>\n";
+ const QVector<Node *> &collective = static_cast<SharedCommentNode *>(n)->collective();
+ std::for_each(collective.begin(), collective.end(), generate);
+ out() << "</ul>\n";
+ }
+ out() << "</li>\n";
+ };
+ generate(node);
}
out() << "</ul>\n";
}
@@ -2885,7 +2887,7 @@ QString HtmlGenerator::generateObsoleteQmlMembersFile(const Sections &sections,
return fileName;
}
-void HtmlGenerator::generateClassHierarchy(const Node *relative, NodeMap& classMap)
+void HtmlGenerator::generateClassHierarchy(const Node *relative, NodeMap &classMap)
{
if (classMap.isEmpty())
return;
@@ -2909,14 +2911,15 @@ void HtmlGenerator::generateClassHierarchy(const Node *relative, NodeMap& classM
out() << "</ul>\n";
}
else {
- ClassNode* child = static_cast<ClassNode*>(*stack.top().begin());
+ ClassNode *child = static_cast<ClassNode *>(*stack.top().begin());
out() << "<li>";
generateFullName(child, relative);
out() << "</li>\n";
stack.top().erase(stack.top().begin());
NodeMap newTop;
- foreach (const RelatedClass &d, child->derivedClasses()) {
+ const auto derivedClasses = child->derivedClasses();
+ for (const RelatedClass &d : derivedClasses) {
if (d.node_ && d.node_->isInAPI())
newTop.insert(d.node_->name(), d.node_);
}
@@ -2932,9 +2935,9 @@ void HtmlGenerator::generateClassHierarchy(const Node *relative, NodeMap& classM
Output an annotated list of the nodes in \a nodeMap.
A two-column table is output.
*/
-void HtmlGenerator::generateAnnotatedList(const Node* relative,
- CodeMarker* marker,
- const NodeMultiMap& nmm)
+void HtmlGenerator::generateAnnotatedList(const Node *relative,
+ CodeMarker *marker,
+ const NodeMultiMap &nmm)
{
if (nmm.isEmpty())
return;
@@ -2945,11 +2948,11 @@ void HtmlGenerator::generateAnnotatedList(const Node* relative,
*/
void HtmlGenerator::generateAnnotatedList(const Node *relative,
CodeMarker *marker,
- const NodeList& unsortedNodes)
+ const NodeList &unsortedNodes)
{
NodeMultiMap nmm;
bool allInternal = true;
- foreach (Node* node, unsortedNodes) {
+ for (auto *node : unsortedNodes) {
if (!node->isInternal() && !node->isObsolete()) {
allInternal = false;
nmm.insert(node->fullName(relative), node);
@@ -2962,7 +2965,7 @@ void HtmlGenerator::generateAnnotatedList(const Node *relative,
NodeList nodes = nmm.values();
std::sort(nodes.begin(), nodes.end(), Node::nodeNameLessThan);
- foreach (const Node* node, nodes) {
+ for (const auto *node : qAsConst(nodes)) {
if (++row % 2 == 1)
out() << "<tr class=\"odd topAlign\">";
else
@@ -3002,11 +3005,12 @@ void HtmlGenerator::generateAnnotatedList(const Node *relative,
Outputs a series of annotated lists from the nodes in \a nmm,
divided into sections based by the key names in the multimap.
*/
-void HtmlGenerator::generateAnnotatedLists(const Node* relative,
- CodeMarker* marker,
- const NodeMultiMap& nmm)
+void HtmlGenerator::generateAnnotatedLists(const Node *relative,
+ CodeMarker *marker,
+ const NodeMultiMap &nmm)
{
- foreach (const QString &name, nmm.uniqueKeys()) {
+ const auto &uniqueKeys = nmm.uniqueKeys();
+ for (const QString &name : uniqueKeys) {
if (!name.isEmpty()) {
out() << "<h2 id=\"" << registerRef(name.toLower())
<< "\">" << protectEnc(name) << "</h2>\n";
@@ -3212,7 +3216,7 @@ void HtmlGenerator::generateFunctionIndex(const Node *relative)
char currentLetter;
out() << "<ul>\n";
- NodeMapMap& funcIndex = qdb_->getFunctionIndex();
+ NodeMapMap &funcIndex = qdb_->getFunctionIndex();
QMap<QString, NodeMap >::ConstIterator f = funcIndex.constBegin();
while (f != funcIndex.constEnd()) {
out() << "<li>";
@@ -3239,7 +3243,7 @@ void HtmlGenerator::generateFunctionIndex(const Node *relative)
void HtmlGenerator::generateLegaleseList(const Node *relative, CodeMarker *marker)
{
- TextToNodeMap& legaleseTexts = qdb_->getLegaleseTexts();
+ TextToNodeMap &legaleseTexts = qdb_->getLegaleseTexts();
QMap<Text, const Node *>::ConstIterator it = legaleseTexts.constBegin();
while (it != legaleseTexts.constEnd()) {
Text text = it.key();
@@ -3293,13 +3297,14 @@ void HtmlGenerator::generateQmlItem(const Node *node,
and must not be empty. If it is empty, nothing is output, and
false is returned. Otherewise, the list is generated and true is returned.
*/
-bool HtmlGenerator::generateGroupList(CollectionNode* cn)
+bool HtmlGenerator::generateGroupList(CollectionNode *cn)
{
qdb_->mergeCollections(cn);
if (cn->members().isEmpty())
return false;
out() << "<ul>\n";
- foreach (const Node* node, cn->members()) {
+ const auto members = cn->members();
+ for (const auto *node : members) {
out() << "<li>"
<< "<a href=\"#"
<< Doc::canonicalTitle(node->title())
@@ -3311,7 +3316,7 @@ bool HtmlGenerator::generateGroupList(CollectionNode* cn)
return true;
}
-void HtmlGenerator::generateList(const Node* relative, CodeMarker* marker, const QString& selector)
+void HtmlGenerator::generateList(const Node *relative, CodeMarker *marker, const QString &selector)
{
CNMap cnm;
Node::NodeType type = Node::NoType;
@@ -3324,12 +3329,13 @@ void HtmlGenerator::generateList(const Node* relative, CodeMarker* marker, const
else if (selector == QLatin1String("js-modules"))
type = Node::JsModule;
if (type != Node::NoType) {
- NodeList nl;
+ NodeList nodeList;
qdb_->mergeCollections(type, cnm, relative);
- CollectionList cl = cnm.values();
- foreach (CollectionNode* cn, cl)
- nl.append(cn);
- generateAnnotatedList(relative, marker, nl);
+ const CollectionList collectionList = cnm.values();
+ nodeList.reserve(collectionList.size());
+ for (auto *collectionNode : collectionList)
+ nodeList.append(collectionNode);
+ generateAnnotatedList(relative, marker, nodeList);
}
else {
/*
@@ -3342,14 +3348,14 @@ void HtmlGenerator::generateList(const Node* relative, CodeMarker* marker, const
"\\module, \\qmlmodule, and \\jsmodule comments.").arg(selector));
return;
}
- Node* n = const_cast<Node*>(relative);
- CollectionNode* cn = static_cast<CollectionNode*>(n);
+ Node *n = const_cast<Node *>(relative);
+ CollectionNode *cn = static_cast<CollectionNode *>(n);
qdb_->mergeCollections(cn);
generateAnnotatedList(cn, marker, cn->members());
}
}
-void HtmlGenerator::generateSection(const NodeVector& nv, const Node *relative, CodeMarker *marker)
+void HtmlGenerator::generateSection(const NodeVector &nv, const Node *relative, CodeMarker *marker)
{
bool alignNames = true;
if (!nv.isEmpty()) {
@@ -3449,14 +3455,14 @@ void HtmlGenerator::generateSectionList(const Section& section,
}
QString prefix;
- const QStringList& keys = section.keys(status);
+ const QStringList &keys = section.keys(status);
if (!keys.isEmpty()) {
prefix = keys.at(i).mid(1);
prefix = prefix.left(keys.at(i).indexOf("::") + 1);
}
generateSynopsis(*m, relative, marker, section.style(), alignNames, &prefix);
if ((*m)->isFunction()) {
- const FunctionNode* fn = static_cast<const FunctionNode*>(*m);
+ const FunctionNode *fn = static_cast<const FunctionNode *>(*m);
if (fn->isPrivateSignal()) {
hasPrivateSignals = true;
if (alignNames)
@@ -3521,7 +3527,7 @@ void HtmlGenerator::generateSynopsis(const Node *node,
CodeMarker *marker,
Section::Style style,
bool alignNames,
- const QString* prefix)
+ const QString *prefix)
{
QString marked = marker->markedUpSynopsis(node, relative, style);
@@ -3561,8 +3567,8 @@ void HtmlGenerator::generateSynopsis(const Node *node,
out() << highlightedCode(marked, relative, alignNames);
}
-QString HtmlGenerator::highlightedCode(const QString& markedCode,
- const Node* relative,
+QString HtmlGenerator::highlightedCode(const QString &markedCode,
+ const Node *relative,
bool alignNames, Node::Genus genus)
{
QString src = markedCode;
@@ -3592,7 +3598,7 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode,
i += 2;
if (parseArg(src, linkTag, &i, srcSize, &arg, &par1)) {
html += QLatin1String("<b>");
- const Node* n = CodeMarker::nodeForString(par1.toString());
+ const Node *n = CodeMarker::nodeForString(par1.toString());
QString link = linkForNode(n, relative);
addLink(link, arg, &html);
html += QLatin1String("</b>");
@@ -3605,7 +3611,7 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode,
}
else if (parseArg(src, typeTag, &i, srcSize, &arg, &par1)) {
par1 = QStringRef();
- const Node* n = qdb_->findTypeNode(arg.toString(), relative, genus);
+ const Node *n = qdb_->findTypeNode(arg.toString(), relative, genus);
html += QLatin1String("<span class=\"type\">");
if (n && (n->isQmlBasicType() || n->isJsBasicType())) {
if (relative && (relative->genus() == n->genus() || genus == n->genus()))
@@ -3622,7 +3628,7 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode,
if (arg.startsWith(QLatin1Char('&')))
html += arg;
else {
- const Node* n = qdb_->findNodeForInclude(QStringList(arg.toString()));
+ const Node *n = qdb_->findNodeForInclude(QStringList(arg.toString()));
if (n && n != relative)
addLink(linkForNode(n,relative), arg, &html);
else
@@ -3718,7 +3724,7 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode,
return html;
}
-void HtmlGenerator::generateLink(const Atom* atom, CodeMarker* marker)
+void HtmlGenerator::generateLink(const Atom *atom, CodeMarker *marker)
{
static QRegExp camelCase("[A-Z][A-Z][a-z]|[a-z][A-Z0-9]|_");
@@ -3739,12 +3745,12 @@ void HtmlGenerator::generateLink(const Atom* atom, CodeMarker* marker)
}
}
-QString HtmlGenerator::registerRef(const QString& ref)
+QString HtmlGenerator::registerRef(const QString &ref)
{
QString clean = Generator::cleanRef(ref);
for (;;) {
- QString& prevRef = refMap[clean.toLower()];
+ QString &prevRef = refMap[clean.toLower()];
if (prevRef.isEmpty()) {
prevRef = ref;
break;
@@ -3832,7 +3838,7 @@ QString HtmlGenerator::refForNode(const Node *node)
break;
case Node::Typedef:
{
- const TypedefNode* tdn = static_cast<const TypedefNode *>(node);
+ const TypedefNode *tdn = static_cast<const TypedefNode *>(node);
if (tdn->associatedEnum())
return refForNode(tdn->associatedEnum());
else
@@ -3906,7 +3912,7 @@ QString HtmlGenerator::refForNode(const Node *node)
*/
QString HtmlGenerator::getLink(const Atom *atom, const Node *relative, const Node** node)
{
- const QString& t = atom->string();
+ const QString &t = atom->string();
if (t.at(0) == QChar('h')) {
if (t.startsWith("http:") || t.startsWith("https:"))
return t;
@@ -4040,18 +4046,16 @@ void HtmlGenerator::generateDetailedMember(const Node *node,
generateKeywordAnchors(node);
QString nodeRef = nullptr;
if (node->isSharedCommentNode()) {
- const SharedCommentNode *scn = reinterpret_cast<const SharedCommentNode*>(node);
- const QVector<Node*>& collective = scn->collective();
+ const SharedCommentNode *scn = reinterpret_cast<const SharedCommentNode *>(node);
+ const QVector<Node *> &collective = scn->collective();
if (collective.size() > 1)
out() << "<div class=\"fngroup\">\n";
- foreach (const Node* n, collective) {
- if (n->isFunction()) {
- nodeRef = refForNode(n);
- out() << "<h3 class=\"fn fngroupitem\" id=\"" << nodeRef << "\">";
- out() << "<a name=\"" + nodeRef + "\"></a>";
- generateSynopsis(n, relative, marker, Section::Details);
- out() << "</h3>";
- }
+ for (const auto *node : collective) {
+ nodeRef = refForNode(node);
+ out() << "<h3 class=\"fn fngroupitem\" id=\"" << nodeRef << "\">";
+ out() << "<a name=\"" + nodeRef + "\"></a>";
+ generateSynopsis(node, relative, marker, Section::Details);
+ out() << "</h3>";
}
if (collective.size() > 1)
out() << "</div>";
@@ -4107,12 +4111,12 @@ void HtmlGenerator::generateDetailedMember(const Node *node,
}
}
else if (node->isFunction()) {
- const FunctionNode* fn = static_cast<const FunctionNode*>(node);
+ const FunctionNode *fn = static_cast<const FunctionNode *>(node);
if (fn->isPrivateSignal())
generatePrivateSignalNote(node, marker);
if (fn->isInvokable())
generateInvokableNote(node, marker);
- generateAssociatedPropertyNotes(const_cast<FunctionNode*>(fn));
+ generateAssociatedPropertyNotes(const_cast<FunctionNode *>(fn));
}
else if (node->isEnumType()) {
const EnumNode *etn = static_cast<const EnumNode *>(node);
@@ -4170,7 +4174,7 @@ const QPair<QString,QString> HtmlGenerator::anchorForNode(const Node *node)
anchorPair.first = Generator::fileName(node);
if (node->isPageNode()) {
- const PageNode *pn = static_cast<const PageNode*>(node);
+ const PageNode *pn = static_cast<const PageNode *>(node);
anchorPair.second = pn->title();
}
@@ -4186,8 +4190,8 @@ void HtmlGenerator::generateMacRef(const Node *node, CodeMarker *marker)
if (!pleaseGenerateMacRef || marker == 0)
return;
- QStringList macRefs = marker->macRefsForNode(node);
- foreach (const QString &macRef, macRefs)
+ const QStringList macRefs = marker->macRefsForNode(node);
+ for (const auto &macRef : macRefs)
out() << "<a name=\"" << "//apple_ref/" << macRef << "\"></a>\n";
}
#endif
@@ -4257,9 +4261,9 @@ void HtmlGenerator::generateQmlSummary(const NodeVector &members,
out() << "<li class=\"fn\">";
generateQmlItem(*m, relative, marker, true);
if ((*m)->isPropertyGroup()) {
- const SharedCommentNode* scn = static_cast<const SharedCommentNode*>(*m);
+ const SharedCommentNode *scn = static_cast<const SharedCommentNode *>(*m);
if (scn->count() > 0) {
- QVector<Node*>::ConstIterator p = scn->collective().constBegin();
+ QVector<Node *>::ConstIterator p = scn->collective().constBegin();
out() << "<ul>\n";
while (p != scn->collective().constEnd()) {
if ((*p)->isQmlProperty() || (*p)->isJsProperty()) {
@@ -4287,7 +4291,7 @@ void HtmlGenerator::generateDetailedQmlMember(Node *node,
const Aggregate *relative,
CodeMarker *marker)
{
- QmlPropertyNode* qpn = nullptr;
+ QmlPropertyNode *qpn = nullptr;
#ifdef GENERATE_MAC_REFS
generateMacRef(node, marker);
#endif
@@ -4306,8 +4310,8 @@ void HtmlGenerator::generateDetailedQmlMember(Node *node,
out() << "<div class=\"qmlitem\">";
QString nodeRef;
if (node->isPropertyGroup()) {
- const SharedCommentNode* scn = static_cast<const SharedCommentNode*>(node);
- QVector<Node*>::ConstIterator p = scn->collective().constBegin();
+ const SharedCommentNode *scn = static_cast<const SharedCommentNode*>(node);
+ QVector<Node *>::ConstIterator p = scn->collective().constBegin();
out() << "<div class=\"qmlproto\">";
out() << "<div class=\"table\"><table class=\"qmlname\">";
if (!scn->name().isEmpty()) {
@@ -4321,7 +4325,7 @@ void HtmlGenerator::generateDetailedQmlMember(Node *node,
}
while (p != scn->collective().constEnd()) {
if ((*p)->isQmlProperty() || (*p)->isJsProperty()) {
- qpn = static_cast<QmlPropertyNode*>(*p);
+ qpn = static_cast<QmlPropertyNode *>(*p);
nodeRef = refForNode(qpn);
out() << "<tr valign=\"top\" class=\"odd\" id=\"" << nodeRef << "\">";
out() << "<td class=\"tblQmlPropNode\"><p>";
@@ -4339,7 +4343,7 @@ void HtmlGenerator::generateDetailedQmlMember(Node *node,
out() << "</table></div>";
out() << "</div>";
} else if (node->isQmlProperty() || node->isJsProperty()) {
- qpn = static_cast<QmlPropertyNode*>(node);
+ qpn = static_cast<QmlPropertyNode *>(node);
out() << qmlItemHeader;
out() << qmlItemStart.arg(nodeRef, "tblQmlPropNode", refForNode(qpn));
@@ -4356,8 +4360,8 @@ void HtmlGenerator::generateDetailedQmlMember(Node *node,
out() << qmlItemEnd;
out() << qmlItemFooter;
} else if (node->isSharedCommentNode()) {
- const SharedCommentNode *scn = reinterpret_cast<const SharedCommentNode*>(node);
- const QVector<Node*>& collective = scn->collective();
+ const SharedCommentNode *scn = reinterpret_cast<const SharedCommentNode *>(node);
+ const QVector<Node *> &collective = scn->collective();
if (collective.size() > 1)
out() << "<div class=\"fngroup\">\n";
out() << qmlItemHeader;
@@ -4393,11 +4397,11 @@ void HtmlGenerator::generateDetailedQmlMember(Node *node,
Output the "Inherits" line for the QML element,
if there should be one.
*/
-void HtmlGenerator::generateQmlInherits(QmlTypeNode* qcn, CodeMarker* marker)
+void HtmlGenerator::generateQmlInherits(QmlTypeNode *qcn, CodeMarker *marker)
{
if (!qcn)
return;
- QmlTypeNode* base = qcn->qmlBaseNode();
+ QmlTypeNode *base = qcn->qmlBaseNode();
while (base && base->isInternal()) {
base = base->qmlBaseNode();
}
@@ -4420,9 +4424,9 @@ void HtmlGenerator::generateQmlInherits(QmlTypeNode* qcn, CodeMarker* marker)
If there is no class node, or if the class node status
is set to Node::Internal, do nothing.
*/
-void HtmlGenerator::generateQmlInstantiates(QmlTypeNode* qcn, CodeMarker* marker)
+void HtmlGenerator::generateQmlInstantiates(QmlTypeNode *qcn, CodeMarker *marker)
{
- ClassNode* cn = qcn->classNode();
+ ClassNode *cn = qcn->classNode();
if (cn && !cn->isInternal()) {
Text text;
text << Atom::ParaLeft;
@@ -4454,10 +4458,10 @@ void HtmlGenerator::generateQmlInstantiates(QmlTypeNode* qcn, CodeMarker* marker
If there is no QML element, or if the class node status
is set to Node::Internal, do nothing.
*/
-void HtmlGenerator::generateInstantiatedBy(ClassNode* cn, CodeMarker* marker)
+void HtmlGenerator::generateInstantiatedBy(ClassNode *cn, CodeMarker *marker)
{
if (cn && !cn->isInternal() && cn->qmlElement() != nullptr) {
- const QmlTypeNode* qcn = cn->qmlElement();
+ const QmlTypeNode *qcn = cn->qmlElement();
Text text;
text << Atom::ParaLeft;
text << Atom(Atom::LinkNode,CodeMarker::stringForNode(cn));
@@ -4493,7 +4497,7 @@ void HtmlGenerator::generateExtractionMark(const Node *node, ExtractionMarkType
out() << "-prop";
const PropertyNode *prop = static_cast<const PropertyNode *>(node);
const NodeList &list = prop->functions();
- foreach (const Node *propFuncNode, list) {
+ for (const auto *propFuncNode : list) {
if (propFuncNode->isFunction()) {
const FunctionNode *func = static_cast<const FunctionNode *>(propFuncNode);
out() << "$$$" + func->name() + func->parameters().rawSignature().remove(' ');
@@ -4501,7 +4505,8 @@ void HtmlGenerator::generateExtractionMark(const Node *node, ExtractionMarkType
}
} else if (node->isEnumType()) {
const EnumNode *enumNode = static_cast<const EnumNode *>(node);
- foreach (const EnumItem &item, enumNode->items())
+ const auto items = enumNode->items();
+ for (const auto &item : items)
out() << "$$$" + item.name();
}
} else if (markType == BriefMark) {
@@ -4535,7 +4540,7 @@ void HtmlGenerator::generateManifestFiles()
*/
void HtmlGenerator::generateManifestFile(const QString &manifest, const QString &element)
{
- ExampleNodeMap& exampleNodeMap = qdb_->exampleNodeMap();
+ ExampleNodeMap &exampleNodeMap = qdb_->exampleNodeMap();
if (exampleNodeMap.isEmpty())
return;
QString fileName = manifest +"-manifest.xml";
@@ -4547,7 +4552,7 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
bool proceed = false;
ExampleNodeMap::Iterator i = exampleNodeMap.begin();
while (i != exampleNodeMap.end()) {
- const ExampleNode* en = i.value();
+ const ExampleNode *en = i.value();
if (demos) {
if (en->name().startsWith("demos")) {
proceed = true;
@@ -4573,7 +4578,7 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
QStringList usedAttributes;
i = exampleNodeMap.begin();
while (i != exampleNodeMap.end()) {
- const ExampleNode* en = i.value();
+ const ExampleNode *en = i.value();
if (demos) {
if (!en->name().startsWith("demos")) {
++i;
@@ -4593,7 +4598,8 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
QString docUrl = manifestDir + fileBase(en) + ".html";
writer.writeAttribute("docUrl", docUrl);
QStringList proFiles;
- foreach (const QString file, en->files()) {
+ const auto exampleFiles = en->files();
+ for (const QString &file : exampleFiles) {
if (file.endsWith(".pro") || file.endsWith(".qmlproject") || file.endsWith(".pyproject"))
proFiles << file;
}
@@ -4626,7 +4632,8 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
QString fullName = project + QLatin1Char('/') + en->title();
QSet<QString> tags;
for (int idx=0; idx < manifestMetaContent.size(); ++idx) {
- foreach (const QString &name, manifestMetaContent[idx].names) {
+ const auto names = manifestMetaContent[idx].names;
+ for (const QString &name : names) {
bool match = false;
int wildcard = name.indexOf(QChar('*'));
switch (wildcard) {
@@ -4641,7 +4648,8 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
}
if (match) {
tags += manifestMetaContent[idx].tags;
- foreach (const QString &attr, manifestMetaContent[idx].attributes) {
+ const auto attributes = manifestMetaContent[idx].attributes;
+ for (const QString &attr : attributes) {
QLatin1Char div(':');
QStringList attrList = attr.split(div);
if (attrList.count() == 1)
@@ -4676,10 +4684,13 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
// Include tags added via \meta {tag} {tag1[,tag2,...]}
// within \example topic
- for (const auto &tag : en->doc().metaTagMap().values("tag"))
- tags += QSet<QString>::fromList(tag.toLower().split(QLatin1Char(',')));
+ for (const auto &tag : en->doc().metaTagMap().values("tag")) {
+ const auto &tagList = tag.toLower().split(QLatin1Char(','));
+ tags += QSet<QString>(tagList.cbegin(), tagList.cend());
+ }
- tags += QSet<QString>::fromList(en->title().toLower().split(QLatin1Char(' ')));
+ const auto &titleWords = en->title().toLower().split(QLatin1Char(' '));
+ tags += QSet<QString>(titleWords.cbegin(), titleWords.cend());
// Clean up tags, exclude invalid and common words
QSet<QString>::iterator tag_it = tags.begin();
@@ -4712,9 +4723,9 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
if (!tags.isEmpty()) {
writer.writeStartElement("tags");
bool wrote_one = false;
- QStringList sortedTags = tags.toList();
+ QStringList sortedTags = tags.values();
sortedTags.sort();
- foreach (const QString &tag, sortedTags) {
+ for (const auto &tag : qAsConst(sortedTags)) {
if (wrote_one)
writer.writeCharacters(",");
writer.writeCharacters(tag);
@@ -4725,7 +4736,8 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
QString ename = en->name().mid(en->name().lastIndexOf('/')+1);
QMap<int, QString> filesToOpen;
- foreach (QString file, en->files()) {
+ const auto files = en->files();
+ for (const QString &file : files) {
QFileInfo fileInfo(file);
QString fileName = fileInfo.fileName().toLower();
// open .qml, .cpp and .h files with a
@@ -4779,9 +4791,10 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
*/
void HtmlGenerator::readManifestMetaContent(const Config &config)
{
- QStringList names = config.getStringList(CONFIG_MANIFESTMETA + Config::dot + QStringLiteral("filters"));
+ const QStringList names =
+ config.getStringList(CONFIG_MANIFESTMETA + Config::dot + QStringLiteral("filters"));
- foreach (const QString &manifest, names) {
+ for (const auto &manifest : names) {
ManifestMetaFilter filter;
QString prefix = CONFIG_MANIFESTMETA + Config::dot + manifest + Config::dot;
filter.names = config.getStringSet(prefix + QStringLiteral("names"));
@@ -4796,14 +4809,14 @@ void HtmlGenerator::readManifestMetaContent(const Config &config)
\e{relates} comand. Report these as errors if they
are not also marked \e {internal}.
*/
-void HtmlGenerator::reportOrphans(const Aggregate* parent)
+void HtmlGenerator::reportOrphans(const Aggregate *parent)
{
- const NodeList& children = parent->childNodes();
+ const NodeList &children = parent->childNodes();
if (children.size() == 0)
return;
QString message = "has documentation but no \\relates command";
- foreach (Node *child, children) {
+ for (const auto *child : children) {
if (!child || child->isInternal() || child->doc().isEmpty() || !child->isRelatedNonmember())
continue;
switch (child->nodeType()) {
@@ -4815,7 +4828,7 @@ void HtmlGenerator::reportOrphans(const Aggregate* parent)
break;
case Node::Function:
{
- const FunctionNode* fn = static_cast<const FunctionNode*>(child);
+ const FunctionNode *fn = static_cast<const FunctionNode *>(child);
switch (fn->metaness()) {
case FunctionNode::QmlSignal:
child->location().warning(tr("Global QML, signal, %1 %2").arg(child->name()).arg(message));
@@ -4867,7 +4880,7 @@ void HtmlGenerator::reportOrphans(const Aggregate* parent)
output generator, it is perhaps impossible for there to ever
be more than one writer open.
*/
-QXmlStreamWriter& HtmlGenerator::xmlWriter()
+QXmlStreamWriter &HtmlGenerator::xmlWriter()
{
return *xmlWriterStack.top();
}
@@ -4882,9 +4895,9 @@ void HtmlGenerator::generateAssociatedPropertyNotes(FunctionNode *fn)
out() << "<p><b>Note:</b> ";
NodeList &nodes = fn->associatedProperties();
std::sort(nodes.begin(), nodes.end(), Node::nodeNameLessThan);
- foreach (const Node *n, nodes) {
+ for (const auto *node : qAsConst(nodes)) {
QString msg;
- const PropertyNode *pn = static_cast<const PropertyNode*>(n);
+ const PropertyNode *pn = static_cast<const PropertyNode *>(node);
switch (pn->role(fn)) {
case PropertyNode::Getter:
msg = QStringLiteral("Getter function ");
diff --git a/src/qdoc/htmlgenerator.h b/src/qdoc/htmlgenerator.h
index 0c897483b..c1564c5b0 100644
--- a/src/qdoc/htmlgenerator.h
+++ b/src/qdoc/htmlgenerator.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -33,13 +33,14 @@
#ifndef HTMLGENERATOR_H
#define HTMLGENERATOR_H
-#include <qhash.h>
-#include <qregexp.h>
-#include <qxmlstream.h>
#include "codemarker.h"
#include "config.h"
#include "generator.h"
+#include <QtCore/qhash.h>
+#include <QtCore/qregexp.h>
+#include <QtCore/qxmlstream.h>
+
QT_BEGIN_NAMESPACE
class HelpProjectWriter;
@@ -52,9 +53,9 @@ public:
public:
HtmlGenerator();
- ~HtmlGenerator();
+ ~HtmlGenerator() override;
- void initializeGenerator(const Config& config) override;
+ void initializeGenerator(const Config &config) override;
void terminateGenerator() override;
QString format() override;
void generateDocs() override;
@@ -66,17 +67,17 @@ public:
protected:
void generateQAPage() override;
void generateExampleFilePage(const Node *en, const QString &file, CodeMarker *marker) override;
- QString generateLinksToLinksPage(const QString& module, CodeMarker* marker);
- QString generateLinksToBrokenLinksPage(CodeMarker* marker, int& count);
+ QString generateLinksToLinksPage(const QString &module, CodeMarker *marker);
+ QString generateLinksToBrokenLinksPage(CodeMarker *marker, int &count);
virtual int generateAtom(const Atom *atom,
const Node *relative,
CodeMarker *marker) override;
void generateCppReferencePage(Aggregate *aggregate, CodeMarker *marker) override;
void generateProxyPage(Aggregate *aggregate, CodeMarker *marker) override;
- void generateQmlTypePage(QmlTypeNode* qcn, CodeMarker* marker) override;
- void generateQmlBasicTypePage(QmlBasicTypeNode* qbtn, CodeMarker* marker) override;
- void generatePageNode(PageNode* pn, CodeMarker* marker) override;
- void generateCollectionNode(CollectionNode* cn, CodeMarker* marker) override;
+ void generateQmlTypePage(QmlTypeNode *qcn, CodeMarker *marker) override;
+ void generateQmlBasicTypePage(QmlBasicTypeNode *qbtn, CodeMarker *marker) override;
+ void generatePageNode(PageNode *pn, CodeMarker *marker) override;
+ void generateCollectionNode(CollectionNode *cn, CodeMarker *marker) override;
void generateGenericCollectionPage(CollectionNode *cn, CodeMarker *marker) override;
QString fileExtension() const override;
virtual QString refForNode(const Node *node);
@@ -84,7 +85,7 @@ protected:
void generateManifestFile(const QString &manifest, const QString &element);
void readManifestMetaContent(const Config &config);
- void generateKeywordAnchors(const Node* node);
+ void generateKeywordAnchors(const Node *node);
void generateAssociatedPropertyNotes(FunctionNode *fn);
QString getLink(const Atom *atom, const Node *relative, const Node **node);
@@ -112,10 +113,10 @@ private:
CodeMarker *marker,
const QString &buildversion,
bool tableItems = false);
- void generateHeader(const QString& title,
+ void generateHeader(const QString &title,
const Node *node = nullptr,
CodeMarker *marker = nullptr);
- void generateTitle(const QString& title,
+ void generateTitle(const QString &title,
const Text &subTitle,
SubTitleSize subTitleSize,
const Node *relative,
@@ -130,16 +131,16 @@ private:
const Node *relative = nullptr, bool addLink=true);
void generateTableOfContents(const Node *node,
CodeMarker *marker,
- QVector<Section>* sections = nullptr);
+ QVector<Section> *sections = nullptr);
void generateSidebar();
QString generateAllMembersFile(const Section &section, CodeMarker *marker);
- QString generateAllQmlMembersFile(const Sections &sections, CodeMarker* marker);
+ QString generateAllQmlMembersFile(const Sections &sections, CodeMarker *marker);
QString generateObsoleteMembersFile(const Sections &sections, CodeMarker *marker);
QString generateObsoleteQmlMembersFile(const Sections &sections, CodeMarker *marker);
void generateClassHierarchy(const Node *relative, NodeMap &classMap);
- void generateAnnotatedList(const Node* relative, CodeMarker* marker, const NodeMultiMap& nodeMap);
- void generateAnnotatedLists(const Node* relative, CodeMarker* marker, const NodeMultiMap& nodeMap);
- void generateAnnotatedList(const Node* relative, CodeMarker* marker, const NodeList& nodes);
+ void generateAnnotatedList(const Node *relative, CodeMarker *marker, const NodeMultiMap &nodeMap);
+ void generateAnnotatedLists(const Node *relative, CodeMarker *marker, const NodeMultiMap &nodeMap);
+ void generateAnnotatedList(const Node *relative, CodeMarker *marker, const NodeList &nodes);
void generateCompactList(ListType listType,
const Node *relative,
const NodeMultiMap &classMap,
@@ -147,8 +148,8 @@ private:
QString commonPrefix);
void generateFunctionIndex(const Node *relative);
void generateLegaleseList(const Node *relative, CodeMarker *marker);
- bool generateGroupList(CollectionNode* cn);
- void generateList(const Node* relative, CodeMarker* marker, const QString& selector);
+ bool generateGroupList(CollectionNode *cn);
+ void generateList(const Node *relative, CodeMarker *marker, const QString &selector);
void generateSectionList(const Section& section,
const Node *relative,
CodeMarker *marker,
@@ -163,20 +164,20 @@ private:
void generateDetailedQmlMember(Node *node,
const Aggregate *relative,
CodeMarker *marker);
- void generateQmlInherits(QmlTypeNode* qcn, CodeMarker* marker) override;
- void generateQmlInstantiates(QmlTypeNode* qcn, CodeMarker* marker);
- void generateInstantiatedBy(ClassNode* cn, CodeMarker* marker);
+ void generateQmlInherits(QmlTypeNode *qcn, CodeMarker *marker) override;
+ void generateQmlInstantiates(QmlTypeNode *qcn, CodeMarker *marker);
+ void generateInstantiatedBy(ClassNode *cn, CodeMarker *marker);
- void generateSection(const NodeVector& nv, const Node *relative, CodeMarker *marker);
+ void generateSection(const NodeVector &nv, const Node *relative, CodeMarker *marker);
void generateSynopsis(const Node *node,
const Node *relative,
CodeMarker *marker,
Section::Style style,
bool alignNames = false,
- const QString* prefix = nullptr);
+ const QString *prefix = nullptr);
void generateSectionInheritedList(const Section& section, const Node *relative);
- QString highlightedCode(const QString& markedCode,
- const Node* relative,
+ QString highlightedCode(const QString &markedCode,
+ const Node *relative,
bool alignNames = false,
Node::Genus genus = Node::DontCare);
@@ -185,7 +186,7 @@ private:
void generateLink(const Atom *atom, CodeMarker *marker);
inline bool hasBrief(const Node *node);
- QString registerRef(const QString& ref);
+ QString registerRef(const QString &ref);
QString fileBase(const Node *node) const override;
QString fileName(const Node *node);
static int hOffset(const Node *node);
@@ -197,9 +198,9 @@ private:
void beginLink(const QString &link, const Node *node, const Node *relative);
void endLink();
void generateExtractionMark(const Node *node, ExtractionMarkType markType);
- void reportOrphans(const Aggregate* parent);
+ void reportOrphans(const Aggregate *parent);
- QXmlStreamWriter& xmlWriter();
+ QXmlStreamWriter &xmlWriter();
QHash<QString, QString> refMap;
int codeIndent;
@@ -229,7 +230,7 @@ private:
QStringList stylesheets;
QStringList customHeadElements;
bool obsoleteLinks;
- QStack<QXmlStreamWriter*> xmlWriterStack;
+ QStack<QXmlStreamWriter *> xmlWriterStack;
static int id;
QList<ManifestMetaFilter> manifestMetaContent;
QString homepage;
diff --git a/src/qdoc/jscodemarker.cpp b/src/qdoc/jscodemarker.cpp
index 575ffbb58..6a26fce2e 100644
--- a/src/qdoc/jscodemarker.cpp
+++ b/src/qdoc/jscodemarker.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -33,11 +33,11 @@
#include "jscodemarker.h"
#include "atom.h"
+#include "generator.h"
#include "node.h"
#include "qmlmarkupvisitor.h"
#include "text.h"
#include "tree.h"
-#include "generator.h"
#ifndef QT_NO_DECLARATIVE
#include <private/qqmljsast_p.h>
diff --git a/src/qdoc/jscodemarker.h b/src/qdoc/jscodemarker.h
index 1b65d4da1..3d2ffa1ef 100644
--- a/src/qdoc/jscodemarker.h
+++ b/src/qdoc/jscodemarker.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -43,7 +43,7 @@ class JsCodeMarker : public QmlCodeMarker
public:
JsCodeMarker();
- ~JsCodeMarker();
+ ~JsCodeMarker() override;
bool recognizeCode(const QString &code) override;
bool recognizeExtension(const QString &ext) override;
diff --git a/src/qdoc/location.cpp b/src/qdoc/location.cpp
index d9a3ad609..f10f53b65 100644
--- a/src/qdoc/location.cpp
+++ b/src/qdoc/location.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -26,17 +26,19 @@
**
****************************************************************************/
-#include <qdebug.h>
-#include "config.h"
#include "location.h"
+
+#include "config.h"
#include "generator.h"
-#include <qdir.h>
-#include <qregexp.h>
-#include <QTime>
-#include <stdlib.h>
-#include <limits.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qdir.h>
+#include <QtCore/qregexp.h>
+#include <QtCore/QTime>
+
+#include <limits.h>
#include <stdio.h>
+#include <stdlib.h>
QT_BEGIN_NAMESPACE
@@ -74,7 +76,7 @@ Location::Location()
Constructs a location with (fileName, 1, 1) on its file
position stack.
*/
-Location::Location(const QString& fileName)
+Location::Location(const QString &fileName)
: stk(nullptr), stkTop(&stkBottom), stkDepth(0), etcetera(false)
{
push(fileName);
@@ -84,7 +86,7 @@ Location::Location(const QString& fileName)
The copy constructor copies the contents of \a other into
this Location using the assignment operator.
*/
-Location::Location(const Location& other)
+Location::Location(const Location &other)
: stk(nullptr), stkTop(&stkBottom), stkDepth(0), etcetera(false)
{
*this = other;
@@ -94,7 +96,7 @@ Location::Location(const Location& other)
The assignment operator does a deep copy of the entire
state of \a other into this Location.
*/
-Location& Location::operator=(const Location& other)
+Location &Location::operator=(const Location &other)
{
QStack<StackEntry> *oldStk = stk;
@@ -155,7 +157,7 @@ void Location::advance(QChar ch)
\sa pop()
*/
-void Location::push(const QString& filePath)
+void Location::push(const QString &filePath)
{
if (stkDepth++ >= 1) {
if (stk == nullptr)
@@ -200,7 +202,7 @@ void Location::pop()
must not be called on an empty Location object.
*/
-/*! \fn const QString& Location::filePath() const
+/*! \fn const QString &Location::filePath() const
Returns the current path and file name. If the Location is
empty, the returned string is null.
@@ -262,7 +264,7 @@ QString Location::canonicalRelativePath(const QString &path)
warning message. Does not write the message if qdoc is in
the Prepare phase.
*/
-void Location::warning(const QString& message, const QString& details) const
+void Location::warning(const QString &message, const QString &details) const
{
if (!Generator::preparing() || Generator::singleExec())
emitMessage(Warning, message, details);
@@ -273,7 +275,7 @@ void Location::warning(const QString& message, const QString& details) const
error message. Does not write the message if qdoc is in
the Prepare phase.
*/
-void Location::error(const QString& message, const QString& details) const
+void Location::error(const QString &message, const QString &details) const
{
if (!Generator::preparing() || Generator::singleExec())
emitMessage(Error, message, details);
@@ -302,7 +304,7 @@ int Location::exitCode()
error message and then exits the program. qdoc prints fatal
errors in either phase (Prepare or Generate).
*/
-void Location::fatal(const QString& message, const QString& details) const
+void Location::fatal(const QString &message, const QString &details) const
{
emitMessage(Error, message, details);
information(message);
@@ -315,7 +317,7 @@ void Location::fatal(const QString& message, const QString& details) const
Writes \a message and \a detals to stderr as a formatted
report message.
*/
-void Location::report(const QString& message, const QString& details) const
+void Location::report(const QString &message, const QString &details) const
{
emitMessage(Report, message, details);
}
@@ -326,7 +328,7 @@ void Location::report(const QString& message, const QString& details) const
appears to be used for matching certain error messages
so that emitMessage() can avoid printing them.
*/
-void Location::initialize(const Config& config)
+void Location::initialize(const Config &config)
{
tabSize = config.getInt(CONFIG_TABSIZE);
programName = config.programName();
@@ -360,7 +362,7 @@ void Location::terminate()
/*!
Prints \a message to \c stdout followed by a \c{'\n'}.
*/
-void Location::information(const QString& message)
+void Location::information(const QString &message)
{
printf("%s\n", message.toLatin1().data());
fflush(stdout);
@@ -370,7 +372,7 @@ void Location::information(const QString& message)
Prints \a message to \c stderr followed by a \c{'\n'},
but only if the -log-progress option is set.
*/
-void Location::logToStdErr(const QString& message)
+void Location::logToStdErr(const QString &message)
{
if (logProgress_) {
fprintf(stderr, "LOG: %s\n", message.toLatin1().data());
@@ -382,7 +384,7 @@ void Location::logToStdErr(const QString& message)
Always prints the current time and \a message to \c stderr
followed by a \c{'\n'}.
*/
-void Location::logToStdErrAlways(const QString& message)
+void Location::logToStdErrAlways(const QString &message)
{
if (Generator::useTimestamps()) {
QTime t = QTime::currentTime();
@@ -396,7 +398,7 @@ void Location::logToStdErrAlways(const QString& message)
/*!
Report a program bug, including the \a hint.
*/
-void Location::internalError(const QString& hint)
+void Location::internalError(const QString &hint)
{
Location::null.fatal(tr("Internal error (%1)").arg(hint),
tr("There is a bug in %1. Seek advice from your local"
@@ -410,8 +412,8 @@ void Location::internalError(const QString& hint)
whether the \a message is an error or a warning.
*/
void Location::emitMessage(MessageType type,
- const QString& message,
- const QString& details) const
+ const QString &message,
+ const QString &details) const
{
if (type == Warning &&
spuriousRegExp != nullptr &&
diff --git a/src/qdoc/location.h b/src/qdoc/location.h
index 16188bde1..7a472ab5a 100644
--- a/src/qdoc/location.h
+++ b/src/qdoc/location.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -33,8 +33,8 @@
#ifndef LOCATION_H
#define LOCATION_H
-#include <qstack.h>
-#include <qcoreapplication.h>
+#include <QtCore/qcoreapplication.h>
+#include <QtCore/qstack.h>
QT_BEGIN_NAMESPACE
@@ -47,17 +47,17 @@ class Location
public:
Location();
- Location(const QString& filePath);
- Location(const Location& other);
+ Location(const QString &filePath);
+ Location(const Location &other);
~Location() { delete stk; }
- Location& operator=(const Location& other);
+ Location &operator=(const Location &other);
void start();
void advance(QChar ch);
void advanceLines(int n) { stkTop->lineNo += n; stkTop->columnNo = 1; }
- void push(const QString& filePath);
+ void push(const QString &filePath);
void pop();
void setEtc(bool etc) { etcetera = etc; }
void setLineNo(int no) { stkTop->lineNo = no; }
@@ -65,29 +65,29 @@ public:
bool isEmpty() const { return stkDepth == 0; }
int depth() const { return stkDepth; }
- const QString& filePath() const { return stkTop->filePath; }
+ const QString &filePath() const { return stkTop->filePath; }
QString fileName() const;
QString fileSuffix() const;
int lineNo() const { return stkTop->lineNo; }
int columnNo() const { return stkTop->columnNo; }
bool etc() const { return etcetera; }
- void warning(const QString& message,
- const QString& details = QString()) const;
- void error(const QString& message,
- const QString& details = QString()) const;
- void fatal(const QString& message,
- const QString& details = QString()) const;
- void report(const QString& message,
- const QString& details = QString()) const;
+ void warning(const QString &message,
+ const QString &details = QString()) const;
+ void error(const QString &message,
+ const QString &details = QString()) const;
+ void fatal(const QString &message,
+ const QString &details = QString()) const;
+ void report(const QString &message,
+ const QString &details = QString()) const;
static const Location null;
- static void initialize(const Config& config);
+ static void initialize(const Config &config);
static void terminate();
- static void information(const QString& message);
- static void internalError(const QString& hint);
- static void logToStdErr(const QString& message);
- static void logToStdErrAlways(const QString& message);
+ static void information(const QString &message);
+ static void internalError(const QString &hint);
+ static void logToStdErr(const QString &message);
+ static void logToStdErrAlways(const QString &message);
static void startLoggingProgress() { logProgress_ = true; }
static void stopLoggingProgress() { logProgress_ = false; }
static QString canonicalRelativePath(const QString &path);
@@ -105,8 +105,8 @@ private:
friend class QTypeInfo<StackEntry>;
void emitMessage(MessageType type,
- const QString& message,
- const QString& details) const;
+ const QString &message,
+ const QString &details) const;
QString toString() const;
QString top() const;
diff --git a/src/qdoc/main.cpp b/src/qdoc/main.cpp
index ad089eb2e..48166257d 100644
--- a/src/qdoc/main.cpp
+++ b/src/qdoc/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -26,16 +26,6 @@
**
****************************************************************************/
-#include <algorithm>
-#include <stdlib.h>
-#include <QtCore/qcommandlineoption.h>
-#include <QtCore/qcommandlineparser.h>
-#include <QtCore/qdatetime.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qglobal.h>
-#include <QtCore/qglobalstatic.h>
-#include <QtCore/qhashfunctions.h>
-
#include "clangcodeparser.h"
#include "codemarker.h"
#include "codeparser.h"
@@ -48,20 +38,30 @@
#include "location.h"
#include "loggingcategory.h"
#include "puredocparser.h"
+#include "qdocdatabase.h"
#include "qmlcodemarker.h"
#include "qmlcodeparser.h"
-#include "qdoccommandlineparser.h"
-#include "qdocdatabase.h"
-#include "qdocglobals.h"
+#include "utilities.h"
#include "qtranslator.h"
#include "tokenizer.h"
#include "tree.h"
#include "webxmlgenerator.h"
+#include <QtCore/qcommandlineoption.h>
+#include <QtCore/qcommandlineparser.h>
+#include <QtCore/qdatetime.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qglobal.h>
+#include <QtCore/qglobalstatic.h>
+#include <QtCore/qhashfunctions.h>
+
#ifndef QT_BOOTSTRAPPED
-# include "qcoreapplication.h"
+# include <QtCore/qcoreapplication.h>
#endif
+#include <algorithm>
+#include <stdlib.h>
+
QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(lcQdoc, "qt.qdoc")
@@ -72,12 +72,11 @@ bool creationTimeBefore(const QFileInfo &fi1, const QFileInfo &fi2)
}
#ifndef QT_NO_TRANSLATION
-typedef QPair<QString, QTranslator*> Translator;
+typedef QPair<QString, QTranslator *> Translator;
static QList<Translator> translators;
#endif
static ClangCodeParser* clangParser_ = nullptr;
-static QDocGlobals qdocGlobals;
/*!
Read some XML indexes containing definitions from other
@@ -88,12 +87,12 @@ static QDocGlobals qdocGlobals;
a list of output formats; each format may have a different
output subdirectory where index files are located.
*/
-static void loadIndexFiles(Config& config, const QSet<QString> &formats)
+static void loadIndexFiles(Config &config, const QSet<QString> &formats)
{
- QDocDatabase* qdb = QDocDatabase::qdocDB();
+ QDocDatabase *qdb = QDocDatabase::qdocDB();
QStringList indexFiles;
- QStringList configIndexes = config.getStringList(CONFIG_INDEXES);
- foreach (const QString &index, configIndexes) {
+ const QStringList configIndexes = config.getStringList(CONFIG_INDEXES);
+ for (const auto &index : configIndexes) {
QFileInfo fi(index);
if (fi.exists() && fi.isFile())
indexFiles << index;
@@ -101,8 +100,8 @@ static void loadIndexFiles(Config& config, const QSet<QString> &formats)
Location::null.warning(QString("Index file not found: %1").arg(index));
}
- qdocGlobals.dependModules() += config.getStringList(CONFIG_DEPENDS);
- qdocGlobals.dependModules().removeDuplicates();
+ config.dependModules() += config.getStringList(CONFIG_DEPENDS);
+ config.dependModules().removeDuplicates();
QSet<QString> subDirs;
for (const auto &format : formats) {
@@ -116,41 +115,41 @@ static void loadIndexFiles(Config& config, const QSet<QString> &formats)
}
}
- if (qdocGlobals.dependModules().size() > 0) {
- if (qdocGlobals.indexDirs().size() > 0) {
- for (int i = 0; i < qdocGlobals.indexDirs().size(); i++) {
- if (qdocGlobals.indexDirs()[i].startsWith("..")) {
- const QString prefix(QDir(qdocGlobals.currentDir()).relativeFilePath(qdocGlobals.previousCurrentDir()));
+ if (config.dependModules().size() > 0) {
+ if (config.indexDirs().size() > 0) {
+ for (int i = 0; i < config.indexDirs().size(); i++) {
+ if (config.indexDirs()[i].startsWith("..")) {
+ const QString prefix(QDir(config.currentDir()).relativeFilePath(config.previousCurrentDir()));
if (!prefix.isEmpty())
- qdocGlobals.indexDirs()[i].prepend(prefix + QLatin1Char('/'));
+ config.indexDirs()[i].prepend(prefix + QLatin1Char('/'));
}
}
/*
Add all subdirectories of the indexdirs as dependModules,
when an asterisk is used in the 'depends' list.
*/
- if (qdocGlobals.dependModules().contains("*")) {
- qdocGlobals.dependModules().removeOne("*");
- for (int i = 0; i < qdocGlobals.indexDirs().size(); i++) {
- QDir scanDir = QDir(qdocGlobals.indexDirs()[i]);
+ if (config.dependModules().contains("*")) {
+ config.dependModules().removeOne("*");
+ for (int i = 0; i < config.indexDirs().size(); i++) {
+ QDir scanDir = QDir(config.indexDirs()[i]);
scanDir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
QFileInfoList dirList = scanDir.entryInfoList();
for (int j = 0; j < dirList.size(); j++) {
if (dirList[j].fileName().toLower() != config.getString(CONFIG_PROJECT).toLower())
- qdocGlobals.dependModules().append(dirList[j].fileName());
+ config.dependModules().append(dirList[j].fileName());
}
}
}
- for (int i = 0; i < qdocGlobals.dependModules().size(); i++) {
+ for (int i = 0; i < config.dependModules().size(); i++) {
QString indexToAdd;
QList<QFileInfo> foundIndices;
// Always look in module-specific subdir, even with *.nosubdirs config
- subDirs << qdocGlobals.dependModules()[i];
- for (int j = 0; j < qdocGlobals.indexDirs().size(); j++) {
+ subDirs << config.dependModules()[i];
+ for (int j = 0; j < config.indexDirs().size(); j++) {
for (const auto &subDir : subDirs) {
- QString fileToLookFor = qdocGlobals.indexDirs()[j]
+ QString fileToLookFor = config.indexDirs()[j]
+ QLatin1Char('/') + subDir
- + QLatin1Char('/') + qdocGlobals.dependModules()[i] + ".index";
+ + QLatin1Char('/') + config.dependModules()[i] + ".index";
if (QFile::exists(fileToLookFor)) {
QFileInfo tempFileInfo(fileToLookFor);
if (!foundIndices.contains(tempFileInfo))
@@ -158,7 +157,7 @@ static void loadIndexFiles(Config& config, const QSet<QString> &formats)
}
}
}
- subDirs.remove(qdocGlobals.dependModules()[i]);
+ subDirs.remove(config.dependModules()[i]);
std::sort(foundIndices.begin(), foundIndices.end(), creationTimeBefore);
if (foundIndices.size() > 1) {
/*
@@ -167,13 +166,14 @@ static void loadIndexFiles(Config& config, const QSet<QString> &formats)
highest UNIX timestamp.
*/
QStringList indexPaths;
- for (int k = 0; k < foundIndices.size(); k++)
- indexPaths << foundIndices[k].absoluteFilePath();
+ indexPaths.reserve(foundIndices.size());
+ for (const auto &found : qAsConst(foundIndices))
+ indexPaths << found.absoluteFilePath();
Location::null.warning(QString("Multiple index files found for dependency \"%1\":\n%2").arg(
- qdocGlobals.dependModules()[i], indexPaths.join('\n')));
+ config.dependModules()[i], indexPaths.join('\n')));
Location::null.warning(QString("Using %1 as index file for dependency \"%2\"").arg(
foundIndices[foundIndices.size() - 1].absoluteFilePath(),
- qdocGlobals.dependModules()[i]));
+ config.dependModules()[i]));
indexToAdd = foundIndices[foundIndices.size() - 1].absoluteFilePath();
}
else if (foundIndices.size() == 1) {
@@ -185,7 +185,7 @@ static void loadIndexFiles(Config& config, const QSet<QString> &formats)
}
else {
Location::null.warning(QString("\"%1\" Cannot locate index file for dependency \"%2\"").arg(
- config.getString(CONFIG_PROJECT), qdocGlobals.dependModules()[i]));
+ config.getString(CONFIG_PROJECT), config.dependModules()[i]));
}
}
}
@@ -197,37 +197,13 @@ static void loadIndexFiles(Config& config, const QSet<QString> &formats)
}
/*!
- Processes the qdoc config file \a fileName. This is the
- controller for all of qdoc.
+ Processes the qdoc config file \a fileName. This is the controller for all
+ of QDoc. The \a config instance represents the configuration data for QDoc.
+ All other classes are initialized with the same config.
*/
-static void processQdocconfFile(const QString &fileName)
+static void processQdocconfFile(const QString &fileName, Config &config)
{
- /*
- The Config instance represents the configuration data for qdoc.
- All the other classes are initialized with the config. Below, we
- initialize the configuration with some default values.
-
- I don't think the call to translate() does anything here. For one
- thing, the translators haven't been installed at this point. And
- I doubt any translator would translate QDoc anyway. But I left it
- here because it does no harm.
- */
- Config config(QCoreApplication::translate("QDoc", "qdoc"));
-
- QHash<QString,QString>::iterator iter;
- for (iter = qdocGlobals.defaults().begin(); iter != qdocGlobals.defaults().end(); ++iter)
- config.setStringList(iter.key(), QStringList() << iter.value());
-
- config.setStringList(CONFIG_SYNTAXHIGHLIGHTING, QStringList(qdocGlobals.highlighting() ? "true" : "false"));
- config.setStringList(CONFIG_SHOWINTERNAL, QStringList(qdocGlobals.showInternal() ? "true" : "false"));
- config.setStringList(CONFIG_SINGLEEXEC, QStringList(qdocGlobals.singleExec() ? "true" : "false"));
- config.setStringList(CONFIG_WRITEQAPAGES, QStringList(qdocGlobals.writeQaPages() ? "true" : "false"));
- config.setStringList(CONFIG_REDIRECTDOCUMENTATIONTODEVNULL, QStringList(qdocGlobals.redirectDocumentationToDevNull() ? "true" : "false"));
- config.setStringList(CONFIG_NOLINKERRORS, QStringList(qdocGlobals.noLinkErrors() ? "true" : "false"));
- config.setStringList(CONFIG_AUTOLINKERRORS, QStringList(qdocGlobals.autolinkErrors() ? "true" : "false"));
- config.setStringList(CONFIG_OBSOLETELINKS, QStringList(qdocGlobals.obsoleteLinks() ? "true" : "false"));
-
- qdocGlobals.setPreviousCurrentDir(QDir::currentPath());
+ config.setPreviousCurrentDir(QDir::currentPath());
/*
With the default configuration values in place, load
@@ -241,23 +217,15 @@ static void processQdocconfFile(const QString &fileName)
Location::initialize(config);
config.load(fileName);
QString project = config.getString(CONFIG_PROJECT);
- QString moduleHeader = config.getString(CONFIG_MODULEHEADER);
if (project.isEmpty()) {
Location::logToStdErrAlways(QLatin1String("qdoc can't run; no project set in qdocconf file"));
exit(1);
}
- /*
- Add the defines to the configuration variables.
- */
- QStringList defs = qdocGlobals.defines() + config.getStringList(CONFIG_DEFINES);
- config.setStringList(CONFIG_DEFINES,defs);
- QStringList incs = qdocGlobals.includesPaths() + config.getStringList(CONFIG_INCLUDEPATHS);
- config.setStringList(CONFIG_INCLUDEPATHS, incs);
Location::terminate();
- qdocGlobals.setCurrentDir(QFileInfo(fileName).path());
- if (!qdocGlobals.currentDir().isEmpty())
- QDir::setCurrent(qdocGlobals.currentDir());
+ config.setCurrentDir(QFileInfo(fileName).path());
+ if (!config.currentDir().isEmpty())
+ QDir::setCurrent(config.currentDir());
QString phase = " in ";
if (Generator::singleExec())
@@ -271,7 +239,10 @@ static void processQdocconfFile(const QString &fileName)
QString msg = "Start qdoc for " + config.getString(CONFIG_PROJECT) + phase;
Location::logToStdErrAlways(msg);
-
+ if (config.getDebug()) {
+ Utilities::startDebugging(QString("command line"));
+ qCDebug(lcQdoc).noquote() << "Arguments:" << QCoreApplication::arguments();
+ }
/*
Initialize all the classes and data structures with the
qdoc configuration. This is safe to do for each qdocconf
@@ -318,8 +289,6 @@ static void processQdocconfFile(const QString &fileName)
}
#endif
- //QSet<QString> outputLanguages = config.getStringSet(CONFIG_OUTPUTLANGUAGES);
-
/*
Get the source language (Cpp) from the configuration
and the location in the configuration file where the
@@ -337,7 +306,7 @@ static void processQdocconfFile(const QString &fileName)
Note: qdocDB() allocates a new instance only if no instance exists.
So it is safe to call qdocDB() any time.
*/
- QDocDatabase* qdb = QDocDatabase::qdocDB();
+ QDocDatabase *qdb = QDocDatabase::qdocDB();
qdb->setVersion(config.getString(CONFIG_VERSION));
qdb->setShowInternal(config.getBool(CONFIG_SHOWINTERNAL));
qdb->setSingleExec(config.getBool(CONFIG_SINGLEEXEC));
@@ -360,17 +329,19 @@ static void processQdocconfFile(const QString &fileName)
qdb->newPrimaryTree(project);
else
qdb->setPrimaryTree(project);
+
+ const QString moduleHeader = config.getString(CONFIG_MODULEHEADER);
if (!moduleHeader.isNull())
clangParser_->setModuleHeader(moduleHeader);
else
clangParser_->setModuleHeader(project);
- qdocGlobals.dependModules() = config.getStringList(CONFIG_DEPENDS);
- qdocGlobals.dependModules().removeDuplicates();
- qdb->setSearchOrder(qdocGlobals.dependModules());
+ config.dependModules() = config.getStringList(CONFIG_DEPENDS);
+ config.dependModules().removeDuplicates();
+ qdb->setSearchOrder(config.dependModules());
// Store the title of the index (landing) page
- NamespaceNode* root = qdb->primaryTreeRoot();
+ NamespaceNode *root = qdb->primaryTreeRoot();
if (root) {
QString title = config.getString(CONFIG_NAVIGATION
+ Config::dot
@@ -380,8 +351,10 @@ static void processQdocconfFile(const QString &fileName)
+ CONFIG_LANDINGTITLE, title));
}
- QSet<QString> excludedDirs = QSet<QString>::fromList(config.getCanonicalPathList(CONFIG_EXCLUDEDIRS));
- QSet<QString> excludedFiles = QSet<QString>::fromList(config.getCanonicalPathList(CONFIG_EXCLUDEFILES));
+ const auto &excludedDirList = config.getCanonicalPathList(CONFIG_EXCLUDEDIRS);
+ QSet<QString> excludedDirs = QSet<QString>(excludedDirList.cbegin(), excludedDirList.cend());
+ const auto &excludedFilesList = config.getCanonicalPathList(CONFIG_EXCLUDEFILES);
+ QSet<QString> excludedFiles = QSet<QString>(excludedFilesList.cbegin(), excludedFilesList.cend());
qCDebug(lcQdoc, "Adding doc/image dirs found in exampledirs to imagedirs");
QSet<QString> exampleImageDirs;
@@ -496,7 +469,7 @@ static void processQdocconfFile(const QString &fileName)
qCDebug(lcQdoc, "Generating docs");
QSet<QString>::ConstIterator of = outputFormats.constBegin();
while (of != outputFormats.constEnd()) {
- Generator* generator = Generator::generatorForFormat(*of);
+ Generator *generator = Generator::generatorForFormat(*of);
if (generator == nullptr)
outputFormatsLocation.fatal(QCoreApplication::translate("QDoc",
"Unknown output format '%1'").arg(*of));
@@ -504,15 +477,11 @@ static void processQdocconfFile(const QString &fileName)
generator->generateDocs();
++of;
}
-#if 0
- if (Generator::generating() && Generator::writeQaPages())
- qdb->printLinkCounts(project);
-#endif
qdb->clearLinkCounts();
qCDebug(lcQdoc, "Terminating qdoc classes");
- if (Generator::debugging())
- Generator::stopDebugging(project);
+ if (Utilities::debugging())
+ Utilities::stopDebugging(project);
msg = "End qdoc for " + config.getString(CONFIG_PROJECT) + phase;
Location::logToStdErrAlways(msg);
@@ -523,7 +492,7 @@ static void processQdocconfFile(const QString &fileName)
Doc::terminate();
Tokenizer::terminate();
Location::terminate();
- QDir::setCurrent(qdocGlobals.previousCurrentDir());
+ QDir::setCurrent(config.previousCurrentDir());
qCDebug(lcQdoc, "qdoc classes terminated");
}
@@ -554,8 +523,14 @@ int main(int argc, char **argv)
/*
Create code markers for plain text, C++,
javascript, and QML.
+
+ The plain CodeMarker must be instantiated first because it is used as
+ fallback when the other markers cannot be used.
+
+ Each marker instance is prepended to the CodeMarker::markers list by the
+ base class constructor.
*/
- PlainCodeMarker plainMarker;
+ CodeMarker fallbackMarker;
CppCodeMarker cppMarker;
JsCodeMarker jsMarker;
QmlCodeMarker qmlMarker;
@@ -563,36 +538,34 @@ int main(int argc, char **argv)
HtmlGenerator htmlGenerator;
WebXMLGenerator webXMLGenerator;
- // Set the globals declared at the top of this file:
- QDocCommandLineParser parser;
- parser.process(app, qdocGlobals);
+ Config config(QCoreApplication::translate("QDoc", "qdoc"), app.arguments());
// Get the list of files to act on:
- QStringList qdocFiles = parser.positionalArguments();
+ QStringList qdocFiles = config.qdocFiles();
if (qdocFiles.isEmpty())
- parser.showHelp();
+ config.showHelp();
- if (qdocGlobals.singleExec())
+ if (config.singleExec())
qdocFiles = Config::loadMaster(qdocFiles.at(0));
if (Generator::singleExec()) {
// single qdoc process for prepare and generate phases
Generator::setQDocPass(Generator::Prepare);
- foreach (const QString &qf, qdocFiles) {
- qdocGlobals.dependModules().clear();
- processQdocconfFile(qf);
+ for (const auto &file : qAsConst(qdocFiles)) {
+ config.dependModules().clear();
+ processQdocconfFile(file, config);
}
Generator::setQDocPass(Generator::Generate);
QDocDatabase::qdocDB()->processForest();
- foreach (const QString &qf, qdocFiles) {
- qdocGlobals.dependModules().clear();
- processQdocconfFile(qf);
+ for (const auto &file : qAsConst(qdocFiles)) {
+ config.dependModules().clear();
+ processQdocconfFile(file, config);
}
} else {
// separate qdoc processes for prepare and generate phases
- foreach (const QString &qf, qdocFiles) {
- qdocGlobals.dependModules().clear();
- processQdocconfFile(qf);
+ for (const auto &file : qAsConst(qdocFiles)) {
+ config.dependModules().clear();
+ processQdocconfFile(file, config);
}
}
diff --git a/src/qdoc/node.cpp b/src/qdoc/node.cpp
index c840c748d..839dd1336 100644
--- a/src/qdoc/node.cpp
+++ b/src/qdoc/node.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -27,21 +27,48 @@
****************************************************************************/
#include "node.h"
-#include "tree.h"
+
#include "codemarker.h"
#include "cppcodeparser.h"
-#include <quuid.h>
-#include "qdocdatabase.h"
-#include <qdebug.h>
#include "generator.h"
-#include "tokenizer.h"
#include "puredocparser.h"
+#include "qdocdatabase.h"
+#include "tokenizer.h"
+#include "tree.h"
+
+#include <QtCore/qdebug.h>
+#include <QtCore/quuid.h>
+
+#include <algorithm>
QT_BEGIN_NAMESPACE
int Node::propertyGroupCount_ = 0;
QStringMap Node::operators_;
-QMap<QString,Node::NodeType> Node::goals_;
+QMap<QString, Node::NodeType> Node::goals_;
+
+/*!
+ \class Node
+ \brief The Node class is the base class for all the nodes in QDoc's parse tree.
+
+ Class Node is the base class of all the node subclasses. There is a subclass of Node
+ for each type of entity that QDoc can document. The types of entities that QDoc can
+ document are listed in the enum type NodeType.
+
+ After ClangCodeParser has parsed all the header files to build its precompiled header,
+ it then visits the clang Abstract Syntax Tree (AST). For each node in the AST that it
+ determines is in the public API and must be documented, it creates an instance of one
+ of the Node subclasses and adds it to the QDoc Tree.
+
+ Each instance of a sublass of Node has a parent pointer to link it into the Tree. The
+ parent pointer is obtained by calling \l {parent()}, which returns a pointer to an
+ instance of the Node subclass, Aggregate, which is never instantiated directly, but
+ as the base class for certain subclasses of Node that can have children. For example,
+ ClassNode and QmlTypeNode can have children, so they both inherit Aggregate, while
+ PropertyNode and QmlPropertyNode can not have children, so they both inherit Node.
+
+ \sa Aggregate, ClassNode, PropertyNode
+ */
/*!
Initialize the map of search goals. This is called once
@@ -132,8 +159,8 @@ bool Node::changeType(NodeType from, NodeType to)
bool Node::nodeNameLessThan(const Node *n1, const Node *n2)
{
if (n1->isPageNode() && n2->isPageNode()) {
- const PageNode* f1 = static_cast<const PageNode*>(n1);
- const PageNode* f2 = static_cast<const PageNode*>(n2);
+ const PageNode *f1 = static_cast<const PageNode *>(n1);
+ const PageNode *f2 = static_cast<const PageNode *>(n2);
if (f1->fullTitle() < f2->fullTitle())
return true;
else if (f1->fullTitle() > f2->fullTitle())
@@ -141,8 +168,8 @@ bool Node::nodeNameLessThan(const Node *n1, const Node *n2)
}
if (n1->isFunction() && n2->isFunction()) {
- const FunctionNode* f1 = static_cast<const FunctionNode*>(n1);
- const FunctionNode* f2 = static_cast<const FunctionNode*>(n2);
+ const FunctionNode *f1 = static_cast<const FunctionNode *>(n1);
+ const FunctionNode *f2 = static_cast<const FunctionNode *>(n2);
if (f1->isConst() < f2->isConst())
return true;
@@ -179,20 +206,404 @@ bool Node::nodeNameLessThan(const Node *n1, const Node *n2)
}
/*!
- \class Node
- \brief The Node class is a node in the Tree.
+ \enum Node::NodeType
+
+ An unsigned char value that identifies an object as a
+ particular subclass of Node.
+
+ \value NoType The node type has not been set yet.
+ \value Namespace The Node subclass is NamespaceNode, which represents a C++
+ namespace.
+ \value Class The Node subclass is ClassNode, which represents a C++ class.
+ \value Struct The Node subclass is ClassNode, which represents a C struct.
+ \value Union The Node subclass is ClassNode, which represents a C union
+ (currently no known uses).
+ \value HeaderFile The Node subclass is HeaderNode, which represents a header
+ file.
+ \value Page The Node subclass is PageNode, which represents a text page from
+ a .qdoc file.
+ \value Enum The Node subclass is EnumNode, which represents an enum type or
+ enum class.
+ \value Example The Node subclass is ExampleNode, which represents an example
+ subdirectory.
+ \value ExternalPage The Node subclass is ExternalPageNode, which is for
+ linking to an external page.
+ \value Function The Node subclass is FunctionNode, which can represent C++,
+ QML, and Javascript functions.
+ \value Typedef The Node subclass is TypedefNode, which represents a C++
+ typedef.
+ \value Property The Node subclass is PropertyNode, which represents a use of
+ Q_Property.
+ \value Variable The Node subclass is VariableNode, which represents a global
+ variable or class data member.
+ \value Group The Node subclass is CollectionNode, which represents a group of
+ documents.
+ \value Module The Node subclass is CollectionNode, which represents a C++
+ module.
+ \value QmlType The Node subclass is QmlTypeNode, which represents a QML type.
+ \value QmlModule The Node subclass is CollectionNode, which represents a QML
+ module.
+ \value QmlProperty The Node subclass is QmlPropertyNode, which represents a
+ property in a QML type.
+ \value QmlBasicType The Node subclass is QmlBasicTypeNode, which represents a
+ basic type like int, etc.
+ \value JsType The Node subclass is QmlTypeNode, which represents a javascript
+ type.
+ \value JsModule The Node subclass is CollectionNode, which represents a
+ javascript module.
+ \value JsProperty The Node subclass is QmlPropertyNode, which represents a
+ javascript property.
+ \value JsBasicType The Node subclass is QmlBasicTypeNode, which represents a
+ basic type like int, etc.
+ \value SharedComment The Node subclass is SharedCommentNode, which represents
+ a collection of nodes that share the same documentation comment.
+ \omitvalue Collection
+ \value Proxy The Node subclass is ProxyNode, which represents one or more
+ entities that are documented in the current module but which actually
+ reside in a different module.
+ \omitvalue LastType
+*/
+
+/*!
+ \enum Node::Genus
+
+ An unsigned char value that specifies whether the Node represents a
+ C++ element, a QML element, a javascript element, or a text document.
+ The Genus values are also passed to search functions to specify the
+ Genus of Tree Node that can satisfy the search.
+
+ \value DontCare The Genus is not specified. Used when calling Tree search functions to indicate
+ the search can accept any Genus of Node.
+ \value CPP The Node represents a C++ element.
+ \value JS The Node represents a javascript element.
+ \value QML The Node represents a QML element.
+ \value DOC The Node represents a text document.
+*/
+
+/*!
+ \enum Node::Access
+
+ An unsigned char value that indicates the C++ access level.
+
+ \value Public The element has public access.
+ \value Protected The element has protected access.
+ \value Private The element has private access.
+*/
+
+/*!
+ \enum Node::Status
- A Node represents a class or function or something else
- from the source code..
+ An unsigned char that specifies the status of the documentation element in
+ the documentation set.
+
+ \value Obsolete The element is obsolete and no longer exists in the software.
+ \value Deprecated The element has been deprecated but still exists in the software.
+ \value Preliminary The element is new; the documentation is preliminary.
+ \value Active The element is current.
+ \value Internal The element is for internal use only, not to be published.
+ \value DontDocument The element is not to be documented.
+*/
+
+/*!
+ \enum Node::ThreadSafeness
+
+ An unsigned char that specifies the degree of thread-safeness of the element.
+
+ \value UnspecifiedSafeness The thread-safeness is not specified.
+ \value NonReentrant The element is not reentrant.
+ \value Reentrant The element is reentrant.
+ \value ThreadSafe The element is threadsafe.
+*/
+
+/*!
+ \enum Node::LinkType
+
+ An unsigned char value that probably should be moved out of the Node base class.
+
+ \value StartLink
+ \value NextLink
+ \value PreviousLink
+ \value ContentsLink
*/
/*!
- The destructor does nothing.
+ \enum Node::PageType
+
+ An unsigned char value that indicates what kind of documentation page
+ the Node represents. I think it is not very useful anymore.
+
+ \value NoPageType
+ \value AttributionPage
+ \value ApiPage
+ \value ArticlePage
+ \value ExamplePage
+ \value HowToPage
+ \value OverviewPage
+ \value TutorialPage
+ \value FAQPage
+ \omitvalue OnBeyondZebra
+*/
+
+/*!
+ \enum Node::FlagValue
+
+ A value used in PropertyNode and QmlPropertyNode that can be -1, 0, or +1.
+ Properties and QML properties have flags, which can be 0 or 1, false or true,
+ or not set. FlagValueDefault is the not set value. In other words, if a flag
+ is set to FlagValueDefault, the meaning is the flag has not been set.
+
+ \value FlagValueDefault -1 Not set.
+ \value FlagValueFalse 0 False.
+ \value FlagValueTrue 1 True.
+*/
+
+/*!
+ \fn Node::~Node()
+
+ The default destructor is virtual so any subclass of Node can be
+ deleted by deleting a pointer to Node.
+ */
+
+/*! \fn bool Node::isActive() const
+ Returns true if this node's status is \c Active.
+ */
+
+/*! \fn bool Node::isAnyType() const
+ Always returns true. I'm not sure why this is here.
+ */
+
+/*! \fn bool Node::isClass() const
+ Returns true if the node type is \c Class.
+ */
+
+/*! \fn bool Node::isCppNode() const
+ Returns true if this node's Genus value is \c CPP.
+ */
+
+/*! \fn bool Node::isDeprecated() const
+ Returns true if this node's status is \c Deprecated.
+ */
+
+/*! \fn bool Node::isDontDocument() const
+ Returns true if this node's status is \c DontDocument.
+ */
+
+/*! \fn bool Node::isEnumType() const
+ Returns true if the node type is \c Enum.
+ */
+
+/*! \fn bool Node::isExample() const
+ Returns true if the node type is \c Example.
+ */
+
+/*! \fn bool Node::isExternalPage() const
+ Returns true if the node type is \c ExternalPage.
+ */
+
+/*! \fn bool Node::isFunction(Genus g = DontCare) const
+ Returns true if this is a FunctionNode and its Genus is set to \a g.
+ */
+
+/*! \fn bool Node::isGroup() const
+ Returns true if the node type is \c Group.
+ */
+
+/*! \fn bool Node::isHeader() const
+ Returns true if the node type is \c HeaderFile.
+ */
+
+/*! \fn bool Node::isIndexNode() const
+ Returns true if this node was created from something in an index file.
+ */
+
+/*! \fn bool Node::isJsBasicType() const
+ Returns true if the node type is \c JsBasicType.
+ */
+
+/*! \fn bool Node::isJsModule() const
+ Returns true if the node type is \c JsModule.
+ */
+
+/*! \fn bool Node::isJsNode() const
+ Returns true if this node's Genus value is \c JS.
+ */
+
+/*! \fn bool Node::isJsProperty() const
+ Returns true if the node type is \c JsProperty.
+ */
+
+/*! \fn bool Node::isJsType() const
+ Returns true if the node type is \c JsType.
+ */
+
+/*! \fn bool Node::isModule() const
+ Returns true if the node type is \c Module.
+ */
+
+/*! \fn bool Node::isNamespace() const
+ Returns true if the node type is \c Namespace.
+ */
+
+/*! \fn bool Node::isObsolete() const
+ Returns true if this node's status is \c Obsolete.
+ */
+
+/*! \fn bool Node::isPage() const
+ Returns true if the node type is \c Page.
+ */
+
+/*! \fn bool Node::isPreliminary() const
+ Returns true if this node's status is \c Preliminary.
+ */
+
+/*! \fn bool Node::isPrivate() const
+ Returns true if this node's access is \c Private.
+ */
+
+/*! \fn bool Node::isProperty() const
+ Returns true if the node type is \c Property.
+ */
+
+/*! \fn bool Node::isProxyNode() const
+ Returns true if the node type is \c Proxy.
+ */
+
+/*! \fn bool Node::isPublic() const
+ Returns true if this node's access is \c Public.
*/
-Node::~Node()
-{
- // nothing.
-}
+
+/*! \fn bool Node::isProtected() const
+ Returns true if this node's access is \c Protected.
+ */
+
+/*! \fn bool Node::isQmlBasicType() const
+ Returns true if the node type is \c QmlBasicType.
+ */
+
+/*! \fn bool Node::isQmlModule() const
+ Returns true if the node type is \c QmlModule.
+ */
+
+/*! \fn bool Node::isQmlNode() const
+ Returns true if this node's Genus value is \c QML.
+ */
+
+/*! \fn bool Node::isQmlProperty() const
+ Returns true if the node type is \c QmlProperty.
+ */
+
+/*! \fn bool Node::isQmlType() const
+ Returns true if the node type is \c QmlType.
+ */
+
+/*! \fn bool Node::isRelatedNonmember() const
+ Returns true if this is a related nonmember of something.
+ */
+
+/*! \fn bool Node::isStruct() const
+ Returns true if the node type is \c Struct.
+ */
+
+/*! \fn bool Node::isSharedCommentNode() const
+ Returns true if the node type is \c SharedComment.
+ */
+
+/*! \fn bool Node::isTypeAlias() const
+ Returns true if the node type is \c Typedef.
+ */
+
+/*! \fn bool Node::isTypedef() const
+ Returns true if the node type is \c Typedef.
+ */
+
+/*! \fn bool Node::isUnion() const
+ Returns true if the node type is \c Union.
+ */
+
+/*! \fn bool Node::isVariable() const
+ Returns true if the node type is \c Variable.
+ */
+
+/*! \fn bool Node::isGenericCollection() const
+ Returns true if the node type is \c Collection.
+ */
+
+/*! \fn bool Node::isAbstract() const
+ Returns true if the ClassNode or QmlTypeNode is marked abstract.
+*/
+
+/*! \fn bool Node::isAggregate() const
+ Returns true if this node is an aggregate, which means it
+ inherits Aggregate and can therefore have children.
+*/
+
+/*! \fn bool Node::isFirstClassAggregate() const
+ Returns true if this Node is an Aggregate but not a ProxyNode.
+*/
+
+/*! \fn bool Node::isAlias() const
+ Returns true if this QML property is marked as an alias.
+*/
+
+/*! \fn bool Node::isAttached() const
+ Returns true if the QML property or QML method node is marked as attached.
+*/
+
+/*! \fn bool Node::isClassNode() const
+ Returns true if this is an instance of ClassNode.
+*/
+
+/*! \fn bool Node::isCollectionNode() const
+ Returns true if this is an instance of CollectionNode.
+*/
+
+/*! \fn bool Node::isDefault() const
+ Returns true if the QML property node is marked as default.
+*/
+
+/*! \fn bool Node::isMacro() const
+ returns true if either FunctionNode::isMacroWithParams() or
+ FunctionNode::isMacroWithoutParams() returns true.
+*/
+
+/*! \fn bool Node::isPageNode() const
+ Returns true if this node represents something that generates a documentation
+ page. In other words, if this Node's subclass inherits PageNode, then this
+ function will return \e true.
+*/
+
+/*! \fn bool Node::isQtQuickNode() const
+ Returns true if this node represents a QML element in the QtQuick module.
+*/
+
+/*! \fn bool Node::isReadOnly() const
+ Returns true if the QML property node is marked as a read-only property.
+*/
+
+/*! \fn bool Node::isRelatableType() const
+ Returns true if this node is something you can relate things to with
+ the \e relates command. NamespaceNode, ClassNode, HeaderNode, and
+ ProxyNode are relatable types.
+*/
+
+/*! \fn bool Node::isMarkedReimp() const
+ Returns true if the FunctionNode is marked as a reimplemented function.
+ That means it is virtual in the base class and it is reimplemented in
+ the subclass.
+*/
+
+/*! \fn bool Node::isPropertyGroup() const
+ Returns true if the node is a SharedCommentNode for documenting
+ multiple C++ properties or multiple QML properties.
+*/
+
+/*! \fn bool Node::isStatic() const
+ Returns true if the FunctionNode represents a static function.
+*/
+
+/*! \fn bool Node::isTextPageNode() const
+ Returns true if the node is a PageNode but not an Aggregate.
+*/
/*!
Returns this node's name member. Appends "()" to the returned
@@ -213,13 +624,13 @@ QString Node::plainName() const
\a relative. Almost all calls to this function pass 0 for
\a relative.
*/
-QString Node::plainFullName(const Node* relative) const
+QString Node::plainFullName(const Node *relative) const
{
if (name_.isEmpty())
return QLatin1String("global");
QString fullName;
- const Node* node = this;
+ const Node *node = this;
while (node) {
fullName.prepend(node->plainName());
if (node->parent() == relative || node->parent()->name().isEmpty())
@@ -242,7 +653,7 @@ QString Node::plainSignature() const
return QLatin1String("global");
QString fullName;
- const Node* node = this;
+ const Node *node = this;
while (node) {
fullName.prepend(node->signature(false, true));
if (node->parent()->name().isEmpty())
@@ -254,9 +665,11 @@ QString Node::plainSignature() const
}
/*!
- Constructs and returns this node's full name.
+ Constructs and returns this node's full name. The full name is
+ often just the title(). When it is not the title, it is the
+ plainFullName().
*/
-QString Node::fullName(const Node* relative) const
+QString Node::fullName(const Node *relative) const
{
if ((isTextPageNode() || isGroup()) && !title().isEmpty())
return title();
@@ -268,7 +681,7 @@ QString Node::fullName(const Node* relative) const
If a match is found, return true. If no match is found,
return false.
*/
-bool Node::match(const QList<int>& types) const
+bool Node::match(const QList<int> &types) const
{
for (int i=0; i<types.size(); ++i) {
if (nodeType() == types.at(i))
@@ -285,7 +698,7 @@ bool Node::match(const QList<int>& types) const
previous Doc was found. If \a replace is true, the Doc is
replaced silently.
*/
-void Node::setDoc(const Doc& doc, bool replace)
+void Node::setDoc(const Doc &doc, bool replace)
{
if (!doc_.isEmpty() && !replace && !doc.isMarkedReimp()) {
doc.location().warning(tr("Overrides a previous doc"));
@@ -299,7 +712,7 @@ void Node::setDoc(const Doc& doc, bool replace)
given \a parent and \a name. The new node is added to the
parent's child list.
*/
-Node::Node(NodeType type, Aggregate *parent, const QString& name)
+Node::Node(NodeType type, Aggregate *parent, const QString &name)
: nodeType_(type),
access_(Public),
safeness_(UnspecifiedSafeness),
@@ -316,48 +729,48 @@ Node::Node(NodeType type, Aggregate *parent, const QString& name)
parent_->addChild(this);
outSubDir_ = Generator::outputSubdir();
if (operators_.isEmpty()) {
- operators_.insert("++","inc");
- operators_.insert("--","dec");
- operators_.insert("==","eq");
- operators_.insert("!=","ne");
- operators_.insert("<<","lt-lt");
- operators_.insert(">>","gt-gt");
- operators_.insert("+=","plus-assign");
- operators_.insert("-=","minus-assign");
- operators_.insert("*=","mult-assign");
- operators_.insert("/=","div-assign");
- operators_.insert("%=","mod-assign");
- operators_.insert("&=","bitwise-and-assign");
- operators_.insert("|=","bitwise-or-assign");
- operators_.insert("^=","bitwise-xor-assign");
- operators_.insert("<<=","bitwise-left-shift-assign");
- operators_.insert(">>=","bitwise-right-shift-assign");
- operators_.insert("||","logical-or");
- operators_.insert("&&","logical-and");
- operators_.insert("()","call");
- operators_.insert("[]","subscript");
- operators_.insert("->","pointer");
- operators_.insert("->*","pointer-star");
- operators_.insert("+","plus");
- operators_.insert("-","minus");
- operators_.insert("*","mult");
- operators_.insert("/","div");
- operators_.insert("%","mod");
- operators_.insert("|","bitwise-or");
- operators_.insert("&","bitwise-and");
- operators_.insert("^","bitwise-xor");
- operators_.insert("!","not");
- operators_.insert("~","bitwise-not");
- operators_.insert("<=","lt-eq");
- operators_.insert(">=","gt-eq");
- operators_.insert("<","lt");
- operators_.insert(">","gt");
- operators_.insert("=","assign");
- operators_.insert(",","comma");
- operators_.insert("delete[]","delete-array");
- operators_.insert("delete","delete");
- operators_.insert("new[]","new-array");
- operators_.insert("new","new");
+ operators_.insert("++", "inc");
+ operators_.insert("--", "dec");
+ operators_.insert("==", "eq");
+ operators_.insert("!=", "ne");
+ operators_.insert("<<", "lt-lt");
+ operators_.insert(">>", "gt-gt");
+ operators_.insert("+=", "plus-assign");
+ operators_.insert("-=", "minus-assign");
+ operators_.insert("*=", "mult-assign");
+ operators_.insert("/=", "div-assign");
+ operators_.insert("%=", "mod-assign");
+ operators_.insert("&=", "bitwise-and-assign");
+ operators_.insert("|=", "bitwise-or-assign");
+ operators_.insert("^=", "bitwise-xor-assign");
+ operators_.insert("<<=" ,"bitwise-left-shift-assign");
+ operators_.insert(">>=" ,"bitwise-right-shift-assign");
+ operators_.insert("||", "logical-or");
+ operators_.insert("&&", "logical-and");
+ operators_.insert("()", "call");
+ operators_.insert("[]", "subscript");
+ operators_.insert("->", "pointer");
+ operators_.insert("->*", "pointer-star");
+ operators_.insert("+", "plus");
+ operators_.insert("-", "minus");
+ operators_.insert("*", "mult");
+ operators_.insert("/", "div");
+ operators_.insert("%", "mod");
+ operators_.insert("|", "bitwise-or");
+ operators_.insert("&", "bitwise-and");
+ operators_.insert("^", "bitwise-xor");
+ operators_.insert("!", "not");
+ operators_.insert("~", "bitwise-not");
+ operators_.insert("<=", "lt-eq");
+ operators_.insert(">=", "gt-eq");
+ operators_.insert("<", "lt");
+ operators_.insert(">", "gt");
+ operators_.insert("=", "assign");
+ operators_.insert(",", "comma");
+ operators_.insert("delete[]", "delete-array");
+ operators_.insert("delete", "delete");
+ operators_.insert("new[]", "new-array");
+ operators_.insert("new", "new");
}
setPageType(getPageType(type));
setGenus(getGenus(type));
@@ -453,11 +866,22 @@ Node::Genus Node::getGenus(Node::NodeType t)
}
/*! \fn QString Node::url() const
- Returns the node's URL.
+ Returns the node's URL, which is the url of the documentation page
+ created for the node or the url of an external page if the node is
+ an ExternalPageNode. The url is used for generating a link to the
+ page the node represents.
+
+ \sa Node::setUrl()
*/
/*! \fn void Node::setUrl(const QString &url)
- Sets the node's URL to \a url
+ Sets the node's URL to \a url, which is the url to the page that the
+ node represents. This function is only called when an index file is
+ read. In other words, a node's url is set when qdoc decides where its
+ page will be and what its name will be, which happens when qdoc writes
+ the index file for the module being documented.
+
+ \sa QDocIndexFiles
*/
/*!
@@ -504,7 +928,7 @@ QString Node::pageTypeString(PageType t)
QString Node::nodeTypeString() const
{
if (isFunction()) {
- const FunctionNode *fn = static_cast<const FunctionNode*>(this);
+ const FunctionNode *fn = static_cast<const FunctionNode *>(this);
return fn->kindString();
}
return nodeTypeString(nodeType());
@@ -581,7 +1005,7 @@ QString Node::nodeTypeString(NodeType t)
/*!
Set the page type according to the string \a t.
*/
-void Node::setPageType(const QString& t)
+void Node::setPageType(const QString &t)
{
if ((t == "API") || (t == "api"))
pageType_ = ApiPage;
@@ -638,7 +1062,7 @@ bool Node::fromFlagValue(FlagValue fv, bool defaultValue)
*/
void Node::setLink(LinkType linkType, const QString &link, const QString &desc)
{
- QPair<QString,QString> linkPair;
+ QPair<QString, QString> linkPair;
linkPair.first = link;
linkPair.second = desc;
linkMap_[linkType] = linkPair;
@@ -699,34 +1123,6 @@ QString Node::extractClassName(const QString &string) const
}
/*!
- Returns a string representing the access specifier.
- */
-QString RelatedClass::accessString() const
-{
- switch (access_) {
- case Node::Protected:
- return QLatin1String("protected");
- case Node::Private:
- return QLatin1String("private");
- case Node::Public:
- default:
- break;
- }
- return QLatin1String("public");
-}
-
-/*!
- Returns the inheritance status.
- */
-Node::Status Node::inheritedStatus() const
-{
- Status parentStatus = Active;
- if (parent_)
- parentStatus = parent_->inheritedStatus();
- return qMin(status_, parentStatus);
-}
-
-/*!
Returns the thread safeness value for whatever this node
represents. But if this node has a parent and the thread
safeness value of the parent is the same as the thread
@@ -759,14 +1155,14 @@ Node::ThreadSafeness Node::inheritedThreadSafeness() const
pointer to its parent QMLor JS type node. Otherwise return
0;
*/
-QmlTypeNode* Node::qmlTypeNode()
+QmlTypeNode *Node::qmlTypeNode()
{
if (isQmlNode() || isJsNode()) {
- Node* n = this;
+ Node *n = this;
while (n && !(n->isQmlType() || n->isJsType()))
n = n->parent();
if (n && (n->isQmlType() || n->isJsType()))
- return static_cast<QmlTypeNode*>(n);
+ return static_cast<QmlTypeNode *>(n);
}
return nullptr;
}
@@ -778,17 +1174,17 @@ QmlTypeNode* Node::qmlTypeNode()
class node is a component. It will be non-null if
the QML class node is a QML element.
*/
-ClassNode* Node::declarativeCppNode()
+ClassNode *Node::declarativeCppNode()
{
- QmlTypeNode* qcn = qmlTypeNode();
+ QmlTypeNode *qcn = qmlTypeNode();
if (qcn)
return qcn->classNode();
return nullptr;
}
/*!
- Returns \c true if the node's status is Internal, or if its
- parent is a class with internal status.
+ Returns \c true if the node's status is \c Internal, or if
+ its parent is a class with \c Internal status.
*/
bool Node::isInternal() const
{
@@ -799,13 +1195,17 @@ bool Node::isInternal() const
return false;
}
+/*! \fn void Node::markInternal()
+ Sets the node's access to Private and its status to Internal.
+ */
+
/*!
Returns a pointer to the root of the Tree this node is in.
*/
Aggregate *Node::root() const
{
if (parent() == nullptr)
- return (this->isAggregate() ? static_cast<Aggregate*>(const_cast<Node*>(this)) : nullptr);
+ return (this->isAggregate() ? static_cast<Aggregate *>(const_cast<Node *>(this)) : nullptr);
Aggregate *t = parent();
while (t->parent() != nullptr)
t = t->parent();
@@ -839,15 +1239,6 @@ void Node::setLocation(const Location& t)
}
/*!
- Adds this node to the shared comment node \a t.
- */
-void Node::setSharedCommentNode(SharedCommentNode* t)
-{
- sharedCommentNode_ = t;
- t->append(this);
-}
-
-/*!
Returns true if this node is sharing a comment and the
shared comment is not empty.
*/
@@ -905,14 +1296,685 @@ QString Node::unqualifyQmlName()
}
/*!
+ Returns \c true if the node is a class node or a QML type node
+ that is marked as being a wrapper class or wrapper QML type,
+ or if it is a member of a wrapper class or type.
+ */
+bool Node::isWrapper() const
+{
+ return (parent_ ? parent_->isWrapper() : false);
+}
+
+/*!
+ Construct the full document name for this node and return it.
+ */
+QString Node::fullDocumentName() const
+{
+ QStringList pieces;
+ const Node *n = this;
+
+ do {
+ if (!n->name().isEmpty())
+ pieces.insert(0, n->name());
+
+ if ((n->isQmlType() || n->isJsType()) && !n->logicalModuleName().isEmpty()) {
+ pieces.insert(0, n->logicalModuleName());
+ break;
+ }
+
+ if (n->isTextPageNode())
+ break;
+
+ // Examine the parent if the node is a member
+ if (!n->parent() || n->isRelatedNonmember())
+ break;
+
+ n = n->parent();
+ } while (true);
+
+ // Create a name based on the type of the ancestor node.
+ QString concatenator = "::";
+ if (n->isQmlType() || n->isJsType())
+ concatenator = QLatin1Char('.');
+
+ if (n->isTextPageNode())
+ concatenator = QLatin1Char('#');
+
+ return pieces.join(concatenator);
+}
+
+/*!
+ Returns the \a str as an NCName, which means the name can
+ be used as the value of an \e id attribute. Search for NCName
+ on the internet for details of what can be an NCName.
+ */
+QString Node::cleanId(const QString &str)
+{
+ QString clean;
+ QString name = str.simplified();
+
+ if (name.isEmpty())
+ return clean;
+
+ name = name.replace("::", "-");
+ name = name.replace(QLatin1Char(' '), QLatin1Char('-'));
+ name = name.replace("()", "-call");
+
+ clean.reserve(name.size() + 20);
+ if (!str.startsWith("id-"))
+ clean = "id-";
+ const QChar c = name[0];
+ const uint u = c.unicode();
+
+ if ((u >= 'a' && u <= 'z') ||
+ (u >= 'A' && u <= 'Z') ||
+ (u >= '0' && u <= '9')) {
+ clean += c;
+ }
+ else if (u == '~') {
+ clean += "dtor.";
+ }
+ else if (u == '_') {
+ clean += "underscore.";
+ }
+ else {
+ clean += QLatin1Char('a');
+ }
+
+ for (int i = 1; i < (int) name.length(); i++) {
+ const QChar c = name[i];
+ const uint u = c.unicode();
+ if ((u >= 'a' && u <= 'z') ||
+ (u >= 'A' && u <= 'Z') ||
+ (u >= '0' && u <= '9') || u == '-' ||
+ u == '_' || u == '.') {
+ clean += c;
+ }
+ else if (c.isSpace() || u == ':' ) {
+ clean += QLatin1Char('-');
+ }
+ else if (u == '!') {
+ clean += "-not";
+ }
+ else if (u == '&') {
+ clean += "-and";
+ }
+ else if (u == '<') {
+ clean += "-lt";
+ }
+ else if (u == '=') {
+ clean += "-eq";
+ }
+ else if (u == '>') {
+ clean += "-gt";
+ }
+ else if (u == '#') {
+ clean += "-hash";
+ }
+ else if (u == '(') {
+ clean += QLatin1Char('-');
+ }
+ else if (u == ')') {
+ clean += QLatin1Char('-');
+ }
+ else {
+ clean += QLatin1Char('-');
+ clean += QString::number((int)u, 16);
+ }
+ }
+ return clean;
+}
+
+/*!
+ Find the module (Qt Core, Qt GUI, etc.) to which the class belongs.
+ We do this by obtaining the full path to the header file's location
+ and examine everything between "src/" and the filename. This is
+ semi-dirty because we are assuming a particular directory structure.
+
+ This function is only really useful if the class's module has not
+ been defined in the header file with a QT_MODULE macro or with an
+ \inmodule command in the documentation.
+ */
+QString Node::physicalModuleName() const
+{
+ if (!physicalModuleName_.isEmpty())
+ return physicalModuleName_;
+
+ QString path = location().filePath();
+ QString pattern = QString("src") + QDir::separator();
+ int start = path.lastIndexOf(pattern);
+
+ if (start == -1)
+ return QString();
+
+ QString moduleDir = path.mid(start + pattern.size());
+ int finish = moduleDir.indexOf(QDir::separator());
+
+ if (finish == -1)
+ return QString();
+
+ QString physicalModuleName = moduleDir.left(finish);
+
+ if (physicalModuleName == QLatin1String("corelib"))
+ return QLatin1String("QtCore");
+ else if (physicalModuleName == QLatin1String("uitools"))
+ return QLatin1String("QtUiTools");
+ else if (physicalModuleName == QLatin1String("gui"))
+ return QLatin1String("QtGui");
+ else if (physicalModuleName == QLatin1String("network"))
+ return QLatin1String("QtNetwork");
+ else if (physicalModuleName == QLatin1String("opengl"))
+ return QLatin1String("QtOpenGL");
+ else if (physicalModuleName == QLatin1String("svg"))
+ return QLatin1String("QtSvg");
+ else if (physicalModuleName == QLatin1String("sql"))
+ return QLatin1String("QtSql");
+ else if (physicalModuleName == QLatin1String("qtestlib"))
+ return QLatin1String("QtTest");
+ else if (moduleDir.contains("webkit"))
+ return QLatin1String("QtWebKit");
+ else if (physicalModuleName == QLatin1String("xml"))
+ return QLatin1String("QtXml");
+ else
+ return QString();
+}
+
+/*! \fn Node *Node::clone(Aggregate *parent)
+
+ When reimplemented in a subclass, this function creates a
+ clone of this node on the heap and makes the clone a child
+ of \a parent. A pointer to the clone is returned.
+
+ Here in the base class, this function does nothing and returns
+ nullptr.
+ */
+
+/*! \fn NodeType Node::nodeType() const
+ Returns this node's type.
+
+ \sa NodeType
+*/
+
+/*! \fn Genus Node::genus() const
+ Returns this node's Genus.
+
+ \sa Genus
+*/
+
+/*! void Node::setGenus(Genus t)
+ Sets this node's Genus to \a t.
+*/
+
+/*! \fn PageType Node::pageType() const
+ Returns this node's page type.
+
+ \sa PageType
+*/
+
+/*! \fn void Node::setPageType(PageType t)
+ Sets this node's page type to \a t.
+
+ \sa PageType
+*/
+
+/*! \fn QString Node::signature(bool values, bool noReturnType) const
+
+ If this node is a FunctionNode, this function returns the function's
+ signature, including default values if \a values is \c true, and
+ including the function's return type if \a noReturnType is \c false.
+
+ If this node is not a FunctionNode, this function returns plainName().
+*/
+
+/*! \fn const QString &Node::fileNameBase() const
+ Returns the node's file name base string, which is built once, when
+ Generator::fileBase() is called and stored in the Node.
+*/
+
+/*! \fn bool Node::hasFileNameBase() const
+ Returns true if the node's file name base has been set.
+
+ \sa Node::fileNameBase()
+*/
+
+/*! \fn void Node::setFileNameBase(const QString &t)
+ Sets the node's file name base to \a t. Only called by
+ Generator::fileBase().
+*/
+
+/*! \fn void Node::setAccess(Access t)
+ Sets the node's access type to \a t.
+
+ \sa Access
+*/
+
+/*! \fn void Node::setStatus(Status t)
+ Sets the node's status to \a t, except that once
+ the node's status has been set to \c Obsolete, it
+ can't be reset to \c Deprecated.
+
+ \sa Status
+*/
+
+/*! \fn void Node::setThreadSafeness(ThreadSafeness t)
+ Sets the node's thread safeness to \a t.
+
+ \sa ThreadSafeness
+*/
+
+/*! \fn void Node::setPhysicalModuleName(const QString &name)
+ Sets the node's physical module \a name.
+*/
+
+/*! \fn void Node::setTemplateStuff(const QString &t)
+ If the node represents a template class or member, this function
+ is called to save the text \a t of the template clause so it can
+ be reconstructed for the generated documentation.
+*/
+
+/*! \fn void Node::setReconstitutedBrief(const QString &t)
+ When reading an index file, this function is called with the
+ reconstituted brief clause \a t to set the node's brief clause.
+ I think this is needed for linking to something in the brief clause.
+*/
+
+/*! \fn void Node::setParent(Aggregate *n)
+ Sets the node's parent pointer to \a n. Such a thing
+ is not lightly done. All the calls to this function
+ are in other member functions of Node subclasses. See
+ the code in node.cpp to understand when this function
+ can be called safely and why it is called.
+*/
+
+/*! \fn void Node::setIndexNodeFlag(bool isIndexNode = true)
+ Sets a flag in this Node that indicates the node was created
+ for something in an index file. This is important to know
+ because an index node is not to be documented in the current
+ module. When the index flag is set, it means the Node
+ represents something in another module, and it will be
+ documented in that module's documentation.
+*/
+
+/*! \fn void Node::setRelatedNonmember(bool b)
+ Sets a flag in the node indicating whether this node is a related nonmember
+ of something. This function is called when the \c relates command is seen.
+ */
+
+/*! \fn void Node::setOutputFileName(const QString &f)
+ In a PageNode, this function sets the node's output file name to \a f.
+ In a non-PageNode, this function does nothing.
+ */
+
+/*! \fn void Node::addMember(Node *node)
+ In a CollectionNode, this function adds \a node to the collection
+ node's members list. It does nothing if this node is not a CollectionNode.
+ */
+
+/*! \fn bool Node::hasMembers() const
+ Returns \c true if this is a CollectionNode and its members list
+ is not empty. Otherwise it returns \c false.
+ */
+
+/*! \fn bool Node::hasNamespaces() const
+ Returns \c true if this is a CollectionNode and its members list
+ contains namespace nodes. Otherwise it returns \c false.
+ */
+
+/*! \fn bool Node::hasClasses() const
+ Returns \c true if this is a CollectionNode and its members list
+ contains class nodes. Otherwise it returns \c false.
+ */
+
+/*! \fn void Node::setAbstract(bool b)
+ If this node is a ClassNode or a QmlTypeNode, the node's abstract flag
+ data member is set to \a b.
+ */
+
+/*! \fn void Node::setWrapper()
+ If this node is a ClassNode or a QmlTypeNode, the node's wrapper flag
+ data member is set to \c true.
+ */
+
+/*! \fn void Node::getMemberNamespaces(NodeMap& out)
+ If this is a CollectionNode, \a out is loaded with all the collection
+ members that are namespaces.
+ */
+
+/*! \fn void getMemberClasses(NodeMap& out) const { }
+ If this is a CollectionNode, \a out is loaded with all the collection
+ members that are classes.
+ */
+
+/*! \fn void Node::setDataType(const QString &dataType)
+ If this node is a PropertyNode or a QmlPropertyNode, its
+ data type data member is set to \a dataType. Otherwise,
+ this function does nothing.
+ */
+
+/*! \fn bool Node::wasSeen() const
+ Returns the \c seen flag data member of this node if it is a NamespaceNode
+ or a CollectionNode. Otherwise it returns \c false. If \c true is returned,
+ it means that the location where the namespace or collection is to be
+ documented has been found.
+ */
+
+/*! \fn void appendGroupName(const QString &t)
+ If this node is a PageNode, the group name \a t is appended to the node's
+ list of group names. It is not clear to me what this list of group names
+ is used for, but it is written to the index file, and it is used in the
+ navigation bar.
+ */
+
+/*! \fn QString Node::element() const
+ If this node is a QmlPropertyNode or a FunctionNode, this function
+ returns the name of the parent node. Otherwise it returns an empty
+ string.
+ */
+
+/*! \fn void Node::setNoAutoList(bool b)
+ If this node is a PageNode, the node's \c {no autolist} flag is set to \a b.
+ Otherwise the function does nothing.
+ */
+
+/*! \fn bool Node::docMustBeGenerated() const
+ This function is called to perform a test to decide if the node must have
+ documentation generated. In the Node base class, it always returns \c false.
+
+ In the ProxyNode class it always returns \c true. There aren't many proxy
+ nodes, but when one appears, it must generate documentation. In the overrides
+ in NamespaceNode and ClassNode, a meaningful test is performed to decide if
+ documentation must be generated.
+ */
+
+/*! \fn QString Node::title() const
+ Returns a string that can be used to print a title in the documentation for
+ whatever this Node is. In the Node base class, the node's name() is returned.
+ In a PageNode, the function returns the title data member. In a HeaderNode,
+ if the title() is empty, the name() is returned.
+ */
+
+/*! \fn QString Node::subtitle() const { return QString(); }
+ Returns a string that can be used to print a subtitle in the documentation for
+ whatever this Node is. In the Node base class, the empty string is returned.
+ In a PageNode, the function returns the subtitle data member. In a HeaderNode,
+ the subtitle data member is returned.
+ */
+
+/*! \fn QString Node::fullTitle() const
+ Returns a string that can be used as the full title for the documentation of
+ this node. In this base class, the name() is returned. In a PageNode, title()
+ is returned. In a HeaderNode, if the title() is empty, the name() is returned.
+ If the title() is not empty then name-title is returned. In a CollectionNode,
+ the title() is returned.
+ */
+
+/*! \fn bool Node::setTitle(const QString &title)
+ Sets the node's \a title, which is used for the title of
+ the documentation page, if one is generated for this node.
+ Returns \c true if the title is set. In this base class,
+ there is no title string stored, so in the base class,
+ nothing happens and \c false is returned. The override in
+ the PageNode class is where the title is set.
+ */
+
+/*! \fn bool Node::setSubtitle(const QString &subtitle)
+ Sets the node's \a subtitle, which is used for the subtitle
+ of the documentation page, if one is generated for this node.
+ Returns \c true if the subtitle is set. In this base class,
+ there is no subtitle string stored, so in the base class,
+ nothing happens and \c false is returned. The override in
+ the PageNode and HeaderNode classes is where the subtitle is
+ set.
+ */
+
+/*! \fn void Node::markDefault()
+ If this node is a QmlPropertyNode, it is marked as the default property.
+ Otherwise the function does nothing.
+ */
+
+/*! \fn void Node::markReadOnly(bool flag)
+ If this node is a QmlPropertyNode, then the property's read-only
+ flag is set to \a flag.
+ */
+
+/*! \fn Aggregate *Node::parent() const
+ Returns the node's paprent pointer.
+*/
+
+/*! \fn const QString &Node::name() const
+ Returns the node's name data member.
+*/
+
+/*! \fn QString Node::nameForLists() const
+ If this node is a PageNode or a HeaderNode, title() is returned.
+ Otherwise name() is returned.
+ */
+
+/*! \fn QString Node::outputFileName() const
+ If this node is a PageNode, the name of the output file that will be
+ generated for the node is returned. Otherwise an empty string is returned.
+ */
+
+/*! \fn QString Node::obsoleteLink() const
+ If this node is a ClassNode or a QmlTypeNode, the link to the obsolete members
+ page is returned. Otherwise an empty string is returned.
+ */
+
+/*! \fn void Node::setObsoleteLink(const QString &t)
+ If this node is a ClassNode or a QmlTypeNode, the link to the obsolete members
+ page is set to \a t. Otherwise the function does nothing.
+ */
+
+/*! \fn void Node::setQtVariable(const QString &v)
+ If this node is a CollectionNode, its QT variable is set to \a v.
+ Otherwise the function does nothing. I don't know what the QT variable
+ is used for.
+ */
+
+/*! \fn QString Node::qtVariable() const
+ If this node is a CollectionNode, its QT variable is returned.
+ Otherwise an empty string is returned. I don't know what the QT
+ variable is used for.
+ */
+
+/*! \fn bool Node::hasTag(const QString &t) const
+ If this node is a FunctionNode, the function returns \c true if
+ the function has the tag \a t. Otherwise the function returns
+ \c false. I don't know what the tag is used for.
+ */
+
+/*! \fn const QMap<LinkType, QPair<QString, QString> > &Node::links() const
+ Returns a reference to this node's link map. The link map should
+ probably be moved to the PageNode, because it contains links to the
+ start page, next page, previous page, and contents page, and these
+ are only used in PageNode, I think.
+ */
+
+/*! \fn Access Node::access() const
+ Returns the node's Access setting, which can be \c Public,
+ \c Protected, or \c Private.
+ */
+
+/*! \fn const Location& Node::declLocation() const
+ Returns the Location where this node's declaration was seen.
+ Normally the declaration location is in an \e include file.
+ The declaration location is used in qdoc error/warning messages
+ about the declaration.
+ */
+
+/*! \fn const Location& Node::defLocation() const
+ Returns the Location where this node's dedefinition was seen.
+ Normally the definition location is in a \e .cpp file.
+ The definition location is used in qdoc error/warning messages
+ when the error is discovered at the location of the definition,
+ although the way to correct the problem often requires changing
+ the declaration.
+ */
+
+/*! \fn const Location& Node::location() const
+ If this node's definition location is empty, this function
+ returns this node's declaration location. Otherwise it
+ returns the definition location.
+
+ \sa Location
+ */
+
+/*! \fn const Doc &Node::doc() const
+ Returns a reference to the node's Doc data member.
+
+ \sa Doc
+ */
+
+/*! \fn bool Node::hasDoc() const
+ Returns \c true if the node has documentation, i.e. if its Doc
+ data member is not empty.
+
+ \sa Doc
+ */
+
+/*! \fn Status Node::status() const
+ Returns the node's status value.
+
+ \sa Status
+ */
+
+/*! \fn QString Node::since() const
+ Returns the node's since string, which can be empty.
+ */
+
+/*! \fn QString Node::templateStuff() const
+ Returns the node's template parameters string, if this node
+ represents a templated element.
+ */
+
+/*! \fn const QString &Node::reconstitutedBrief() const
+ Returns the node's reconstituted brief data member.
+ */
+
+/*! \fn void Node::addPageKeywords(const QString &t)
+ If this is a PageNode, the function appends the string \a t
+ to the page keywords data member. Otherwise the function does
+ nothing.
+ */
+
+/*! \fn bool Node::isSharingComment() const
+ This function returns \c true if the node is sharing a comment
+ with other nodes. For example, multiple functions can be documented
+ with a single qdoc comment by listing the \c {\\fn} signatures for
+ all the functions in the single qdoc comment.
+ */
+
+/*! \fn QString Node::qmlTypeName() const
+ If this is a QmlPropertyNode or a FunctionNode representing a QML
+ or javascript methos, this function returns the qmlTypeName() of
+ the parent() node. Otherwise it returns the name data member.
+ */
+
+/*! \fn QString Node::qmlFullBaseName() const
+ If this is a QmlTypeNode, this function returns the QML full
+ base name. Otherwise it returns an empty string.
+ */
+
+/*! \fn QString Node::logicalModuleName() const
+ If this is a CollectionNode, this function returns the logical
+ module name. Otherwise it returns an empty string.
+ */
+
+/*! \fn QString Node::logicalModuleVersion() const
+ If this is a CollectionNode, this function returns the logical
+ module version number. Otherwise it returns an empty string.
+ */
+
+/*! \fn QString Node::logicalModuleIdentifier() const
+ If this is a CollectionNode, this function returns the logical
+ module identifier. Otherwise it returns an empty string.
+ */
+
+/*! \fn void Node::setLogicalModuleInfo(const QString &arg)
+ If this node is a CollectionNode, this function splits \a arg
+ on the blank character to get a logical module name and version
+ number. If the version number is present, it splits the version
+ number on the '.' character to get a major version number and a
+ minor version number. If the version number is present, both the
+ major and minor version numbers should be there, but the minor
+ version number is not absolutely necessary.
+
+ The strings are stored in the appropriate data members for use
+ when the QML or javascript module page is generated.
+ */
+
+/*! \fn void Node::setLogicalModuleInfo(const QStringList &info)
+ If this node is a CollectionNode, this function accepts the
+ logical module \a info as a string list. If the logical module
+ info contains the version number, it splits the version number
+ on the '.' character to get the major and minor version numbers.
+ Both major and minor version numbers should be provided, but
+ the minor version number is not strictly necessary.
+
+ The strings are stored in the appropriate data members for use
+ when the QML or javascript module page is generated. This overload
+ of the function is called when qdoc is reading an index file.
+ */
+
+/*! \fn CollectionNode *Node::logicalModule() const
+ If this is a QmlTypeNode, a pointer to its QML module is returned,
+ which is a pointer to a CollectionNode. Otherwise the \c nullptr
+ is returned.
+ */
+
+/*! \fn void Node::setQmlModule(CollectionNode *t)
+ If this is a QmlTypeNode, this function sets the QML type's QML module
+ pointer to the CollectionNode \a t. Otherwise the function does nothing.
+ */
+
+/*! \fn ClassNode *Node::classNode()
+ If this is a QmlTypeNode, this function returns the pointer to
+ the C++ ClassNode that this QML type represents. Otherwise the
+ \c nullptr is returned.
+ */
+
+/*! \fn void Node::setClassNode(ClassNode *cn)
+ If this is a QmlTypeNode, this function sets the C++ class node
+ to \a cn. The C++ ClassNode is the C++ implementation of the QML
+ type.
+ */
+
+/*! \fn const QString &Node::outputSubdirectory() const
+ Returns the node's output subdirector, which is the subdirectory
+ of the output directory where the node's documentation file is
+ written.
+ */
+
+/*! \fn void Node::setOutputSubdirectory(const QString &t)
+ Sets the node's output subdirectory to \a t. This is the subdirector
+ of the output directory where the node's documentation file will be
+ written.
+ */
+
+/*! \fn NodeType Node::goal(const QString &t)
+ When a square-bracket parameter is used in a qdoc command, this
+ function might be called to convert the text string \a t obtained
+ from inside the square brackets to be a Goal value, which is returned.
+
+ \sa Goal
+ */
+
+/*!
\class Aggregate
*/
+/*! \fn Aggregate::Aggregate(NodeType type, Aggregate *parent, const QString &name)
+ The constructor should never be called directly. It is only called
+ by the constructors of subclasses of Aggregate. Those constructors
+ pass the node \a type they want to create, the \a parent of the new
+ node, and its \a name.
+ */
+
/*!
- Calls delete for each child of this Aggregate that has this
- Aggregate as its parent. A child node that has some other
- Aggregate as its parent is deleted by that Aggregate's
- destructor.
+ The destructor calls delete for each child of this Aggregate
+ that has this Aggregate as its parent. A child node that has
+ some other Aggregate as its parent is deleted by that
+ Aggregate's destructor. This is a fail-safe test.
The destructor no longer deletes the collection of children
by calling qDeleteAll() because the child list can contain
@@ -954,7 +2016,7 @@ Aggregate::~Aggregate()
find all this node's children that have the given \a name,
and return the one that satisfies the \a genus requirement.
*/
-Node *Aggregate::findChildNode(const QString& name, Node::Genus genus, int findFlags) const
+Node *Aggregate::findChildNode(const QString &name, Node::Genus genus, int findFlags) const
{
if (genus == Node::DontCare) {
Node *node = nonfunctionMap_.value(name);
@@ -964,7 +2026,7 @@ Node *Aggregate::findChildNode(const QString& name, Node::Genus genus, int findF
NodeList nodes = nonfunctionMap_.values(name);
if (!nodes.isEmpty()) {
for (int i = 0; i < nodes.size(); ++i) {
- Node* node = nodes.at(i);
+ Node *node = nodes.at(i);
if (genus == node->genus()) {
if (findFlags & TypesOnly) {
if (!node->isTypedef()
@@ -1028,11 +2090,11 @@ void Aggregate::findChildren(const QString &name, NodeVector &nodes) const
passed must be one of the isXxx() functions in class Node
that tests the node type.
*/
-Node* Aggregate::findNonfunctionChild(const QString& name, bool (Node::*isMatch) () const)
+Node *Aggregate::findNonfunctionChild(const QString &name, bool (Node::*isMatch) () const)
{
NodeList nodes = nonfunctionMap_.values(name);
for (int i=0; i<nodes.size(); ++i) {
- Node* node = nodes.at(i);
+ Node *node = nodes.at(i);
if ((node->*(isMatch))())
return node;
}
@@ -1113,14 +2175,14 @@ QStringList Aggregate::primaryKeys()
*/
void Aggregate::markUndocumentedChildrenInternal()
{
- foreach (Node *child, children_) {
- if (!child->isSharingComment() && !child->hasDoc()) {
+ for (auto *child : qAsConst(children_)) {
+ if (!child->isSharingComment() && !child->hasDoc() && !child->isDontDocument()) {
if (!child->docMustBeGenerated()) {
if (child->isFunction()) {
- if (static_cast<FunctionNode*>(child)->hasAssociatedProperties())
+ if (static_cast<FunctionNode *>(child)->hasAssociatedProperties())
continue;
} else if (child->isTypedef()) {
- if (static_cast<TypedefNode*>(child)->hasAssociatedEnum())
+ if (static_cast<TypedefNode *>(child)->hasAssociatedEnum())
continue;
}
child->setAccess(Node::Private);
@@ -1128,7 +2190,7 @@ void Aggregate::markUndocumentedChildrenInternal()
}
}
if (child->isAggregate()) {
- static_cast<Aggregate*>(child)->markUndocumentedChildrenInternal();
+ static_cast<Aggregate *>(child)->markUndocumentedChildrenInternal();
}
}
}
@@ -1187,9 +2249,9 @@ void Aggregate::normalizeOverloads()
/*
Recursive part.
*/
- foreach (Node *n, children_) {
- if (n->isAggregate())
- static_cast<Aggregate*>(n)->normalizeOverloads();
+ for (auto *node : qAsConst(children_)) {
+ if (node->isAggregate())
+ static_cast<Aggregate *>(node)->normalizeOverloads();
}
}
@@ -1200,28 +2262,19 @@ void Aggregate::normalizeOverloads()
*/
const NodeList &Aggregate::nonfunctionList()
{
- std::list<Node*> list = nonfunctionMap_.values().toStdList();
- list.sort();
- list.unique();
- nonfunctionList_ = NodeList::fromStdList(list);
+ nonfunctionList_ = nonfunctionMap_.values();
+ std::sort(nonfunctionList_.begin(), nonfunctionList_.end());
+ nonfunctionList_.erase(std::unique(nonfunctionList_.begin(), nonfunctionList_.end()),
+ nonfunctionList_.end());
return nonfunctionList_;
}
/*! \fn bool Aggregate::isAggregate() const
- Returns \c true because this is an inner node.
+ Returns \c true because this node is an instance of Aggregate,
+ which means it can have children.
*/
/*!
- Returns \c true if the node is a class node or a QML type node
- that is marked as being a wrapper class or QML type, or if
- it is a member of a wrapper class or type.
- */
-bool Node::isWrapper() const
-{
- return (parent_ ? parent_->isWrapper() : false);
-}
-
-/*!
Finds the enum type node that has \a enumValue as one of
its enum values and returns a pointer to it. Returns 0 if
no enum type node is found that has \a enumValue as one
@@ -1229,7 +2282,7 @@ bool Node::isWrapper() const
*/
const EnumNode *Aggregate::findEnumNodeForValue(const QString &enumValue) const
{
- foreach (const Node *node, enumChildren_) {
+ for (const auto *node : enumChildren_) {
const EnumNode *en = static_cast<const EnumNode *>(node);
if (en->hasItem(enumValue))
return en;
@@ -1254,7 +2307,11 @@ void Aggregate::setIncludeFiles(const QStringList &includeFiles)
}
/*!
- f1 is always the clone
+ Compare \a f1 to \a f2 and return \c true if they have the same
+ signature. Otherwise return \c false. They must have the same
+ number of parameters, and all the parameter types must be the
+ same. The functions must have the same constness and refness.
+ This is a private function.
*/
bool Aggregate::isSameSignature(const FunctionNode *f1, const FunctionNode *f2)
{
@@ -1321,6 +2378,8 @@ bool Aggregate::isSameSignature(const FunctionNode *f1, const FunctionNode *f2)
\note The function's overload number and overload flag are set in
normalizeOverloads().
+ \note This is a private function.
+
\sa normalizeOverloads()
*/
void Aggregate::addFunction(FunctionNode *fn)
@@ -1340,6 +2399,8 @@ void Aggregate::addFunction(FunctionNode *fn)
already in the function map. If the function's name is
already in the function map, do nothing. The overload
link is already set correctly.
+
+ \note This is a private function.
*/
void Aggregate::adoptFunction(FunctionNode *fn)
{
@@ -1355,7 +2416,7 @@ void Aggregate::adoptFunction(FunctionNode *fn)
again, because it is presumed to already be there. We just
want to be able to find the child by its \a title.
*/
-void Aggregate::addChildByTitle(Node* child, const QString& title)
+void Aggregate::addChildByTitle(Node *child, const QString &title)
{
nonfunctionMap_.insertMulti(title, child);
}
@@ -1385,10 +2446,10 @@ void Aggregate::addChild(Node *child)
child->setOutputSubdirectory(this->outputSubdirectory());
child->setUrl(QString());
child->setIndexNodeFlag(isIndexNode());
+
if (child->isFunction()) {
- addFunction(static_cast<FunctionNode*>(child));
- }
- else {
+ addFunction(static_cast<FunctionNode *>(child));
+ } else if (!child->name().isEmpty()) {
nonfunctionMap_.insertMulti(child->name(), child);
if (child->isEnumType())
enumChildren_.append(child);
@@ -1412,17 +2473,16 @@ void Aggregate::adoptChild(Node *child)
children_.append(child);
child->setParent(this);
if (child->isFunction()) {
- adoptFunction(static_cast<FunctionNode*>(child));
- }
- else {
+ adoptFunction(static_cast<FunctionNode *>(child));
+ } else if (!child->name().isEmpty()) {
nonfunctionMap_.insertMulti(child->name(), child);
- if (child->isEnumType()) {
+ if (child->isEnumType())
enumChildren_.append(child);
- } else if (child->isSharedCommentNode()) {
- SharedCommentNode *scn = static_cast<SharedCommentNode*>(child);
- for (Node *n : scn->collective())
- adoptChild(n);
- }
+ }
+ if (child->isSharedCommentNode()) {
+ SharedCommentNode *scn = static_cast<SharedCommentNode *>(child);
+ for (Node *n : scn->collective())
+ adoptChild(n);
}
}
}
@@ -1433,77 +2493,23 @@ void Aggregate::adoptChild(Node *child)
void Aggregate::setOutputSubdirectory(const QString &t)
{
Node::setOutputSubdirectory(t);
- foreach (Node *n, children_)
- n->setOutputSubdirectory(t);
-}
-
-/*!
- Find the module (Qt Core, Qt GUI, etc.) to which the class belongs.
- We do this by obtaining the full path to the header file's location
- and examine everything between "src/" and the filename. This is
- semi-dirty because we are assuming a particular directory structure.
-
- This function is only really useful if the class's module has not
- been defined in the header file with a QT_MODULE macro or with an
- \inmodule command in the documentation.
- */
-QString Node::physicalModuleName() const
-{
- if (!physicalModuleName_.isEmpty())
- return physicalModuleName_;
-
- QString path = location().filePath();
- QString pattern = QString("src") + QDir::separator();
- int start = path.lastIndexOf(pattern);
-
- if (start == -1)
- return QString();
-
- QString moduleDir = path.mid(start + pattern.size());
- int finish = moduleDir.indexOf(QDir::separator());
-
- if (finish == -1)
- return QString();
-
- QString physicalModuleName = moduleDir.left(finish);
-
- if (physicalModuleName == QLatin1String("corelib"))
- return QLatin1String("QtCore");
- else if (physicalModuleName == QLatin1String("uitools"))
- return QLatin1String("QtUiTools");
- else if (physicalModuleName == QLatin1String("gui"))
- return QLatin1String("QtGui");
- else if (physicalModuleName == QLatin1String("network"))
- return QLatin1String("QtNetwork");
- else if (physicalModuleName == QLatin1String("opengl"))
- return QLatin1String("QtOpenGL");
- else if (physicalModuleName == QLatin1String("svg"))
- return QLatin1String("QtSvg");
- else if (physicalModuleName == QLatin1String("sql"))
- return QLatin1String("QtSql");
- else if (physicalModuleName == QLatin1String("qtestlib"))
- return QLatin1String("QtTest");
- else if (moduleDir.contains("webkit"))
- return QLatin1String("QtWebKit");
- else if (physicalModuleName == QLatin1String("xml"))
- return QLatin1String("QtXml");
- else
- return QString();
+ for (auto *node : qAsConst(children_))
+ node->setOutputSubdirectory(t);
}
/*!
If this node has a child that is a QML property or JS property
named \a n, return a pointer to that child. Otherwise, return \nullptr.
*/
-QmlPropertyNode* Aggregate::hasQmlProperty(const QString& n) const
+QmlPropertyNode *Aggregate::hasQmlProperty(const QString &n) const
{
NodeType goal = Node::QmlProperty;
if (isJsNode())
goal = Node::JsProperty;
- foreach (Node *child, children_) {
+ for (auto *child : qAsConst(children_)) {
if (child->nodeType() == goal) {
if (child->name() == n)
- return static_cast<QmlPropertyNode*>(child);
+ return static_cast<QmlPropertyNode *>(child);
}
}
return nullptr;
@@ -1514,15 +2520,15 @@ QmlPropertyNode* Aggregate::hasQmlProperty(const QString& n) const
named \a n and that also matches \a attached, return a pointer
to that child.
*/
-QmlPropertyNode* Aggregate::hasQmlProperty(const QString& n, bool attached) const
+QmlPropertyNode *Aggregate::hasQmlProperty(const QString &n, bool attached) const
{
NodeType goal = Node::QmlProperty;
if (isJsNode())
goal = Node::JsProperty;
- foreach (Node *child, children_) {
+ for (auto *child : qAsConst(children_)) {
if (child->nodeType() == goal) {
if (child->name() == n && child->isAttached() == attached)
- return static_cast<QmlPropertyNode*>(child);
+ return static_cast<QmlPropertyNode *>(child);
}
}
return nullptr;
@@ -1551,157 +2557,393 @@ bool Aggregate::hasOverloads(const FunctionNode *fn) const
}
/*!
- \class NamespaceNode
- \brief This class represents a C++ namespace.
-
- A namespace can be used in multiple C++ modules, so there
- can be a NamespaceNode for namespace Xxx in more than one
- Node tree.
+ Prints the inner node's list of children.
+ For debugging only.
*/
+void Aggregate::printChildren(const QString &title)
+{
+ qDebug() << title << name() << children_.size();
+ if (children_.size() > 0) {
+ for (int i=0; i<children_.size(); ++i) {
+ Node *n = children_.at(i);
+ qDebug() << " CHILD:" << n->name() << n->nodeTypeString();
+ }
+ }
+}
/*!
- If this is the global namespace node, remove all orphans
- from the child list before deleting anything.
+ Removes \a fn from this aggregate's function map. That's
+ all it does. If \a fn is in the function map index and it
+ has an overload, the value pointer in the function map
+ index is set to the the overload pointer. If the function
+ has no overload pointer, the function map entry is erased.
+
+ \note When removing a function node from the function map,
+ it is important to set the removed function node's next
+ overload pointer to null because the function node might
+ be added as a child to some other aggregate.
+
+ \note This is a protected function.
*/
-NamespaceNode::~NamespaceNode()
+void Aggregate::removeFunctionNode(FunctionNode *fn)
{
- for (int i = 0; i < children_.size(); ++i) {
- if (children_[i]->parent() != this)
- children_[i] = nullptr;
+ FunctionMap::Iterator i = functionMap_.find(fn->name());
+ if (i != functionMap_.end()) {
+ if (i.value() == fn) {
+ if (fn->nextOverload() != nullptr) {
+ i.value() = fn->nextOverload();
+ fn->setNextOverload(nullptr);
+ fn->setOverloadNumber(0);
+ }
+ else {
+ functionMap_.erase(i);
+ }
+ } else {
+ FunctionNode *current = i.value();
+ while (current != nullptr) {
+ if (current->nextOverload() == fn) {
+ current->setNextOverload(fn->nextOverload());
+ fn->setNextOverload(nullptr);
+ fn->setOverloadNumber(0);
+ break;
+ }
+ current = current->nextOverload();
+ }
+ }
}
}
-/*!
- Returns true if this namespace is to be documented in the
- current module. There can be elements declared in this
- namespace spread over multiple modules. Those elements are
- documented in the modules where they are declared, but they
- are linked to from the namespace page in the module where
- the namespace itself is documented.
+/*
+ When deciding whether to include a function in the function
+ index, if the function is marked private, don't include it.
+ If the function is marked obsolete, don't include it. If the
+ function is marked internal, don't include it. Or if the
+ function is a destructor or any kind of constructor, don't
+ include it. Otherwise include it.
*/
-bool NamespaceNode::isDocumentedHere() const
+static bool keep(FunctionNode *fn)
{
- return whereDocumented_ == tree()->camelCaseModuleName();
+ if (fn->isPrivate() ||
+ fn->isObsolete() ||
+ fn->isInternal() ||
+ fn->isSomeCtor() ||
+ fn->isDtor())
+ return false;
+ return true;
}
/*!
- Returns true if this namespace node contains at least one
- child that has documentation and is not private or internal.
+ Insert all functions declared in this aggregate into the
+ \a functionIndex. Call the function recursively for each
+ child that is an aggregate.
+
+ Only include functions that are in the public API and
+ that are not constructors or destructors.
*/
-bool NamespaceNode::hasDocumentedChildren() const
+void Aggregate::findAllFunctions(NodeMapMap &functionIndex)
{
- foreach (Node *n, children_) {
- if (n->isInAPI())
- return true;
+ FunctionMap::const_iterator i;
+ for (i = functionMap_.constBegin(); i != functionMap_.constEnd(); ++i) {
+ FunctionNode *fn = i.value();
+ if (keep(fn))
+ functionIndex[fn->name()].insert(fn->parent()->fullDocumentName(), fn);
+ fn = fn->nextOverload();
+ while (fn != nullptr) {
+ if (keep(fn))
+ functionIndex[fn->name()].insert(fn->parent()->fullDocumentName(), fn);
+ fn = fn->nextOverload();
+ }
+ }
+ for (Node *node : qAsConst(children_)) {
+ if (node->isAggregate() && !node->isPrivate())
+ static_cast<Aggregate *>(node)->findAllFunctions(functionIndex);
}
- return false;
}
/*!
- Report qdoc warning for each documented child in a namespace
- that is not documented. This function should only be called
- when the namespace is not documented.
- */
-void NamespaceNode::reportDocumentedChildrenInUndocumentedNamespace() const
-{
- foreach (Node *n, children_) {
- if (n->isInAPI()) {
- QString msg1 = n->name();
- if (n->isFunction())
- msg1 += "()";
- msg1 += tr(" is documented, but namespace %1 is not documented in any module.").arg(name());
- QString msg2 = tr("Add /*! '\\%1 %2' ... */ or remove the qdoc comment marker (!) at that line number.").arg(COMMAND_NAMESPACE).arg(name());
+ For each child of this node, if the child is a namespace node,
+ insert the child into the \a namespaces multimap. If the child
+ is an aggregate, call this function recursively for that child.
- n->doc().location().warning(msg1, msg2);
+ When the function called with the root node of a tree, it finds
+ all the namespace nodes in that tree and inserts them into the
+ \a namespaces multimap.
+
+ The root node of a tree is a namespace, but it has no name, so
+ it is not inserted into the map. So, if this function is called
+ for each tree in the qdoc database, it finds all the namespace
+ nodes in the database.
+ */
+void Aggregate::findAllNamespaces(NodeMultiMap &namespaces)
+{
+ for (auto *node : qAsConst(children_)) {
+ if (node->isAggregate() && !node->isPrivate()) {
+ if (node->isNamespace() && !node->name().isEmpty())
+ namespaces.insert(node->name(), node);
+ static_cast<Aggregate *>(node)->findAllNamespaces(namespaces);
}
}
}
/*!
- Returns true if this namespace node is not private and
- contains at least one public child node with documentation.
+ Returns true if this aggregate contains at least one child
+ that is marked obsolete. Otherwise returns false.
*/
-bool NamespaceNode::docMustBeGenerated() const
+bool Aggregate::hasObsoleteMembers() const
{
- if (isInAPI())
- return true;
- return (hasDocumentedChildren() ? true : false);
+ for (const auto *node : children_) {
+ if (!node->isPrivate() && node->isObsolete()) {
+ if (node->isFunction() || node->isProperty() || node->isEnumType() ||
+ node->isTypedef() || node->isTypeAlias() || node->isVariable() ||
+ node->isQmlProperty() || node->isJsProperty())
+ return true;
+ }
+ }
+ return false;
}
/*!
- Returns a const reference to the namespace node's list of
- included children, which contains pointers to all the child
- nodes of other namespace nodes that have the same name as
- this namespace node. The list is built after the prepare
- phase has been run but just before the generate phase. It
- is buils by QDocDatabase::resolveNamespaces().
-
- \sa QDocDatabase::resolveNamespaces()
+ Finds all the obsolete C++ classes and QML types in this
+ aggregate and all the C++ classes and QML types with obsolete
+ members, and inserts them into maps used elsewhere for
+ generating documentation.
*/
-const NodeList &NamespaceNode::includedChildren() const
+void Aggregate::findAllObsoleteThings()
{
- return includedChildren_;
+ for (auto *node : qAsConst(children_)) {
+ if (!node->isPrivate()) {
+ QString name = node->name();
+ if (node->isObsolete()) {
+ if (node->isClassNode())
+ QDocDatabase::obsoleteClasses().insert(node->qualifyCppName(), node);
+ else if (node->isQmlType() || node->isJsType())
+ QDocDatabase::obsoleteQmlTypes().insert(node->qualifyQmlName(), node);
+ } else if (node->isClassNode()) {
+ Aggregate *a = static_cast<Aggregate *>(node);
+ if (a->hasObsoleteMembers())
+ QDocDatabase::classesWithObsoleteMembers().insert(node->qualifyCppName(), node);
+ } else if (node->isQmlType() || node->isJsType()) {
+ Aggregate *a = static_cast<Aggregate *>(node);
+ if (a->hasObsoleteMembers())
+ QDocDatabase::qmlTypesWithObsoleteMembers().insert(node->qualifyQmlName(), node);
+ } else if (node->isAggregate()) {
+ static_cast<Aggregate *>(node)->findAllObsoleteThings();
+ }
+ }
+ }
}
/*!
- This function is only called from QDocDatabase::resolveNamesapces().
-
- \sa includedChildren(), QDocDatabase::resolveNamespaces()
+ Finds all the C++ classes, QML types, JS types, QML and JS
+ basic types, and examples in this aggregate and inserts them
+ into appropriate maps for later use in generating documentation.
*/
-void NamespaceNode::includeChild(Node *child)
+void Aggregate::findAllClasses()
{
- includedChildren_.append(child);
+ for (auto *node : qAsConst(children_)) {
+ if (!node->isPrivate() && !node->isInternal() &&
+ node->tree()->camelCaseModuleName() != QString("QDoc")) {
+ if (node->isClassNode()) {
+ QDocDatabase::cppClasses().insert(node->qualifyCppName().toLower(), node);
+ } else if (node->isQmlType() || node->isQmlBasicType() || node->isJsType() || node->isJsBasicType()) {
+ QString name = node->unqualifyQmlName();
+ QDocDatabase::qmlTypes().insert(name, node);
+ //also add to the QML basic type map
+ if (node->isQmlBasicType() || node->isJsBasicType())
+ QDocDatabase::qmlBasicTypes().insert(name, node);
+ } else if (node->isExample()) {
+ // use the module index title as key for the example map
+ QString title = node->tree()->indexTitle();
+ if (!QDocDatabase::examples().contains(title, node))
+ QDocDatabase::examples().insert(title, node);
+ } else if (node->isAggregate()) {
+ static_cast<Aggregate *>(node)->findAllClasses();
+ }
+ }
+ }
}
/*!
- \class ClassNode
- \brief This class represents a C++ class.
- */
-
-/*!
- Adds the base class \a node to this class's list of base
- classes. The base class has the specified \a access. This
- is a resolved base class.
+ Find all the attribution pages in this node and insert them
+ into \a attributions.
*/
-void ClassNode::addResolvedBaseClass(Access access, ClassNode* node)
+void Aggregate::findAllAttributions(NodeMultiMap &attributions)
{
- bases_.append(RelatedClass(access, node));
- node->derived_.append(RelatedClass(access, this));
+ for (auto *node : qAsConst(children_)) {
+ if (!node->isPrivate()) {
+ if (node->pageType() == Node::AttributionPage)
+ attributions.insertMulti(node->tree()->indexTitle(), node);
+ else if (node->isAggregate())
+ static_cast<Aggregate *>(node)->findAllAttributions(attributions);
+ }
+ }
}
/*!
- Adds the derived class \a node to this class's list of derived
- classes. The derived class inherits this class with \a access.
+ Finds all the nodes in this node where a \e{since} command appeared
+ in the qdoc comment and sorts them into maps according to the kind
+ of node.
+
+ This function is used for generating the "New Classes... in x.y"
+ section on the \e{What's New in Qt x.y} page.
*/
-void ClassNode::addDerivedClass(Access access, ClassNode* node)
+void Aggregate::findAllSince()
{
- derived_.append(RelatedClass(access, node));
+ for (auto *node : qAsConst(children_)) {
+ QString sinceString = node->since();
+ // Insert a new entry into each map for each new since string found.
+ if (!node->isPrivate() && !sinceString.isEmpty()) {
+ NodeMultiMapMap::iterator nsmap = QDocDatabase::newSinceMaps().find(sinceString);
+ if (nsmap == QDocDatabase::newSinceMaps().end())
+ nsmap = QDocDatabase::newSinceMaps().insert(sinceString, NodeMultiMap());
+
+ NodeMapMap::iterator ncmap = QDocDatabase::newClassMaps().find(sinceString);
+ if (ncmap == QDocDatabase::newClassMaps().end())
+ ncmap = QDocDatabase::newClassMaps().insert(sinceString, NodeMap());
+
+ NodeMapMap::iterator nqcmap = QDocDatabase::newQmlTypeMaps().find(sinceString);
+ if (nqcmap == QDocDatabase::newQmlTypeMaps().end())
+ nqcmap = QDocDatabase::newQmlTypeMaps().insert(sinceString, NodeMap());
+
+ if (node->isFunction()) {
+ // Insert functions into the general since map.
+ FunctionNode *fn = static_cast<FunctionNode *>(node);
+ if (!fn->isObsolete() && !fn->isSomeCtor() && !fn->isDtor())
+ nsmap.value().insert(fn->name(), fn);
+ }
+ else if (node->isClassNode()) {
+ // Insert classes into the since and class maps.
+ QString name = node->qualifyWithParentName();
+ nsmap.value().insert(name, node);
+ ncmap.value().insert(name, node);
+ } else if (node->isQmlType() || node->isJsType()) {
+ // Insert QML elements into the since and element maps.
+ QString name = node->qualifyWithParentName();
+ nsmap.value().insert(name, node);
+ nqcmap.value().insert(name, node);
+ } else if (node->isQmlProperty() || node->isJsProperty()) {
+ // Insert QML properties into the since map.
+ nsmap.value().insert(node->name(), node);
+ } else {
+ // Insert external documents into the general since map.
+ QString name = node->qualifyWithParentName();
+ nsmap.value().insert(name, node);
+ }
+ }
+ // Recursively find child nodes with since commands.
+ if (node->isAggregate())
+ static_cast<Aggregate *>(node)->findAllSince();
+ }
}
/*!
- Add an unresolved base class to this class node's list of
- base classes. The unresolved base class will be resolved
- before the generate phase of qdoc. In an unresolved base
- class, the pointer to the base class node is 0.
+ For each QML Type node in this aggregate's children, if the
+ QML type has a QML base type name but its QML base type node
+ pointer is nullptr, use the QML base type name to look up the
+ base type node. If the node is found, set the node's QML base
+ type node pointer to that node.
*/
-void ClassNode::addUnresolvedBaseClass(Access access,
- const QStringList& path,
- const QString& signature)
+void Aggregate::resolveQmlInheritance()
{
- bases_.append(RelatedClass(access, path, signature));
+ NodeMap previousSearches;
+ // Do we need recursion?
+ for (auto *child : qAsConst(children_)) {
+ if (!child->isQmlType() && !child->isJsType())
+ continue;
+ QmlTypeNode *type = static_cast<QmlTypeNode *>(child);
+ if (type->qmlBaseNode() != nullptr)
+ continue;
+ if (type->qmlBaseName().isEmpty())
+ continue;
+ QmlTypeNode *base = static_cast<QmlTypeNode *>(previousSearches.value(type->qmlBaseName()));
+ if (base && (base != type)) {
+ type->setQmlBaseNode(base);
+ QmlTypeNode::addInheritedBy(base, type);
+ } else {
+ if (!type->importList().isEmpty()) {
+ const ImportList &imports = type->importList();
+ for (int i=0; i<imports.size(); ++i) {
+ base = QDocDatabase::qdocDB()->findQmlType(imports[i], type->qmlBaseName());
+ if (base && (base != type)) {
+ if (base->logicalModuleVersion()[0] != imports[i].version_[0])
+ base = nullptr; // Safeguard for QTBUG-53529
+ break;
+ }
+ }
+ }
+ if (base == nullptr) {
+ base = QDocDatabase::qdocDB()->findQmlType(QString(), type->qmlBaseName());
+ }
+ if (base && (base != type)) {
+ type->setQmlBaseNode(base);
+ QmlTypeNode::addInheritedBy(base, type);
+ previousSearches.insert(type->qmlBaseName(), base);
+ }
+ }
+ }
}
/*!
- Add an unresolved \c using clause to this class node's list
- of \c using clauses. The unresolved \c using clause will be
- resolved before the generate phase of qdoc. In an unresolved
- \c using clause, the pointer to the function node is 0.
+ Returns a word representing the kind of Aggregate this node is.
+ Currently only works for class, struct, and union, but it can
+ easily be extended. If \a cap is true, the word is capitalised.
*/
-void ClassNode::addUnresolvedUsingClause(const QString& signature)
+QString Aggregate::typeWord(bool cap) const
{
- usingClauses_.append(UsingClause(signature));
+ if (cap) {
+ switch (nodeType()) {
+ case Node::Class:
+ return QLatin1String("Class");
+ case Node::Struct:
+ return QLatin1String("Struct");
+ case Node::Union:
+ return QLatin1String("Union");
+ default:
+ break;
+ }
+ } else {
+ switch (nodeType()) {
+ case Node::Class:
+ return QLatin1String("class");
+ case Node::Struct:
+ return QLatin1String("struct");
+ case Node::Union:
+ return QLatin1String("union");
+ default:
+ break;
+ }
+ }
+ return QString();
}
+/*! \fn int Aggregate::count() const
+ Returns the number of children in the child list.
+ */
+
+/*! \fn const NodeList &Aggregate::childNodes() const
+ Returns a const reference to the child list.
+ */
+
+/*! \fn NodeList::ConstIterator Aggregate::constBegin() const
+ Returns a const iterator pointing at the beginning of the child list.
+ */
+
+/*! \fn NodeList::ConstIterator Aggregate::constEnd() const
+ Returns a const iterator pointing at the end of the child list.
+ */
+
+/*! \fn const QStringList &Aggregate::includeFiles() const
+ This function returns a const reference to a list of strings, but
+ I no longer know what they are.
+ */
+
+/*! \fn QmlTypeNode *Aggregate::qmlBaseNode() const
+ If this Aggregate is a QmlTypeNode, this function returns a pointer to
+ the QmlTypeNode that is its base type. Otherwise it returns \c nullptr.
+ A QmlTypeNode doesn't always have a base type, so even when this Aggregate
+ is aQmlTypeNode, the pointer returned can be \c nullptr.
+ */
+
/*!
A base class of this class node was private or internal.
That node's list of \a bases is traversed in this function.
@@ -1711,11 +2953,11 @@ void ClassNode::addUnresolvedUsingClause(const QString& signature)
is called recursively with the list of base classes from
that private or internal class node.
*/
-void ClassNode::promotePublicBases(const QList<RelatedClass>& bases)
+void ClassNode::promotePublicBases(const QList<RelatedClass> &bases)
{
if (!bases.isEmpty()) {
for (int i = bases.size() - 1; i >= 0; --i) {
- ClassNode* bc = bases.at(i).node_;
+ ClassNode *bc = bases.at(i).node_;
if (bc == nullptr)
bc = QDocDatabase::qdocDB()->findClassNode(bases.at(i).path_);
if (bc != nullptr) {
@@ -1741,7 +2983,7 @@ void ClassNode::removePrivateAndInternalBases()
// Remove private and duplicate base classes.
while (i < bases_.size()) {
- ClassNode* bc = bases_.at(i).node_;
+ ClassNode *bc = bases_.at(i).node_;
if (bc == nullptr)
bc = QDocDatabase::qdocDB()->findClassNode(bases_.at(i).path_);
if (bc != nullptr && (bc->isPrivate() || bc->isInternal() || found.contains(bc))) {
@@ -1758,7 +3000,7 @@ void ClassNode::removePrivateAndInternalBases()
i = 0;
while (i < derived_.size()) {
- ClassNode* dc = derived_.at(i).node_;
+ ClassNode *dc = derived_.at(i).node_;
if (dc != nullptr && (dc->isPrivate() || dc->isInternal())) {
derived_.removeAt(i);
const QList<RelatedClass> &dd = dc->derivedClasses();
@@ -1773,15 +3015,15 @@ void ClassNode::removePrivateAndInternalBases()
/*!
*/
-void ClassNode::resolvePropertyOverriddenFromPtrs(PropertyNode* pn)
+void ClassNode::resolvePropertyOverriddenFromPtrs(PropertyNode *pn)
{
QList<RelatedClass>::const_iterator bc = baseClasses().constBegin();
while (bc != baseClasses().constEnd()) {
- ClassNode* cn = bc->node_;
+ ClassNode *cn = bc->node_;
if (cn) {
- Node* n = cn->findNonfunctionChild(pn->name(), &Node::isProperty);
+ Node *n = cn->findNonfunctionChild(pn->name(), &Node::isProperty);
if (n) {
- PropertyNode* baseProperty = static_cast<PropertyNode*>(n);
+ PropertyNode *baseProperty = static_cast<PropertyNode *>(n);
cn->resolvePropertyOverriddenFromPtrs(baseProperty);
pn->setOverriddenFrom(baseProperty);
}
@@ -1792,23 +3034,380 @@ void ClassNode::resolvePropertyOverriddenFromPtrs(PropertyNode* pn)
}
}
+/*! \fn FunctionMap &Aggregate::functionMap()
+ Returns a reference to this Aggregate's function map, which
+ is a map of all the children of this Aggregate that are
+ FunctionNodes.
+ */
+
+/*! \fn void Aggregate::appendToRelatedByProxy(const NodeList &t)
+ Appends the list of node pointers to the list of elements that are
+ related to this Aggregate but are documented in a different module.
+
+ \sa relatedByProxy()
+ */
+
+/*! \fn NodeList &Aggregate::relatedByProxy()
+ Returns a reference to a list of node pointers where each element
+ points to a node in an index file for some other module, such that
+ whatever the node represents was documented in that other module,
+ but it is related to this Aggregate, so when the documentation for
+ this Aggregate is written, it will contain links to elements in the
+ other module.
+ */
+
+/*!
+ \class NamespaceNode
+ \brief This class represents a C++ namespace.
+
+ A namespace can be used in multiple C++ modules, so there
+ can be a NamespaceNode for namespace Xxx in more than one
+ Node tree.
+ */
+
+/*! \fn NamespaceNode(Aggregate *parent, const QString &name)
+ Constructs a NamespaceNode with the specified \a parent and \a name.
+ The node type is Node::Namespace.
+ */
+
+/*!
+ The destructor removes all children from the child list that
+ have a parent() that is not this NamespaceNode. This situation
+ can arise because of elements that are related to this namespace
+ using the \c {\\relates} command.
+
+ \note The child nodes remaining in the child list after the ones
+ with a different parent() have been removed are deleted in the
+ destructor of the Aggregate base class.
+ */
+NamespaceNode::~NamespaceNode()
+{
+ for (int i = 0; i < children_.size(); ++i) {
+ if (children_[i]->parent() != this)
+ children_[i] = nullptr;
+ }
+}
+
+/*!
+ Returns true if this namespace is to be documented in the
+ current module. There can be elements declared in this
+ namespace spread over multiple modules. Those elements are
+ documented in the modules where they are declared, but they
+ are linked to from the namespace page in the module where
+ the namespace itself is documented.
+ */
+bool NamespaceNode::isDocumentedHere() const
+{
+ return whereDocumented_ == tree()->camelCaseModuleName();
+}
+
+/*!
+ Returns true if this namespace node contains at least one
+ child that has documentation and is not private or internal.
+ */
+bool NamespaceNode::hasDocumentedChildren() const
+{
+ for (const auto *node : qAsConst(children_)) {
+ if (node->isInAPI())
+ return true;
+ }
+ return false;
+}
+
+/*!
+ Report qdoc warning for each documented child in a namespace
+ that is not documented. This function should only be called
+ when the namespace is not documented.
+ */
+void NamespaceNode::reportDocumentedChildrenInUndocumentedNamespace() const
+{
+ for (const auto *node : qAsConst(children_)) {
+ if (node->isInAPI()) {
+ QString msg1 = node->name();
+ if (node->isFunction())
+ msg1 += "()";
+ msg1 += tr(" is documented, but namespace %1 is not documented in any module.").arg(name());
+ QString msg2 = tr("Add /*! '\\%1 %2' ... */ or remove the qdoc comment marker (!) at that line number.").arg(COMMAND_NAMESPACE).arg(name());
+
+ node->doc().location().warning(msg1, msg2);
+ }
+ }
+}
+
+/*!
+ Returns true if this namespace node is not private and
+ contains at least one public child node with documentation.
+ */
+bool NamespaceNode::docMustBeGenerated() const
+{
+ if (isInAPI())
+ return true;
+ return (hasDocumentedChildren() ? true : false);
+}
+
+/*!
+ Returns a const reference to the namespace node's list of
+ included children, which contains pointers to all the child
+ nodes of other namespace nodes that have the same name as
+ this namespace node. The list is built after the prepare
+ phase has been run but just before the generate phase. It
+ is buils by QDocDatabase::resolveNamespaces().
+
+ \sa QDocDatabase::resolveNamespaces()
+ */
+const NodeList &NamespaceNode::includedChildren() const
+{
+ return includedChildren_;
+}
+
+/*!
+ This function is only called from QDocDatabase::resolveNamesapces().
+
+ \sa includedChildren(), QDocDatabase::resolveNamespaces()
+ */
+void NamespaceNode::includeChild(Node *child)
+{
+ includedChildren_.append(child);
+}
+
+/*! \fn Tree* NamespaceNode::tree() const
+ Returns a pointer to the Tree that contains this NamespaceNode.
+ This requires traversing the parent() pointers to the root of
+ the Tree, which is the unnamed NamespaceNode.
+ */
+
+/*! \fn bool NamespaceNode::isFirstClassAggregate() const
+ Returns \c true.
+ */
+
+/*! \fn bool NamespaceNode::isRelatableType() const
+ Returns \c true.
+ */
+
+/*! \fn bool NamespaceNode::wasSeen() const
+ Returns \c true if the \c {\\namespace} command that this NamespaceNode
+ represents has been parsed by qdoc. When \c false is returned, it means
+ that only \c {\\relates} commands have been seen that relate elements to
+ this namespace.
+ */
+
+/*! \fn void NamespaceNode::markSeen()
+ Sets the data member that indicates that the \c {\\namespace} command this
+ NamespaceNode represents has been parsed by qdoc.
+ */
+
+/*! \fn void NamespaceNode::markNotSeen()
+ Clears the data member that indicates that the \c {\\namespace} command this
+ NamespaceNode represents has been parsed by qdoc.
+ */
+
+/*! \fn void NamespaceNode::setTree(Tree* t)
+ Sets the Tree pointer to \a t, which means this NamespaceNode is in the Tree \a t.
+ */
+
+/*! \fn QString NamespaceNode::whereDocumented() const
+ Returns the camel case name of the module where this namespace is documented.
+
+ \sa setWhereDocumented()
+ */
+
+/*! \fn void NamespaceNode::setWhereDocumented(const QString &t)
+ Sets the camel case name of the module where this namespace is documented to
+ the module named \a t.
+
+ This function is called when the \c {\\namespace} command is processed to let
+ qdoc know that this namespace is documented in the current module, so that
+ when something in another module is marked as related to this namespace, it
+ can be documented there with a ProxyNode for this namespace.
+
+ \sa whereDocumented()
+ */
+
+/*! \fn void NamespaceNode::setDocumented()
+ Sets the flag indicating that the \c {\\namespace} command for this
+ namespace was seen.
+ */
+
+/*! \fn bool NamespaceNode::wasDocumented() const
+ Returns \c true if a \c {\\namespace} command for this namespace was seen.
+ Otherwise returns \c false.
+ */
+
+/*! \fn void NamespaceNode::setDocNode(NamespaceNode *ns) { docNode_ = ns; }
+ Called in QDocDatabase::resolveNamespaces() to set the pointer to the
+ NamespaceNode in which this namespace is documented.
+
+ \sa QDocDatabase::resolveNamespaces()
+ */
+
+/*! \fn NamespaceNode *NamespaceNode::docNode() const
+ Returns a pointer to the NamespaceNode that represents where the namespace
+ documentation is actually generated. API elements in many different modules
+ can be included in a single namespace. That namespace is only documented in
+ one module. The namespace is documented in the module where the \c {\\namespace}
+ command for the namespace appears.
+
+ \sa QDocDatabase::resolveNamespaces()
+ */
+
+/*!
+ \struct RelatedClass
+ \brief A struct for indicating that a ClassNode is related in some way to another ClassNode.
+
+ This struct has nothing to do with the \c {\\relates} command. This struct
+ is used for indicating that a ClassNode is a base class of another ClassNode,
+ is a derived class of another ClassNode, or is an ignored base class of
+ another ClassNode. This struct is only used in ClassNode.
+*/
+
+/*! \fn RelatedClass::RelatedClass()
+ The default constructor does nothing. It is only used for allocating empty
+ instances of RelatedClass in containers.
+ */
+
+/*! \fn RelatedClass::RelatedClass(Node::Access access, ClassNode *node)
+ This is the constructor used when the related class has been resolved.
+ In other words, when the ClassNode has been created so that \a node is
+ not \c nullptr.
+*/
+
+/*! \fn RelatedClass::RelatedClass(Node::Access access, const QStringList &path, const QString &signature)
+ This is the constructor used when the related class has not bee resolved,
+ because it hasn't been created yet. In that case, we store the qualified
+ \a path name of the class and the \a signature of the class, which I think
+ is just the name of the class.
+
+ \note We might be able to simplify the whole RelatedClass concept. Maybe we
+ can get rid of it completely.
+*/
+
+/*! \fn bool RelatedClass::isPrivate() const
+ Returns \c true if this RelatedClass is marked as Node::Private.
+*/
+
+/*!
+ Returns a string representing the access specifier.
+ */
+QString RelatedClass::accessString() const
+{
+ switch (access_) {
+ case Node::Protected:
+ return QLatin1String("protected");
+ case Node::Private:
+ return QLatin1String("private");
+ case Node::Public:
+ default:
+ break;
+ }
+ return QLatin1String("public");
+}
+
+/*!
+ \struct UsingClause
+ \brief This is supposed to describe a using clause, but I think it is not used.
+
+ This struct is only used in ClassNode. It describes a \c using clause that
+ was parsed. But now it looks like it is not actually used at all.
+
+ Maybe we can get rid of it?
+*/
+
+/*! \fn UsingClause::UsingClause()
+ The default constructor does nothing. It is only used for allocating empty
+ instances of UsingClause in containers.
+ */
+
+/*! \fn UsingClause::UsingClause(const QString &signature)
+ We assume the node that the using clause refers to has not yet been
+ created, so this constructor provides its \a signature, which is the
+ qualified path name of whatever it is.
+ */
+
+/*! \fn const QString &UsingClause::signature() const
+ This function returns a const reference to the signature, which is the qualified
+ path name of whatever the using clause refers to.
+ */
+
+/*! \fn const Node *UsingClause::node()
+ This function returns a pointer to the node which has been resolved by looking
+ up the signature in the qdoc database. If it wasn't resolved, \c nullptr is returned.
+ */
+
+/*! \fn void UsingClause::setNode(const Node *n)
+ This function is called when the signature can be resolved. The node pointer
+ is set to \a n.
+ */
+
+/*!
+ \class ClassNode
+ \brief The ClassNode represents a C++ class.
+
+ It is also used to represent a C++ struct or union. There are some
+ actual uses for structs, but I don't think any unions have been
+ documented yet.
+ */
+
+/*!
+ Adds the base class \a node to this class's list of base
+ classes. The base class has the specified \a access. This
+ is a resolved base class.
+ */
+void ClassNode::addResolvedBaseClass(Access access, ClassNode *node)
+{
+ bases_.append(RelatedClass(access, node));
+ node->derived_.append(RelatedClass(access, this));
+}
+
+/*!
+ Adds the derived class \a node to this class's list of derived
+ classes. The derived class inherits this class with \a access.
+ */
+void ClassNode::addDerivedClass(Access access, ClassNode *node)
+{
+ derived_.append(RelatedClass(access, node));
+}
+
+/*!
+ Add an unresolved base class to this class node's list of
+ base classes. The unresolved base class will be resolved
+ before the generate phase of qdoc. In an unresolved base
+ class, the pointer to the base class node is 0.
+ */
+void ClassNode::addUnresolvedBaseClass(Access access,
+ const QStringList &path,
+ const QString &signature)
+{
+ bases_.append(RelatedClass(access, path, signature));
+}
+
+/*!
+ Add an unresolved \c using clause to this class node's list
+ of \c using clauses. The unresolved \c using clause will be
+ resolved before the generate phase of qdoc. In an unresolved
+ \c using clause, the pointer to the function node is 0.
+ */
+void ClassNode::addUnresolvedUsingClause(const QString &signature)
+{
+ usingClauses_.append(UsingClause(signature));
+}
+
/*!
Search the child list to find the property node with the
specified \a name.
*/
-PropertyNode* ClassNode::findPropertyNode(const QString& name)
+PropertyNode *ClassNode::findPropertyNode(const QString &name)
{
- Node* n = findNonfunctionChild(name, &Node::isProperty);
+ Node *n = findNonfunctionChild(name, &Node::isProperty);
if (n)
- return static_cast<PropertyNode*>(n);
+ return static_cast<PropertyNode *>(n);
- PropertyNode* pn = nullptr;
+ PropertyNode *pn = nullptr;
const QList<RelatedClass> &bases = baseClasses();
if (!bases.isEmpty()) {
for (int i = 0; i < bases.size(); ++i) {
- ClassNode* cn = bases[i].node_;
+ ClassNode *cn = bases[i].node_;
if (cn) {
pn = cn->findPropertyNode(name);
if (pn)
@@ -1816,10 +3415,10 @@ PropertyNode* ClassNode::findPropertyNode(const QString& name)
}
}
}
- const QList<RelatedClass>& ignoredBases = ignoredBaseClasses();
+ const QList<RelatedClass> &ignoredBases = ignoredBaseClasses();
if (!ignoredBases.isEmpty()) {
for (int i = 0; i < ignoredBases.size(); ++i) {
- ClassNode* cn = ignoredBases[i].node_;
+ ClassNode *cn = ignoredBases[i].node_;
if (cn) {
pn = cn->findPropertyNode(name);
if (pn)
@@ -1837,20 +3436,20 @@ PropertyNode* ClassNode::findPropertyNode(const QString& name)
finds one, it returns the pointer to that QML element. If
it doesn't find one, it returns null.
*/
-QmlTypeNode* ClassNode::findQmlBaseNode()
+QmlTypeNode *ClassNode::findQmlBaseNode()
{
- QmlTypeNode* result = nullptr;
- const QList<RelatedClass>& bases = baseClasses();
+ QmlTypeNode *result = nullptr;
+ const QList<RelatedClass> &bases = baseClasses();
if (!bases.isEmpty()) {
for (int i = 0; i < bases.size(); ++i) {
- ClassNode* cn = bases[i].node_;
+ ClassNode *cn = bases[i].node_;
if (cn && cn->qmlElement()) {
return cn->qmlElement();
}
}
for (int i = 0; i < bases.size(); ++i) {
- ClassNode* cn = bases[i].node_;
+ ClassNode *cn = bases[i].node_;
if (cn) {
result = cn->findQmlBaseNode();
if (result != nullptr) {
@@ -1866,14 +3465,13 @@ QmlTypeNode* ClassNode::findQmlBaseNode()
\a fn is an overriding function in this class or in a class
derived from this class. Find the node for the function that
\a fn overrides in this class's children or in one of this
- class's base classes.
-
- \returns a pointer to the overridden function, or \nullptr.
+ class's base classes. Return a pointer to the overridden
+ function or return 0.
This should be revised because clang provides the path to the
overridden function. mws 15/12/2018
*/
-FunctionNode* ClassNode::findOverriddenFunction(const FunctionNode* fn)
+FunctionNode *ClassNode::findOverriddenFunction(const FunctionNode *fn)
{
QList<RelatedClass>::Iterator bc = bases_.begin();
while (bc != bases_.end()) {
@@ -1899,11 +3497,10 @@ FunctionNode* ClassNode::findOverriddenFunction(const FunctionNode* fn)
\a fn is an overriding function in this class or in a class
derived from this class. Find the node for the property that
\a fn overrides in this class's children or in one of this
- class's base classes.
-
- \returns a pointer to the overridden function, or \nullptr.
+ class's base classes. Return a pointer to the overridden
+ property or return 0.
*/
-PropertyNode* ClassNode::findOverriddenProperty(const FunctionNode* fn)
+PropertyNode *ClassNode::findOverriddenProperty(const FunctionNode *fn)
{
QList<RelatedClass>::Iterator bc = bases_.begin();
while (bc != bases_.end()) {
@@ -1917,7 +3514,7 @@ PropertyNode* ClassNode::findOverriddenProperty(const FunctionNode* fn)
NodeList::const_iterator i = children.begin();
while (i != children.end()) {
if ((*i)->isProperty()) {
- PropertyNode *pn = static_cast<PropertyNode*>(*i);
+ PropertyNode *pn = static_cast<PropertyNode *>(*i);
if (pn->name() == fn->name() || pn->hasAccessFunction(fn->name())) {
if (pn->hasDoc())
return pn;
@@ -1955,7 +3552,7 @@ bool ClassNode::docMustBeGenerated() const
\brief This class represents a C++ header file.
*/
-HeaderNode::HeaderNode(Aggregate* parent, const QString& name) : Aggregate(HeaderFile, parent, name)
+HeaderNode::HeaderNode(Aggregate *parent, const QString &name) : Aggregate(HeaderFile, parent, name)
{
// Add the include file with enclosing angle brackets removed
if (name.startsWith(QChar('<')) && name.length() > 2)
@@ -1981,8 +3578,8 @@ bool HeaderNode::docMustBeGenerated() const
*/
bool HeaderNode::hasDocumentedChildren() const
{
- foreach (Node *n, children_) {
- if (n->isInAPI())
+ for (const auto *node : qAsConst(children_)) {
+ if (node->isInAPI())
return true;
}
return false;
@@ -1990,6 +3587,19 @@ bool HeaderNode::hasDocumentedChildren() const
/*!
\class PageNode
+ \brief A PageNode is a Node that generates a documentation page.
+
+ Not all subclasses of Node produce documentation pages. FunctionNode,
+ PropertyNode, and EnumNode are all examples of subclasses of Node that
+ don't produce documentation pages but add documentation to a page.
+ They are always child nodes of an Aggregate, and Aggregate inherits
+ PageNode.
+
+ Not every subclass of PageNode inherits Aggregate. ExternalPageNode,
+ ExampleNode, and CollectionNode are subclasses of PageNode that are
+ not subclasses of Aggregate. Because they are not subclasses of
+ Aggregate, they can't have children. But they still generate, or
+ link to, a documentation page.
*/
/*! \fn QString PageNode::title() const
@@ -2020,7 +3630,8 @@ QString PageNode::fullTitle() const
/*!
Sets the node's \a title, which is used for the page title.
- Returns true.
+ Returns true. Adds the node to the parent() nonfunction map
+ using the \a title as the key.
*/
bool PageNode::setTitle(const QString &title)
{
@@ -2034,8 +3645,111 @@ bool PageNode::setTitle(const QString &title)
Sets the node's \a subtitle. Returns true;
*/
-/*! \f void Node::markInternal()
- Sets the node's access to Private and its status to Internal.
+/*! \fn PageNode::PageNode(Aggregate *parent, const QString &name)
+ This constructor sets the PageNode's \a parent and the \a name is the
+ argument of the \c {\\page} command. The node type is set to Node::Page.
+ */
+
+/*! \fn PageNode::PageNode(NodeType type, Aggregate *parent, const QString &name)
+ This constructor is not called directly. It is called by the constructors of
+ subclasses of PageNode, usually Aggregate. The node type is set to \a type,
+ and the parent pointer is set to \a parent. \a name is the argument of the topic
+ command that resulted in the PageNode being created. This could be \c {\\class}
+ or \c {\\namespace}, for example.
+ */
+
+/*! \fn PageNode::PageNode(Aggregate *parent, const QString &name, PageType ptype)
+ This constructor is called when the argument to the \c {\\page} command
+ contains a space, which means the second word of the argument is the page type.
+ It creates a PageNode that has node type Node::Page, with the specified
+ \a parent and \name, and the \a ptype is that second word of the argument to
+ the \c {\\page} command.
+
+ \sa Node::PageType
+ */
+
+/*! \fn PageNode::~PageNode()
+ The destructor is virtual, and it does nothing.
+ */
+
+/*! \fn bool PageNode::isPageNode() const
+ Always returns \c true because this is a PageNode.
+ */
+
+/*! \fn bool PageNode::isTextPageNode() const
+ Returns \c true if this instance of PageNode is not an Aggregate.
+ The significance of a \c true return value is that this PageNode
+ doesn't have children, because it is not an Aggregate.
+
+ \sa Aggregate.
+ */
+
+/*! \fn QString PageNode::nameForLists() const
+ Returns the title().
+ */
+
+/*! \fn QString PageNode::imageFileName() const
+ If this PageNode is an ExampleNode, the image file name
+ data member is returned. Otherwise an empty string is
+ returned.
+ */
+
+/*! \fn void PageNode::setImageFileName(const QString &ifn)
+ If this PageNode is an ExampleNode, the image file name
+ data member is set to \a ifn. Otherwise the function does
+ nothing.
+ */
+
+/*! \fn bool PageNode::noAutoList() const
+ Returns the value of the no auto-list flag.
+ */
+
+/*! \fn void PageNode::setNoAutoList(bool b)
+ Sets the no auto-list flag to \a b.
+ */
+
+/*! \fn const QStringList &PageNode::groupNames() const
+ Returns a const reference to the string list containing all the group names.
+ */
+
+/*! \fn void PageNode::appendGroupName(const QString &t)
+ Appends \a t to the list of group names.
+ */
+
+/*! \fn const QStringList &PageNode::pageKeywords() const
+ Returns a const reference to the list of keywords for this page.
+ */
+
+/*! \fn void PageNode::addPageKeywords(const QString &t)
+ Appends \a t to the keywords list.
+ */
+
+/*! \fn void PageNode::setOutputFileName(const QString &f)
+ Sets this PageNode's output file name to \a f.
+ */
+
+/*! \fn QString PageNode::outputFileName() const
+ Returns this PageNode's output file name.
+ */
+
+/*!
+ \class ExternalPageNode
+
+ \brief The ExternalPageNode represents an external documentation page.
+
+ Qdoc can generate links to pages that are not part of the documentation
+ being generated. 3rd party software pages are often referenced by links
+ from the QT documentation. Qdoc creates an ExternalPageNode when it sees
+ an \c {\\externalpage} command. The HTML generator can then use the node
+ when it needs to create links to the external page.
+
+ ExternalPageNode inherits PageNode.
+*/
+
+/*! \fn ExternalPageNode::ExternalPageNode(Aggregate *parent, const QString &name)
+ The constructor creates an ExternalPageNode as a child node of \a parent.
+ It's \a name is the argument from the \c {\\externalpage} command. The node
+ type is Node::ExternalPage, and the page type is Node::ArticlePage.
*/
/*!
@@ -2068,7 +3782,7 @@ Node::Access EnumNode::itemAccess(const QString &name) const
*/
QString EnumNode::itemValue(const QString &name) const
{
- foreach (const EnumItem &item, items_) {
+ for (const auto &item : qAsConst(items_)) {
if (item.name() == name)
return item.value();
}
@@ -2166,7 +3880,7 @@ Node *TypeAliasNode::clone(Aggregate *parent)
its overload number is set to 0. These data members are set
in normalizeOverloads(), when all the overloads are known.
*/
-FunctionNode::FunctionNode(Aggregate *parent, const QString& name)
+FunctionNode::FunctionNode(Aggregate *parent, const QString &name)
: Node(Function, parent, name),
const_(false),
static_(false),
@@ -2196,7 +3910,7 @@ FunctionNode::FunctionNode(Aggregate *parent, const QString& name)
its overload number is set to 0. These data members are set
in normalizeOverloads(), when all the overloads are known.
*/
-FunctionNode::FunctionNode(Metaness kind, Aggregate *parent, const QString& name, bool attached)
+FunctionNode::FunctionNode(Metaness kind, Aggregate *parent, const QString &name, bool attached)
: Node(Function, parent, name),
const_(false),
static_(false),
@@ -2256,7 +3970,7 @@ QString FunctionNode::virtualness() const
parent() is a C++ class, set the parent's \e abstract flag to
\c {true}.
*/
-void FunctionNode::setVirtualness(const QString& t)
+void FunctionNode::setVirtualness(const QString &t)
{
if (t == QLatin1String("non"))
virtualness_ = NonVirtual;
@@ -2345,7 +4059,7 @@ Node::Genus FunctionNode::getGenus(FunctionNode::Metaness t)
This static function converts the string \a t to an enum
value for the kind of function named by \a t.
*/
-FunctionNode::Metaness FunctionNode::getMetaness(const QString& t)
+FunctionNode::Metaness FunctionNode::getMetaness(const QString &t)
{
if (metanessMap_.isEmpty())
buildMetanessMap();
@@ -2356,7 +4070,7 @@ FunctionNode::Metaness FunctionNode::getMetaness(const QString& t)
This static function converts the topic string \a t to an enum
value for the kind of function this FunctionNode represents.
*/
-FunctionNode::Metaness FunctionNode::getMetanessFromTopic(const QString& t)
+FunctionNode::Metaness FunctionNode::getMetanessFromTopic(const QString &t)
{
if (topicMetanessMap_.isEmpty())
buildTopicMetanessMap();
@@ -2368,7 +4082,7 @@ FunctionNode::Metaness FunctionNode::getMetanessFromTopic(const QString& t)
of string \a t, which is the value of the function's "meta"
attribute in an index file. Returns the Metaness value
*/
-FunctionNode::Metaness FunctionNode::setMetaness(const QString& t)
+FunctionNode::Metaness FunctionNode::setMetaness(const QString &t)
{
metaness_ = getMetaness(t);
return metaness_;
@@ -2571,8 +4285,8 @@ bool FunctionNode::hasActiveAssociatedProperty() const
{
if (associatedProperties_.isEmpty())
return false;
- foreach (const Node *p, associatedProperties_) {
- if (!p->isObsolete())
+ for (const auto *property : qAsConst(associatedProperties_)) {
+ if (!property->isObsolete())
return true;
}
return false;
@@ -2611,10 +4325,10 @@ QString FunctionNode::signature(bool values, bool noReturnType) const
Returns true if function \a fn has role \a r for this
property.
*/
-PropertyNode::FunctionRole PropertyNode::role(const FunctionNode* fn) const
+PropertyNode::FunctionRole PropertyNode::role(const FunctionNode *fn) const
{
for (int i=0; i<4; i++) {
- if (functions_[i].contains(const_cast<FunctionNode*>(fn)))
+ if (functions_[i].contains(const_cast<FunctionNode *>(fn)))
return (FunctionRole) i;
}
return Notifier;
@@ -2633,7 +4347,7 @@ Node *VariableNode::clone(Aggregate *parent)
}
/*!
- Print some debugging stuff.
+ Print some information used for debugging qdoc. Only used when debugging.
*/
void FunctionNode::debug() const
{
@@ -2733,7 +4447,7 @@ bool FunctionNode::hasOverloads() const
The constructor sets the \a parent and the \a name, but
everything else is set to default values.
*/
-PropertyNode::PropertyNode(Aggregate *parent, const QString& name)
+PropertyNode::PropertyNode(Aggregate *parent, const QString &name)
: Node(Property, parent, name),
stored_(FlagValueDefault),
designable_(FlagValueDefault),
@@ -2758,7 +4472,7 @@ PropertyNode::PropertyNode(Aggregate *parent, const QString& name)
We probably should ensure that the constant and final
attributes are not being overridden improperly.
*/
-void PropertyNode::setOverriddenFrom(const PropertyNode* baseProperty)
+void PropertyNode::setOverriddenFrom(const PropertyNode *baseProperty)
{
for (int i = 0; i < NumFunctionRoles; ++i) {
if (functions_[i].isEmpty())
@@ -2778,6 +4492,9 @@ void PropertyNode::setOverriddenFrom(const PropertyNode* baseProperty)
}
/*!
+ Returns a string containing the data type qualified with "const" either
+ prepended to the data type or appended to it, or without the const
+ qualification, depending circumstances in the PropertyNode internal state.
*/
QString PropertyNode::qualifiedDataType() const
{
@@ -2832,7 +4549,7 @@ bool PropertyNode::hasAccessFunction(const QString &name) const
}
bool QmlTypeNode::qmlOnly = false;
-QMultiMap<const Node*, Node*> QmlTypeNode::inheritedBy;
+QMultiMap<const Node *, Node *> QmlTypeNode::inheritedBy;
/*!
Constructs a Qml type node or a Js type node depending on
@@ -2840,7 +4557,7 @@ QMultiMap<const Node*, Node*> QmlTypeNode::inheritedBy;
but which can also be Node::JsType. The new node has the
given \a parent and \a name.
*/
-QmlTypeNode::QmlTypeNode(Aggregate *parent, const QString& name, NodeType type)
+QmlTypeNode::QmlTypeNode(Aggregate *parent, const QString &name, NodeType type)
: Aggregate(type, parent, name),
abstract_(false),
cnodeRequired_(false),
@@ -2858,14 +4575,6 @@ QmlTypeNode::QmlTypeNode(Aggregate *parent, const QString& name, NodeType type)
}
/*!
- Needed for printing a debug messages.
- */
-QmlTypeNode::~QmlTypeNode()
-{
- // nothing.
-}
-
-/*!
Clear the static maps so that subsequent runs don't try to use
contents from a previous run.
*/
@@ -2878,7 +4587,7 @@ void QmlTypeNode::terminate()
Record the fact that QML class \a base is inherited by
QML class \a sub.
*/
-void QmlTypeNode::addInheritedBy(const Node *base, Node* sub)
+void QmlTypeNode::addInheritedBy(const Node *base, Node *sub)
{
if (sub->isInternal())
return;
@@ -2945,9 +4654,9 @@ QString QmlTypeNode::logicalModuleIdentifier() const
/*!
Returns true if this QML type inherits \a type.
*/
-bool QmlTypeNode::inherits(Aggregate* type)
+bool QmlTypeNode::inherits(Aggregate *type)
{
- QmlTypeNode* qtn = qmlBaseNode();
+ QmlTypeNode *qtn = qmlBaseNode();
while (qtn != nullptr) {
if (qtn == type)
return true;
@@ -2962,7 +4671,7 @@ bool QmlTypeNode::inherits(Aggregate* type)
must be either Node::QmlBasicType or Node::JsBasicType.
The new node has the given \a parent and \a name.
*/
-QmlBasicTypeNode::QmlBasicTypeNode(Aggregate *parent, const QString& name, Node::NodeType type)
+QmlBasicTypeNode::QmlBasicTypeNode(Aggregate *parent, const QString &name, Node::NodeType type)
: Aggregate(type, parent, name)
{
setTitle(name);
@@ -2971,9 +4680,9 @@ QmlBasicTypeNode::QmlBasicTypeNode(Aggregate *parent, const QString& name, Node:
/*!
Constructor for the QML property node.
*/
-QmlPropertyNode::QmlPropertyNode(Aggregate* parent,
- const QString& name,
- const QString& type,
+QmlPropertyNode::QmlPropertyNode(Aggregate *parent,
+ const QString &name,
+ const QString &type,
bool attached)
: Node(parent->isJsType() ? JsProperty : QmlProperty, parent, name),
type_(type),
@@ -3007,11 +4716,11 @@ bool QmlPropertyNode::isWritable()
if (readOnly_ != FlagValueDefault)
return !fromFlagValue(readOnly_, false);
- QmlTypeNode* qcn = qmlTypeNode();
+ QmlTypeNode *qcn = qmlTypeNode();
if (qcn) {
if (qcn->cppClassRequired()) {
if (qcn->classNode()) {
- PropertyNode* pn = findCorrespondingCppProperty();
+ PropertyNode *pn = findCorrespondingCppProperty();
if (pn)
return pn->isWritable();
else
@@ -3034,15 +4743,15 @@ bool QmlPropertyNode::isWritable()
Returns a pointer this QML property's corresponding C++
property, if it has one.
*/
-PropertyNode* QmlPropertyNode::findCorrespondingCppProperty()
+PropertyNode *QmlPropertyNode::findCorrespondingCppProperty()
{
- PropertyNode* pn;
- Node* n = parent();
+ PropertyNode *pn;
+ Node *n = parent();
while (n && !(n->isQmlType() || n->isJsType()))
n = n->parent();
if (n) {
- QmlTypeNode* qcn = static_cast<QmlTypeNode*>(n);
- ClassNode* cn = qcn->classNode();
+ QmlTypeNode *qcn = static_cast<QmlTypeNode *>(n);
+ ClassNode *cn = qcn->classNode();
if (cn) {
/*
If there is a dot in the property name, first
@@ -3059,9 +4768,9 @@ PropertyNode* QmlPropertyNode::findCorrespondingCppProperty()
*/
if (dotSplit.size() > 1) {
QStringList path(extractClassName(pn->qualifiedDataType()));
- Node* nn = QDocDatabase::qdocDB()->findClassNode(path);
+ Node *nn = QDocDatabase::qdocDB()->findClassNode(path);
if (nn) {
- ClassNode* cn = static_cast<ClassNode*>(nn);
+ ClassNode *cn = static_cast<ClassNode *>(nn);
PropertyNode *pn2 = cn->findPropertyNode(dotSplit[1]);
/*
If found, return the C++ property
@@ -3082,488 +4791,6 @@ PropertyNode* QmlPropertyNode::findCorrespondingCppProperty()
}
/*!
- Construct the full document name for this node and return it.
- */
-QString Node::fullDocumentName() const
-{
- QStringList pieces;
- const Node* n = this;
-
- do {
- if (!n->name().isEmpty())
- pieces.insert(0, n->name());
-
- if ((n->isQmlType() || n->isJsType()) && !n->logicalModuleName().isEmpty()) {
- pieces.insert(0, n->logicalModuleName());
- break;
- }
-
- if (n->isTextPageNode())
- break;
-
- // Examine the parent if the node is a member
- if (!n->parent() || n->isRelatedNonmember())
- break;
-
- n = n->parent();
- } while (true);
-
- // Create a name based on the type of the ancestor node.
- QString concatenator = "::";
- if (n->isQmlType() || n->isJsType())
- concatenator = QLatin1Char('.');
-
- if (n->isTextPageNode())
- concatenator = QLatin1Char('#');
-
- return pieces.join(concatenator);
-}
-
-/*!
- Returns the \a str as an NCName, which means the name can
- be used as the value of an \e id attribute. Search for NCName
- on the internet for details of what can be an NCName.
- */
-QString Node::cleanId(const QString &str)
-{
- QString clean;
- QString name = str.simplified();
-
- if (name.isEmpty())
- return clean;
-
- name = name.replace("::","-");
- name = name.replace(QLatin1Char(' '), QLatin1Char('-'));
- name = name.replace("()","-call");
-
- clean.reserve(name.size() + 20);
- if (!str.startsWith("id-"))
- clean = "id-";
- const QChar c = name[0];
- const uint u = c.unicode();
-
- if ((u >= 'a' && u <= 'z') ||
- (u >= 'A' && u <= 'Z') ||
- (u >= '0' && u <= '9')) {
- clean += c;
- }
- else if (u == '~') {
- clean += "dtor.";
- }
- else if (u == '_') {
- clean += "underscore.";
- }
- else {
- clean += QLatin1Char('a');
- }
-
- for (int i = 1; i < (int) name.length(); i++) {
- const QChar c = name[i];
- const uint u = c.unicode();
- if ((u >= 'a' && u <= 'z') ||
- (u >= 'A' && u <= 'Z') ||
- (u >= '0' && u <= '9') || u == '-' ||
- u == '_' || u == '.') {
- clean += c;
- }
- else if (c.isSpace() || u == ':' ) {
- clean += QLatin1Char('-');
- }
- else if (u == '!') {
- clean += "-not";
- }
- else if (u == '&') {
- clean += "-and";
- }
- else if (u == '<') {
- clean += "-lt";
- }
- else if (u == '=') {
- clean += "-eq";
- }
- else if (u == '>') {
- clean += "-gt";
- }
- else if (u == '#') {
- clean += "-hash";
- }
- else if (u == '(') {
- clean += QLatin1Char('-');
- }
- else if (u == ')') {
- clean += QLatin1Char('-');
- }
- else {
- clean += QLatin1Char('-');
- clean += QString::number((int)u, 16);
- }
- }
- return clean;
-}
-
-/*!
- Prints the inner node's list of children.
- For debugging only.
- */
-void Aggregate::printChildren(const QString& title)
-{
- qDebug() << title << name() << children_.size();
- if (children_.size() > 0) {
- for (int i=0; i<children_.size(); ++i) {
- Node* n = children_.at(i);
- qDebug() << " CHILD:" << n->name() << n->nodeTypeString();
- }
- }
-}
-
-/*!
- Removes \a fn from this aggregate's function map. That's
- all it does. If \a fn is in the function map index and it
- has an overload, the value pointer in the function map
- index is set to the the overload pointer. If the function
- has no overload pointer, the function map entry is erased.
-
- \note When removing a function node from the function map,
- it is important to set the removed function node's next
- overload pointer to null because the function node might
- be added as a child to some other aggregate.
- */
-void Aggregate::removeFunctionNode(FunctionNode *fn)
-{
- FunctionMap::Iterator i = functionMap_.find(fn->name());
- if (i != functionMap_.end()) {
- if (i.value() == fn) {
- if (fn->nextOverload() != nullptr) {
- i.value() = fn->nextOverload();
- fn->setNextOverload(nullptr);
- fn->setOverloadNumber(0);
- }
- else {
- functionMap_.erase(i);
- }
- } else {
- FunctionNode *current = i.value();
- while (current != nullptr) {
- if (current->nextOverload() == fn) {
- current->setNextOverload(fn->nextOverload());
- fn->setNextOverload(nullptr);
- fn->setOverloadNumber(0);
- break;
- }
- current = current->nextOverload();
- }
- }
- }
-}
-
-/*
- When deciding whether to include a function in the function
- index, if the function is marked private, don't include it.
- If the function is marked obsolete, don't include it. If the
- function is marked internal, don't include it. Or if the
- function is a destructor or any kind of constructor, don't
- include it. Otherwise include it.
- */
-static bool keep(FunctionNode *fn)
-{
- if (fn->isPrivate() ||
- fn->isObsolete() ||
- fn->isInternal() ||
- fn->isSomeCtor() ||
- fn->isDtor())
- return false;
- return true;
-}
-
-/*!
- Insert all functions declared in this aggregate into the
- \a functionIndex. Call the function recursively for each
- child that is an aggregate.
-
- Only include functions that are in the public API and
- that are not constructors or destructors.
- */
-void Aggregate::findAllFunctions(NodeMapMap &functionIndex)
-{
- FunctionMap::const_iterator i;
- for (i = functionMap_.constBegin(); i != functionMap_.constEnd(); ++i) {
- FunctionNode *fn = i.value();
- if (keep(fn))
- functionIndex[fn->name()].insert(fn->parent()->fullDocumentName(), fn);
- fn = fn->nextOverload();
- while (fn != nullptr) {
- if (keep(fn))
- functionIndex[fn->name()].insert(fn->parent()->fullDocumentName(), fn);
- fn = fn->nextOverload();
- }
- }
- foreach (Node *n, children_) {
- if (n->isAggregate() && !n->isPrivate())
- static_cast<Aggregate*>(n)->findAllFunctions(functionIndex);
- }
-}
-
-/*!
- For each child of this node, if the child is a namespace node,
- insert the child into the \a namespaces multimap. If the child
- is an aggregate, call this function recursively for that child.
-
- When the function called with the root node of a tree, it finds
- all the namespace nodes in that tree and inserts them into the
- \a namespaces multimap.
-
- The root node of a tree is a namespace, but it has no name, so
- it is not inserted into the map. So, if this function is called
- for each tree in the qdoc database, it finds all the namespace
- nodes in the database.
- */
-void Aggregate::findAllNamespaces(NodeMultiMap &namespaces)
-{
- foreach (Node *n, children_) {
- if (n->isAggregate() && !n->isPrivate()) {
- if (n->isNamespace() && !n->name().isEmpty())
- namespaces.insert(n->name(), n);
- static_cast<Aggregate*>(n)->findAllNamespaces(namespaces);
- }
- }
-}
-
-/*!
- Returns true if this aggregate contains at least one child
- that is marked obsolete. Otherwise returns false.
- */
-bool Aggregate::hasObsoleteMembers()
-{
- foreach (Node *n, children_) {
- if (!n->isPrivate() && n->isObsolete()) {
- if (n->isFunction() || n->isProperty() || n->isEnumType() ||
- n->isTypedef() || n->isTypeAlias() || n->isVariable() ||
- n->isQmlProperty() || n->isJsProperty())
- return true;
- }
- }
- return false;
-}
-
-/*!
- Finds all the obsolete C++ classes and QML types in this
- aggregate and all the C++ classes and QML types with obsolete
- members, and inserts them into maps used elesewhere for
- generating documentation.
- */
-void Aggregate::findAllObsoleteThings()
-{
- foreach (Node *n, children_) {
- if (!n->isPrivate()) {
- QString name = n->name();
- if (n->isObsolete()) {
- if (n->isClassNode())
- QDocDatabase::obsoleteClasses().insert(n->qualifyCppName(), n);
- else if (n->isQmlType() || n->isJsType())
- QDocDatabase::obsoleteQmlTypes().insert(n->qualifyQmlName(), n);
- } else if (n->isClassNode()) {
- Aggregate* a = static_cast<Aggregate*>(n);
- if (a->hasObsoleteMembers())
- QDocDatabase::classesWithObsoleteMembers().insert(n->qualifyCppName(), n);
- }
- else if (n->isQmlType() || n->isJsType()) {
- Aggregate *a = static_cast<Aggregate *>(n);
- if (a->hasObsoleteMembers())
- QDocDatabase::qmlTypesWithObsoleteMembers().insert(n->qualifyQmlName(), n);
- }
- else if (n->isAggregate()) {
- static_cast<Aggregate*>(n)->findAllObsoleteThings();
- }
- }
- }
-}
-
-/*!
- Finds all the C++ classes, QML types, JS types, QML and JS
- basic types, and examples in this aggregate and inserts them
- into appropriate maps for later use in generating documentation.
- */
-void Aggregate::findAllClasses()
-{
- foreach (Node *n, children_) {
- if (!n->isPrivate() && !n->isInternal() && !n->isDontDocument() &&
- n->tree()->camelCaseModuleName() != QString("QDoc")) {
- if (n->isClassNode()) {
- QDocDatabase::cppClasses().insert(n->qualifyCppName().toLower(), n);
- } else if (n->isQmlType() || n->isQmlBasicType() || n->isJsType() || n->isJsBasicType()) {
- QString name = n->unqualifyQmlName();
- QDocDatabase::qmlTypes().insert(name, n);
- //also add to the QML basic type map
- if (n->isQmlBasicType() || n->isJsBasicType())
- QDocDatabase::qmlBasicTypes().insert(name, n);
- } else if (n->isExample()) {
- // use the module index title as key for the example map
- QString title = n->tree()->indexTitle();
- if (!QDocDatabase::examples().contains(title, n))
- QDocDatabase::examples().insert(title, n);
- } else if (n->isAggregate()) {
- static_cast<Aggregate*>(n)->findAllClasses();
- }
- }
- }
-}
-
-/*!
- Find all the attribution pages in this node and insert them
- into \a attributions.
- */
-void Aggregate::findAllAttributions(NodeMultiMap &attributions)
-{
- foreach (Node *n, children_) {
- if (!n->isPrivate()) {
- if (n->pageType() == Node::AttributionPage)
- attributions.insertMulti(n->tree()->indexTitle(), n);
- else if (n->isAggregate())
- static_cast<Aggregate*>(n)->findAllAttributions(attributions);
- }
- }
-}
-
-/*!
- \fn void findAllSince()
-
- Finds all the nodes in this node where a \e{since} command appeared
- in the qdoc comment and sorts them into maps according to the kind
- of node.
-
- This function is used for generating the "New Classes... in x.y"
- section on the \e{What's New in Qt x.y} page.
- */
-void Aggregate::findAllSince()
-{
- foreach (Node *n, children_) {
- QString sinceString = n->since();
- // Insert a new entry into each map for each new since string found.
- if (!n->isPrivate() && !sinceString.isEmpty()) {
- NodeMultiMapMap::iterator nsmap = QDocDatabase::newSinceMaps().find(sinceString);
- if (nsmap == QDocDatabase::newSinceMaps().end())
- nsmap = QDocDatabase::newSinceMaps().insert(sinceString, NodeMultiMap());
-
- NodeMapMap::iterator ncmap = QDocDatabase::newClassMaps().find(sinceString);
- if (ncmap == QDocDatabase::newClassMaps().end())
- ncmap = QDocDatabase::newClassMaps().insert(sinceString, NodeMap());
-
- NodeMapMap::iterator nqcmap = QDocDatabase::newQmlTypeMaps().find(sinceString);
- if (nqcmap == QDocDatabase::newQmlTypeMaps().end())
- nqcmap = QDocDatabase::newQmlTypeMaps().insert(sinceString, NodeMap());
-
- if (n->isFunction()) {
- // Insert functions into the general since map.
- FunctionNode *fn = static_cast<FunctionNode*>(n);
- if (!fn->isObsolete() && !fn->isSomeCtor() && !fn->isDtor())
- nsmap.value().insert(fn->name(), fn);
- }
- else if (n->isClassNode()) {
- // Insert classes into the since and class maps.
- QString name = n->qualifyWithParentName();
- nsmap.value().insert(name, n);
- ncmap.value().insert(name, n);
- } else if (n->isQmlType() || n->isJsType()) {
- // Insert QML elements into the since and element maps.
- QString name = n->qualifyWithParentName();
- nsmap.value().insert(name, n);
- nqcmap.value().insert(name, n);
- } else if (n->isQmlProperty() || n->isJsProperty()) {
- // Insert QML properties into the since map.
- nsmap.value().insert(n->name(), n);
- } else {
- // Insert external documents into the general since map.
- QString name = n->qualifyWithParentName();
- nsmap.value().insert(name, n);
- }
- }
- // Recursively find child nodes with since commands.
- if (n->isAggregate())
- static_cast<Aggregate*>(n)->findAllSince();
- }
-}
-
-/*!
- For each QML Type node in this aggregate's children, if the
- QML type has a QML base type name but its QML base type node
- pointer is nullptr, use the QML base type name to look up the
- base type node. If the node is found, set the node's QML base
- type node pointer to that node.
- */
-void Aggregate::resolveQmlInheritance()
-{
- NodeMap previousSearches;
- // Do we need recursion?
- foreach (Node *child, children_) {
- if (!child->isQmlType() && !child->isJsType())
- continue;
- QmlTypeNode *type = static_cast<QmlTypeNode *>(child);
- if (type->qmlBaseNode() != nullptr)
- continue;
- if (type->qmlBaseName().isEmpty())
- continue;
- QmlTypeNode *base = static_cast<QmlTypeNode *>(previousSearches.value(type->qmlBaseName()));
- if (base && (base != type)) {
- type->setQmlBaseNode(base);
- QmlTypeNode::addInheritedBy(base, type);
- } else {
- if (!type->importList().isEmpty()) {
- const ImportList &imports = type->importList();
- for (int i=0; i<imports.size(); ++i) {
- base = QDocDatabase::qdocDB()->findQmlType(imports[i], type->qmlBaseName());
- if (base && (base != type)) {
- if (base->logicalModuleVersion()[0] != imports[i].version_[0])
- base = nullptr; // Safeguard for QTBUG-53529
- break;
- }
- }
- }
- if (base == nullptr) {
- base = QDocDatabase::qdocDB()->findQmlType(QString(), type->qmlBaseName());
- }
- if (base && (base != type)) {
- type->setQmlBaseNode(base);
- QmlTypeNode::addInheritedBy(base, type);
- previousSearches.insert(type->qmlBaseName(), base);
- }
- }
- }
-}
-
-/*!
- Returns a word representing the kind of Aggregate this node is.
- Currently only works for class, struct, and union, but it can
- easily be extended. If \a cap is true, the word is capitalised.
- */
-QString Aggregate::typeWord(bool cap) const
-{
- if (cap) {
- switch (nodeType()) {
- case Node::Class:
- return QLatin1String("Class");
- case Node::Struct:
- return QLatin1String("Struct");
- case Node::Union:
- return QLatin1String("Union");
- default:
- break;
- }
- } else {
- switch (nodeType()) {
- case Node::Class:
- return QLatin1String("class");
- case Node::Struct:
- return QLatin1String("struct");
- case Node::Union:
- return QLatin1String("union");
- default:
- break;
- }
- }
- return QString();
-}
-
-/*!
\class ProxyNode
\brief A class for representing an Aggregate that is documented in a different module.
@@ -3598,6 +4825,16 @@ ProxyNode::ProxyNode(Aggregate *parent, const QString &name)
tree()->appendProxy(this);
}
+/*! \fn bool ProxyNode::docMustBeGenerated() const
+ Returns true because a ProxyNode always means some documentation
+ must be generated.
+*/
+
+/*! \fn bool ProxyNode::isRelatableType() const
+ Returns true because the ProxyNode exists so that elements
+ can be related to it with the \c {\\relates} command.
+*/
+
/*!
\class CollectionNode
\brief A class for holding the members of a collection of doc pages.
@@ -3616,7 +4853,7 @@ bool CollectionNode::hasMembers() const
Appends \a node to the collection node's member list, if
and only if it isn't already in the member list.
*/
-void CollectionNode::addMember(Node* node)
+void CollectionNode::addMember(Node *node)
{
if (!members_.contains(node))
members_.append(node);
@@ -3666,7 +4903,7 @@ void CollectionNode::getMemberNamespaces(NodeMap& out)
NodeList::const_iterator i = members_.cbegin();
while (i != members_.cend()) {
if ((*i)->isNamespace())
- out.insert((*i)->name(),(*i));
+ out.insert((*i)->name(), (*i));
++i;
}
}
@@ -3681,7 +4918,7 @@ void CollectionNode::getMemberClasses(NodeMap& out) const
NodeList::const_iterator i = members_.cbegin();
while (i != members_.cend()) {
if ((*i)->isClassNode())
- out.insert((*i)->name(),(*i));
+ out.insert((*i)->name(), (*i));
++i;
}
}
@@ -3690,12 +4927,12 @@ void CollectionNode::getMemberClasses(NodeMap& out) const
Prints the collection node's list of members.
For debugging only.
*/
-void CollectionNode::printMembers(const QString& title)
+void CollectionNode::printMembers(const QString &title)
{
qDebug() << title << name() << members_.size();
if (members_.size() > 0) {
for (int i=0; i<members_.size(); ++i) {
- Node* n = members_.at(i);
+ Node *n = members_.at(i);
qDebug() << " MEMBER:" << n->name() << n->nodeTypeString();
}
}
@@ -3704,13 +4941,13 @@ void CollectionNode::printMembers(const QString& title)
/*!
This function splits \a arg on the blank character to get a
logical module name and version number. If the version number
- is present, it spilts the version number on the '.' character
- to get a major version number and a minor vrsion number. If
+ is present, it splits the version number on the '.' character
+ to get a major version number and a minor version number. If
the version number is present, both the major and minor version
numbers should be there, but the minor version number is not
absolutely necessary.
*/
-void CollectionNode::setLogicalModuleInfo(const QString& arg)
+void CollectionNode::setLogicalModuleInfo(const QString &arg)
{
QStringList blankSplit = arg.split(QLatin1Char(' '));
logicalModuleName_ = blankSplit[0];
@@ -3727,12 +4964,12 @@ void CollectionNode::setLogicalModuleInfo(const QString& arg)
/*!
This function accepts the logical module \a info as a string
list. If the logical module info contains the version number,
- it spilts the version number on the '.' character to get the
- major and minor vrsion numbers. Both major and minor version
+ it splits the version number on the '.' character to get the
+ major and minor version numbers. Both major and minor version
numbers should be provided, but the minor version number is
not strictly necessary.
*/
-void CollectionNode::setLogicalModuleInfo(const QStringList& info)
+void CollectionNode::setLogicalModuleInfo(const QStringList &info)
{
logicalModuleName_ = info[0];
if (info.size() > 1) {
@@ -3753,7 +4990,7 @@ void SharedCommentNode::setOverloadFlags()
{
for (Node *n : collective_) {
if (n->isFunction())
- static_cast<FunctionNode*>(n)->setOverloadFlag();
+ static_cast<FunctionNode *>(n)->setOverloadFlag();
}
}
diff --git a/src/qdoc/node.h b/src/qdoc/node.h
index 755f5efb4..0b6eb9e62 100644
--- a/src/qdoc/node.h
+++ b/src/qdoc/node.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -29,13 +29,14 @@
#ifndef NODE_H
#define NODE_H
-#include <qdir.h>
-#include <qmap.h>
-#include <qpair.h>
-#include <qstringlist.h>
-#include <qvector.h>
-#include "parameters.h"
#include "doc.h"
+#include "parameters.h"
+
+#include <QtCore/qdir.h>
+#include <QtCore/qmap.h>
+#include <QtCore/qpair.h>
+#include <QtCore/qstringlist.h>
+#include <QtCore/qvector.h>
QT_BEGIN_NAMESPACE
@@ -55,17 +56,17 @@ class CollectionNode;
class QmlPropertyNode;
class SharedCommentNode;
-typedef QMap<QString, FunctionNode*> FunctionMap;
-typedef QList<Node*> NodeList;
-typedef QList<ClassNode*> ClassList;
-typedef QVector<Node*> NodeVector;
-typedef QMap<QString, Node*> NodeMap;
+typedef QMap<QString, FunctionNode *> FunctionMap;
+typedef QList<Node *> NodeList;
+typedef QList<ClassNode *> ClassList;
+typedef QVector<Node *> NodeVector;
+typedef QMap<QString, Node *> NodeMap;
typedef QMap<QString, NodeMap> NodeMapMap;
-typedef QMultiMap<QString, Node*> NodeMultiMap;
+typedef QMultiMap<QString, Node *> NodeMultiMap;
typedef QMap<QString, NodeMultiMap> NodeMultiMapMap;
-typedef QMap<QString, CollectionNode*> CNMap;
-typedef QMultiMap<QString, CollectionNode*> CNMultiMap;
-typedef QList<CollectionNode*> CollectionList;
+typedef QMap<QString, CollectionNode *> CNMap;
+typedef QMultiMap<QString, CollectionNode *> CNMultiMap;
+typedef QList<CollectionNode *> CollectionList;
class Node
{
@@ -149,7 +150,7 @@ public:
FlagValueTrue = 1
};
- virtual ~Node();
+ virtual ~Node() { }
virtual Node *clone(Aggregate *) { return nullptr; } // currently only FunctionNode
virtual Tree *tree() const;
Aggregate *root() const;
@@ -165,7 +166,7 @@ public:
PageType pageType() const { return pageType_; }
QString pageTypeString() const;
void setPageType(PageType t) { pageType_ = t; }
- void setPageType(const QString& t);
+ void setPageType(const QString &t);
static PageType getPageType(NodeType t);
bool isActive() const { return status_ == Active; }
@@ -233,18 +234,18 @@ public:
virtual bool isWrapper() const;
QString plainName() const;
- QString plainFullName(const Node* relative = nullptr) const;
+ QString plainFullName(const Node *relative = nullptr) const;
QString plainSignature() const;
- QString fullName(const Node* relative = nullptr) const;
+ QString fullName(const Node *relative = nullptr) const;
virtual QString signature(bool , bool ) const { return plainName(); }
- const QString& fileNameBase() const { return fileNameBase_; }
+ const QString &fileNameBase() const { return fileNameBase_; }
bool hasFileNameBase() const { return !fileNameBase_.isEmpty(); }
- void setFileNameBase(const QString& t) { fileNameBase_ = t; }
+ void setFileNameBase(const QString &t) { fileNameBase_ = t; }
void setAccess(Access t) { access_ = t; }
- void setLocation(const Location& t);
- void setDoc(const Doc& doc, bool replace = false);
+ void setLocation(const Location &t);
+ void setDoc(const Doc &doc, bool replace = false);
void setStatus(Status t) {
if (status_ == Obsolete && t == Deprecated)
return;
@@ -253,25 +254,25 @@ public:
void setThreadSafeness(ThreadSafeness t) { safeness_ = t; }
void setSince(const QString &since);
void setPhysicalModuleName(const QString &name) { physicalModuleName_ = name; }
- void setUrl(const QString& url) { url_ = url; }
+ void setUrl(const QString &url) { url_ = url; }
void setTemplateStuff(const QString &t) { templateStuff_ = t; }
void setReconstitutedBrief(const QString &t) { reconstitutedBrief_ = t; }
- void setParent(Aggregate* n) { parent_ = n; }
+ void setParent(Aggregate *n) { parent_ = n; }
void setIndexNodeFlag(bool isIndexNode = true) { indexNodeFlag_ = isIndexNode; }
void setHadDoc() { hadDoc_ = true; }
virtual void setRelatedNonmember(bool b) { relatedNonmember_ = b; }
- virtual void setOutputFileName(const QString& ) { }
- virtual void addMember(Node* ) { }
+ virtual void setOutputFileName(const QString &) { }
+ virtual void addMember(Node *) { }
virtual bool hasMembers() const { return false; }
virtual bool hasNamespaces() const { return false; }
virtual bool hasClasses() const { return false; }
virtual void setAbstract(bool ) { }
virtual void setWrapper() { }
- virtual void getMemberNamespaces(NodeMap& ) { }
- virtual void getMemberClasses(NodeMap& ) const { }
- virtual void setDataType(const QString& ) { }
+ virtual void getMemberNamespaces(NodeMap &) { }
+ virtual void getMemberClasses(NodeMap &) const { }
+ virtual void setDataType(const QString &) { }
virtual bool wasSeen() const { return false; }
- virtual void appendGroupName(const QString& ) { }
+ virtual void appendGroupName(const QString &) { }
virtual QString element() const { return QString(); }
virtual void setNoAutoList(bool ) { }
virtual bool docMustBeGenerated() const { return false; }
@@ -279,51 +280,51 @@ public:
virtual QString title() const { return name(); }
virtual QString subtitle() const { return QString(); }
virtual QString fullTitle() const { return name(); }
- virtual bool setTitle(const QString& ) { return false; }
- virtual bool setSubtitle(const QString& ) { return false; }
+ virtual bool setTitle(const QString &) { return false; }
+ virtual bool setSubtitle(const QString &) { return false; }
- virtual void markInternal() { setAccess(Private); setStatus(Internal); }
+ void markInternal() { setAccess(Private); setStatus(Internal); }
virtual void markDefault() { }
virtual void markReadOnly(bool ) { }
- bool match(const QList<int>& types) const;
- Aggregate* parent() const { return parent_; }
- const QString& name() const { return name_; }
+ bool match(const QList<int> &types) const;
+ Aggregate *parent() const { return parent_; }
+ const QString &name() const { return name_; }
QString physicalModuleName() const;
QString url() const { return url_; }
virtual QString nameForLists() const { return name_; }
virtual QString outputFileName() const { return QString(); }
virtual QString obsoleteLink() const { return QString(); }
- virtual void setObsoleteLink(const QString& ) { }
- virtual void setQtVariable(const QString& ) { }
+ virtual void setObsoleteLink(const QString &) { }
+ virtual void setQtVariable(const QString &) { }
virtual QString qtVariable() const { return QString(); }
- virtual bool hasTag(const QString& ) const { return false; }
+ virtual bool hasTag(const QString &) const { return false; }
- const QMap<LinkType, QPair<QString,QString> >& links() const { return linkMap_; }
+ const QMap<LinkType, QPair<QString,QString> > &links() const { return linkMap_; }
void setLink(LinkType linkType, const QString &link, const QString &desc);
Access access() const { return access_; }
QString accessString() const;
- const Location& declLocation() const { return declLocation_; }
- const Location& defLocation() const { return defLocation_; }
- const Location& location() const { return (defLocation_.isEmpty() ? declLocation_ : defLocation_); }
- const Doc& doc() const { return doc_; }
+ const Location &declLocation() const { return declLocation_; }
+ const Location &defLocation() const { return defLocation_; }
+ const Location &location() const { return (defLocation_.isEmpty() ? declLocation_ : defLocation_); }
+ const Doc &doc() const { return doc_; }
bool isInAPI() const { return !isPrivate() && !isInternal() && hasDoc(); }
bool hasDoc() const { return (hadDoc_ || !doc_.isEmpty()); }
bool hadDoc() const { return hadDoc_; }
Status status() const { return status_; }
- Status inheritedStatus() const;
ThreadSafeness threadSafeness() const;
ThreadSafeness inheritedThreadSafeness() const;
QString since() const { return since_; }
QString templateStuff() const { return templateStuff_; }
- const QString& reconstitutedBrief() const { return reconstitutedBrief_; }
+ const QString &reconstitutedBrief() const { return reconstitutedBrief_; }
QString nodeSubtypeString() const;
- virtual void addPageKeywords(const QString& ) { }
+ virtual void addPageKeywords(const QString &) { }
bool isSharingComment() const { return (sharedCommentNode_ != nullptr); }
bool hasSharedDoc() const;
- void setSharedCommentNode(SharedCommentNode* t);
+ void setSharedCommentNode(SharedCommentNode *t) { sharedCommentNode_ = t; }
+ SharedCommentNode *sharedCommentNode() { return sharedCommentNode_; }
//QString guid() const;
QString extractClassName(const QString &string) const;
@@ -332,18 +333,16 @@ public:
virtual QString logicalModuleName() const { return QString(); }
virtual QString logicalModuleVersion() const { return QString(); }
virtual QString logicalModuleIdentifier() const { return QString(); }
- virtual void setLogicalModuleInfo(const QString& ) { }
- virtual void setLogicalModuleInfo(const QStringList& ) { }
- virtual CollectionNode* logicalModule() const { return nullptr; }
- virtual void setQmlModule(CollectionNode* ) { }
- virtual ClassNode* classNode() { return nullptr; }
- virtual void setClassNode(ClassNode* ) { }
- virtual const Node* applyModuleName(const Node* ) const { return nullptr; }
- virtual QString idNumber() { return "0"; }
- QmlTypeNode* qmlTypeNode();
- ClassNode* declarativeCppNode();
- const QString& outputSubdirectory() const { return outSubDir_; }
- virtual void setOutputSubdirectory(const QString& t) { outSubDir_ = t; }
+ virtual void setLogicalModuleInfo(const QString &) { }
+ virtual void setLogicalModuleInfo(const QStringList &) { }
+ virtual CollectionNode *logicalModule() const { return nullptr; }
+ virtual void setQmlModule(CollectionNode *) { }
+ virtual ClassNode *classNode() { return nullptr; }
+ virtual void setClassNode(ClassNode *) { }
+ QmlTypeNode *qmlTypeNode();
+ ClassNode *declarativeCppNode();
+ const QString &outputSubdirectory() const { return outSubDir_; }
+ virtual void setOutputSubdirectory(const QString &t) { outSubDir_ = t; }
QString fullDocumentName() const;
QString qualifyCppName();
QString qualifyQmlName();
@@ -357,11 +356,11 @@ public:
static QString nodeTypeString(NodeType t);
static QString nodeSubtypeString(unsigned char t);
static void initialize();
- static NodeType goal(const QString& t) { return goals_.value(t); }
+ static NodeType goal(const QString &t) { return goals_.value(t); }
static bool nodeNameLessThan(const Node *first, const Node *second);
protected:
- Node(NodeType type, Aggregate* parent, const QString& name);
+ Node(NodeType type, Aggregate *parent, const QString &name);
private:
NodeType nodeType_;
@@ -374,7 +373,7 @@ private:
bool relatedNonmember_ : 1;
bool hadDoc_ : 1;
- Aggregate* parent_;
+ Aggregate *parent_;
SharedCommentNode *sharedCommentNode_;
QString name_;
Location declLocation_;
@@ -397,13 +396,12 @@ private:
class PageNode : public Node
{
public:
- PageNode(Aggregate* parent, const QString& name) : Node(Page, parent, name),
+ PageNode(Aggregate *parent, const QString &name) : Node(Page, parent, name),
noAutoList_(false) { }
- PageNode(NodeType type, Aggregate* parent, const QString& name) : Node(type, parent, name),
+ PageNode(NodeType type, Aggregate *parent, const QString &name) : Node(type, parent, name),
noAutoList_(false) { }
- PageNode(Aggregate* parent, const QString& name, PageType ptype) : Node(Page, parent, name),
+ PageNode(Aggregate *parent, const QString &name, PageType ptype) : Node(Page, parent, name),
noAutoList_(false) { setPageType(ptype); }
- virtual ~PageNode() { }
bool isPageNode() const override { return true; }
bool isTextPageNode() const override { return !isAggregate(); } // PageNode but not Aggregate
@@ -411,21 +409,21 @@ public:
QString title() const override { return title_; }
QString subtitle() const override { return subtitle_; }
QString fullTitle() const override;
- bool setTitle(const QString& title) override;
+ bool setTitle(const QString &title) override;
bool setSubtitle(const QString &subtitle) override { subtitle_ = subtitle; return true; }
QString nameForLists() const override { return title(); }
virtual QString imageFileName() const { return QString(); }
- virtual void setImageFileName(const QString& ) { }
+ virtual void setImageFileName(const QString &) { }
bool noAutoList() const { return noAutoList_; }
void setNoAutoList(bool b) override { noAutoList_ = b; }
- const QStringList& groupNames() const { return groupNames_; }
- void appendGroupName(const QString& t) override { groupNames_.append(t); }
+ const QStringList &groupNames() const { return groupNames_; }
+ void appendGroupName(const QString &t) override { groupNames_.append(t); }
- const QStringList& pageKeywords() const { return pageKeywds_; }
- void addPageKeywords(const QString& t) override { pageKeywds_ << t; }
- void setOutputFileName(const QString& f) override { outputFileName_ = f; }
+ const QStringList &pageKeywords() const { return pageKeywds_; }
+ void addPageKeywords(const QString &t) override { pageKeywds_ << t; }
+ void setOutputFileName(const QString &f) override { outputFileName_ = f; }
QString outputFileName() const override { return outputFileName_; }
protected:
@@ -443,7 +441,7 @@ public:
class ExternalPageNode : public PageNode
{
public:
- ExternalPageNode(Aggregate* parent, const QString& name)
+ ExternalPageNode(Aggregate *parent, const QString &name)
: PageNode(Node::ExternalPage, parent, name) {
setPageType(Node::ArticlePage);
}
@@ -452,17 +450,17 @@ public:
class Aggregate : public PageNode
{
public:
- Node* findChildNode(const QString& name, Node::Genus genus, int findFlags = 0) const;
- Node* findNonfunctionChild(const QString& name, bool (Node::*) () const);
- void findChildren(const QString& name, NodeVector& nodes) const;
- FunctionNode* findFunctionChild(const QString& name, const Parameters &parameters);
- FunctionNode* findFunctionChild(const FunctionNode* clone);
+ Node *findChildNode(const QString &name, Node::Genus genus, int findFlags = 0) const;
+ Node *findNonfunctionChild(const QString &name, bool (Node:: *) () const);
+ void findChildren(const QString &name, NodeVector &nodes) const;
+ FunctionNode *findFunctionChild(const QString &name, const Parameters &parameters);
+ FunctionNode *findFunctionChild(const FunctionNode *clone);
void normalizeOverloads();
void markUndocumentedChildrenInternal();
bool isAggregate() const override { return true; }
- const EnumNode* findEnumNodeForValue(const QString &enumValue) const;
+ const EnumNode *findEnumNodeForValue(const QString &enumValue) const;
int count() const { return children_.size(); }
const NodeList &childNodes() const { return children_; }
@@ -475,20 +473,20 @@ public:
const QStringList &includeFiles() const { return includeFiles_; }
QStringList primaryKeys();
- QmlPropertyNode* hasQmlProperty(const QString& ) const;
- QmlPropertyNode* hasQmlProperty(const QString&, bool attached) const;
- virtual QmlTypeNode* qmlBaseNode() const { return nullptr; }
- void addChildByTitle(Node* child, const QString& title);
- void printChildren(const QString& title);
- void addChild(Node* child);
+ QmlPropertyNode *hasQmlProperty(const QString &) const;
+ QmlPropertyNode *hasQmlProperty(const QString &, bool attached) const;
+ virtual QmlTypeNode *qmlBaseNode() const { return nullptr; }
+ void addChildByTitle(Node *child, const QString &title);
+ void printChildren(const QString &title);
+ void addChild(Node *child);
void adoptChild(Node *child);
- void setOutputSubdirectory(const QString& t) override;
+ void setOutputSubdirectory(const QString &t) override;
FunctionMap &functionMap() { return functionMap_; }
void findAllFunctions(NodeMapMap &functionIndex);
void findAllNamespaces(NodeMultiMap &namespaces);
void findAllAttributions(NodeMultiMap &attributions);
- bool hasObsoleteMembers();
+ bool hasObsoleteMembers() const;
void findAllObsoleteThings();
void findAllClasses();
void findAllSince();
@@ -501,14 +499,14 @@ public:
protected:
Aggregate(NodeType type, Aggregate *parent, const QString &name)
: PageNode(type, parent, name), functionCount_(0) { }
- virtual ~Aggregate();
+ ~Aggregate() override;
void removeFunctionNode(FunctionNode *fn);
private:
friend class Node;
void addFunction(FunctionNode *fn);
void adoptFunction(FunctionNode *fn);
- static bool isSameSignature(const FunctionNode* f1, const FunctionNode* f2);
+ static bool isSameSignature(const FunctionNode *f1, const FunctionNode *f2);
protected:
NodeList children_;
@@ -536,17 +534,17 @@ class ProxyNode : public Aggregate
class NamespaceNode : public Aggregate
{
public:
- NamespaceNode(Aggregate* parent, const QString& name) : Aggregate(Namespace, parent, name),
+ NamespaceNode(Aggregate *parent, const QString &name) : Aggregate(Namespace, parent, name),
seen_(false), tree_(nullptr), docNode_(nullptr) { }
- virtual ~NamespaceNode();
- Tree* tree() const override { return (parent() ? parent()->tree() : tree_); }
+ ~NamespaceNode() override;
+ Tree *tree() const override { return (parent() ? parent()->tree() : tree_); }
bool isFirstClassAggregate() const override { return true; }
bool isRelatableType() const override { return true; }
bool wasSeen() const override { return seen_; }
void markSeen() { seen_ = true; }
void markNotSeen() { seen_ = false; }
- void setTree(Tree* t) { tree_ = t; }
+ void setTree(Tree *t) { tree_ = t; }
const NodeList &includedChildren() const;
void includeChild(Node *child);
QString whereDocumented() const { return whereDocumented_; }
@@ -555,90 +553,89 @@ public:
bool hasDocumentedChildren() const;
void reportDocumentedChildrenInUndocumentedNamespace() const;
bool docMustBeGenerated() const override;
- void setDocNode(NamespaceNode* ns) { docNode_ = ns; }
- NamespaceNode* docNode() const { return docNode_; }
+ void setDocNode(NamespaceNode *ns) { docNode_ = ns; }
+ NamespaceNode *docNode() const { return docNode_; }
private:
- bool seen_;
- Tree* tree_;
- QString whereDocumented_;
- NamespaceNode* docNode_;
- NodeList includedChildren_;
+ bool seen_;
+ Tree *tree_;
+ QString whereDocumented_;
+ NamespaceNode *docNode_;
+ NodeList includedChildren_;
};
struct RelatedClass
{
RelatedClass() { }
// constructor for resolved base class
- RelatedClass(Node::Access access, ClassNode* node)
+ RelatedClass(Node::Access access, ClassNode *node)
: access_(access), node_(node) { }
// constructor for unresolved base class
- RelatedClass(Node::Access access, const QStringList& path, const QString& signature)
+ RelatedClass(Node::Access access, const QStringList &path, const QString &signature)
: access_(access), node_(nullptr), path_(path), signature_(signature) { }
QString accessString() const;
bool isPrivate() const { return (access_ == Node::Private); }
- Node::Access access_;
- ClassNode* node_;
- QStringList path_;
- QString signature_;
+ Node::Access access_;
+ ClassNode *node_;
+ QStringList path_;
+ QString signature_;
};
struct UsingClause
{
UsingClause() { }
- UsingClause(const QString& signature) : node_(nullptr), signature_(signature) { }
- const QString& signature() const { return signature_; }
- const Node* node() { return node_; }
- void setNode(const Node* n) { node_ = n; }
+ UsingClause(const QString &signature) : node_(nullptr), signature_(signature) { }
+ const QString &signature() const { return signature_; }
+ const Node *node() { return node_; }
+ void setNode(const Node *n) { node_ = n; }
- const Node* node_;
+ const Node *node_;
QString signature_;
};
class ClassNode : public Aggregate
{
public:
- ClassNode(NodeType type, Aggregate* parent, const QString& name) : Aggregate(type, parent, name),
+ ClassNode(NodeType type, Aggregate *parent, const QString &name) : Aggregate(type, parent, name),
abstract_(false), wrapper_(false), qmlelement(nullptr) { }
- virtual ~ClassNode() { }
bool isFirstClassAggregate() const override { return true; }
bool isClassNode() const override { return true; }
bool isRelatableType() const override { return true; }
bool isWrapper() const override { return wrapper_; }
QString obsoleteLink() const override { return obsoleteLink_; }
- void setObsoleteLink(const QString& t) override { obsoleteLink_ = t; }
+ void setObsoleteLink(const QString &t) override { obsoleteLink_ = t; }
void setWrapper() override { wrapper_ = true; }
- void addResolvedBaseClass(Access access, ClassNode* node);
- void addDerivedClass(Access access, ClassNode* node);
- void addUnresolvedBaseClass(Access access, const QStringList& path, const QString& signature);
- void addUnresolvedUsingClause(const QString& signature);
+ void addResolvedBaseClass(Access access, ClassNode *node);
+ void addDerivedClass(Access access, ClassNode *node);
+ void addUnresolvedBaseClass(Access access, const QStringList &path, const QString &signature);
+ void addUnresolvedUsingClause(const QString &signature);
void removePrivateAndInternalBases();
- void resolvePropertyOverriddenFromPtrs(PropertyNode* pn);
+ void resolvePropertyOverriddenFromPtrs(PropertyNode *pn);
- QList<RelatedClass>& baseClasses() { return bases_; }
- QList<RelatedClass>& derivedClasses() { return derived_; }
- QList<RelatedClass>& ignoredBaseClasses() { return ignoredBases_; }
- QList<UsingClause>& usingClauses() { return usingClauses_; }
+ QList<RelatedClass> &baseClasses() { return bases_; }
+ QList<RelatedClass> &derivedClasses() { return derived_; }
+ QList<RelatedClass> &ignoredBaseClasses() { return ignoredBases_; }
+ QList<UsingClause> &usingClauses() { return usingClauses_; }
const QList<RelatedClass> &baseClasses() const { return bases_; }
const QList<RelatedClass> &derivedClasses() const { return derived_; }
const QList<RelatedClass> &ignoredBaseClasses() const { return ignoredBases_; }
- const QList<UsingClause>& usingClauses() const { return usingClauses_; }
+ const QList<UsingClause> &usingClauses() const { return usingClauses_; }
- QmlTypeNode* qmlElement() { return qmlelement; }
- void setQmlElement(QmlTypeNode* qcn) { qmlelement = qcn; }
+ QmlTypeNode *qmlElement() { return qmlelement; }
+ void setQmlElement(QmlTypeNode *qcn) { qmlelement = qcn; }
bool isAbstract() const override { return abstract_; }
void setAbstract(bool b) override { abstract_ = b; }
- PropertyNode* findPropertyNode(const QString& name);
- QmlTypeNode* findQmlBaseNode();
- FunctionNode* findOverriddenFunction(const FunctionNode* fn);
- PropertyNode* findOverriddenProperty(const FunctionNode* fn);
+ PropertyNode *findPropertyNode(const QString &name);
+ QmlTypeNode *findQmlBaseNode();
+ FunctionNode *findOverriddenFunction(const FunctionNode *fn);
+ PropertyNode *findOverriddenProperty(const FunctionNode *fn);
bool docMustBeGenerated() const override;
private:
- void promotePublicBases(const QList<RelatedClass>& bases);
+ void promotePublicBases(const QList<RelatedClass> &bases);
private:
QList<RelatedClass> bases_;
@@ -648,21 +645,20 @@ private:
bool abstract_;
bool wrapper_;
QString obsoleteLink_;
- QmlTypeNode* qmlelement;
+ QmlTypeNode *qmlelement;
};
class HeaderNode : public Aggregate
{
public:
- HeaderNode(Aggregate* parent, const QString& name);
- virtual ~HeaderNode() { }
+ HeaderNode(Aggregate *parent, const QString &name);
bool docMustBeGenerated() const override;
bool isFirstClassAggregate() const override { return true; }
bool isRelatableType() const override { return true; }
QString title() const override { return (title_.isEmpty() ? name() : title_); }
QString subtitle() const override { return subtitle_; }
QString fullTitle() const override { return (title_.isEmpty() ? name() : name() + " - " + title_); }
- bool setTitle(const QString& title) override { title_ = title; return true; }
+ bool setTitle(const QString &title) override { title_ = title; return true; }
bool setSubtitle(const QString &subtitle) override { subtitle_ = subtitle; return true; }
QString nameForLists() const override { return title(); }
bool hasDocumentedChildren() const;
@@ -675,13 +671,12 @@ private:
class ExampleNode : public PageNode
{
public:
- ExampleNode(Aggregate* parent, const QString& name)
+ ExampleNode(Aggregate *parent, const QString &name)
: PageNode(Node::Example, parent, name) { }
- virtual ~ExampleNode() { }
QString imageFileName() const override { return imageFileName_; }
- void setImageFileName(const QString& ifn) override { imageFileName_ = ifn; }
- const QStringList& files() const { return files_; }
- const QStringList& images() const { return images_; }
+ void setImageFileName(const QString &ifn) override { imageFileName_ = ifn; }
+ const QStringList &files() const { return files_; }
+ const QStringList &images() const { return images_; }
void setFiles(const QStringList files) { files_ = files; }
void setImages(const QStringList images) { images_ = images; }
void appendFile(QString &file) { files_.append(file); }
@@ -699,15 +694,15 @@ struct ImportRec {
QString importId_; // "as" name
QString importUri_; // subdirectory of module directory
- ImportRec(const QString& name,
- const QString& version,
- const QString& importId,
- const QString& importUri)
+ ImportRec(const QString &name,
+ const QString &version,
+ const QString &importId,
+ const QString &importUri)
: name_(name), version_(version), importId_(importId), importUri_(importUri) { }
- QString& name() { return name_; }
- QString& version() { return version_; }
- QString& importId() { return importId_; }
- QString& importUri() { return importUri_; }
+ QString &name() { return name_; }
+ QString &version() { return version_; }
+ QString &importId() { return importId_; }
+ QString &importUri() { return importUri_; }
bool isEmpty() const { return name_.isEmpty(); }
};
@@ -716,14 +711,13 @@ typedef QList<ImportRec> ImportList;
class QmlTypeNode : public Aggregate
{
public:
- QmlTypeNode(Aggregate* parent, const QString& name, NodeType type = QmlType);
- virtual ~QmlTypeNode();
+ QmlTypeNode(Aggregate *parent, const QString &name, NodeType type = QmlType);
bool isFirstClassAggregate() const override { return true; }
bool isQtQuickNode() const override {
return (logicalModuleName() == QLatin1String("QtQuick"));
}
- ClassNode* classNode() override { return cnode_; }
- void setClassNode(ClassNode* cn) override { cnode_ = cn; }
+ ClassNode *classNode() override { return cnode_; }
+ void setClassNode(ClassNode *cn) override { cnode_ = cn; }
bool isAbstract() const override { return abstract_; }
bool isWrapper() const override { return wrapper_; }
void setAbstract(bool b) override { abstract_ = b; }
@@ -731,48 +725,47 @@ public:
bool isInternal() const override { return (status() == Internal); }
QString qmlFullBaseName() const override;
QString obsoleteLink() const override { return obsoleteLink_; }
- void setObsoleteLink(const QString& t) override { obsoleteLink_ = t; }
+ void setObsoleteLink(const QString &t) override { obsoleteLink_ = t; }
QString logicalModuleName() const override;
QString logicalModuleVersion() const override;
QString logicalModuleIdentifier() const override;
- CollectionNode* logicalModule() const override { return logicalModule_; }
- void setQmlModule(CollectionNode* t) override { logicalModule_ = t; }
+ CollectionNode *logicalModule() const override { return logicalModule_; }
+ void setQmlModule(CollectionNode *t) override { logicalModule_ = t; }
- const ImportList& importList() const { return importList_; }
- void setImportList(const ImportList& il) { importList_ = il; }
- const QString& qmlBaseName() const { return qmlBaseName_; }
- void setQmlBaseName(const QString& name) { qmlBaseName_ = name; }
+ const ImportList &importList() const { return importList_; }
+ void setImportList(const ImportList &il) { importList_ = il; }
+ const QString &qmlBaseName() const { return qmlBaseName_; }
+ void setQmlBaseName(const QString &name) { qmlBaseName_ = name; }
bool qmlBaseNodeNotSet() const { return (qmlBaseNode_ == nullptr); }
- QmlTypeNode* qmlBaseNode() const override { return qmlBaseNode_; }
- void setQmlBaseNode(QmlTypeNode* b) { qmlBaseNode_ = b; }
+ QmlTypeNode *qmlBaseNode() const override { return qmlBaseNode_; }
+ void setQmlBaseNode(QmlTypeNode *b) { qmlBaseNode_ = b; }
void requireCppClass() { cnodeRequired_ = true; }
bool cppClassRequired() const { return cnodeRequired_; }
- static void addInheritedBy(const Node *base, Node* sub);
- static void subclasses(const Node *base, NodeList& subs);
+ static void addInheritedBy(const Node *base, Node *sub);
+ static void subclasses(const Node *base, NodeList &subs);
static void terminate();
- bool inherits(Aggregate* type);
+ bool inherits(Aggregate *type);
public:
static bool qmlOnly;
- static QMultiMap<const Node*, Node*> inheritedBy;
+ static QMultiMap<const Node *, Node *> inheritedBy;
private:
bool abstract_;
bool cnodeRequired_;
bool wrapper_;
- ClassNode* cnode_;
- QString qmlBaseName_;
- QString obsoleteLink_;
- CollectionNode* logicalModule_;
- QmlTypeNode* qmlBaseNode_;
- ImportList importList_;
+ ClassNode *cnode_;
+ QString qmlBaseName_;
+ QString obsoleteLink_;
+ CollectionNode *logicalModule_;
+ QmlTypeNode *qmlBaseNode_;
+ ImportList importList_;
};
class QmlBasicTypeNode : public Aggregate
{
public:
- QmlBasicTypeNode(Aggregate* parent, const QString& name, NodeType type = QmlBasicType);
- virtual ~QmlBasicTypeNode() { }
+ QmlBasicTypeNode(Aggregate *parent, const QString &name, NodeType type = QmlBasicType);
bool isFirstClassAggregate() const override { return true; }
};
@@ -782,12 +775,11 @@ class QmlPropertyNode : public Node
public:
QmlPropertyNode(Aggregate *parent,
- const QString& name,
- const QString& type,
+ const QString &name,
+ const QString &type,
bool attached);
- virtual ~QmlPropertyNode() { }
- void setDataType(const QString& dataType) override { type_ = dataType; }
+ void setDataType(const QString &dataType) override { type_ = dataType; }
void setStored(bool stored) { stored_ = toFlagValue(stored); }
void setDesignable(bool designable) { designable_ = toFlagValue(designable); }
@@ -818,7 +810,7 @@ public:
void markReadOnly(bool flag) override { readOnly_ = toFlagValue(flag); }
private:
- PropertyNode* findCorrespondingCppProperty();
+ PropertyNode *findCorrespondingCppProperty();
private:
QString type_;
@@ -834,11 +826,11 @@ class EnumItem
{
public:
EnumItem() { }
- EnumItem(const QString& name, const QString& value)
+ EnumItem(const QString &name, const QString &value)
: name_(name), value_(value) { }
- const QString& name() const { return name_; }
- const QString& value() const { return value_; }
+ const QString &name() const { return name_; }
+ const QString &value() const { return value_; }
private:
QString name_;
@@ -848,50 +840,47 @@ private:
class EnumNode : public Node
{
public:
- EnumNode(Aggregate *parent, const QString& name) : Node(Enum, parent, name), flagsType_(nullptr) { }
- virtual ~EnumNode() { }
+ EnumNode(Aggregate *parent, const QString &name) : Node(Enum, parent, name), flagsType_(nullptr) { }
- void addItem(const EnumItem& item);
- void setFlagsType(TypedefNode* typedeff);
+ void addItem(const EnumItem &item);
+ void setFlagsType(TypedefNode *typedeff);
bool hasItem(const QString &name) const { return names_.contains(name); }
- const QList<EnumItem>& items() const { return items_; }
- Access itemAccess(const QString& name) const;
- const TypedefNode* flagsType() const { return flagsType_; }
+ const QList<EnumItem> &items() const { return items_; }
+ Access itemAccess(const QString &name) const;
+ const TypedefNode *flagsType() const { return flagsType_; }
QString itemValue(const QString &name) const;
Node *clone(Aggregate *parent) override;
private:
QList<EnumItem> items_;
QSet<QString> names_;
- const TypedefNode* flagsType_;
+ const TypedefNode *flagsType_;
};
class TypedefNode : public Node
{
public:
- TypedefNode(Aggregate *parent, const QString& name) : Node(Typedef, parent, name),
+ TypedefNode(Aggregate *parent, const QString &name) : Node(Typedef, parent, name),
associatedEnum_(nullptr) { }
- virtual ~TypedefNode() { }
bool hasAssociatedEnum() const { return associatedEnum_ != nullptr; }
- const EnumNode* associatedEnum() const { return associatedEnum_; }
+ const EnumNode *associatedEnum() const { return associatedEnum_; }
Node *clone(Aggregate *parent) override;
private:
- void setAssociatedEnum(const EnumNode* t);
+ void setAssociatedEnum(const EnumNode *t);
friend class EnumNode;
- const EnumNode* associatedEnum_;
+ const EnumNode *associatedEnum_;
};
class TypeAliasNode : public TypedefNode
{
public:
- TypeAliasNode(Aggregate *parent, const QString& name, const QString& aliasedType)
+ TypeAliasNode(Aggregate *parent, const QString &name, const QString &aliasedType)
: TypedefNode(parent, name), aliasedType_(aliasedType) { }
- virtual ~TypeAliasNode() { }
QString aliasedType() { return aliasedType_; }
Node *clone(Aggregate *parent) override;
@@ -900,7 +889,7 @@ private:
QString aliasedType_;
};
-inline void EnumNode::setFlagsType(TypedefNode* t)
+inline void EnumNode::setFlagsType(TypedefNode *t)
{
flagsType_ = t;
t->setAssociatedEnum(this);
@@ -911,26 +900,29 @@ class SharedCommentNode : public Node
public:
SharedCommentNode(Node *n)
: Node(Node::SharedComment, n->parent(), QString()) {
- collective_.reserve(1); n->setSharedCommentNode(this);
+ collective_.reserve(1);
+ append(n);
}
SharedCommentNode(QmlTypeNode *parent, int count, QString &group)
: Node(Node::SharedComment, parent, group) {
collective_.reserve(count);
}
- virtual ~SharedCommentNode() { collective_.clear(); }
+ ~SharedCommentNode() override { collective_.clear(); }
- bool isPropertyGroup() const override { return !collective_.isEmpty() &&
- (collective_.at(0)->isQmlProperty() || collective_.at(0)->isJsProperty());
+ bool isPropertyGroup() const override {
+ return !name().isEmpty() &&
+ !collective_.isEmpty() &&
+ (collective_.at(0)->isQmlProperty() || collective_.at(0)->isJsProperty());
}
int count() const { return collective_.size(); }
- void append(Node* n) { collective_.append(n); }
- const QVector<Node*>& collective() const { return collective_; }
+ void append(Node *n) { collective_.append(n); n->setSharedCommentNode(this); setGenus(n->genus()); }
+ const QVector<Node *> &collective() const { return collective_; }
void setOverloadFlags();
void setRelatedNonmember(bool b) override;
Node *clone(Aggregate *parent) override;
private:
- QVector<Node*> collective_;
+ QVector<Node *> collective_;
};
class FunctionNode : public Node
@@ -959,24 +951,23 @@ public:
JsMethod
};
- FunctionNode(Aggregate* parent, const QString &name); // C++ function (Plain)
- FunctionNode(Metaness type, Aggregate* parent, const QString &name, bool attached = false);
- virtual ~FunctionNode() { }
+ FunctionNode(Aggregate *parent, const QString &name); // C++ function (Plain)
+ FunctionNode(Metaness type, Aggregate *parent, const QString &name, bool attached = false);
Node *clone(Aggregate *parent) override;
Metaness metaness() const { return metaness_; }
QString metanessString() const;
bool changeMetaness(Metaness from, Metaness to);
void setMetaness(Metaness t) { metaness_ = t; }
- Metaness setMetaness(const QString& t);
+ Metaness setMetaness(const QString &t);
QString kindString() const;
- static Metaness getMetaness(const QString& t);
- static Metaness getMetanessFromTopic(const QString& t);
+ static Metaness getMetaness(const QString &t);
+ static Metaness getMetanessFromTopic(const QString &t);
static Genus getGenus(Metaness t);
- void setReturnType(const QString& t) { returnType_ = t; }
- void setParentPath(const QStringList& p) { parentPath_ = p; }
- void setVirtualness(const QString& t);
+ void setReturnType(const QString &t) { returnType_ = t; }
+ void setParentPath(const QStringList &p) { parentPath_ = p; }
+ void setVirtualness(const QString &t);
void setVirtualness(Virtualness v) { virtualness_ = v; }
void setVirtual() { virtualness_ = NormalVirtual; }
void setConst(bool b) { const_ = b; }
@@ -984,7 +975,7 @@ public:
void setReimpFlag() { reimpFlag_ = true; }
void setOverridesThis(const QString &path) { overridesThis_ = path; }
- const QString& returnType() const { return returnType_; }
+ const QString &returnType() const { return returnType_; }
QString virtualness() const;
bool isConst() const { return const_; }
bool isStatic() const override { return static_; }
@@ -1029,7 +1020,7 @@ public:
const QString &overridesThis() const { return overridesThis_; }
NodeList &associatedProperties() { return associatedProperties_; }
- const QStringList& parentPath() const { return parentPath_; }
+ const QStringList &parentPath() const { return parentPath_; }
bool hasAssociatedProperties() const { return !associatedProperties_.isEmpty(); }
bool hasOneAssociatedProperty() const { return (associatedProperties_.size() == 1); }
Node *firstAssociatedProperty() const { return associatedProperties_[0]; }
@@ -1060,8 +1051,8 @@ public:
void setInvokable(bool b) { isInvokable_ = b; }
bool isInvokable() const { return isInvokable_; }
- bool hasTag(const QString& t) const override { return (tag_ == t); }
- void setTag(const QString& t) { tag_ = t; }
+ bool hasTag(const QString &t) const override { return (tag_ == t); }
+ void setTag(const QString &t) { tag_ = t; }
const QString &tag() const { return tag_; }
bool compare(const FunctionNode *fn) const;
bool isIgnored() const;
@@ -1076,7 +1067,7 @@ public:
FunctionNode *findPrimaryFunction();
private:
- void addAssociatedProperty(PropertyNode* property);
+ void addAssociatedProperty(PropertyNode *property);
friend class Aggregate;
friend class PropertyNode;
@@ -1109,20 +1100,19 @@ public:
enum FunctionRole { Getter, Setter, Resetter, Notifier };
enum { NumFunctionRoles = Notifier + 1 };
- PropertyNode(Aggregate* parent, const QString& name);
- virtual ~PropertyNode() { }
+ PropertyNode(Aggregate *parent, const QString &name);
- void setDataType(const QString& dataType) override { type_ = dataType; }
- void addFunction(FunctionNode* function, FunctionRole role);
- void addSignal(FunctionNode* function, FunctionRole role);
+ void setDataType(const QString &dataType) override { type_ = dataType; }
+ void addFunction(FunctionNode *function, FunctionRole role);
+ void addSignal(FunctionNode *function, FunctionRole role);
void setStored(bool stored) { stored_ = toFlagValue(stored); }
void setDesignable(bool designable) { designable_ = toFlagValue(designable); }
void setScriptable(bool scriptable) { scriptable_ = toFlagValue(scriptable); }
void setWritable(bool writable) { writable_ = toFlagValue(writable); }
void setUser(bool user) { user_ = toFlagValue(user); }
- void setOverriddenFrom(const PropertyNode* baseProperty);
- void setRuntimeDesFunc(const QString& rdf) { runtimeDesFunc_ = rdf; }
- void setRuntimeScrFunc(const QString& scrf) { runtimeScrFunc_ = scrf; }
+ void setOverriddenFrom(const PropertyNode *baseProperty);
+ void setRuntimeDesFunc(const QString &rdf) { runtimeDesFunc_ = rdf; }
+ void setRuntimeScrFunc(const QString &scrf) { runtimeScrFunc_ = scrf; }
void setConstant() { const_ = true; }
void setFinal() { final_ = true; }
void setRevision(int revision) { revision_ = revision; }
@@ -1136,17 +1126,17 @@ public:
const NodeList &resetters() const { return functions(Resetter); }
const NodeList &notifiers() const { return functions(Notifier); }
bool hasAccessFunction(const QString &name) const;
- FunctionRole role(const FunctionNode* fn) const;
+ FunctionRole role(const FunctionNode *fn) const;
bool isStored() const { return fromFlagValue(stored_, storedDefault()); }
bool isDesignable() const { return fromFlagValue(designable_, designableDefault()); }
bool isScriptable() const { return fromFlagValue(scriptable_, scriptableDefault()); }
- const QString& runtimeDesignabilityFunction() const { return runtimeDesFunc_; }
- const QString& runtimeScriptabilityFunction() const { return runtimeScrFunc_; }
+ const QString &runtimeDesignabilityFunction() const { return runtimeDesFunc_; }
+ const QString &runtimeScriptabilityFunction() const { return runtimeScrFunc_; }
bool isWritable() const { return fromFlagValue(writable_, writableDefault()); }
bool isUser() const { return fromFlagValue(user_, userDefault()); }
bool isConstant() const { return const_; }
bool isFinal() const { return final_; }
- const PropertyNode* overriddenFrom() const { return overrides_; }
+ const PropertyNode *overriddenFrom() const { return overrides_; }
bool storedDefault() const { return true; }
bool userDefault() const { return false; }
@@ -1167,16 +1157,16 @@ private:
bool const_;
bool final_;
int revision_;
- const PropertyNode* overrides_;
+ const PropertyNode *overrides_;
};
-inline void PropertyNode::addFunction(FunctionNode* function, FunctionRole role)
+inline void PropertyNode::addFunction(FunctionNode *function, FunctionRole role)
{
functions_[(int)role].append(function);
function->addAssociatedProperty(this);
}
-inline void PropertyNode::addSignal(FunctionNode* function, FunctionRole role)
+inline void PropertyNode::addSignal(FunctionNode *function, FunctionRole role)
{
functions_[(int)role].append(function);
function->addAssociatedProperty(this);
@@ -1193,8 +1183,7 @@ inline NodeList PropertyNode::functions() const
class VariableNode : public Node
{
public:
- VariableNode(Aggregate* parent, const QString &name);
- virtual ~VariableNode() { }
+ VariableNode(Aggregate *parent, const QString &name);
void setLeftType(const QString &leftType) { leftType_ = leftType; }
void setRightType(const QString &rightType) { rightType_ = rightType; }
@@ -1212,7 +1201,7 @@ private:
bool static_;
};
-inline VariableNode::VariableNode(Aggregate* parent, const QString &name)
+inline VariableNode::VariableNode(Aggregate *parent, const QString &name)
: Node(Variable, parent, name), static_(false)
{
setGenus(Node::CPP);
@@ -1221,19 +1210,18 @@ inline VariableNode::VariableNode(Aggregate* parent, const QString &name)
class CollectionNode : public PageNode
{
public:
- CollectionNode(NodeType type, Aggregate* parent, const QString& name)
+ CollectionNode(NodeType type, Aggregate *parent, const QString &name)
: PageNode(type, parent, name), seen_(false) { }
- virtual ~CollectionNode() { }
bool isCollectionNode() const override { return true; }
QString qtVariable() const override { return qtVariable_; }
- void setQtVariable(const QString& v) override { qtVariable_ = v; }
- void addMember(Node* node) override;
+ void setQtVariable(const QString &v) override { qtVariable_ = v; }
+ void addMember(Node *node) override;
bool hasMembers() const override;
bool hasNamespaces() const override;
bool hasClasses() const override;
- void getMemberNamespaces(NodeMap& out) override;
- void getMemberClasses(NodeMap& out) const override;
+ void getMemberNamespaces(NodeMap &out) override;
+ void getMemberClasses(NodeMap &out) const override;
bool wasSeen() const override { return seen_; }
QString fullTitle() const override { return title(); }
@@ -1244,22 +1232,22 @@ public:
QString logicalModuleIdentifier() const override {
return logicalModuleName_ + logicalModuleVersionMajor_;
}
- void setLogicalModuleInfo(const QString& arg) override;
- void setLogicalModuleInfo(const QStringList& info) override;
+ void setLogicalModuleInfo(const QString &arg) override;
+ void setLogicalModuleInfo(const QStringList &info) override;
- const NodeList& members() const { return members_; }
- void printMembers(const QString& title);
+ const NodeList &members() const { return members_; }
+ void printMembers(const QString &title);
void markSeen() { seen_ = true; }
void markNotSeen() { seen_ = false; }
private:
- bool seen_;
- NodeList members_;
- QString logicalModuleName_;
- QString logicalModuleVersionMajor_;
- QString logicalModuleVersionMinor_;
- QString qtVariable_;
+ bool seen_;
+ NodeList members_;
+ QString logicalModuleName_;
+ QString logicalModuleVersionMajor_;
+ QString logicalModuleVersionMinor_;
+ QString qtVariable_;
};
QT_END_NAMESPACE
diff --git a/src/qdoc/openedlist.cpp b/src/qdoc/openedlist.cpp
index 79a0e8a63..ce9efb06e 100644
--- a/src/qdoc/openedlist.cpp
+++ b/src/qdoc/openedlist.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -30,52 +30,53 @@
openedlist.cpp
*/
-#include <qregexp.h>
+#include "openedlist.h"
#include "atom.h"
-#include "openedlist.h"
+
+#include <QtCore/qregexp.h>
QT_BEGIN_NAMESPACE
static const char roman[] = "m\2d\5c\2l\5x\2v\5i";
-OpenedList::OpenedList( ListStyle style )
- : sty( style ), ini( 1 ), nex( 0 )
+OpenedList::OpenedList(ListStyle style)
+ : sty(style), ini(1), nex(0)
{
}
-OpenedList::OpenedList( const Location& location, const QString& hint )
- : sty( Bullet ), ini( 1 )
+OpenedList::OpenedList(const Location &location, const QString &hint)
+ : sty(Bullet), ini(1)
{
- QRegExp hintSyntax( "(\\W*)([0-9]+|[A-Z]+|[a-z]+)(\\W*)" );
+ QRegExp hintSyntax("(\\W*)([0-9]+|[A-Z]+|[a-z]+)(\\W*)");
- if ( hintSyntax.exactMatch(hint) ) {
+ if (hintSyntax.exactMatch(hint)) {
bool ok;
- int asNumeric = hint.toInt( &ok );
- int asRoman = fromRoman( hintSyntax.cap(2) );
- int asAlpha = fromAlpha( hintSyntax.cap(2) );
+ int asNumeric = hint.toInt(&ok);
+ int asRoman = fromRoman(hintSyntax.cap(2));
+ int asAlpha = fromAlpha(hintSyntax.cap(2));
- if ( ok ) {
+ if (ok) {
sty = Numeric;
ini = asNumeric;
- } else if ( asRoman > 0 && asRoman != 100 && asRoman != 500 ) {
- sty = ( hint == hint.toLower() ) ? LowerRoman : UpperRoman;
+ } else if (asRoman > 0 && asRoman != 100 && asRoman != 500) {
+ sty = (hint == hint.toLower()) ? LowerRoman : UpperRoman;
ini = asRoman;
} else {
- sty = ( hint == hint.toLower() ) ? LowerAlpha : UpperAlpha;
+ sty = (hint == hint.toLower()) ? LowerAlpha : UpperAlpha;
ini = asAlpha;
}
- pref = hintSyntax.cap( 1 );
- suff = hintSyntax.cap( 3 );
- } else if ( !hint.isEmpty() ) {
- location.warning( tr("Unrecognized list style '%1'").arg(hint) );
+ pref = hintSyntax.cap(1);
+ suff = hintSyntax.cap(3);
+ } else if (!hint.isEmpty()) {
+ location.warning(tr("Unrecognized list style '%1'").arg(hint));
}
nex = ini - 1;
}
QString OpenedList::styleString() const
{
- switch ( style() ) {
+ switch (style()) {
case Bullet:
default:
return ATOM_LIST_BULLET;
@@ -98,7 +99,7 @@ QString OpenedList::styleString() const
QString OpenedList::numberString() const
{
- return QString::number( number() );
+ return QString::number(number());
/*
switch ( style() ) {
case Numeric:
@@ -117,26 +118,26 @@ QString OpenedList::numberString() const
}*/
}
-QString OpenedList::toAlpha( int n )
+QString OpenedList::toAlpha(int n)
{
QString str;
- while ( n > 0 ) {
+ while (n > 0) {
n--;
- str.prepend( (n % 26) + 'a' );
+ str.prepend((n % 26) + 'a');
n /= 26;
}
return str;
}
-int OpenedList::fromAlpha( const QString& str )
+int OpenedList::fromAlpha(const QString &str)
{
int n = 0;
int u;
- for ( int i = 0; i < (int) str.length(); i++ ) {
+ for (int i = 0; i < (int) str.length(); i++) {
u = str[i].toLower().unicode();
- if ( u >= 'a' && u <= 'z' ) {
+ if (u >= 'a' && u <= 'z') {
n *= 26;
n += u - 'a' + 1;
} else {
@@ -146,7 +147,7 @@ int OpenedList::fromAlpha( const QString& str )
return n;
}
-QString OpenedList::toRoman( int n )
+QString OpenedList::toRoman(int n)
{
/*
See p. 30 of Donald E. Knuth's "TeX: The Program".
@@ -157,22 +158,22 @@ QString OpenedList::toRoman( int n )
int u;
int v = 1000;
- for ( ;; ) {
- while ( n >= v ) {
+ for (;;) {
+ while (n >= v) {
str += roman[j];
n -= v;
}
- if ( n <= 0 )
+ if (n <= 0)
break;
k = j + 2;
u = v / roman[k - 1];
- if ( roman[k - 1] == 2 ) {
+ if (roman[k - 1] == 2) {
k += 2;
u /= 5;
}
- if ( n + u >= v ) {
+ if (n + u >= v) {
str += roman[k];
n += u;
} else {
@@ -183,21 +184,21 @@ QString OpenedList::toRoman( int n )
return str;
}
-int OpenedList::fromRoman( const QString& str )
+int OpenedList::fromRoman(const QString &str)
{
int n = 0;
int j;
int u;
int v = 0;
- for ( int i = str.length() - 1; i >= 0; i-- ) {
+ for (int i = str.length() - 1; i >= 0; i--) {
j = 0;
u = 1000;
- while ( roman[j] != 'i' && roman[j] != str[i].toLower() ) {
+ while (roman[j] != 'i' && roman[j] != str[i].toLower()) {
j += 2;
u /= roman[j - 1];
}
- if ( u < v ) {
+ if (u < v) {
n -= u;
} else {
n += u;
@@ -205,7 +206,7 @@ int OpenedList::fromRoman( const QString& str )
v = u;
}
- if ( str.toLower() == toRoman(n) ) {
+ if (str.toLower() == toRoman(n)) {
return n;
} else {
return 0;
diff --git a/src/qdoc/openedlist.h b/src/qdoc/openedlist.h
index 77f134a9b..6c4cea6c0 100644
--- a/src/qdoc/openedlist.h
+++ b/src/qdoc/openedlist.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -33,10 +33,10 @@
#ifndef OPENEDLIST_H
#define OPENEDLIST_H
-#include <qstring.h>
-
#include "location.h"
+#include <QtCore/qstring.h>
+
QT_BEGIN_NAMESPACE
class OpenedList
@@ -48,9 +48,9 @@ public:
UpperRoman, LowerRoman };
OpenedList()
- : sty( Bullet ), ini( 1 ), nex( 0 ) { }
- OpenedList( ListStyle style );
- OpenedList( const Location& location, const QString& hint );
+ : sty(Bullet), ini(1), nex(0) { }
+ OpenedList(ListStyle style);
+ OpenedList(const Location &location, const QString &hint);
void next() { nex++; }
@@ -63,10 +63,10 @@ public:
QString suffix() const { return suff; }
private:
- static QString toAlpha( int n );
- static int fromAlpha( const QString& str );
- static QString toRoman( int n );
- static int fromRoman( const QString& str );
+ static QString toAlpha(int n);
+ static int fromAlpha(const QString &str);
+ static QString toRoman(int n);
+ static int fromRoman(const QString &str);
ListStyle sty;
int ini;
diff --git a/src/qdoc/parameters.cpp b/src/qdoc/parameters.cpp
index 281232e39..44178c9d9 100644
--- a/src/qdoc/parameters.cpp
+++ b/src/qdoc/parameters.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -27,9 +27,10 @@
****************************************************************************/
#include "parameters.h"
-#include "tokenizer.h"
+
#include "codechunk.h"
#include "generator.h"
+#include "tokenizer.h"
QT_BEGIN_NAMESPACE
@@ -83,13 +84,13 @@ QString Parameter::signature(bool includeValue) const
*/
Parameters::Parameters()
- : valid_(true), privateSignal_(false), tok_(0), tokenizer_(0)
+ : valid_(true), privateSignal_(false), tok_(0), tokenizer_(nullptr)
{
// nothing.
}
Parameters::Parameters(const QString &signature)
- : valid_(true), privateSignal_(false), tok_(0), tokenizer_(0)
+ : valid_(true), privateSignal_(false), tok_(0), tokenizer_(nullptr)
{
if (!signature.isEmpty()) {
if (!parse(signature)) {
@@ -455,7 +456,8 @@ QString Parameters::signature(bool includeValues) const
QString Parameters::rawSignature(bool names, bool values) const
{
QString raw;
- foreach (const Parameter &parameter, parameters_) {
+ const auto params = parameters_;
+ for (const auto &parameter : params) {
raw += parameter.type();
if (names)
raw += parameter.name();
@@ -507,7 +509,8 @@ void Parameters::set(const QString &signature)
*/
void Parameters::getNames(QSet<QString> &names) const
{
- foreach (const Parameter &parameter, parameters_) {
+ const auto params = parameters_;
+ for (const auto &parameter : params) {
if (!parameter.name().isEmpty())
names.insert(parameter.name());
}
diff --git a/src/qdoc/parameters.h b/src/qdoc/parameters.h
index b83c579c2..db704426f 100644
--- a/src/qdoc/parameters.h
+++ b/src/qdoc/parameters.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -29,9 +29,9 @@
#ifndef PARAMETERS_H
#define PARAMETERS_H
-#include <qregexp.h>
-#include <qvector.h>
-#include <qset.h>
+#include <QtCore/qregexp.h>
+#include <QtCore/qset.h>
+#include <QtCore/qvector.h>
QT_BEGIN_NAMESPACE
diff --git a/src/qdoc/puredocparser.cpp b/src/qdoc/puredocparser.cpp
index 251c47185..6ba46a20e 100644
--- a/src/qdoc/puredocparser.cpp
+++ b/src/qdoc/puredocparser.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -26,11 +26,13 @@
**
****************************************************************************/
-#include <errno.h>
-#include "tokenizer.h"
-#include "qdocdatabase.h"
#include "puredocparser.h"
+#include "qdocdatabase.h"
+#include "tokenizer.h"
+
+#include <errno.h>
+
QT_BEGIN_NAMESPACE
PureDocParser *PureDocParser::pureParser_ = nullptr;
@@ -50,7 +52,7 @@ QStringList PureDocParser::sourceFileNameFilter()
parsed contents to the database. The \a location is used for
reporting errors.
*/
-void PureDocParser::parseSourceFile(const Location& location, const QString& filePath)
+void PureDocParser::parseSourceFile(const Location &location, const QString &filePath)
{
QFile in(filePath);
currentFile_ = filePath;
@@ -83,7 +85,7 @@ void PureDocParser::parseSourceFile(const Location& location, const QString& fil
*/
bool PureDocParser::processQdocComments()
{
- const QSet<QString>& commands = topicCommands() + metaCommands();
+ const QSet<QString> &commands = topicCommands() + metaCommands();
while (tok_ != Tok_Eoi) {
if (tok_ == Tok_Doc) {
@@ -96,7 +98,7 @@ bool PureDocParser::processQdocComments()
// Doc constructor parses the comment.
Doc doc(start_loc, end_loc, comment, commands, topicCommands());
- const TopicList& topics = doc.topicsUsed();
+ const TopicList &topics = doc.topicsUsed();
if (topics.isEmpty()) {
doc.location().warning(tr("This qdoc comment contains no topic command "
"(e.g., '\\%1', '\\%2').")
diff --git a/src/qdoc/puredocparser.h b/src/qdoc/puredocparser.h
index 4e6a16a48..7d814e982 100644
--- a/src/qdoc/puredocparser.h
+++ b/src/qdoc/puredocparser.h
@@ -41,10 +41,10 @@ class PureDocParser : public CppCodeParser
public:
PureDocParser() : tokenizer_(nullptr), tok_(0) { pureParser_ = this; }
- virtual ~PureDocParser() { pureParser_ = nullptr; }
+ ~PureDocParser() override { pureParser_ = nullptr; }
QStringList sourceFileNameFilter() override;
- void parseSourceFile(const Location& location, const QString& filePath) override;
+ void parseSourceFile(const Location &location, const QString &filePath) override;
static PureDocParser *pureDocParser() { return pureParser_; }
diff --git a/src/qdoc/qdoc.pro b/src/qdoc/qdoc.pro
index 95fdc5cdf..df9123b09 100644
--- a/src/qdoc/qdoc.pro
+++ b/src/qdoc/qdoc.pro
@@ -11,6 +11,8 @@ qtHaveModule(qmldevtools-private) {
DEFINES += QT_NO_DECLARATIVE
}
+DEFINES += QT_NO_FOREACH
+
include($$OUT_PWD/qtqdoc-config.pri)
LIBS += $$CLANG_LIBS
@@ -20,9 +22,6 @@ DEFINES += $$CLANG_DEFINES
!contains(QMAKE_DEFAULT_LIBDIRS, $$CLANG_LIBDIR):!disable_external_rpath: QMAKE_RPATHDIR += $$CLANG_LIBDIR
DEFINES += $$shell_quote(CLANG_RESOURCE_DIR=\"$${CLANG_LIBDIR}/clang/$${CLANG_VERSION}/include\")
-DEFINES += \
- QDOC2_COMPAT
-
INCLUDEPATH += $$QT_SOURCE_TREE/src/tools/qdoc \
$$QT_SOURCE_TREE/src/tools/qdoc/qmlparser
@@ -60,8 +59,8 @@ HEADERS += atom.h \
tokenizer.h \
tree.h \
webxmlgenerator.h \
- qdocglobals.h \
- qdoccommandlineparser.h
+ qdoccommandlineparser.h \
+ utilities.h
SOURCES += atom.cpp \
clangcodeparser.cpp \
@@ -93,8 +92,8 @@ SOURCES += atom.cpp \
tree.cpp \
yyindent.cpp \
webxmlgenerator.cpp \
- qdocglobals.cpp \
- qdoccommandlineparser.cpp
+ qdoccommandlineparser.cpp \
+ utilities.cpp
### QML/JS Parser ###
@@ -121,3 +120,38 @@ QMAKE_TARGET_DESCRIPTION = "Qt Documentation Compiler"
load(qt_tool)
TR_EXCLUDE += $$PWD/*
+
+load(cmake_functions)
+
+CMAKE_INSTALL_LIBS_DIR = $$cmakeTargetPath($$[QT_INSTALL_LIBS])
+contains(CMAKE_INSTALL_LIBS_DIR, ^(/usr)?/lib(64)?.*): CMAKE_USR_MOVE_WORKAROUND = $$CMAKE_INSTALL_LIBS_DIR
+
+CMAKE_LIB_DIR = $$cmakeRelativePath($$[QT_INSTALL_LIBS], $$[QT_INSTALL_PREFIX])
+!contains(CMAKE_LIB_DIR,"^\\.\\./.*") {
+ CMAKE_RELATIVE_INSTALL_LIBS_DIR = $$cmakeRelativePath($$[QT_INSTALL_PREFIX], $$[QT_INSTALL_LIBS])
+ # We need to go up another two levels because the CMake files are
+ # installed in $${CMAKE_LIB_DIR}/cmake/Qt5$${CMAKE_MODULE_NAME}
+ CMAKE_RELATIVE_INSTALL_DIR = "$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}../../"
+} else {
+ CMAKE_LIB_DIR_IS_ABSOLUTE = True
+}
+
+CMAKE_BIN_DIR = $$cmakeRelativePath($$[QT_HOST_BINS], $$[QT_INSTALL_PREFIX])
+contains(CMAKE_BIN_DIR, "^\\.\\./.*") {
+ CMAKE_BIN_DIR = $$[QT_HOST_BINS]/
+ CMAKE_BIN_DIR_IS_ABSOLUTE = True
+}
+
+load(qt_build_paths)
+
+cmake_qdoc_config_file.input = $$PWD/Qt5DocToolsConfig.cmake.in
+cmake_qdoc_config_version_file.input = $$[QT_HOST_DATA/src]/mkspecs/features/data/cmake/Qt5ConfigVersion.cmake.in
+CMAKE_PACKAGE_VERSION = $$MODULE_VERSION
+cmake_qdoc_config_file.output = $$MODULE_BASE_OUTDIR/lib/cmake/Qt5DocTools/Qt5DocToolsConfig.cmake
+cmake_qdoc_config_version_file.output = $$MODULE_BASE_OUTDIR/lib/cmake/Qt5DocTools/Qt5DocToolsConfigVersion.cmake
+QMAKE_SUBSTITUTES += cmake_qdoc_config_file cmake_qdoc_config_version_file
+
+cmake_qdoc_tools_files.files += $$cmake_qdoc_config_file.output $$cmake_qdoc_config_version_file.output
+cmake_qdoc_tools_files.path = $$[QT_INSTALL_LIBS]/cmake/Qt5DocTools
+cmake_qdoc_tools_files.CONFIG = no_check_exist
+INSTALLS += cmake_qdoc_tools_files
diff --git a/src/qdoc/qdoccommandlineparser.cpp b/src/qdoc/qdoccommandlineparser.cpp
index e56abe6da..33009c512 100644
--- a/src/qdoc/qdoccommandlineparser.cpp
+++ b/src/qdoc/qdoccommandlineparser.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2018 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -28,13 +28,13 @@
#include "qdoccommandlineparser.h"
+#include "loggingcategory.h"
+#include "utilities.h"
+
#include <QtCore/qdebug.h>
+#include <QtCore/qdir.h>
#include <QtCore/qfile.h>
-#include "config.h"
-#include "generator.h"
-#include "loggingcategory.h"
-
QDocCommandLineParser::QDocCommandLineParser()
: QCommandLineParser(),
defineOption(QStringList() << QStringLiteral("D")),
@@ -144,82 +144,45 @@ QDocCommandLineParser::QDocCommandLineParser()
addOption(timestampsOption);
}
-void QDocCommandLineParser::process(const QCoreApplication &app, QDocGlobals &qdocGlobals)
+/*!
+ * \internal
+ *
+ * Create a list of arguments from the command line and/or file(s).
+ * This lets QDoc accept arguments contained in a file provided as a
+ * command-line argument prepended by '@'.
+ */
+static QStringList argumentsFromCommandLineAndFile(const QStringList &arguments)
{
- QCommandLineParser::process(app);
-
- qdocGlobals.addDefine(values(defineOption));
- qdocGlobals.dependModules() += values(dependsOption);
- qdocGlobals.enableHighlighting(isSet(highlightingOption));
- qdocGlobals.setShowInternal(isSet(showInternalOption));
- qdocGlobals.setSingleExec(isSet(singleExecOption));
- qdocGlobals.setWriteQaPages(isSet(writeQaPagesOption));
- qdocGlobals.setRedirectDocumentationToDevNull(isSet(redirectDocumentationToDevNullOption));
- Config::generateExamples = !isSet(noExamplesOption);
- foreach (const QString &indexDir, values(indexDirOption)) {
- if (QFile::exists(indexDir))
- qdocGlobals.appendToIndexDirs(indexDir);
- else
- qDebug() << "Cannot find index directory" << indexDir;
- }
- if (isSet(installDirOption))
- Config::installDir = value(installDirOption);
- qdocGlobals.setObsoleteLinks(isSet(obsoleteLinksOption));
- if (isSet(outputDirOption))
- Config::overrideOutputDir = value(outputDirOption);
- foreach (const QString &format, values(outputFormatOption))
- Config::overrideOutputFormats.insert(format);
- qdocGlobals.setNoLinkErrors(isSet(noLinkErrorsOption) || qEnvironmentVariableIsSet("QDOC_NOLINKERRORS"));
- qdocGlobals.setAutolinkErrors(isSet(autoLinkErrorsOption));
- if (isSet(debugOption))
- Generator::startDebugging(QString("command line"));
- qCDebug(lcQdoc).noquote() << "Arguments :" << QCoreApplication::arguments();
-
- if (isSet(prepareOption))
- Generator::setQDocPass(Generator::Prepare);
- if (isSet(generateOption))
- Generator::setQDocPass(Generator::Generate);
- if (isSet(singleExecOption)) {
- Generator::setSingleExec();
- if (isSet(indexDirOption))
- qDebug() << "WARNING: -indexdir option ignored: Index files are not used in -single-exec mode.";
- }
- if (isSet(writeQaPagesOption))
- Generator::setWriteQaPages();
- if (isSet(logProgressOption))
- Location::startLoggingProgress();
- if (isSet(timestampsOption))
- Generator::setUseTimestamps();
-
- QDir currentDir = QDir::current();
- const auto paths = values(includePathOption);
- for (const auto &i : paths)
- qdocGlobals.addIncludePath("-I", currentDir.absoluteFilePath(i));
-
-#ifdef QDOC_PASS_ISYSTEM
- const auto paths2 = values(includePathSystemOption);
- for (const auto &i : paths2)
- qdocGlobals.addIncludePath("-isystem", currentDir.absoluteFilePath(i));
-#endif
- const auto paths3 = values(frameworkOption);
- for (const auto &i : paths3)
- qdocGlobals.addIncludePath("-F", currentDir.absoluteFilePath(i));
-
- /*
- The default indent for code is 0.
- The default value for false is 0.
- The default supported file extensions are cpp, h, qdoc and qml.
- The default language is c++.
- The default output format is html.
- The default tab size is 8.
- And those are all the default values for configuration variables.
- */
- if (qdocGlobals.defaults().isEmpty()) {
- qdocGlobals.defaults().insert(CONFIG_CODEINDENT, QLatin1String("0"));
- qdocGlobals.defaults().insert(CONFIG_FALSEHOODS, QLatin1String("0"));
- qdocGlobals.defaults().insert(CONFIG_FILEEXTENSIONS, QLatin1String("*.cpp *.h *.qdoc *.qml"));
- qdocGlobals.defaults().insert(CONFIG_LANGUAGE, QLatin1String("Cpp"));
- qdocGlobals.defaults().insert(CONFIG_OUTPUTFORMATS, QLatin1String("HTML"));
- qdocGlobals.defaults().insert(CONFIG_TABSIZE, QLatin1String("8"));
+ QStringList allArguments;
+ allArguments.reserve(arguments.size());
+ for (const QString &argument : arguments) {
+ // "@file" doesn't start with a '-' so we can't use QCommandLineParser for it
+ if (argument.startsWith(QLatin1Char('@'))) {
+ QString optionsFile = argument;
+ optionsFile.remove(0, 1);
+ if (optionsFile.isEmpty())
+ qFatal("The @ option requires an input file");
+ QFile f(optionsFile);
+ if (!f.open(QIODevice::ReadOnly | QIODevice::Text))
+ qFatal("Cannot open options file specified with @: %ls",
+ qUtf16Printable(optionsFile));
+ while (!f.atEnd()) {
+ QString line = QString::fromLocal8Bit(f.readLine().trimmed());
+ if (!line.isEmpty())
+ allArguments << line;
+ }
+ } else {
+ allArguments << argument;
+ }
}
+ return allArguments;
+}
+
+void QDocCommandLineParser::process(const QStringList &arguments)
+{
+ auto allArguments = argumentsFromCommandLineAndFile(arguments);
+ QCommandLineParser::process(allArguments);
+
+ if (isSet(singleExecOption) && isSet(indexDirOption))
+ qDebug("WARNING: -indexdir option ignored: Index files are not used in single-exec mode.");
}
diff --git a/src/qdoc/qdoccommandlineparser.h b/src/qdoc/qdoccommandlineparser.h
index 45385aa41..d88cb6ffc 100644
--- a/src/qdoc/qdoccommandlineparser.h
+++ b/src/qdoc/qdoccommandlineparser.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2018 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -28,18 +28,16 @@
#ifndef QDOCCOMMANDLINEPARSER_H
#define QDOCCOMMANDLINEPARSER_H
+
#include <QtCore/qcommandlineparser.h>
-#include "qdocglobals.h"
QT_BEGIN_NAMESPACE
-class QDocCommandLineParser : public QCommandLineParser
+struct QDocCommandLineParser : public QCommandLineParser
{
-public:
QDocCommandLineParser();
- void process(const QCoreApplication &app, QDocGlobals &qdocGlobals);
+ void process(const QStringList &arguments);
-private:
QCommandLineOption defineOption, dependsOption, highlightingOption;
QCommandLineOption showInternalOption, redirectDocumentationToDevNullOption;
QCommandLineOption noExamplesOption, indexDirOption, installDirOption;
diff --git a/src/qdoc/qdocdatabase.cpp b/src/qdoc/qdocdatabase.cpp
index 2cbc8fab9..311b19db7 100644
--- a/src/qdoc/qdocdatabase.cpp
+++ b/src/qdoc/qdocdatabase.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -26,13 +26,15 @@
**
****************************************************************************/
-#include "generator.h"
-#include "atom.h"
-#include "tree.h"
#include "qdocdatabase.h"
-#include "qdoctagfiles.h"
+
+#include "atom.h"
+#include "generator.h"
#include "qdocindexfiles.h"
-#include <qdebug.h>
+#include "qdoctagfiles.h"
+#include "tree.h"
+
+#include <QtCore/qdebug.h>
QT_BEGIN_NAMESPACE
@@ -167,7 +169,7 @@ void QDocForest::setPrimaryTree(const QString &t)
If the search order array is empty, create the search order.
If the search order array is not empty, do nothing.
*/
-void QDocForest::setSearchOrder(QStringList &t)
+void QDocForest::setSearchOrder(const QStringList &t)
{
if (!searchOrder_.isEmpty())
return;
@@ -184,8 +186,8 @@ void QDocForest::setSearchOrder(QStringList &t)
moduleNames_.append(primaryName);
forest_.remove(primaryName);
- QMap<QString, Tree*>::iterator i;
- foreach (const QString &m, t) {
+ QMap<QString, Tree *>::iterator i;
+ for (const QString &m : t) {
if (primaryName != m) {
i = forest_.find(m);
if (i != forest_.end()) {
@@ -223,13 +225,6 @@ void QDocForest::setSearchOrder(QStringList &t)
forest_.insert(moduleNames_.at(i), searchOrder_.at(i));
}
}
-#if 0
- qDebug() << " SEARCH ORDER:";
- for (int i=0; i<moduleNames_.size(); ++i)
- qDebug() << " " << i+1 << "." << moduleNames_.at(i);
- qDebug() << " FOREST:" << forest_.keys();
- qDebug() << "SEARCH ORDER:" << moduleNames_;
-#endif
}
/*!
@@ -257,7 +252,7 @@ void QDocForest::setSearchOrder(QStringList &t)
ordering required in this temporary search order is that
the current tree must be searched first.
*/
-const QVector<Tree*> &QDocForest::searchOrder()
+const QVector<Tree *> &QDocForest::searchOrder()
{
if (searchOrder_.isEmpty())
return indexSearchOrder();
@@ -279,7 +274,7 @@ const QVector<Tree*> &QDocForest::searchOrder()
one being read now. That one is prepended to the front of
the vector.
*/
-const QVector<Tree*> &QDocForest::indexSearchOrder()
+const QVector<Tree *> &QDocForest::indexSearchOrder()
{
if (forest_.size() > indexSearchOrder_.size())
indexSearchOrder_.prepend(primaryTree_);
@@ -331,8 +326,8 @@ const Node *QDocForest::findNodeForTarget(QStringList &targetPath,
if (!targetPath.isEmpty())
target = targetPath.takeFirst();
- foreach (Tree *t, searchOrder()) {
- const Node *n = t->findNodeForTarget(entityPath, target, relative, flags, genus, ref);
+ for (const auto *tree : searchOrder()) {
+ const Node *n = tree->findNodeForTarget(entityPath, target, relative, flags, genus, ref);
if (n)
return n;
relative = nullptr;
@@ -348,9 +343,9 @@ void QDocForest::printLinkCounts(const QString &project)
{
Location::null.report(QString("%1: Link Counts").arg(project));
QMultiMap<int, QString> m;
- foreach (Tree *t, searchOrder()) {
- if (t->linkCount() < 0)
- m.insert(t->linkCount(), t->physicalModuleName());
+ for (const auto *tree : searchOrder()) {
+ if (tree->linkCount() < 0)
+ m.insert(tree->linkCount(), tree->physicalModuleName());
}
QString depends = "depends +=";
QString module = project.toLower();
@@ -377,9 +372,9 @@ void QDocForest::printLinkCounts(const QString &project)
QString QDocForest::getLinkCounts(QStringList &strings, QVector<int> &counts)
{
QMultiMap<int, QString> m;
- foreach (Tree *t, searchOrder()) {
- if (t->linkCount() < 0)
- m.insert(t->linkCount(), t->physicalModuleName());
+ for (const auto *tree : searchOrder()) {
+ if (tree->linkCount() < 0)
+ m.insert(tree->linkCount(), tree->physicalModuleName());
}
QString depends = "depends +=";
QString module = Generator::defaultModuleName().toLower();
@@ -410,8 +405,8 @@ const FunctionNode *QDocForest::findFunctionNode(const QStringList &path,
const Node *relative,
Node::Genus genus)
{
- foreach (Tree *t, searchOrder()) {
- const FunctionNode *fn = t->findFunctionNode(path, parameters, relative, genus);
+ for (const auto *tree : searchOrder()) {
+ const FunctionNode *fn = tree->findFunctionNode(path, parameters, relative, genus);
if (fn)
return fn;
relative = nullptr;
@@ -435,8 +430,8 @@ NodeMultiMap QDocDatabase::cppClasses_;
NodeMultiMap QDocDatabase::qmlBasicTypes_;
NodeMultiMap QDocDatabase::qmlTypes_;
NodeMultiMap QDocDatabase::examples_;
-NodeMapMap QDocDatabase::newClassMaps_;
-NodeMapMap QDocDatabase::newQmlTypeMaps_;
+NodeMapMap QDocDatabase::newClassMaps_;
+NodeMapMap QDocDatabase::newQmlTypeMaps_;
NodeMultiMapMap QDocDatabase::newSinceMaps_;
/*!
@@ -514,139 +509,139 @@ void QDocDatabase::destroyQdocDB()
void QDocDatabase::initializeDB()
{
Node::initialize();
- typeNodeMap_.insert( "accepted", nullptr);
- typeNodeMap_.insert( "actionPerformed", nullptr);
- typeNodeMap_.insert( "activated", nullptr);
- typeNodeMap_.insert( "alias", nullptr);
- typeNodeMap_.insert( "anchors", nullptr);
- typeNodeMap_.insert( "any", nullptr);
- typeNodeMap_.insert( "array", nullptr);
- typeNodeMap_.insert( "autoSearch", nullptr);
- typeNodeMap_.insert( "axis", nullptr);
- typeNodeMap_.insert( "backClicked", nullptr);
- typeNodeMap_.insert( "boomTime", nullptr);
- typeNodeMap_.insert( "border", nullptr);
- typeNodeMap_.insert( "buttonClicked", nullptr);
- typeNodeMap_.insert( "callback", nullptr);
- typeNodeMap_.insert( "char", nullptr);
- typeNodeMap_.insert( "clicked", nullptr);
- typeNodeMap_.insert( "close", nullptr);
- typeNodeMap_.insert( "closed", nullptr);
- typeNodeMap_.insert( "cond", nullptr);
- typeNodeMap_.insert( "data", nullptr);
- typeNodeMap_.insert( "dataReady", nullptr);
- typeNodeMap_.insert( "dateString", nullptr);
- typeNodeMap_.insert( "dateTimeString", nullptr);
- typeNodeMap_.insert( "datetime", nullptr);
- typeNodeMap_.insert( "day", nullptr);
- typeNodeMap_.insert( "deactivated", nullptr);
- typeNodeMap_.insert( "drag", nullptr);
- typeNodeMap_.insert( "easing", nullptr);
- typeNodeMap_.insert( "error", nullptr);
- typeNodeMap_.insert( "exposure", nullptr);
- typeNodeMap_.insert( "fatalError", nullptr);
- typeNodeMap_.insert( "fileSelected", nullptr);
- typeNodeMap_.insert( "flags", nullptr);
- typeNodeMap_.insert( "float", nullptr);
- typeNodeMap_.insert( "focus", nullptr);
- typeNodeMap_.insert( "focusZone", nullptr);
- typeNodeMap_.insert( "format", nullptr);
- typeNodeMap_.insert( "framePainted", nullptr);
- typeNodeMap_.insert( "from", nullptr);
- typeNodeMap_.insert( "frontClicked", nullptr);
- typeNodeMap_.insert( "function", nullptr);
- typeNodeMap_.insert( "hasOpened", nullptr);
- typeNodeMap_.insert( "hovered", nullptr);
- typeNodeMap_.insert( "hoveredTitle", nullptr);
- typeNodeMap_.insert( "hoveredUrl", nullptr);
- typeNodeMap_.insert( "imageCapture", nullptr);
- typeNodeMap_.insert( "imageProcessing", nullptr);
- typeNodeMap_.insert( "index", nullptr);
- typeNodeMap_.insert( "initialized", nullptr);
- typeNodeMap_.insert( "isLoaded", nullptr);
- typeNodeMap_.insert( "item", nullptr);
- typeNodeMap_.insert( "jsdict", nullptr);
- typeNodeMap_.insert( "jsobject", nullptr);
- typeNodeMap_.insert( "key", nullptr);
- typeNodeMap_.insert( "keysequence", nullptr);
- typeNodeMap_.insert( "listViewClicked", nullptr);
- typeNodeMap_.insert( "loadRequest", nullptr);
- typeNodeMap_.insert( "locale", nullptr);
- typeNodeMap_.insert( "location", nullptr);
- typeNodeMap_.insert( "long", nullptr);
- typeNodeMap_.insert( "message", nullptr);
- typeNodeMap_.insert( "messageReceived", nullptr);
- typeNodeMap_.insert( "mode", nullptr);
- typeNodeMap_.insert( "month", nullptr);
- typeNodeMap_.insert( "name", nullptr);
- typeNodeMap_.insert( "number", nullptr);
- typeNodeMap_.insert( "object", nullptr);
- typeNodeMap_.insert( "offset", nullptr);
- typeNodeMap_.insert( "ok", nullptr);
- typeNodeMap_.insert( "openCamera", nullptr);
- typeNodeMap_.insert( "openImage", nullptr);
- typeNodeMap_.insert( "openVideo", nullptr);
- typeNodeMap_.insert( "padding", nullptr);
- typeNodeMap_.insert( "parent", nullptr);
- typeNodeMap_.insert( "path", nullptr);
- typeNodeMap_.insert( "photoModeSelected", nullptr);
- typeNodeMap_.insert( "position", nullptr);
- typeNodeMap_.insert( "precision", nullptr);
- typeNodeMap_.insert( "presetClicked", nullptr);
- typeNodeMap_.insert( "preview", nullptr);
- typeNodeMap_.insert( "previewSelected", nullptr);
- typeNodeMap_.insert( "progress", nullptr);
- typeNodeMap_.insert( "puzzleLost", nullptr);
- typeNodeMap_.insert( "qmlSignal", nullptr);
- typeNodeMap_.insert( "rectangle", nullptr);
- typeNodeMap_.insert( "request", nullptr);
- typeNodeMap_.insert( "requestId", nullptr);
- typeNodeMap_.insert( "section", nullptr);
- typeNodeMap_.insert( "selected", nullptr);
- typeNodeMap_.insert( "send", nullptr);
- typeNodeMap_.insert( "settingsClicked", nullptr);
- typeNodeMap_.insert( "shoe", nullptr);
- typeNodeMap_.insert( "short", nullptr);
- typeNodeMap_.insert( "signed", nullptr);
- typeNodeMap_.insert( "sizeChanged", nullptr);
- typeNodeMap_.insert( "size_t", nullptr);
- typeNodeMap_.insert( "sockaddr", nullptr);
- typeNodeMap_.insert( "someOtherSignal", nullptr);
- typeNodeMap_.insert( "sourceSize", nullptr);
- typeNodeMap_.insert( "startButtonClicked", nullptr);
- typeNodeMap_.insert( "state", nullptr);
- typeNodeMap_.insert( "std::initializer_list", nullptr);
- typeNodeMap_.insert( "std::list", nullptr);
- typeNodeMap_.insert( "std::map", nullptr);
- typeNodeMap_.insert( "std::pair", nullptr);
- typeNodeMap_.insert( "std::string", nullptr);
- typeNodeMap_.insert( "std::vector", nullptr);
- typeNodeMap_.insert( "stringlist", nullptr);
- typeNodeMap_.insert( "swapPlayers", nullptr);
- typeNodeMap_.insert( "symbol", nullptr);
- typeNodeMap_.insert( "t", nullptr);
- typeNodeMap_.insert( "T", nullptr);
- typeNodeMap_.insert( "tagChanged", nullptr);
- typeNodeMap_.insert( "timeString", nullptr);
- typeNodeMap_.insert( "timeout", nullptr);
- typeNodeMap_.insert( "to", nullptr);
- typeNodeMap_.insert( "toggled", nullptr);
- typeNodeMap_.insert( "type", nullptr);
- typeNodeMap_.insert( "unsigned", nullptr);
- typeNodeMap_.insert( "urllist", nullptr);
- typeNodeMap_.insert( "va_list", nullptr);
- typeNodeMap_.insert( "value", nullptr);
- typeNodeMap_.insert( "valueEmitted", nullptr);
- typeNodeMap_.insert( "videoFramePainted", nullptr);
- typeNodeMap_.insert( "videoModeSelected", nullptr);
- typeNodeMap_.insert( "videoRecorder", nullptr);
- typeNodeMap_.insert( "void", nullptr);
- typeNodeMap_.insert( "volatile", nullptr);
- typeNodeMap_.insert( "wchar_t", nullptr);
- typeNodeMap_.insert( "x", nullptr);
- typeNodeMap_.insert( "y", nullptr);
- typeNodeMap_.insert( "zoom", nullptr);
- typeNodeMap_.insert( "zoomTo", nullptr);
+ typeNodeMap_.insert("accepted", nullptr);
+ typeNodeMap_.insert("actionPerformed", nullptr);
+ typeNodeMap_.insert("activated", nullptr);
+ typeNodeMap_.insert("alias", nullptr);
+ typeNodeMap_.insert("anchors", nullptr);
+ typeNodeMap_.insert("any", nullptr);
+ typeNodeMap_.insert("array", nullptr);
+ typeNodeMap_.insert("autoSearch", nullptr);
+ typeNodeMap_.insert("axis", nullptr);
+ typeNodeMap_.insert("backClicked", nullptr);
+ typeNodeMap_.insert("boomTime", nullptr);
+ typeNodeMap_.insert("border", nullptr);
+ typeNodeMap_.insert("buttonClicked", nullptr);
+ typeNodeMap_.insert("callback", nullptr);
+ typeNodeMap_.insert("char", nullptr);
+ typeNodeMap_.insert("clicked", nullptr);
+ typeNodeMap_.insert("close", nullptr);
+ typeNodeMap_.insert("closed", nullptr);
+ typeNodeMap_.insert("cond", nullptr);
+ typeNodeMap_.insert("data", nullptr);
+ typeNodeMap_.insert("dataReady", nullptr);
+ typeNodeMap_.insert("dateString", nullptr);
+ typeNodeMap_.insert("dateTimeString", nullptr);
+ typeNodeMap_.insert("datetime", nullptr);
+ typeNodeMap_.insert("day", nullptr);
+ typeNodeMap_.insert("deactivated", nullptr);
+ typeNodeMap_.insert("drag", nullptr);
+ typeNodeMap_.insert("easing", nullptr);
+ typeNodeMap_.insert("error", nullptr);
+ typeNodeMap_.insert("exposure", nullptr);
+ typeNodeMap_.insert("fatalError", nullptr);
+ typeNodeMap_.insert("fileSelected", nullptr);
+ typeNodeMap_.insert("flags", nullptr);
+ typeNodeMap_.insert("float", nullptr);
+ typeNodeMap_.insert("focus", nullptr);
+ typeNodeMap_.insert("focusZone", nullptr);
+ typeNodeMap_.insert("format", nullptr);
+ typeNodeMap_.insert("framePainted", nullptr);
+ typeNodeMap_.insert("from", nullptr);
+ typeNodeMap_.insert("frontClicked", nullptr);
+ typeNodeMap_.insert("function", nullptr);
+ typeNodeMap_.insert("hasOpened", nullptr);
+ typeNodeMap_.insert("hovered", nullptr);
+ typeNodeMap_.insert("hoveredTitle", nullptr);
+ typeNodeMap_.insert("hoveredUrl", nullptr);
+ typeNodeMap_.insert("imageCapture", nullptr);
+ typeNodeMap_.insert("imageProcessing", nullptr);
+ typeNodeMap_.insert("index", nullptr);
+ typeNodeMap_.insert("initialized", nullptr);
+ typeNodeMap_.insert("isLoaded", nullptr);
+ typeNodeMap_.insert("item", nullptr);
+ typeNodeMap_.insert("jsdict", nullptr);
+ typeNodeMap_.insert("jsobject", nullptr);
+ typeNodeMap_.insert("key", nullptr);
+ typeNodeMap_.insert("keysequence", nullptr);
+ typeNodeMap_.insert("listViewClicked", nullptr);
+ typeNodeMap_.insert("loadRequest", nullptr);
+ typeNodeMap_.insert("locale", nullptr);
+ typeNodeMap_.insert("location", nullptr);
+ typeNodeMap_.insert("long", nullptr);
+ typeNodeMap_.insert("message", nullptr);
+ typeNodeMap_.insert("messageReceived", nullptr);
+ typeNodeMap_.insert("mode", nullptr);
+ typeNodeMap_.insert("month", nullptr);
+ typeNodeMap_.insert("name", nullptr);
+ typeNodeMap_.insert("number", nullptr);
+ typeNodeMap_.insert("object", nullptr);
+ typeNodeMap_.insert("offset", nullptr);
+ typeNodeMap_.insert("ok", nullptr);
+ typeNodeMap_.insert("openCamera", nullptr);
+ typeNodeMap_.insert("openImage", nullptr);
+ typeNodeMap_.insert("openVideo", nullptr);
+ typeNodeMap_.insert("padding", nullptr);
+ typeNodeMap_.insert("parent", nullptr);
+ typeNodeMap_.insert("path", nullptr);
+ typeNodeMap_.insert("photoModeSelected", nullptr);
+ typeNodeMap_.insert("position", nullptr);
+ typeNodeMap_.insert("precision", nullptr);
+ typeNodeMap_.insert("presetClicked", nullptr);
+ typeNodeMap_.insert("preview", nullptr);
+ typeNodeMap_.insert("previewSelected", nullptr);
+ typeNodeMap_.insert("progress", nullptr);
+ typeNodeMap_.insert("puzzleLost", nullptr);
+ typeNodeMap_.insert("qmlSignal", nullptr);
+ typeNodeMap_.insert("rectangle", nullptr);
+ typeNodeMap_.insert("request", nullptr);
+ typeNodeMap_.insert("requestId", nullptr);
+ typeNodeMap_.insert("section", nullptr);
+ typeNodeMap_.insert("selected", nullptr);
+ typeNodeMap_.insert("send", nullptr);
+ typeNodeMap_.insert("settingsClicked", nullptr);
+ typeNodeMap_.insert("shoe", nullptr);
+ typeNodeMap_.insert("short", nullptr);
+ typeNodeMap_.insert("signed", nullptr);
+ typeNodeMap_.insert("sizeChanged", nullptr);
+ typeNodeMap_.insert("size_t", nullptr);
+ typeNodeMap_.insert("sockaddr", nullptr);
+ typeNodeMap_.insert("someOtherSignal", nullptr);
+ typeNodeMap_.insert("sourceSize", nullptr);
+ typeNodeMap_.insert("startButtonClicked", nullptr);
+ typeNodeMap_.insert("state", nullptr);
+ typeNodeMap_.insert("std::initializer_list", nullptr);
+ typeNodeMap_.insert("std::list", nullptr);
+ typeNodeMap_.insert("std::map", nullptr);
+ typeNodeMap_.insert("std::pair", nullptr);
+ typeNodeMap_.insert("std::string", nullptr);
+ typeNodeMap_.insert("std::vector", nullptr);
+ typeNodeMap_.insert("stringlist", nullptr);
+ typeNodeMap_.insert("swapPlayers", nullptr);
+ typeNodeMap_.insert("symbol", nullptr);
+ typeNodeMap_.insert("t", nullptr);
+ typeNodeMap_.insert("T", nullptr);
+ typeNodeMap_.insert("tagChanged", nullptr);
+ typeNodeMap_.insert("timeString", nullptr);
+ typeNodeMap_.insert("timeout", nullptr);
+ typeNodeMap_.insert("to", nullptr);
+ typeNodeMap_.insert("toggled", nullptr);
+ typeNodeMap_.insert("type", nullptr);
+ typeNodeMap_.insert("unsigned", nullptr);
+ typeNodeMap_.insert("urllist", nullptr);
+ typeNodeMap_.insert("va_list", nullptr);
+ typeNodeMap_.insert("value", nullptr);
+ typeNodeMap_.insert("valueEmitted", nullptr);
+ typeNodeMap_.insert("videoFramePainted", nullptr);
+ typeNodeMap_.insert("videoModeSelected", nullptr);
+ typeNodeMap_.insert("videoRecorder", nullptr);
+ typeNodeMap_.insert("void", nullptr);
+ typeNodeMap_.insert("volatile", nullptr);
+ typeNodeMap_.insert("wchar_t", nullptr);
+ typeNodeMap_.insert("x", nullptr);
+ typeNodeMap_.insert("y", nullptr);
+ typeNodeMap_.insert("zoom", nullptr);
+ typeNodeMap_.insert("zoomTo", nullptr);
}
/*! \fn NamespaceNode *QDocDatabase::primaryTreeRoot()
@@ -801,7 +796,7 @@ QmlTypeNode *QDocDatabase::findQmlType(const QString &qmid, const QString &name)
QStringList path(name);
Node *n = forest_.findNodeByNameAndType(path, &Node::isQmlType);
if (n && (n->isQmlType() || n->isJsType()))
- return static_cast<QmlTypeNode*>(n);
+ return static_cast<QmlTypeNode *>(n);
return nullptr;
}
@@ -825,7 +820,7 @@ Aggregate *QDocDatabase::findQmlBasicType(const QString &qmid, const QString &na
QStringList path(name);
Node *n = forest_.findNodeByNameAndType(path, &Node::isQmlBasicType);
if (n && n->isQmlBasicType())
- return static_cast<Aggregate*>(n);
+ return static_cast<Aggregate *>(n);
return nullptr;
}
@@ -1186,15 +1181,15 @@ void QDocDatabase::resolveNamespaces()
t->root()->findAllNamespaces(namespaceMultimap);
t = forest_.nextTree();
}
- QList<QString> keys = namespaceMultimap.uniqueKeys();
- foreach (const QString &s, keys) {
+ const QList<QString> keys = namespaceMultimap.uniqueKeys();
+ for (const QString &key : keys) {
NamespaceNode *ns = nullptr;
NamespaceNode *somewhere = nullptr;
- NodeList namespaces = namespaceMultimap.values(s);
- int count = namespaceMultimap.remove(s);
+ const NodeList namespaces = namespaceMultimap.values(key);
+ int count = namespaceMultimap.remove(key);
if (count > 0) {
- foreach (Node *n, namespaces) {
- ns = static_cast<NamespaceNode*>(n);
+ for (auto *node : namespaces) {
+ ns = static_cast<NamespaceNode *>(node);
if (ns->isDocumentedHere())
break;
else if (ns->hadDoc())
@@ -1202,8 +1197,8 @@ void QDocDatabase::resolveNamespaces()
ns = nullptr;
}
if (ns) {
- foreach (Node *n, namespaces) {
- NamespaceNode *NS = static_cast<NamespaceNode*>(n);
+ for (auto *node : namespaces) {
+ NamespaceNode *NS = static_cast<NamespaceNode *>(node);
if (NS->hadDoc() && NS != ns) {
ns->doc().location().warning(tr("Namespace %1 documented more than once")
.arg(NS->name()));
@@ -1212,14 +1207,14 @@ void QDocDatabase::resolveNamespaces()
}
} else if (somewhere == nullptr) {
- foreach (Node *n, namespaces) {
- NamespaceNode *NS = static_cast<NamespaceNode*>(n);
+ for (auto *node : namespaces) {
+ NamespaceNode *NS = static_cast<NamespaceNode *>(node);
NS->reportDocumentedChildrenInUndocumentedNamespace();
}
}
if (somewhere) {
- foreach (Node *n, namespaces) {
- NamespaceNode *NS = static_cast<NamespaceNode*>(n);
+ for (auto *node : namespaces) {
+ NamespaceNode *NS = static_cast<NamespaceNode *>(node);
if (NS != somewhere)
NS->setDocNode(somewhere);
}
@@ -1234,11 +1229,11 @@ void QDocDatabase::resolveNamespaces()
the namespace.
*/
if (ns && count > 1) {
- foreach (Node *n, namespaces) {
- NamespaceNode *NS = static_cast<NamespaceNode*>(n);
- if (NS != ns) {
- NodeList::ConstIterator c = NS->constBegin();
- while (c != NS->constEnd()) {
+ for (auto *node : namespaces) {
+ auto *nameSpaceNode = static_cast<NamespaceNode *>(node);
+ if (nameSpaceNode != ns) {
+ NodeList::ConstIterator c = nameSpaceNode->constBegin();
+ while (c != nameSpaceNode->constEnd()) {
Node *N = *c;
if (N && N->isPublic() && !N->isInternal())
ns->includeChild(N);
@@ -1248,7 +1243,7 @@ void QDocDatabase::resolveNamespaces()
}
}
if (ns == nullptr)
- ns = static_cast<NamespaceNode*>(namespaces.at(0));
+ ns = static_cast<NamespaceNode *>(namespaces.at(0));
namespaceIndex_.insert(ns->name(), ns);
}
}
@@ -1270,10 +1265,10 @@ void QDocDatabase::resolveProxies()
Tree *t = forest_.firstTree();
t = forest_.nextTree();
while (t) {
- NodeList &proxies = t->proxies();
+ const NodeList &proxies = t->proxies();
if (!proxies.isEmpty()) {
- foreach (Node *n, proxies) {
- ProxyNode *pn = static_cast<ProxyNode*>(n);
+ for (auto *node : proxies) {
+ ProxyNode *pn = static_cast<ProxyNode *>(node);
if (pn->count() > 0) {
Aggregate *aggregate = primaryTree()->findAggregate(pn->name());
if (aggregate != nullptr)
@@ -1354,8 +1349,8 @@ const Node *QDocDatabase::findNodeForTarget(const QString &target, const Node *r
else {
QStringList path = target.split("::");
int flags = SearchBaseClasses | SearchEnumValues;
- foreach (Tree *t, searchOrder()) {
- const Node *n = t->findNode(path, relative, flags, Node::DontCare);
+ for (const auto *tree : searchOrder()) {
+ const Node *n = tree->findNode(path, relative, flags, Node::DontCare);
if (n)
return n;
relative = nullptr;
@@ -1377,19 +1372,19 @@ void QDocDatabase::generateTagFile(const QString &name, Generator *g)
}
/*!
- Reads and parses the qdoc index files listed in \a t.
+ Reads and parses the qdoc index files listed in \a indexFiles.
*/
-void QDocDatabase::readIndexes(const QStringList &t)
+void QDocDatabase::readIndexes(const QStringList &indexFiles)
{
- QStringList indexFiles;
- foreach (const QString &f, t) {
- QString fn = f.mid(f.lastIndexOf(QChar('/'))+1);
+ QStringList filesToRead;
+ for (const QString &file : indexFiles) {
+ QString fn = file.mid(file.lastIndexOf(QChar('/'))+1);
if (!isLoaded(fn))
- indexFiles << f;
+ filesToRead << file;
else
- qDebug() << "This index file is already in memory:" << f;
+ qDebug() << "This index file is already in memory:" << file;
}
- QDocIndexFiles::qdocIndexFiles()->readIndexes(indexFiles);
+ QDocIndexFiles::qdocIndexFiles()->readIndexes(filesToRead);
}
/*!
@@ -1421,7 +1416,8 @@ Node *QDocDatabase::findNodeInOpenNamespace(QStringList &path, bool (Node::*isMa
return nullptr;
Node *n = nullptr;
if (!openNamespaces_.isEmpty()) {
- foreach (const QString &t, openNamespaces_) {
+ const auto &openNamespaces = openNamespaces_;
+ for (const QString &t : openNamespaces) {
QStringList p;
if (t != path[0])
p = t.split("::") + path;
@@ -1446,8 +1442,8 @@ void QDocDatabase::mergeCollections(Node::NodeType type, CNMap &cnm, const Node
{
cnm.clear();
CNMultiMap cnmm;
- foreach (Tree *t, searchOrder()) {
- CNMap *m = t->getCollectionMap(type);
+ for (auto *tree : searchOrder()) {
+ CNMap *m = tree->getCollectionMap(type);
if (m && !m->isEmpty()) {
CNMap::const_iterator i = m->cbegin();
while (i != m->cend()) {
@@ -1460,28 +1456,28 @@ void QDocDatabase::mergeCollections(Node::NodeType type, CNMap &cnm, const Node
if (cnmm.isEmpty())
return;
QRegExp singleDigit("\\b([0-9])\\b");
- QStringList keys = cnmm.uniqueKeys();
- foreach (const QString &key, keys) {
- QList<CollectionNode*> values = cnmm.values(key);
+ const QStringList keys = cnmm.uniqueKeys();
+ for (const auto &key : keys) {
+ const QList<CollectionNode *> values = cnmm.values(key);
CollectionNode *n = nullptr;
- foreach (CollectionNode *v, values) {
- if (v && v->wasSeen() && (v != relative)) {
- n = v;
+ for (auto *value : values) {
+ if (value && value->wasSeen() && value != relative) {
+ n = value;
break;
}
}
if (n) {
if (values.size() > 1) {
- foreach (CollectionNode *v, values) {
- if (v != n) {
+ for (CollectionNode *value : values) {
+ if (value != n) {
// Allow multiple (major) versions of QML/JS modules
if ((n->isQmlModule() || n->isJsModule()) &&
- n->logicalModuleIdentifier() != v->logicalModuleIdentifier()) {
- if (v->wasSeen() && v != relative && !v->members().isEmpty())
- cnm.insert(v->fullTitle().toLower(), v);
+ n->logicalModuleIdentifier() != value->logicalModuleIdentifier()) {
+ if (value->wasSeen() && value != relative && !value->members().isEmpty())
+ cnm.insert(value->fullTitle().toLower(), value);
continue;
}
- foreach (Node *t, v->members())
+ for (Node *t : value->members())
n->addMember(t);
}
}
@@ -1508,14 +1504,14 @@ void QDocDatabase::mergeCollections(Node::NodeType type, CNMap &cnm, const Node
*/
void QDocDatabase::mergeCollections(CollectionNode *c)
{
- foreach (Tree *t, searchOrder()) {
- CollectionNode *cn = t->getCollection(c->name(), c->nodeType());
+ for (auto *tree : searchOrder()) {
+ CollectionNode *cn = tree->getCollection(c->name(), c->nodeType());
if (cn && cn != c) {
if ((cn->isQmlModule() || cn->isJsModule()) &&
cn->logicalModuleIdentifier() != c->logicalModuleIdentifier())
continue;
- foreach (Node *n, cn->members())
- c->addMember(n);
+ for (auto *node : cn->members())
+ c->addMember(node);
}
}
}
@@ -1533,7 +1529,7 @@ const Node *QDocDatabase::findNodeForAtom(const Atom *a, const Node *relative, Q
{
const Node *node = nullptr;
- Atom *atom = const_cast<Atom*>(a);
+ Atom *atom = const_cast<Atom *>(a);
QStringList targetPath = atom->string().split(QLatin1Char('#'));
QString first = targetPath.first().trimmed();
diff --git a/src/qdoc/qdocdatabase.h b/src/qdoc/qdocdatabase.h
index d7db6b7e5..28b1cea83 100644
--- a/src/qdoc/qdocdatabase.h
+++ b/src/qdoc/qdocdatabase.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -29,16 +29,17 @@
#ifndef QDOCDATABASE_H
#define QDOCDATABASE_H
-#include <qstring.h>
-#include <qmap.h>
-#include "tree.h"
#include "config.h"
#include "text.h"
-#include <qdebug.h>
+#include "tree.h"
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qmap.h>
+#include <QtCore/qstring.h>
QT_BEGIN_NAMESPACE
-typedef QMap<Text, const Node*> TextToNodeMap;
+typedef QMap<Text, const Node *> TextToNodeMap;
class Atom;
class Generator;
@@ -55,39 +56,39 @@ class QDocForest
{
private:
friend class QDocDatabase;
- QDocForest(QDocDatabase* qdb)
+ QDocForest(QDocDatabase *qdb)
: qdb_(qdb), primaryTree_(nullptr), currentIndex_(0) { }
~QDocForest();
- NamespaceNode* firstRoot();
- NamespaceNode* nextRoot();
- Tree* firstTree();
- Tree* nextTree();
- Tree* primaryTree() { return primaryTree_; }
- Tree* findTree(const QString& t) { return forest_.value(t); }
+ NamespaceNode *firstRoot();
+ NamespaceNode *nextRoot();
+ Tree *firstTree();
+ Tree *nextTree();
+ Tree *primaryTree() { return primaryTree_; }
+ Tree *findTree(const QString &t) { return forest_.value(t); }
QStringList keys() {
return forest_.keys();
}
- NamespaceNode* primaryTreeRoot() { return (primaryTree_ ? primaryTree_->root() : nullptr); }
+ NamespaceNode *primaryTreeRoot() { return (primaryTree_ ? primaryTree_->root() : nullptr); }
bool isEmpty() { return searchOrder().isEmpty(); }
bool done() { return (currentIndex_ >= searchOrder().size()); }
- const QVector<Tree*>& searchOrder();
- const QVector<Tree*>& indexSearchOrder();
- void setSearchOrder(QStringList& t);
- bool isLoaded(const QString& fn) {
- foreach (Tree* t, searchOrder()) {
- if (fn == t->indexFileName())
+ const QVector<Tree *> &searchOrder();
+ const QVector<Tree *> &indexSearchOrder();
+ void setSearchOrder(const QStringList &t);
+ bool isLoaded(const QString &fn) {
+ for (const auto *tree : searchOrder()) {
+ if (fn == tree->indexFileName())
return true;
}
return false;
}
- const Node* findNode(const QStringList& path,
- const Node* relative,
+ const Node *findNode(const QStringList &path,
+ const Node *relative,
int findFlags,
Node::Genus genus) {
- foreach (Tree* t, searchOrder()) {
- const Node* n = t->findNode(path, relative, findFlags, genus);
+ for (const auto *tree : searchOrder()) {
+ const Node *n = tree->findNode(path, relative, findFlags, genus);
if (n)
return n;
relative = nullptr;
@@ -95,27 +96,27 @@ class QDocForest
return nullptr;
}
- Node* findNodeByNameAndType(const QStringList& path, bool (Node::*isMatch) () const) {
- foreach (Tree* t, searchOrder()) {
- Node* n = t->findNodeByNameAndType(path, isMatch);
+ Node *findNodeByNameAndType(const QStringList &path, bool (Node::*isMatch) () const) {
+ for (const auto *tree : searchOrder()) {
+ Node *n = tree->findNodeByNameAndType(path, isMatch);
if (n)
return n;
}
return nullptr;
}
- ClassNode* findClassNode(const QStringList& path) {
- foreach (Tree* t, searchOrder()) {
- ClassNode* n = t->findClassNode(path);
+ ClassNode *findClassNode(const QStringList &path) {
+ for (const auto *tree : searchOrder()) {
+ ClassNode *n = tree->findClassNode(path);
if (n)
return n;
}
return nullptr;
}
- Node* findNodeForInclude(const QStringList& path) {
- foreach (Tree* t, searchOrder()) {
- Node* n = t->findNodeForInclude(path);
+ Node *findNodeForInclude(const QStringList &path) {
+ for (const auto *tree : searchOrder()) {
+ Node *n = tree->findNodeForInclude(path);
if (n)
return n;
}
@@ -124,20 +125,20 @@ class QDocForest
const FunctionNode *findFunctionNode(const QStringList &path,
const Parameters &parameters,
- const Node* relative,
+ const Node *relative,
Node::Genus genus);
- const Node* findNodeForTarget(QStringList& targetPath,
- const Node* relative,
+ const Node *findNodeForTarget(QStringList &targetPath,
+ const Node *relative,
Node::Genus genus,
- QString& ref);
+ QString &ref);
- const Node* findTypeNode(const QStringList& path, const Node* relative, Node::Genus genus)
+ const Node *findTypeNode(const QStringList &path, const Node *relative, Node::Genus genus)
{
int flags = SearchBaseClasses | SearchEnumValues | TypesOnly;
if (relative && genus == Node::DontCare && relative->genus() != Node::DOC)
genus = relative->genus();
- foreach (Tree* t, searchOrder()) {
- const Node* n = t->findNode(path, relative, flags, genus);
+ for (const auto *tree : searchOrder()) {
+ const Node *n = tree->findNode(path, relative, flags, genus);
if (n)
return n;
relative = nullptr;
@@ -145,40 +146,40 @@ class QDocForest
return nullptr;
}
- const PageNode* findPageNodeByTitle(const QString& title)
+ const PageNode *findPageNodeByTitle(const QString &title)
{
- foreach (Tree* t, searchOrder()) {
- const PageNode* n = t->findPageNodeByTitle(title);
+ for (const auto *tree : searchOrder()) {
+ const PageNode *n = tree->findPageNodeByTitle(title);
if (n)
return n;
}
return nullptr;
}
- const CollectionNode* getCollectionNode(const QString& name, Node::NodeType type)
+ const CollectionNode *getCollectionNode(const QString &name, Node::NodeType type)
{
- foreach (Tree* t, searchOrder()) {
- const CollectionNode* cn = t->getCollection(name, type);
+ for (auto *tree : searchOrder()) {
+ const CollectionNode *cn = tree->getCollection(name, type);
if (cn)
return cn;
}
return nullptr;
}
- QmlTypeNode* lookupQmlType(const QString& name)
+ QmlTypeNode *lookupQmlType(const QString &name)
{
- foreach (Tree* t, searchOrder()) {
- QmlTypeNode* qcn = t->lookupQmlType(name);
+ for (const auto *tree : searchOrder()) {
+ QmlTypeNode *qcn = tree->lookupQmlType(name);
if (qcn)
return qcn;
}
return nullptr;
}
- Aggregate* lookupQmlBasicType(const QString& name)
+ Aggregate *lookupQmlBasicType(const QString &name)
{
- foreach (Tree* t, searchOrder()) {
- Aggregate* a = t->lookupQmlBasicType(name);
+ for (const auto *tree : searchOrder()) {
+ Aggregate *a = tree->lookupQmlBasicType(name);
if (a)
return a;
}
@@ -187,23 +188,23 @@ class QDocForest
void clearSearchOrder() { searchOrder_.clear(); }
void clearLinkCounts()
{
- foreach (Tree* t, searchOrder())
- t->clearLinkCount();
+ for (auto *tree : searchOrder())
+ tree->clearLinkCount();
}
- void printLinkCounts(const QString& project);
- QString getLinkCounts(QStringList& strings, QVector<int>& counts);
- void newPrimaryTree(const QString& module);
- void setPrimaryTree(const QString& t);
- NamespaceNode* newIndexTree(const QString& module);
+ void printLinkCounts(const QString &project);
+ QString getLinkCounts(QStringList &strings, QVector<int> &counts);
+ void newPrimaryTree(const QString &module);
+ void setPrimaryTree(const QString &t);
+ NamespaceNode *newIndexTree(const QString &module);
private:
- QDocDatabase* qdb_;
- Tree* primaryTree_;
- int currentIndex_;
- QMap<QString, Tree*> forest_;
- QVector<Tree*> searchOrder_;
- QVector<Tree*> indexSearchOrder_;
- QVector<QString> moduleNames_;
+ QDocDatabase *qdb_;
+ Tree *primaryTree_;
+ int currentIndex_;
+ QMap<QString, Tree *> forest_;
+ QVector<Tree *> searchOrder_;
+ QVector<Tree *> indexSearchOrder_;
+ QVector<QString> moduleNames_;
};
class QDocDatabase
@@ -211,42 +212,42 @@ class QDocDatabase
Q_DECLARE_TR_FUNCTIONS(QDoc::QDocDatabase)
public:
- static QDocDatabase* qdocDB();
+ static QDocDatabase *qdocDB();
static void destroyQdocDB();
~QDocDatabase();
- Tree* findTree(const QString& t) { return forest_.findTree(t); }
+ Tree *findTree(const QString &t) { return forest_.findTree(t); }
- const CNMap& groups() { return primaryTree()->groups(); }
- const CNMap& modules() { return primaryTree()->modules(); }
- const CNMap& qmlModules() { return primaryTree()->qmlModules(); }
- const CNMap& jsModules() { return primaryTree()->jsModules(); }
+ const CNMap &groups() { return primaryTree()->groups(); }
+ const CNMap &modules() { return primaryTree()->modules(); }
+ const CNMap &qmlModules() { return primaryTree()->qmlModules(); }
+ const CNMap &jsModules() { return primaryTree()->jsModules(); }
- CollectionNode* addGroup(const QString& name) { return primaryTree()->addGroup(name); }
- CollectionNode* addModule(const QString& name) { return primaryTree()->addModule(name); }
- CollectionNode* addQmlModule(const QString& name) { return primaryTree()->addQmlModule(name); }
- CollectionNode* addJsModule(const QString& name) { return primaryTree()->addJsModule(name); }
+ CollectionNode *addGroup(const QString &name) { return primaryTree()->addGroup(name); }
+ CollectionNode *addModule(const QString &name) { return primaryTree()->addModule(name); }
+ CollectionNode *addQmlModule(const QString &name) { return primaryTree()->addQmlModule(name); }
+ CollectionNode *addJsModule(const QString &name) { return primaryTree()->addJsModule(name); }
- CollectionNode* addToGroup(const QString& name, Node* node) {
+ CollectionNode *addToGroup(const QString &name, Node *node) {
return primaryTree()->addToGroup(name, node);
}
- CollectionNode* addToModule(const QString& name, Node* node) {
+ CollectionNode *addToModule(const QString &name, Node *node) {
return primaryTree()->addToModule(name, node);
}
- CollectionNode* addToQmlModule(const QString& name, Node* node) {
+ CollectionNode *addToQmlModule(const QString &name, Node *node) {
return primaryTree()->addToQmlModule(name, node);
}
- CollectionNode* addToJsModule(const QString& name, Node* node) {
+ CollectionNode *addToJsModule(const QString &name, Node *node) {
return primaryTree()->addToJsModule(name, node);
}
- void addExampleNode(ExampleNode* n) { primaryTree()->addExampleNode(n); }
- ExampleNodeMap& exampleNodeMap() { return primaryTree()->exampleNodeMap(); }
+ void addExampleNode(ExampleNode *n) { primaryTree()->addExampleNode(n); }
+ ExampleNodeMap &exampleNodeMap() { return primaryTree()->exampleNodeMap(); }
- QmlTypeNode* findQmlType(const QString& name);
- QmlTypeNode* findQmlType(const QString& qmid, const QString& name);
- QmlTypeNode* findQmlType(const ImportRec& import, const QString& name);
- Aggregate* findQmlBasicType(const QString& qmid, const QString& name);
+ QmlTypeNode *findQmlType(const QString &name);
+ QmlTypeNode *findQmlType(const QString &qmid, const QString &name);
+ QmlTypeNode *findQmlType(const ImportRec& import, const QString &name);
+ Aggregate *findQmlBasicType(const QString &qmid, const QString &name);
static NodeMultiMap &obsoleteClasses() { return obsoleteClasses_; }
static NodeMultiMap &obsoleteQmlTypes() { return obsoleteQmlTypes_; }
@@ -272,30 +273,30 @@ class QDocDatabase
/*******************************************************************
special collection access functions
********************************************************************/
- NodeMultiMap& getCppClasses();
- NodeMultiMap& getObsoleteClasses();
- NodeMultiMap& getClassesWithObsoleteMembers();
- NodeMultiMap& getObsoleteQmlTypes();
- NodeMultiMap& getQmlTypesWithObsoleteMembers();
- NodeMultiMap& getNamespaces();
- NodeMultiMap& getQmlBasicTypes();
- NodeMultiMap& getQmlTypes();
- NodeMultiMap& getExamples();
- NodeMultiMap& getAttributions();
- NodeMapMap& getFunctionIndex();
- TextToNodeMap& getLegaleseTexts();
- const NodeMap& getClassMap(const QString& key);
- const NodeMap& getQmlTypeMap(const QString& key);
- const NodeMap& getSinceMap(const QString& key);
+ NodeMultiMap &getCppClasses();
+ NodeMultiMap &getObsoleteClasses();
+ NodeMultiMap &getClassesWithObsoleteMembers();
+ NodeMultiMap &getObsoleteQmlTypes();
+ NodeMultiMap &getQmlTypesWithObsoleteMembers();
+ NodeMultiMap &getNamespaces();
+ NodeMultiMap &getQmlBasicTypes();
+ NodeMultiMap &getQmlTypes();
+ NodeMultiMap &getExamples();
+ NodeMultiMap &getAttributions();
+ NodeMapMap &getFunctionIndex();
+ TextToNodeMap &getLegaleseTexts();
+ const NodeMap &getClassMap(const QString &key);
+ const NodeMap &getQmlTypeMap(const QString &key);
+ const NodeMap &getSinceMap(const QString &key);
/*******************************************************************
Many of these will be either eliminated or replaced.
********************************************************************/
void resolveStuff();
- void insertTarget(const QString& name,
- const QString& title,
+ void insertTarget(const QString &name,
+ const QString &title,
TargetRec::TargetType type,
- Node* node,
+ Node *node,
int priority) {
primaryTree()->insertTarget(name, title, type, node, priority);
}
@@ -303,41 +304,41 @@ class QDocDatabase
/*******************************************************************
The functions declared below are called for the current tree only.
********************************************************************/
- Aggregate* findRelatesNode(const QStringList& path) { return primaryTree()->findRelatesNode(path); }
- Node* findNodeInOpenNamespace(QStringList& path, bool (Node::*) () const);
+ Aggregate *findRelatesNode(const QStringList &path) { return primaryTree()->findRelatesNode(path); }
+ Node *findNodeInOpenNamespace(QStringList &path, bool (Node::*) () const);
/*******************************************************************/
/*****************************************************************************
This function can handle parameters enclosed in '[' ']' (domanin and genus).
******************************************************************************/
- const Node* findNodeForAtom(const Atom* atom, const Node* relative, QString& ref);
+ const Node *findNodeForAtom(const Atom *atom, const Node *relative, QString &ref);
/*******************************************************************/
/*******************************************************************
The functions declared below are called for all trees.
********************************************************************/
- ClassNode* findClassNode(const QStringList& path) { return forest_.findClassNode(path); }
- Node* findNodeForInclude(const QStringList& path) { return forest_.findNodeForInclude(path); }
+ ClassNode *findClassNode(const QStringList &path) { return forest_.findClassNode(path); }
+ Node *findNodeForInclude(const QStringList &path) { return forest_.findNodeForInclude(path); }
const FunctionNode *findFunctionNode(const QString &target, const Node *relative, Node::Genus genus);
- const Node* findTypeNode(const QString& type, const Node* relative, Node::Genus genus);
- const Node* findNodeForTarget(const QString& target, const Node* relative);
- const PageNode* findPageNodeByTitle(const QString& title) {
+ const Node *findTypeNode(const QString &type, const Node *relative, Node::Genus genus);
+ const Node *findNodeForTarget(const QString &target, const Node *relative);
+ const PageNode *findPageNodeByTitle(const QString &title) {
return forest_.findPageNodeByTitle(title);
}
- Node* findNodeByNameAndType(const QStringList& path, bool (Node::*isMatch) () const) {
+ Node *findNodeByNameAndType(const QStringList &path, bool (Node::*isMatch) () const) {
return forest_.findNodeByNameAndType(path, isMatch);
}
- const CollectionNode* getCollectionNode(const QString& name, Node::NodeType type) {
+ const CollectionNode *getCollectionNode(const QString &name, Node::NodeType type) {
return forest_.getCollectionNode(name, type);
}
FunctionNode *findFunctionNodeForTag(QString tag) { return primaryTree()->findFunctionNodeForTag(tag); }
FunctionNode *findMacroNode(const QString &t) { return primaryTree()->findMacroNode(t); }
private:
- const Node* findNodeForTarget(QStringList& targetPath,
- const Node* relative,
+ const Node *findNodeForTarget(QStringList &targetPath,
+ const Node *relative,
Node::Genus genus,
- QString& ref) {
+ QString &ref) {
return forest_.findNodeForTarget(targetPath, relative, genus, ref);
}
const FunctionNode *findFunctionNode(const QStringList &path,
@@ -349,52 +350,52 @@ class QDocDatabase
/*******************************************************************/
public:
- void addPropertyFunction(PropertyNode* property,
- const QString& funcName,
+ void addPropertyFunction(PropertyNode *property,
+ const QString &funcName,
PropertyNode::FunctionRole funcRole) {
primaryTree()->addPropertyFunction(property, funcName, funcRole);
}
- void setVersion(const QString& v) { version_ = v; }
+ void setVersion(const QString &v) { version_ = v; }
QString version() const { return version_; }
- void generateTagFile(const QString& name, Generator* g);
- void readIndexes(const QStringList& indexFiles);
+ void generateTagFile(const QString &name, Generator *g);
+ void readIndexes(const QStringList &indexFiles);
void generateIndex(const QString &fileName, const QString &url, const QString &title, Generator *g);
void clearOpenNamespaces() { openNamespaces_.clear(); }
- void insertOpenNamespace(const QString& path) { openNamespaces_.insert(path); }
+ void insertOpenNamespace(const QString &path) { openNamespaces_.insert(path); }
void setShowInternal(bool value) { showInternal_ = value; }
void setSingleExec(bool value) { singleExec_ = value; }
void processForest();
// Try to make this function private.
QDocForest& forest() { return forest_; }
- NamespaceNode* primaryTreeRoot() { return forest_.primaryTreeRoot(); }
- void newPrimaryTree(const QString& module) { forest_.newPrimaryTree(module); }
- void setPrimaryTree(const QString& t) { forest_.setPrimaryTree(t); }
- NamespaceNode* newIndexTree(const QString& module) { return forest_.newIndexTree(module); }
- const QVector<Tree*>& searchOrder() { return forest_.searchOrder(); }
- void setLocalSearch() { forest_.searchOrder_ = QVector<Tree*>(1, primaryTree()); }
- void setSearchOrder(const QVector<Tree*>& searchOrder) { forest_.searchOrder_ = searchOrder; }
- void setSearchOrder(QStringList& t) { forest_.setSearchOrder(t); }
- void mergeCollections(Node::NodeType type, CNMap& cnm, const Node* relative);
- void mergeCollections(CollectionNode* c);
+ NamespaceNode *primaryTreeRoot() { return forest_.primaryTreeRoot(); }
+ void newPrimaryTree(const QString &module) { forest_.newPrimaryTree(module); }
+ void setPrimaryTree(const QString &t) { forest_.setPrimaryTree(t); }
+ NamespaceNode *newIndexTree(const QString &module) { return forest_.newIndexTree(module); }
+ const QVector<Tree *> &searchOrder() { return forest_.searchOrder(); }
+ void setLocalSearch() { forest_.searchOrder_ = QVector<Tree *>(1, primaryTree()); }
+ void setSearchOrder(const QVector<Tree *> &searchOrder) { forest_.searchOrder_ = searchOrder; }
+ void setSearchOrder(QStringList &t) { forest_.setSearchOrder(t); }
+ void mergeCollections(Node::NodeType type, CNMap &cnm, const Node *relative);
+ void mergeCollections(CollectionNode *c);
void clearSearchOrder() { forest_.clearSearchOrder(); }
- void incrementLinkCount(const Node* t) { t->tree()->incrementLinkCount(); }
+ void incrementLinkCount(const Node *t) { t->tree()->incrementLinkCount(); }
void clearLinkCounts() { forest_.clearLinkCounts(); }
- void printLinkCounts(const QString& t) { forest_.printLinkCounts(t); }
- QString getLinkCounts(QStringList& strings, QVector<int>& counts) {
+ void printLinkCounts(const QString &t) { forest_.printLinkCounts(t); }
+ QString getLinkCounts(QStringList &strings, QVector<int> &counts) {
return forest_.getLinkCounts(strings, counts);
}
- QString getNewLinkTarget(const Node* locNode,
- const Node* t,
- const QString& fileName,
- QString& text,
+ QString getNewLinkTarget(const Node *locNode,
+ const Node *t,
+ const QString &fileName,
+ QString &text,
bool broken = false) {
return primaryTree()->getNewLinkTarget(locNode, t, fileName, text, broken);
}
- TargetList* getTargetList(const QString& t) { return primaryTree()->getTargetList(t); }
+ TargetList* getTargetList(const QString &t) { return primaryTree()->getTargetList(t); }
QStringList getTargetListKeys() { return primaryTree()->getTargetListKeys(); }
QStringList keys() { return forest_.keys(); }
void resolveNamespaces();
@@ -404,50 +405,50 @@ class QDocDatabase
private:
friend class Tree;
- const Node* findNode(const QStringList& path,
- const Node* relative,
+ const Node *findNode(const QStringList &path,
+ const Node *relative,
int findFlags,
Node::Genus genus) {
return forest_.findNode(path, relative, findFlags, genus);
}
void processForest(void (QDocDatabase::*) (Aggregate*));
- bool isLoaded(const QString& t) { return forest_.isLoaded(t); }
+ bool isLoaded(const QString &t) { return forest_.isLoaded(t); }
static void initializeDB();
private:
QDocDatabase();
- QDocDatabase(QDocDatabase const& ) : showInternal_(false), forest_(this) { }
- QDocDatabase& operator=(QDocDatabase const& );
+ QDocDatabase(QDocDatabase const &) : showInternal_(false), forest_(this) { }
+ QDocDatabase& operator=(QDocDatabase const &);
public:
- static bool debug;
- Tree* primaryTree() { return forest_.primaryTree(); }
+ static bool debug;
+ Tree *primaryTree() { return forest_.primaryTree(); }
private:
- static QDocDatabase* qdocDB_;
- static NodeMap typeNodeMap_;
- static NodeMultiMap obsoleteClasses_;
- static NodeMultiMap classesWithObsoleteMembers_;
- static NodeMultiMap obsoleteQmlTypes_;
- static NodeMultiMap qmlTypesWithObsoleteMembers_;
- static NodeMultiMap cppClasses_;
- static NodeMultiMap qmlBasicTypes_;
- static NodeMultiMap qmlTypes_;
- static NodeMultiMap examples_;
- static NodeMapMap newClassMaps_;
- static NodeMapMap newQmlTypeMaps_;
- static NodeMultiMapMap newSinceMaps_;
-
- bool showInternal_;
- bool singleExec_;
- QString version_;
- QDocForest forest_;
-
- NodeMultiMap namespaceIndex_;
- NodeMultiMap attributions_;
- NodeMapMap functionIndex_;
- TextToNodeMap legaleseTexts_;
- QSet<QString> openNamespaces_;
+ static QDocDatabase *qdocDB_;
+ static NodeMap typeNodeMap_;
+ static NodeMultiMap obsoleteClasses_;
+ static NodeMultiMap classesWithObsoleteMembers_;
+ static NodeMultiMap obsoleteQmlTypes_;
+ static NodeMultiMap qmlTypesWithObsoleteMembers_;
+ static NodeMultiMap cppClasses_;
+ static NodeMultiMap qmlBasicTypes_;
+ static NodeMultiMap qmlTypes_;
+ static NodeMultiMap examples_;
+ static NodeMapMap newClassMaps_;
+ static NodeMapMap newQmlTypeMaps_;
+ static NodeMultiMapMap newSinceMaps_;
+
+ bool showInternal_;
+ bool singleExec_;
+ QString version_;
+ QDocForest forest_;
+
+ NodeMultiMap namespaceIndex_;
+ NodeMultiMap attributions_;
+ NodeMapMap functionIndex_;
+ TextToNodeMap legaleseTexts_;
+ QSet<QString> openNamespaces_;
};
QT_END_NAMESPACE
diff --git a/src/qdoc/qdocglobals.cpp b/src/qdoc/qdocglobals.cpp
deleted file mode 100644
index 2e1e084ed..000000000
--- a/src/qdoc/qdocglobals.cpp
+++ /dev/null
@@ -1,172 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdocglobals.h"
-
-QDocGlobals::QDocGlobals()
-{
-}
-
-bool QDocGlobals::highlighting()
-{
- return m_highlighting;
-}
-
-void QDocGlobals::enableHighlighting(bool value)
-{
- m_highlighting = value;
-}
-
-bool QDocGlobals::showInternal()
-{
- return m_showInternal;
-}
-
-void QDocGlobals::setShowInternal(bool value)
-{
- m_showInternal = value;
-}
-
-bool QDocGlobals::singleExec()
-{
- return m_singleExec;
-}
-void QDocGlobals::setSingleExec(bool value)
-{
- m_singleExec = value;
-}
-
-bool QDocGlobals::writeQaPages()
-{
- return m_writeQaPages;
-}
-void QDocGlobals::setWriteQaPages(bool value)
-{
- m_writeQaPages = value;
-}
-
-bool QDocGlobals::redirectDocumentationToDevNull()
-{
- return m_redirectDocumentationToDevNull;
-}
-
-void QDocGlobals::setRedirectDocumentationToDevNull(bool value)
-{
- m_redirectDocumentationToDevNull = value;
-}
-
-bool QDocGlobals::noLinkErrors()
-{
- return m_noLinkErrors;
-}
-
-void QDocGlobals::setNoLinkErrors(bool value)
-{
- m_noLinkErrors = value;
-}
-
-bool QDocGlobals::autolinkErrors()
-{
- return m_autolinkErrors;
-}
-
-void QDocGlobals::setAutolinkErrors(bool value)
-{
- m_autolinkErrors = value;
-}
-
-bool QDocGlobals::obsoleteLinks()
-{
- return m_obsoleteLinks;
-}
-
-void QDocGlobals::setObsoleteLinks(bool value)
-{
- m_obsoleteLinks = value;
-}
-
-QStringList QDocGlobals::defines()
-{
- return m_defines;
-}
-
-void QDocGlobals::addDefine(const QStringList &valueList)
-{
- m_defines += valueList;
-}
-
-QStringList QDocGlobals::includesPaths()
-{
- return m_includesPaths;
-}
-
-void QDocGlobals::addIncludePath(const QString &flag, const QString &path)
-{
- QString includePath = flag + path;
- m_includesPaths << includePath;
-}
-
-QStringList &QDocGlobals::dependModules()
-{
- return m_dependModules;
-}
-
-QStringList QDocGlobals::indexDirs()
-{
- return m_indexDirs;
-}
-
-void QDocGlobals::appendToIndexDirs(const QString &path)
-{
- m_indexDirs += path;
-}
-
-QString QDocGlobals::currentDir()
-{
- return m_currentDir;
-}
-
-void QDocGlobals::setCurrentDir(const QString &path)
-{
- m_currentDir = path;
-}
-
-QString QDocGlobals::previousCurrentDir()
-{
- return m_previousCurrentDir;
-}
-
-void QDocGlobals::setPreviousCurrentDir(const QString &path)
-{
- m_previousCurrentDir = path;
-}
-
-QHash<QString, QString> &QDocGlobals::defaults()
-{
- return m_defaults;
-}
diff --git a/src/qdoc/qdocglobals.h b/src/qdoc/qdocglobals.h
deleted file mode 100644
index a29e9f0b0..000000000
--- a/src/qdoc/qdocglobals.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDOCGLOBALS_H
-#define QDOCGLOBALS_H
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qhash.h>
-#include <QtCore/qtranslator.h>
-
-QT_BEGIN_NAMESPACE
-class QDocGlobals
-{
-public:
- QDocGlobals();
-
- bool highlighting();
- void enableHighlighting(bool value);
-
- bool showInternal();
- void setShowInternal(bool value);
-
- bool singleExec();
- void setSingleExec(bool value);
-
- bool writeQaPages();
- void setWriteQaPages(bool value);
-
- bool redirectDocumentationToDevNull();
- void setRedirectDocumentationToDevNull(bool value);
-
- bool noLinkErrors();
- void setNoLinkErrors(bool value);
-
- bool autolinkErrors();
- void setAutolinkErrors(bool value);
-
- bool obsoleteLinks();
- void setObsoleteLinks(bool value);
-
- QStringList defines();
- void addDefine(const QStringList &valueList);
-
- QStringList includesPaths();
- void addIncludePath(const QString &flag, const QString &path);
-
- QStringList &dependModules();
-
- QStringList indexDirs();
- void appendToIndexDirs(const QString &path);
-
- QString currentDir();
- void setCurrentDir(const QString &path);
-
- QString previousCurrentDir();
- void setPreviousCurrentDir(const QString &path);
-
- QHash<QString, QString> &defaults();
-
-private:
- bool m_highlighting = false;
- bool m_showInternal = false;
- bool m_singleExec = false;
- bool m_writeQaPages = false;
- bool m_redirectDocumentationToDevNull = false;
- bool m_noLinkErrors = false;
- bool m_autolinkErrors = false;
- bool m_obsoleteLinks = false;
-
- QStringList m_defines;
- QStringList m_includesPaths;
- QStringList m_dependModules;
- QStringList m_indexDirs;
- QString m_currentDir;
- QString m_previousCurrentDir;
- QHash<QString,QString> m_defaults;
-};
-
-QT_END_NAMESPACE
-
-#endif // QDOCGLOBALS_H
diff --git a/src/qdoc/qdocindexfiles.cpp b/src/qdoc/qdocindexfiles.cpp
index a9f996a0f..9ea7d9f86 100644
--- a/src/qdoc/qdocindexfiles.cpp
+++ b/src/qdoc/qdocindexfiles.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -26,15 +26,17 @@
**
****************************************************************************/
-#include "qxmlstream.h"
#include "qdocindexfiles.h"
-#include "qdoctagfiles.h"
-#include "config.h"
-#include "qdocdatabase.h"
-#include "location.h"
+
#include "atom.h"
+#include "config.h"
#include "generator.h"
-#include <qdebug.h>
+#include "location.h"
+#include "qdocdatabase.h"
+#include "qdoctagfiles.h"
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qxmlstream.h>
#include <algorithm>
@@ -104,12 +106,12 @@ void QDocIndexFiles::destroyQDocIndexFiles()
/*!
Reads and parses the list of index files in \a indexFiles.
*/
-void QDocIndexFiles::readIndexes(const QStringList& indexFiles)
+void QDocIndexFiles::readIndexes(const QStringList &indexFiles)
{
- foreach (const QString& indexFile, indexFiles) {
- QString msg = "Loading index file: " + indexFile;
+ for (const QString &file : indexFiles) {
+ QString msg = "Loading index file: " + file;
Location::logToStdErr(msg);
- readIndexFile(indexFile);
+ readIndexFile(file);
}
}
@@ -118,7 +120,7 @@ static bool readingRoot = true;
/*!
Reads and parses the index file at \a path.
*/
-void QDocIndexFiles::readIndexFile(const QString& path)
+void QDocIndexFiles::readIndexFile(const QString &path)
{
QFile file(path);
if (!file.open(QFile::ReadOnly)) {
@@ -154,7 +156,7 @@ void QDocIndexFiles::readIndexFile(const QString& path)
QString indexTitle = attrs.value(QLatin1String("indexTitle")).toString();
basesList_.clear();
- NamespaceNode* root = qdb_->newIndexTree(project_);
+ NamespaceNode *root = qdb_->newIndexTree(project_);
root->tree()->setIndexTitle(indexTitle);
// Scan all elements in the XML file, constructing a map that contains
@@ -174,22 +176,22 @@ void QDocIndexFiles::readIndexFile(const QString& path)
appropriate node(s).
*/
void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
- Node* current,
- const QString& indexUrl)
+ Node *current,
+ const QString &indexUrl)
{
QXmlStreamAttributes attributes = reader.attributes();
QStringRef elementName = reader.name();
QString name = attributes.value(QLatin1String("name")).toString();
QString href = attributes.value(QLatin1String("href")).toString();
- Node* node;
+ Node *node;
Location location;
- Aggregate* parent = nullptr;
+ Aggregate *parent = nullptr;
bool hasReadChildren = false;
if (current->isAggregate())
- parent = static_cast<Aggregate*>(current);
+ parent = static_cast<Aggregate *>(current);
QString filePath;
int lineNo = 0;
@@ -198,7 +200,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
lineNo = attributes.value("lineno").toInt();
}
if (elementName == QLatin1String("namespace")) {
- NamespaceNode* ns = new NamespaceNode(parent, name);
+ NamespaceNode *ns = new NamespaceNode(parent, name);
node = ns;
if (!indexUrl.isEmpty())
location = Location(indexUrl + QLatin1Char('/') + name.toLower() + ".html");
@@ -217,7 +219,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
if (attributes.hasAttribute(QLatin1String("bases"))) {
QString bases = attributes.value(QLatin1String("bases")).toString();
if (!bases.isEmpty())
- basesList_.append(QPair<ClassNode*,QString>(static_cast<ClassNode*>(node), bases));
+ basesList_.append(QPair<ClassNode *, QString>(static_cast<ClassNode *>(node), bases));
}
if (!indexUrl.isEmpty())
location = Location(indexUrl + QLatin1Char('/') + name.toLower() + ".html");
@@ -238,7 +240,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
else if (!indexUrl.isNull())
location = Location(name);
} else if (elementName == QLatin1String("qmlclass")) {
- QmlTypeNode* qcn = new QmlTypeNode(parent, name);
+ QmlTypeNode *qcn = new QmlTypeNode(parent, name);
qcn->setTitle(attributes.value(QLatin1String("title")).toString());
QString logicalModuleName = attributes.value(QLatin1String("qml-module-name")).toString();
if (!logicalModuleName.isEmpty())
@@ -259,7 +261,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
location = Location(name);
node = qcn;
} else if (elementName == QLatin1String("jstype")) {
- QmlTypeNode* qcn = new QmlTypeNode(parent, name);
+ QmlTypeNode *qcn = new QmlTypeNode(parent, name);
qcn->setGenus(Node::JS);
qcn->setTitle(attributes.value(QLatin1String("title")).toString());
QString logicalModuleName = attributes.value(QLatin1String("js-module-name")).toString();
@@ -281,7 +283,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
location = Location(name);
node = qcn;
} else if (elementName == QLatin1String("qmlbasictype")) {
- QmlBasicTypeNode* qbtn = new QmlBasicTypeNode(parent, name);
+ QmlBasicTypeNode *qbtn = new QmlBasicTypeNode(parent, name);
qbtn->setTitle(attributes.value(QLatin1String("title")).toString());
if (attributes.hasAttribute(QLatin1String("location")))
name = attributes.value("location").toString();
@@ -291,7 +293,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
location = Location(name);
node = qbtn;
} else if (elementName == QLatin1String("jsbasictype")) {
- QmlBasicTypeNode* qbtn = new QmlBasicTypeNode(parent, name);
+ QmlBasicTypeNode *qbtn = new QmlBasicTypeNode(parent, name);
qbtn->setGenus(Node::JS);
qbtn->setTitle(attributes.value(QLatin1String("title")).toString());
if (attributes.hasAttribute(QLatin1String("location")))
@@ -309,7 +311,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
bool readonly = false;
if (attributes.value(QLatin1String("writable")) == QLatin1String("false"))
readonly = true;
- QmlPropertyNode* qpn = new QmlPropertyNode(parent, name, type, attached);
+ QmlPropertyNode *qpn = new QmlPropertyNode(parent, name, type, attached);
qpn->markReadOnly(readonly);
node = qpn;
} else if (elementName == QLatin1String("jsproperty")) {
@@ -320,19 +322,19 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
bool readonly = false;
if (attributes.value(QLatin1String("writable")) == QLatin1String("false"))
readonly = true;
- QmlPropertyNode* qpn = new QmlPropertyNode(parent, name, type, attached);
+ QmlPropertyNode *qpn = new QmlPropertyNode(parent, name, type, attached);
qpn->setGenus(Node::JS);
qpn->markReadOnly(readonly);
node = qpn;
} else if (elementName == QLatin1String("group")) {
- CollectionNode* cn = qdb_->addGroup(name);
+ CollectionNode *cn = qdb_->addGroup(name);
cn->setTitle(attributes.value(QLatin1String("title")).toString());
cn->setSubtitle(attributes.value(QLatin1String("subtitle")).toString());
if (attributes.value(QLatin1String("seen")) == QLatin1String("true"))
cn->markSeen();
node = cn;
} else if (elementName == QLatin1String("module")) {
- CollectionNode* cn = qdb_->addModule(name);
+ CollectionNode *cn = qdb_->addModule(name);
cn->setTitle(attributes.value(QLatin1String("title")).toString());
cn->setSubtitle(attributes.value(QLatin1String("subtitle")).toString());
if (attributes.value(QLatin1String("seen")) == QLatin1String("true"))
@@ -340,7 +342,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
node = cn;
} else if (elementName == QLatin1String("qmlmodule")) {
QString t = attributes.value(QLatin1String("qml-module-name")).toString();
- CollectionNode* cn = qdb_->addQmlModule(t);
+ CollectionNode *cn = qdb_->addQmlModule(t);
QStringList info;
info << t << attributes.value(QLatin1String("qml-module-version")).toString();
cn->setLogicalModuleInfo(info);
@@ -351,7 +353,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
node = cn;
} else if (elementName == QLatin1String("jsmodule")) {
QString t = attributes.value(QLatin1String("js-module-name")).toString();
- CollectionNode* cn = qdb_->addJsModule(t);
+ CollectionNode *cn = qdb_->addJsModule(t);
QStringList info;
info << t << attributes.value(QLatin1String("js-module-version")).toString();
cn->setLogicalModuleInfo(info);
@@ -386,7 +388,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
goto done;
if (current && current->isExample()) {
- ExampleNode* en = static_cast<ExampleNode *>(current);
+ ExampleNode *en = static_cast<ExampleNode *>(current);
if (subtype == QDocAttrFile) {
en->appendFile(name);
goto done;
@@ -396,7 +398,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
goto done;
}
}
- PageNode* pn = nullptr;
+ PageNode *pn = nullptr;
if (subtype == QDocAttrExample)
pn = new ExampleNode(parent, name);
else if (subtype == QDocAttrExternalPage)
@@ -416,7 +418,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
node = pn;
} else if (elementName == QLatin1String("enum")) {
- EnumNode* enumNode = new EnumNode(parent, name);
+ EnumNode *enumNode = new EnumNode(parent, name);
if (!indexUrl.isEmpty())
location = Location(indexUrl + QLatin1Char('/') + parent->name().toLower() + ".html");
@@ -464,7 +466,7 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
metaness = FunctionNode::getMetaness(t);
if (attributes.value(QLatin1String("attached")) == QLatin1String("true"))
attached = true;
- FunctionNode* fn = new FunctionNode(metaness, parent, name, attached);
+ FunctionNode *fn = new FunctionNode(metaness, parent, name, attached);
if (fn->isCppNode()) {
fn->setReturnType(attributes.value(QLatin1String("type")).toString());
fn->setVirtualness(attributes.value(QLatin1String("virtual")).toString());
@@ -606,8 +608,8 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader,
QString groupsAttr = attributes.value(QLatin1String("groups")).toString();
if (!groupsAttr.isEmpty()) {
- QStringList groupNames = groupsAttr.split(QLatin1Char(','));
- foreach (const QString &name, groupNames) {
+ const QStringList groupNames = groupsAttr.split(QLatin1Char(','));
+ for (const auto &name : groupNames) {
qdb_->addToGroup(name, node);
}
}
@@ -688,14 +690,14 @@ void QDocIndexFiles::insertTarget(TargetRec::TargetType type,
*/
void QDocIndexFiles::resolveIndex()
{
- QPair<ClassNode*,QString> pair;
- foreach (pair, basesList_) {
- QStringList bases = pair.second.split(QLatin1Char(','));
- foreach (const QString& base, bases) {
+ QPair<ClassNode *, QString> pair;
+ for (const auto &pair : qAsConst(basesList_)) {
+ const QStringList bases = pair.second.split(QLatin1Char(','));
+ for (const auto &base : bases) {
QStringList basePath = base.split(QString("::"));
- Node* n = qdb_->findClassNode(basePath);
+ Node *n = qdb_->findClassNode(basePath);
if (n)
- pair.first->addResolvedBaseClass(Node::Public, static_cast<ClassNode*>(n));
+ pair.first->addResolvedBaseClass(Node::Public, static_cast<ClassNode *>(n));
else
pair.first->addUnresolvedBaseClass(Node::Public, basePath, QString());
}
@@ -910,7 +912,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
else
href = node->name();
if (node->isQmlNode() || node->isJsNode()) {
- Aggregate* p = node->parent();
+ Aggregate *p = node->parent();
if (p && (p->isQmlType() || p->isJsType()) && p->isAbstract())
href.clear();
}
@@ -923,7 +925,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
if (node->isAbstract())
writer.writeAttribute("abstract", "true");
}
- const Location& declLocation = node->declLocation();
+ const Location &declLocation = node->declLocation();
if (!declLocation.fileName().isEmpty())
writer.writeAttribute("location", declLocation.fileName());
if (!declLocation.filePath().isEmpty()) {
@@ -947,11 +949,11 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
case Node::Union:
{
// Classes contain information about their base classes.
- const ClassNode* classNode = static_cast<const ClassNode*>(node);
- QList<RelatedClass> bases = classNode->baseClasses();
+ const ClassNode *classNode = static_cast<const ClassNode *>(node);
+ const QList<RelatedClass> bases = classNode->baseClasses();
QSet<QString> baseStrings;
- foreach (const RelatedClass& related, bases) {
- ClassNode* n = related.node_;
+ for (const auto &related : bases) {
+ ClassNode *n = related.node_;
if (n)
baseStrings.insert(n->fullName());
else if (!related.path_.isEmpty())
@@ -959,7 +961,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
}
if (!baseStrings.isEmpty())
{
- QStringList baseStringsAsList = baseStrings.toList();
+ QStringList baseStringsAsList = baseStrings.values();
baseStringsAsList.sort();
writer.writeAttribute("bases", baseStringsAsList.join(QLatin1Char(',')));
}
@@ -973,7 +975,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
break;
case Node::HeaderFile:
{
- const HeaderNode* hn = static_cast<const HeaderNode*>(node);
+ const HeaderNode *hn = static_cast<const HeaderNode *>(node);
if (!hn->physicalModuleName().isEmpty())
writer.writeAttribute("module", hn->physicalModuleName());
if (!hn->groupNames().isEmpty())
@@ -987,7 +989,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
break;
case Node::Namespace:
{
- const NamespaceNode* ns = static_cast<const NamespaceNode*>(node);
+ const NamespaceNode *ns = static_cast<const NamespaceNode *>(node);
if (!ns->physicalModuleName().isEmpty())
writer.writeAttribute("module", ns->physicalModuleName());
if (!ns->groupNames().isEmpty())
@@ -999,7 +1001,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
case Node::JsType:
case Node::QmlType:
{
- const QmlTypeNode* qcn = static_cast<const QmlTypeNode*>(node);
+ const QmlTypeNode *qcn = static_cast<const QmlTypeNode *>(node);
writer.writeAttribute("title", qcn->title());
writer.writeAttribute("fulltitle", qcn->fullTitle());
writer.writeAttribute("subtitle", qcn->subtitle());
@@ -1036,7 +1038,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
writer.writeAttribute("subtype", "page");
writeModuleName = true;
}
- const PageNode* pn = static_cast<const PageNode*>(node);
+ const PageNode *pn = static_cast<const PageNode *>(node);
writer.writeAttribute("title", pn->title());
writer.writeAttribute("fulltitle", pn->fullTitle());
writer.writeAttribute("subtitle", pn->subtitle());
@@ -1050,7 +1052,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
break;
case Node::Group:
{
- const CollectionNode* cn = static_cast<const CollectionNode*>(node);
+ const CollectionNode *cn = static_cast<const CollectionNode *>(node);
writer.writeAttribute("seen", cn->wasSeen() ? "true" : "false");
writer.writeAttribute("title", cn->title());
if (!cn->subtitle().isEmpty())
@@ -1065,7 +1067,8 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
*/
if (!cn->members().isEmpty()) {
QStringList names;
- foreach (const Node* member, cn->members())
+ const auto &members = cn->members();
+ for (const Node *member : members)
names.append(member->name());
writer.writeAttribute("members", names.join(QLatin1Char(',')));
}
@@ -1075,7 +1078,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
break;
case Node::Module:
{
- const CollectionNode* cn = static_cast<const CollectionNode*>(node);
+ const CollectionNode *cn = static_cast<const CollectionNode *>(node);
writer.writeAttribute("seen", cn->wasSeen() ? "true" : "false");
writer.writeAttribute("title", cn->title());
if (!cn->subtitle().isEmpty())
@@ -1090,7 +1093,8 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
*/
if (!cn->members().isEmpty()) {
QStringList names;
- foreach (const Node* member, cn->members())
+ const auto &members = cn->members();
+ for (const Node *member : members)
names.append(member->name());
writer.writeAttribute("members", names.join(QLatin1Char(',')));
}
@@ -1101,7 +1105,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
case Node::JsModule:
case Node::QmlModule:
{
- const CollectionNode* cn = static_cast<const CollectionNode*>(node);
+ const CollectionNode *cn = static_cast<const CollectionNode *>(node);
writer.writeAttribute("seen", cn->wasSeen() ? "true" : "false");
writer.writeAttribute("title", cn->title());
if (!cn->subtitle().isEmpty())
@@ -1116,7 +1120,8 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
*/
if (!cn->members().isEmpty()) {
QStringList names;
- foreach (const Node* member, cn->members())
+ const auto &members = cn->members();
+ for (const Node *member : members)
names.append(member->name());
writer.writeAttribute("members", names.join(QLatin1Char(',')));
}
@@ -1127,7 +1132,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
case Node::JsProperty:
case Node::QmlProperty:
{
- QmlPropertyNode* qpn = static_cast<QmlPropertyNode*>(node);
+ QmlPropertyNode *qpn = static_cast<QmlPropertyNode *>(node);
writer.writeAttribute("type", qpn->dataType());
writer.writeAttribute("attached", qpn->isAttached() ? "true" : "false");
writer.writeAttribute("writable", qpn->isWritable() ? "true" : "false");
@@ -1137,37 +1142,41 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
break;
case Node::Property:
{
- const PropertyNode* propertyNode = static_cast<const PropertyNode*>(node);
+ const PropertyNode *propertyNode = static_cast<const PropertyNode *>(node);
writer.writeAttribute("type", propertyNode->dataType());
if (!brief.isEmpty())
writer.writeAttribute("brief", brief);
- foreach (const Node* fnNode, propertyNode->getters()) {
+ const auto &getters = propertyNode->getters();
+ for (const auto *fnNode : getters) {
if (fnNode) {
- const FunctionNode* functionNode = static_cast<const FunctionNode*>(fnNode);
+ const FunctionNode *functionNode = static_cast<const FunctionNode *>(fnNode);
writer.writeStartElement("getter");
writer.writeAttribute("name", functionNode->name());
writer.writeEndElement(); // getter
}
}
- foreach (const Node* fnNode, propertyNode->setters()) {
+ const auto &setters = propertyNode->setters();
+ for (const auto *fnNode : setters) {
if (fnNode) {
- const FunctionNode* functionNode = static_cast<const FunctionNode*>(fnNode);
+ const FunctionNode *functionNode = static_cast<const FunctionNode *>(fnNode);
writer.writeStartElement("setter");
writer.writeAttribute("name", functionNode->name());
writer.writeEndElement(); // setter
}
}
- foreach (const Node* fnNode, propertyNode->resetters()) {
+ const auto &resetters = propertyNode->resetters();
+ for (const auto *fnNode : resetters) {
if (fnNode) {
- const FunctionNode* functionNode = static_cast<const FunctionNode*>(fnNode);
+ const FunctionNode *functionNode = static_cast<const FunctionNode *>(fnNode);
writer.writeStartElement("resetter");
writer.writeAttribute("name", functionNode->name());
writer.writeEndElement(); // resetter
}
}
- foreach (const Node* fnNode, propertyNode->notifiers()) {
+ const auto &notifiers = propertyNode->notifiers();
+ for (const auto *fnNode : notifiers) {
if (fnNode) {
- const FunctionNode* functionNode = static_cast<const FunctionNode*>(fnNode);
+ const FunctionNode *functionNode = static_cast<const FunctionNode *>(fnNode);
writer.writeStartElement("notifier");
writer.writeAttribute("name", functionNode->name());
writer.writeEndElement(); // notifier
@@ -1177,7 +1186,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
break;
case Node::Variable:
{
- const VariableNode* variableNode = static_cast<const VariableNode*>(node);
+ const VariableNode *variableNode = static_cast<const VariableNode *>(node);
writer.writeAttribute("type", variableNode->dataType());
writer.writeAttribute("static", variableNode->isStatic() ? "true" : "false");
if (!brief.isEmpty())
@@ -1186,10 +1195,11 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
break;
case Node::Enum:
{
- const EnumNode* enumNode = static_cast<const EnumNode*>(node);
+ const EnumNode *enumNode = static_cast<const EnumNode *>(node);
if (enumNode->flagsType())
writer.writeAttribute("typedef",enumNode->flagsType()->fullDocumentName());
- foreach (const EnumItem& item, enumNode->items()) {
+ const auto &items = enumNode->items();
+ for (const auto &item : items) {
writer.writeStartElement("value");
writer.writeAttribute("name", item.name());
writer.writeAttribute("value", item.value());
@@ -1199,7 +1209,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
break;
case Node::Typedef:
{
- const TypedefNode* typedefNode = static_cast<const TypedefNode*>(node);
+ const TypedefNode *typedefNode = static_cast<const TypedefNode *>(node);
if (typedefNode->associatedEnum())
writer.writeAttribute("enum",typedefNode->associatedEnum()->fullDocumentName());
}
@@ -1225,7 +1235,8 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
bool external = false;
if (node->isExternalPage())
external = true;
- foreach (const Atom* target, node->doc().targets()) {
+ const auto &targets = node->doc().targets();
+ for (const Atom *target : targets) {
QString title = target->string();
QString name = Doc::canonicalTitle(title);
writer.writeStartElement("target");
@@ -1239,7 +1250,8 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
}
}
if (node->doc().hasKeywords()) {
- foreach (const Atom* keyword, node->doc().keywords()) {
+ const auto &keywords = node->doc().keywords();
+ for (const Atom *keyword : keywords) {
QString title = keyword->string();
QString name = Doc::canonicalTitle(title);
writer.writeStartElement("keyword");
@@ -1260,7 +1272,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
if (node->isPageNode() || node->isCollectionNode()) {
if (node->doc().hasTableOfContents()) {
for (int i = 0; i < node->doc().tableOfContents().size(); ++i) {
- Atom* item = node->doc().tableOfContents()[i];
+ Atom *item = node->doc().tableOfContents()[i];
int level = node->doc().tableOfContentsLevels()[i];
QString title = Text::sectionHeading(item).toString();
writer.writeStartElement("contents");
@@ -1275,7 +1287,8 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
// files/images, as the generator produces them separately
if (node->isExample() && gen_->format() != QLatin1String("WebXML")) {
const ExampleNode *en = static_cast<const ExampleNode *>(node);
- foreach (const QString &file, en->files()) {
+ const auto &files = en->files();
+ for (const QString &file : files) {
writer.writeStartElement("page");
writer.writeAttribute("name", file);
QString href = gen_->linkForExampleFile(file, en);
@@ -1287,7 +1300,8 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
writer.writeAttribute("subtitle", file);
writer.writeEndElement(); // page
}
- foreach (const QString &file, en->images()) {
+ const auto &images = en->images();
+ for (const QString &file : images) {
writer.writeStartElement("page");
writer.writeAttribute("name", file);
QString href = gen_->linkForExampleFile(file, en);
@@ -1368,8 +1382,8 @@ void QDocIndexFiles::generateFunctionSection(QXmlStreamWriter &writer, FunctionN
writer.writeAttribute("refness", QString::number(2));
if (fn->hasAssociatedProperties()) {
QStringList associatedProperties;
- foreach (Node *n, fn->associatedProperties()) {
- associatedProperties << n->name();
+ for (const auto *node : qAsConst(fn->associatedProperties())) {
+ associatedProperties << node->name();
}
associatedProperties.sort();
writer.writeAttribute("associated-property", associatedProperties.join(QLatin1Char(',')));
@@ -1462,8 +1476,9 @@ void QDocIndexFiles::generateIndexSections(QXmlStreamWriter &writer, Node *node,
Aggregate *aggregate = static_cast<Aggregate *>(node);
// First write the function children, then write the nonfunction children.
generateFunctionSections(writer, aggregate);
- foreach (Node *n, aggregate->nonfunctionList())
- generateIndexSections(writer, n, post);
+ const auto &nonFunctionList = aggregate->nonfunctionList();
+ for (auto *node : nonFunctionList)
+ generateIndexSections(writer, node, post);
}
if (node == root_) {
@@ -1475,7 +1490,7 @@ void QDocIndexFiles::generateIndexSections(QXmlStreamWriter &writer, Node *node,
create the group, module, or QML module element and add each member to
its member list.
*/
- const CNMap& groups = qdb_->groups();
+ const CNMap &groups = qdb_->groups();
if (!groups.isEmpty()) {
CNMap::ConstIterator g = groups.constBegin();
while (g != groups.constEnd()) {
@@ -1485,7 +1500,7 @@ void QDocIndexFiles::generateIndexSections(QXmlStreamWriter &writer, Node *node,
}
}
- const CNMap& modules = qdb_->modules();
+ const CNMap &modules = qdb_->modules();
if (!modules.isEmpty()) {
CNMap::ConstIterator g = modules.constBegin();
while (g != modules.constEnd()) {
@@ -1495,7 +1510,7 @@ void QDocIndexFiles::generateIndexSections(QXmlStreamWriter &writer, Node *node,
}
}
- const CNMap& qmlModules = qdb_->qmlModules();
+ const CNMap &qmlModules = qdb_->qmlModules();
if (!qmlModules.isEmpty()) {
CNMap::ConstIterator g = qmlModules.constBegin();
while (g != qmlModules.constEnd()) {
@@ -1505,7 +1520,7 @@ void QDocIndexFiles::generateIndexSections(QXmlStreamWriter &writer, Node *node,
}
}
- const CNMap& jsModules = qdb_->jsModules();
+ const CNMap &jsModules = qdb_->jsModules();
if (!jsModules.isEmpty()) {
CNMap::ConstIterator g = jsModules.constBegin();
while (g != jsModules.constEnd()) {
@@ -1527,9 +1542,9 @@ void QDocIndexFiles::generateIndexSections(QXmlStreamWriter &writer, Node *node,
\a g is used to get the Config object that contains the variables
from the module's .qdocconf file.
*/
-void QDocIndexFiles::generateIndex(const QString& fileName,
- const QString& url,
- const QString& title,
+void QDocIndexFiles::generateIndex(const QString &fileName,
+ const QString &url,
+ const QString &title,
Generator *g)
{
QFile file(fileName);
diff --git a/src/qdoc/qdocindexfiles.h b/src/qdoc/qdocindexfiles.h
index d04e0a325..a93df774a 100644
--- a/src/qdoc/qdocindexfiles.h
+++ b/src/qdoc/qdocindexfiles.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -39,6 +39,7 @@ class Generator;
class QStringList;
class QDocDatabase;
class WebXMLGenerator;
+class QXmlStreamReader;
class QXmlStreamWriter;
class QXmlStreamAttributes;
@@ -62,9 +63,9 @@ class QDocIndexFiles
QDocIndexFiles();
~QDocIndexFiles();
- void readIndexes(const QStringList& indexFiles);
- void readIndexFile(const QString& path);
- void readIndexSection(QXmlStreamReader &reader, Node* current, const QString& indexUrl);
+ void readIndexes(const QStringList &indexFiles);
+ void readIndexFile(const QString &path);
+ void readIndexSection(QXmlStreamReader &reader, Node *current, const QString &indexUrl);
void insertTarget(TargetRec::TargetType type, const QXmlStreamAttributes &attributes, Node *node);
void resolveIndex();
@@ -76,10 +77,10 @@ class QDocIndexFiles
private:
static QDocIndexFiles* qdocIndexFiles_;
- QDocDatabase* qdb_;
- Generator* gen_;
+ QDocDatabase *qdb_;
+ Generator *gen_;
QString project_;
- QVector<QPair<ClassNode*,QString> > basesList_;
+ QVector<QPair<ClassNode *, QString> > basesList_;
};
QT_END_NAMESPACE
diff --git a/src/qdoc/qdoctagfiles.cpp b/src/qdoc/qdoctagfiles.cpp
index e04f684a3..bdf001469 100644
--- a/src/qdoc/qdoctagfiles.cpp
+++ b/src/qdoc/qdoctagfiles.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -26,18 +26,19 @@
**
****************************************************************************/
-#include "node.h"
#include "qdoctagfiles.h"
-#include "qdocdatabase.h"
#include "atom.h"
#include "doc.h"
#include "htmlgenerator.h"
#include "location.h"
#include "node.h"
+#include "qdocdatabase.h"
#include "text.h"
+
+#include <QtCore/qdebug.h>
+
#include <limits.h>
-#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -47,7 +48,7 @@ QT_BEGIN_NAMESPACE
This class handles the generation of the qdoc tag file.
*/
-QDocTagFiles* QDocTagFiles::qdocTagFiles_ = nullptr;
+QDocTagFiles *QDocTagFiles::qdocTagFiles_ = nullptr;
/*!
Constructs the singleton. \a qdb is the pointer to the
@@ -71,7 +72,7 @@ QDocTagFiles::~QDocTagFiles()
Creates the singleton. Allows only one instance of the class
to be created. Returns a pointer to the singleton.
*/
-QDocTagFiles* QDocTagFiles::qdocTagFiles()
+QDocTagFiles *QDocTagFiles::qdocTagFiles()
{
if (qdocTagFiles_ == nullptr)
qdocTagFiles_ = new QDocTagFiles;
@@ -95,7 +96,8 @@ void QDocTagFiles::destroyQDocTagFiles()
*/
void QDocTagFiles::generateTagFileCompounds(QXmlStreamWriter &writer, const Aggregate *parent)
{
- foreach (const Node *node, const_cast<Aggregate *>(parent)->nonfunctionList()) {
+ const auto &nonFunctionList = const_cast<Aggregate *>(parent)->nonfunctionList();
+ for (const auto *node : nonFunctionList) {
if (!node->url().isEmpty() || node->isPrivate())
continue;
@@ -114,7 +116,7 @@ void QDocTagFiles::generateTagFileCompounds(QXmlStreamWriter &writer, const Aggr
default:
continue;
}
- const Aggregate *aggregate = static_cast<const Aggregate*>(node);
+ const Aggregate *aggregate = static_cast<const Aggregate *>(node);
QString access = "public";
if (node->isProtected())
@@ -135,10 +137,10 @@ void QDocTagFiles::generateTagFileCompounds(QXmlStreamWriter &writer, const Aggr
writer.writeTextElement("filename", gen_->fullDocumentLocation(node, false));
// Classes contain information about their base classes.
- const ClassNode* classNode = static_cast<const ClassNode*>(node);
- QList<RelatedClass> bases = classNode->baseClasses();
- foreach (const RelatedClass& related, bases) {
- ClassNode* n = related.node_;
+ const ClassNode *classNode = static_cast<const ClassNode *>(node);
+ const QList<RelatedClass> bases = classNode->baseClasses();
+ for (const auto &related : bases) {
+ ClassNode *n = related.node_;
if (n)
writer.writeTextElement("base", n->name());
}
@@ -169,7 +171,8 @@ void QDocTagFiles::generateTagFileCompounds(QXmlStreamWriter &writer, const Aggr
*/
void QDocTagFiles::generateTagFileMembers(QXmlStreamWriter &writer, const Aggregate *parent)
{
- foreach (const Node *node, parent->childNodes()) {
+ const auto &childNodes = parent->childNodes();
+ for (const auto *node : childNodes) {
if (!node->url().isEmpty())
continue;
@@ -247,7 +250,7 @@ void QDocTagFiles::generateTagFileMembers(QXmlStreamWriter &writer, const Aggreg
the type of function being described.
*/
- const FunctionNode* functionNode = static_cast<const FunctionNode*>(node);
+ const FunctionNode *functionNode = static_cast<const FunctionNode *>(node);
writer.writeAttribute("protection", access);
writer.writeAttribute("virtualness", functionNode->virtualness());
writer.writeAttribute("static", functionNode->isStatic() ? "yes" : "no");
@@ -277,7 +280,7 @@ void QDocTagFiles::generateTagFileMembers(QXmlStreamWriter &writer, const Aggreg
break;
case Node::Property:
{
- const PropertyNode* propertyNode = static_cast<const PropertyNode*>(node);
+ const PropertyNode *propertyNode = static_cast<const PropertyNode *>(node);
writer.writeAttribute("type", propertyNode->dataType());
writer.writeTextElement("name", objName);
QStringList pieces = gen_->fullDocumentLocation(node, false).split(QLatin1Char('#'));
@@ -289,7 +292,7 @@ void QDocTagFiles::generateTagFileMembers(QXmlStreamWriter &writer, const Aggreg
break;
case Node::Enum:
{
- const EnumNode* enumNode = static_cast<const EnumNode*>(node);
+ const EnumNode *enumNode = static_cast<const EnumNode *>(node);
writer.writeTextElement("name", objName);
QStringList pieces = gen_->fullDocumentLocation(node, false).split(QLatin1Char('#'));
writer.writeTextElement("anchor", pieces[1]);
@@ -308,7 +311,7 @@ void QDocTagFiles::generateTagFileMembers(QXmlStreamWriter &writer, const Aggreg
break;
case Node::Typedef:
{
- const TypedefNode* typedefNode = static_cast<const TypedefNode*>(node);
+ const TypedefNode *typedefNode = static_cast<const TypedefNode *>(node);
if (typedefNode->associatedEnum())
writer.writeAttribute("type", typedefNode->associatedEnum()->fullDocumentName());
else
@@ -332,7 +335,7 @@ void QDocTagFiles::generateTagFileMembers(QXmlStreamWriter &writer, const Aggreg
/*!
Writes a tag file named \a fileName.
*/
-void QDocTagFiles::generateTagFile(const QString& fileName, Generator* g)
+void QDocTagFiles::generateTagFile(const QString &fileName, Generator *g)
{
QFile file(fileName);
QFileInfo fileInfo(fileName);
diff --git a/src/qdoc/qdoctagfiles.h b/src/qdoc/qdoctagfiles.h
index 56d0b92f6..e1b8b5f73 100644
--- a/src/qdoc/qdoctagfiles.h
+++ b/src/qdoc/qdoctagfiles.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -29,7 +29,7 @@
#ifndef QDOCTAGFILES_H
#define QDOCTAGFILES_H
-#include "qxmlstream.h"
+#include <QtCore/qxmlstream.h>
QT_BEGIN_NAMESPACE
@@ -42,20 +42,20 @@ class QDocTagFiles
friend class QDocDatabase;
private:
- static QDocTagFiles* qdocTagFiles();
+ static QDocTagFiles *qdocTagFiles();
static void destroyQDocTagFiles();
QDocTagFiles();
~QDocTagFiles();
- void generateTagFileCompounds(QXmlStreamWriter& writer, const Aggregate* inner);
- void generateTagFileMembers(QXmlStreamWriter& writer, const Aggregate* inner);
- void generateTagFile(const QString& fileName, Generator* g);
+ void generateTagFileCompounds(QXmlStreamWriter &writer, const Aggregate *inner);
+ void generateTagFileMembers(QXmlStreamWriter &writer, const Aggregate *inner);
+ void generateTagFile(const QString &fileName, Generator *g);
private:
- static QDocTagFiles* qdocTagFiles_;
- QDocDatabase* qdb_;
- Generator* gen_;
+ static QDocTagFiles *qdocTagFiles_;
+ QDocDatabase *qdb_;
+ Generator *gen_;
};
QT_END_NAMESPACE
diff --git a/src/qdoc/qmlcodemarker.cpp b/src/qdoc/qmlcodemarker.cpp
index ce074360b..fe39e6e54 100644
--- a/src/qdoc/qmlcodemarker.cpp
+++ b/src/qdoc/qmlcodemarker.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -141,7 +141,7 @@ QString QmlCodeMarker::markedUpFullName(const Node *node, const Node *relative)
}
}
-QString QmlCodeMarker::markedUpIncludes(const QStringList& includes)
+QString QmlCodeMarker::markedUpIncludes(const QStringList &includes)
{
QString code;
@@ -154,13 +154,13 @@ QString QmlCodeMarker::markedUpIncludes(const QStringList& includes)
return addMarkUp(code, nullptr, location);
}
-QString QmlCodeMarker::functionBeginRegExp(const QString& funcName)
+QString QmlCodeMarker::functionBeginRegExp(const QString &funcName)
{
return QLatin1Char('^') + QRegExp::escape("function " + funcName) + QLatin1Char('$');
}
-QString QmlCodeMarker::functionEndRegExp(const QString& /* funcName */)
+QString QmlCodeMarker::functionEndRegExp(const QString &/* funcName */)
{
return "^\\}$";
}
diff --git a/src/qdoc/qmlcodemarker.h b/src/qdoc/qmlcodemarker.h
index c8469b78f..e28d46309 100644
--- a/src/qdoc/qmlcodemarker.h
+++ b/src/qdoc/qmlcodemarker.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -47,7 +47,7 @@ class QmlCodeMarker : public CppCodeMarker
public:
QmlCodeMarker();
- ~QmlCodeMarker();
+ ~QmlCodeMarker() override;
bool recognizeCode(const QString &code) override;
bool recognizeExtension(const QString &ext) override;
diff --git a/src/qdoc/qmlcodeparser.cpp b/src/qdoc/qmlcodeparser.cpp
index 437bcfd21..1b8688f00 100644
--- a/src/qdoc/qmlcodeparser.cpp
+++ b/src/qdoc/qmlcodeparser.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -114,7 +114,7 @@ QStringList QmlCodeParser::sourceFileNameFilter()
If it can't open the file at \a filePath, it reports an error
and returns without doing anything.
*/
-void QmlCodeParser::parseSourceFile(const Location& location, const QString& filePath)
+void QmlCodeParser::parseSourceFile(const Location &location, const QString &filePath)
{
QFile in(filePath);
currentFile_ = filePath;
@@ -147,9 +147,15 @@ void QmlCodeParser::parseSourceFile(const Location& location, const QString& fil
<< "The output is incomplete.";
}
}
- foreach (const QQmlJS::DiagnosticMessage &msg, parser->diagnosticMessages()) {
- qDebug().nospace() << qPrintable(filePath) << ':' << msg.loc.startLine
- << ": QML syntax error at col " << msg.loc.startColumn
+ const auto &messages = parser->diagnosticMessages();
+ for (const auto &msg : messages) {
+ qDebug().nospace() << qPrintable(filePath) << ':'
+#if Q_QML_PRIVATE_API_VERSION < 5
+ << msg.loc.startLine << ": QML syntax error at col "
+ << msg.loc.startColumn
+#else
+ << msg.line << ": QML syntax error at col " << msg.column
+#endif
<< ": " << qPrintable(msg.message);
}
currentFile_.clear();
@@ -162,7 +168,7 @@ static QSet<QString> topicCommands_;
/*!
Returns the set of strings representing the topic commands.
*/
-const QSet<QString>& QmlCodeParser::topicCommands()
+const QSet<QString> &QmlCodeParser::topicCommands()
{
if (topicCommands_.isEmpty()) {
topicCommands_ << COMMAND_VARIABLE
diff --git a/src/qdoc/qmlcodeparser.h b/src/qdoc/qmlcodeparser.h
index 5188867e4..85923137b 100644
--- a/src/qdoc/qmlcodeparser.h
+++ b/src/qdoc/qmlcodeparser.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -35,7 +35,8 @@
#include "codeparser.h"
-#include <qset.h>
+#include <QtCore/qset.h>
+
#ifndef QT_NO_DECLARATIVE
#include <private/qqmljsengine_p.h>
#include <private/qqmljslexer_p.h>
@@ -54,13 +55,13 @@ class QmlCodeParser : public CodeParser
public:
QmlCodeParser();
- virtual ~QmlCodeParser();
+ ~QmlCodeParser() override;
- void initializeParser(const Config& config) override;
+ void initializeParser(const Config &config) override;
void terminateParser() override;
QString language() override;
QStringList sourceFileNameFilter() override;
- void parseSourceFile(const Location& location, const QString& filePath) override;
+ void parseSourceFile(const Location &location, const QString &filePath) override;
#ifndef QT_NO_DECLARATIVE
/* Copied from src/declarative/qml/qdeclarativescriptparser.cpp */
@@ -68,7 +69,7 @@ public:
#endif
protected:
- const QSet<QString>& topicCommands();
+ const QSet<QString> &topicCommands();
private:
#ifndef QT_NO_DECLARATIVE
diff --git a/src/qdoc/qmlmarkupvisitor.cpp b/src/qdoc/qmlmarkupvisitor.cpp
index 6d0f2470b..e99bf5fc3 100644
--- a/src/qdoc/qmlmarkupvisitor.cpp
+++ b/src/qdoc/qmlmarkupvisitor.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -28,8 +28,9 @@
#include "qmlmarkupvisitor.h"
-#include <qstringlist.h>
-#include <qglobal.h>
+#include <QtCore/qglobal.h>
+#include <QtCore/qstringlist.h>
+
#ifndef QT_NO_DECLARATIVE
#include <private/qqmljsast_p.h>
#include <private/qqmljsastfwd_p.h>
@@ -89,7 +90,7 @@ static const QString slt = QLatin1String("&lt;");
static const QString sgt = QLatin1String("&gt;");
static const QString squot = QLatin1String("&quot;");
-QString QmlMarkupVisitor::protect(const QString& str)
+QString QmlMarkupVisitor::protect(const QString &str)
{
int n = str.length();
QString marked;
@@ -191,7 +192,7 @@ void QmlMarkupVisitor::addMarkedUpToken(
return;
output += QString(QLatin1String("<@%1")).arg(tagName);
- foreach (const QString &key, attributes)
+ for (const auto &key : attributes)
output += QString(QLatin1String(" %1=\"%2\"")).arg(key).arg(attributes[key]);
output += QString(QLatin1String(">%2</@%3>")).arg(protect(sourceText(location)), tagName);
cursor += location.length;
diff --git a/src/qdoc/qmlmarkupvisitor.h b/src/qdoc/qmlmarkupvisitor.h
index c752f7264..1f48722b1 100644
--- a/src/qdoc/qmlmarkupvisitor.h
+++ b/src/qdoc/qmlmarkupvisitor.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -32,7 +32,8 @@
#include "node.h"
#include "tree.h"
-#include <qstring.h>
+#include <QtCore/qstring.h>
+
#ifndef QT_NO_DECLARATIVE
#include <private/qqmljsastvisitor_p.h>
#include <private/qqmljsengine_p.h>
diff --git a/src/qdoc/qmlvisitor.cpp b/src/qdoc/qmlvisitor.cpp
index e41a544f2..c7be4b1cf 100644
--- a/src/qdoc/qmlvisitor.cpp
+++ b/src/qdoc/qmlvisitor.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -28,16 +28,17 @@
#include "qmlvisitor.h"
-#include "node.h"
+#include "codechunk.h"
#include "codeparser.h"
+#include "node.h"
#include "qdocdatabase.h"
#include "tokenizer.h"
-#include "codechunk.h"
-#include <qfileinfo.h>
-#include <qstringlist.h>
-#include <qglobal.h>
-#include <qdebug.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qglobal.h>
+#include <QtCore/qstringlist.h>
+
#ifndef QT_NO_DECLARATIVE
#include <private/qqmljsast_p.h>
#include <private/qqmljsastfwd_p.h>
@@ -80,12 +81,9 @@ QmlDocVisitor::~QmlDocVisitor()
*/
QQmlJS::AST::SourceLocation QmlDocVisitor::precedingComment(quint32 offset) const
{
- QListIterator<QQmlJS::AST::SourceLocation> it(engine->comments());
- it.toBack();
-
- while (it.hasPrevious()) {
-
- QQmlJS::AST::SourceLocation loc = it.previous();
+ const auto comments = engine->comments();
+ for (auto it = comments.rbegin(), end = comments.rend(); it != end; ++it) {
+ QQmlJS::AST::SourceLocation loc = *it;
if (loc.begin() <= lastEndOffset) {
// Return if we reach the end of the preceding structure.
@@ -112,7 +110,7 @@ QQmlJS::AST::SourceLocation QmlDocVisitor::precedingComment(quint32 offset) cons
class QmlSignatureParser
{
public:
- QmlSignatureParser(FunctionNode* func, const QString& signature, const Location& loc);
+ QmlSignatureParser(FunctionNode *func, const QString &signature, const Location &loc);
void readToken() { tok_ = tokenizer_->getToken(); }
QString lexeme() { return tokenizer_->lexeme(); }
QString previousLexeme() { return tokenizer_->previousLexeme(); }
@@ -123,13 +121,13 @@ class QmlSignatureParser
bool matchFunctionDecl();
private:
- QString signature_;
- QStringList names_;
- QString funcName_;
- Tokenizer* tokenizer_;
- int tok_;
- FunctionNode* func_;
- const Location& location_;
+ QString signature_;
+ QStringList names_;
+ QString funcName_;
+ Tokenizer *tokenizer_;
+ int tok_;
+ FunctionNode *func_;
+ const Location &location_;
};
/*!
@@ -141,7 +139,7 @@ class QmlSignatureParser
If a qdoc comment is found for \a location, true is returned.
If a comment is not found there, false is returned.
*/
-bool QmlDocVisitor::applyDocumentation(QQmlJS::AST::SourceLocation location, Node* node)
+bool QmlDocVisitor::applyDocumentation(QQmlJS::AST::SourceLocation location, Node *node)
{
QQmlJS::AST::SourceLocation loc = precedingComment(location.begin());
@@ -155,10 +153,10 @@ bool QmlDocVisitor::applyDocumentation(QQmlJS::AST::SourceLocation location, Nod
finish.setColumnNo(loc.startColumn);
Doc doc(start, finish, source.mid(1), commands_, topics_);
- const TopicList& topicsUsed = doc.topicsUsed();
+ const TopicList &topicsUsed = doc.topicsUsed();
NodeList nodes;
- Node* nodePassedIn = node;
- Aggregate* parent = nodePassedIn->parent();
+ Node *nodePassedIn = node;
+ Aggregate *parent = nodePassedIn->parent();
node->setDoc(doc);
nodes.append(node);
if (topicsUsed.size() > 0) {
@@ -178,7 +176,7 @@ bool QmlDocVisitor::applyDocumentation(QQmlJS::AST::SourceLocation location, Nod
}
else {
bool isAttached = topic.contains(QLatin1String("attached"));
- QmlPropertyNode* n = parent->hasQmlProperty(qpa.name_, isAttached);
+ QmlPropertyNode *n = parent->hasQmlProperty(qpa.name_, isAttached);
if (n == nullptr)
n = new QmlPropertyNode(parent, qpa.name_, qpa.type_, isAttached);
n->setLocation(doc.location());
@@ -197,7 +195,7 @@ bool QmlDocVisitor::applyDocumentation(QQmlJS::AST::SourceLocation location, Nod
qDebug() << " FAILED TO PARSE QML OR JS PROPERTY:" << topic << args;
} else if (topic.endsWith(QLatin1String("method"))) {
if (node->isFunction()) {
- FunctionNode* fn = static_cast<FunctionNode*>(node);
+ FunctionNode *fn = static_cast<FunctionNode *>(node);
QmlSignatureParser qsp(fn, args, doc.location());
if (topic == COMMAND_JSMETHOD || topic == COMMAND_JSATTACHEDMETHOD)
fn->changeMetaness(FunctionNode::QmlMethod, FunctionNode::JsMethod);
@@ -219,7 +217,7 @@ bool QmlDocVisitor::applyDocumentation(QQmlJS::AST::SourceLocation location, Nod
return false;
}
-QmlSignatureParser::QmlSignatureParser(FunctionNode* func, const QString& signature, const Location& loc)
+QmlSignatureParser::QmlSignatureParser(FunctionNode *func, const QString &signature, const Location &loc)
: signature_(signature), func_(func), location_(loc)
{
QByteArray latin1 = signature.toLatin1();
@@ -407,8 +405,8 @@ bool QmlSignatureParser::matchFunctionDecl()
are found, a qdoc warning is emitted and false is
returned.
*/
-bool QmlDocVisitor::splitQmlPropertyArg(const Doc& doc,
- const QString& arg,
+bool QmlDocVisitor::splitQmlPropertyArg(const Doc &doc,
+ const QString &arg,
QmlPropArgs& qpa)
{
qpa.clear();
@@ -445,10 +443,10 @@ bool QmlDocVisitor::splitQmlPropertyArg(const Doc& doc,
Applies the metacommands found in the comment.
*/
void QmlDocVisitor::applyMetacommands(QQmlJS::AST::SourceLocation,
- Node* node,
- Doc& doc)
+ Node *node,
+ Doc &doc)
{
- QDocDatabase* qdb = QDocDatabase::qdocDB();
+ QDocDatabase *qdb = QDocDatabase::qdocDB();
QSet<QString> metacommands = doc.metaCommandsUsed();
if (metacommands.count() > 0) {
metacommands.subtract(topics_);
@@ -471,7 +469,7 @@ void QmlDocVisitor::applyMetacommands(QQmlJS::AST::SourceLocation,
if (node->name() == args[0].first)
doc.location().warning(tr("%1 tries to inherit itself").arg(args[0].first));
else if (node->isQmlType() || node->isJsType()) {
- QmlTypeNode *qmlType = static_cast<QmlTypeNode*>(node);
+ QmlTypeNode *qmlType = static_cast<QmlTypeNode *>(node);
qmlType->setQmlBaseName(args[0].first);
}
}
@@ -553,7 +551,7 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiObjectDefinition *definition)
QmlTypeNode *component = nullptr;
Node *candidate = current ->findChildNode(name, Node::QML);
if (candidate != nullptr)
- component = static_cast<QmlTypeNode*>(candidate);
+ component = static_cast<QmlTypeNode *>(candidate);
else
component = new QmlTypeNode(current, name);
component->setTitle(name);
@@ -684,7 +682,7 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiPublicMember *member)
QmlTypeNode *qmlType = static_cast<QmlTypeNode *>(current);
if (qmlType) {
QString name = member->name.toString();
- QmlPropertyNode* qmlPropNode = qmlType->hasQmlProperty(name);
+ QmlPropertyNode *qmlPropNode = qmlType->hasQmlProperty(name);
if (qmlPropNode == nullptr)
qmlPropNode = new QmlPropertyNode(qmlType, name, type, false);
qmlPropNode->markReadOnly(member->isReadonlyMember);
@@ -762,24 +760,6 @@ void QmlDocVisitor::endVisit(QQmlJS::AST::FunctionDeclaration* fd)
*/
bool QmlDocVisitor::visit(QQmlJS::AST::UiScriptBinding* )
{
-#if 0
- if (nestingLevel > 1) {
- return true;
- }
- if (current->isQmlType() || current->isJsType()) {
- QString handler = sb->qualifiedId->name.toString();
- if (handler.length() > 2 && handler.startsWith("on") && handler.at(2).isUpper()) {
- QmlTypeNode* qmlType = static_cast<QmlTypeNode*>(current);
- if (qmlType) {
- FunctionNode::Metaness metaness = FunctionNode::QmSignalHandler;
- if (qmlType->isJsType())
- metaness = FunctionNode::JsSignalHandler;
- FunctionNode* qmlSH = new FunctionNode(metaness, current, handler);
- applyDocumentation(sb->firstSourceLocation(), qmlSH);
- }
- }
- }
-#endif
return true;
}
diff --git a/src/qdoc/qmlvisitor.h b/src/qdoc/qmlvisitor.h
index 4d32a6bd5..fae02c1e2 100644
--- a/src/qdoc/qmlvisitor.h
+++ b/src/qdoc/qmlvisitor.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -31,7 +31,8 @@
#include "node.h"
-#include <qstring.h>
+#include <QtCore/qstring.h>
+
#ifndef QT_NO_DECLARATIVE
#include <private/qqmljsastvisitor_p.h>
#include <private/qqmljsengine_p.h>
@@ -65,7 +66,7 @@ public:
QQmlJS::Engine *engine,
const QSet<QString> &commands,
const QSet<QString> &topics);
- virtual ~QmlDocVisitor();
+ ~QmlDocVisitor() override;
bool visit(QQmlJS::AST::UiImport *import) override;
void endVisit(QQmlJS::AST::UiImport *definition) override;
@@ -99,9 +100,9 @@ private:
QString getFullyQualifiedId(QQmlJS::AST::UiQualifiedId *id);
QQmlJS::AST::SourceLocation precedingComment(quint32 offset) const;
bool applyDocumentation(QQmlJS::AST::SourceLocation location, Node *node);
- void applyMetacommands(QQmlJS::AST::SourceLocation location, Node* node, Doc& doc);
- bool splitQmlPropertyArg(const Doc& doc,
- const QString& arg,
+ void applyMetacommands(QQmlJS::AST::SourceLocation location, Node *node, Doc &doc);
+ bool splitQmlPropertyArg(const Doc &doc,
+ const QString &arg,
QmlPropArgs& qpa);
QQmlJS::Engine *engine;
diff --git a/src/qdoc/quoter.cpp b/src/qdoc/quoter.cpp
index 408b1b5b0..b54d959e4 100644
--- a/src/qdoc/quoter.cpp
+++ b/src/qdoc/quoter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -26,12 +26,12 @@
**
****************************************************************************/
-#include <qfileinfo.h>
-#include <qregexp.h>
-#include <qdebug.h>
-
#include "quoter.h"
+#include <QtCore/qdebug.h>
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qregexp.h>
+
QT_BEGIN_NAMESPACE
QHash<QString,QString> Quoter::commentHash;
@@ -77,26 +77,26 @@ QStringList Quoter::splitLines(const QString &line)
Transforms 'int x = 3 + 4' into 'int x=3+4'. A white space is kept
between 'int' and 'x' because it is meaningful in C++.
*/
-static void trimWhiteSpace( QString& str )
+static void trimWhiteSpace(QString &str)
{
enum { Normal, MetAlnum, MetSpace } state = Normal;
const int n = str.length();
int j = -1;
QChar *d = str.data();
- for ( int i = 0; i != n; ++i ) {
+ for (int i = 0; i != n; ++i) {
const QChar c = d[i];
- if ( c.isLetterOrNumber() ) {
- if ( state == Normal ) {
+ if (c.isLetterOrNumber()) {
+ if (state == Normal) {
state = MetAlnum;
} else {
- if ( state == MetSpace )
+ if (state == MetSpace)
str[++j] = c;
state = Normal;
}
str[++j] = c;
- } else if ( c.isSpace() ) {
- if ( state == MetAlnum )
+ } else if (c.isSpace()) {
+ if (state == MetAlnum)
state = MetSpace;
} else {
state = Normal;
@@ -107,7 +107,7 @@ static void trimWhiteSpace( QString& str )
}
Quoter::Quoter()
- : silent( false )
+ : silent(false)
{
/* We're going to hard code these delimiters:
* C++, Qt, Qt Script, Java:
@@ -138,9 +138,9 @@ void Quoter::reset()
codeLocation = Location::null;
}
-void Quoter::quoteFromFile( const QString& userFriendlyFilePath,
- const QString& plainCode,
- const QString& markedCode )
+void Quoter::quoteFromFile(const QString &userFriendlyFilePath,
+ const QString &plainCode,
+ const QString &markedCode)
{
silent = false;
@@ -165,7 +165,7 @@ void Quoter::quoteFromFile( const QString& userFriendlyFilePath,
Newlines are preserved because they affect codeLocation.
*/
- codeLocation = Location( userFriendlyFilePath );
+ codeLocation = Location(userFriendlyFilePath);
plainLines = splitLines(plainCode);
markedLines = splitLines(markedCode);
@@ -178,33 +178,33 @@ void Quoter::quoteFromFile( const QString& userFriendlyFilePath,
Squeeze blanks (cat -s).
*/
QStringList::Iterator m = markedLines.begin();
- while ( m != markedLines.end() ) {
- replaceMultipleNewlines( *m );
+ while (m != markedLines.end()) {
+ replaceMultipleNewlines(*m);
++m;
}
codeLocation.start();
}
-QString Quoter::quoteLine( const Location& docLocation, const QString& command,
- const QString& pattern )
+QString Quoter::quoteLine(const Location &docLocation, const QString &command,
+ const QString &pattern)
{
- if ( plainLines.isEmpty() ) {
+ if (plainLines.isEmpty()) {
failedAtEnd( docLocation, command );
return QString();
}
- if ( pattern.isEmpty() ) {
- docLocation.warning( tr("Missing pattern after '\\%1'").arg(command) );
+ if (pattern.isEmpty()) {
+ docLocation.warning(tr("Missing pattern after '\\%1'").arg(command));
return QString();
}
- if ( match(docLocation, pattern, plainLines.first()) )
+ if (match(docLocation, pattern, plainLines.first()))
return getLine();
- if ( !silent ) {
- docLocation.warning( tr("Command '\\%1' failed").arg(command) );
- codeLocation.warning( tr("Pattern '%1' didn't match here")
- .arg(pattern) );
+ if (!silent) {
+ docLocation.warning(tr("Command '\\%1' failed").arg(command));
+ codeLocation.warning(tr("Pattern '%1' didn't match here")
+ .arg(pattern));
silent = true;
}
return QString();
@@ -252,40 +252,40 @@ QString Quoter::quoteSnippet(const Location &docLocation, const QString &identif
return t;
}
-QString Quoter::quoteTo( const Location& docLocation, const QString& command,
- const QString& pattern )
+QString Quoter::quoteTo(const Location &docLocation, const QString &command,
+ const QString &pattern)
{
QString t;
QString comment = commentForCode();
- if ( pattern.isEmpty() ) {
- while ( !plainLines.isEmpty() ) {
+ if (pattern.isEmpty()) {
+ while (!plainLines.isEmpty()) {
QString line = plainLines.first();
t += removeSpecialLines(line, comment);
}
} else {
- while ( !plainLines.isEmpty() ) {
- if ( match(docLocation, pattern, plainLines.first()) ) {
+ while (!plainLines.isEmpty()) {
+ if (match(docLocation, pattern, plainLines.first())) {
return t;
}
t += getLine();
}
- failedAtEnd( docLocation, command );
+ failedAtEnd(docLocation, command);
}
return t;
}
-QString Quoter::quoteUntil( const Location& docLocation, const QString& command,
- const QString& pattern )
+QString Quoter::quoteUntil(const Location &docLocation, const QString &command,
+ const QString &pattern)
{
- QString t = quoteTo( docLocation, command, pattern );
+ QString t = quoteTo(docLocation, command, pattern);
t += getLine();
return t;
}
QString Quoter::getLine(int unindent)
{
- if ( plainLines.isEmpty() )
+ if (plainLines.isEmpty())
return QString();
plainLines.removeFirst();
@@ -297,42 +297,42 @@ QString Quoter::getLine(int unindent)
t = t.mid(i);
t += QLatin1Char('\n');
- codeLocation.advanceLines( t.count( QLatin1Char('\n') ) );
+ codeLocation.advanceLines(t.count(QLatin1Char('\n')));
return t;
}
-bool Quoter::match( const Location& docLocation, const QString& pattern0,
- const QString& line )
+bool Quoter::match(const Location &docLocation, const QString &pattern0,
+ const QString &line)
{
QString str = line;
- while ( str.endsWith(QLatin1Char('\n')) )
- str.truncate( str.length() - 1 );
+ while (str.endsWith(QLatin1Char('\n')))
+ str.truncate(str.length() - 1);
QString pattern = pattern0;
- if ( pattern.startsWith(QLatin1Char('/'))
+ if (pattern.startsWith(QLatin1Char('/'))
&& pattern.endsWith(QLatin1Char('/'))
- && pattern.length() > 2 ) {
- QRegExp rx( pattern.mid(1, pattern.length() - 2) );
- if ( !silent && !rx.isValid() ) {
- docLocation.warning( tr("Invalid regular expression '%1'")
- .arg(rx.pattern()) );
+ && pattern.length() > 2) {
+ QRegExp rx(pattern.mid(1, pattern.length() - 2));
+ if (!silent && !rx.isValid()) {
+ docLocation.warning(tr("Invalid regular expression '%1'")
+ .arg(rx.pattern()));
silent = true;
}
- return str.indexOf( rx ) != -1;
+ return str.indexOf(rx) != -1;
}
trimWhiteSpace(str);
trimWhiteSpace(pattern);
return str.indexOf(pattern) != -1;
}
-void Quoter::failedAtEnd( const Location& docLocation, const QString& command )
+void Quoter::failedAtEnd(const Location &docLocation, const QString &command)
{
if (!silent && !command.isEmpty()) {
- if ( codeLocation.filePath().isEmpty() ) {
- docLocation.warning( tr("Unexpected '\\%1'").arg(command) );
+ if (codeLocation.filePath().isEmpty() ) {
+ docLocation.warning(tr("Unexpected '\\%1'").arg(command));
} else {
- docLocation.warning( tr("Command '\\%1' failed at end of file '%2'")
- .arg(command).arg(codeLocation.filePath()) );
+ docLocation.warning(tr("Command '\\%1' failed at end of file '%2'")
+ .arg(command).arg(codeLocation.filePath()));
}
silent = true;
}
diff --git a/src/qdoc/quoter.h b/src/qdoc/quoter.h
index a22f7ddec..6dec63641 100644
--- a/src/qdoc/quoter.h
+++ b/src/qdoc/quoter.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -33,11 +33,11 @@
#ifndef QUOTER_H
#define QUOTER_H
-#include <qhash.h>
-#include <qstringlist.h>
-
#include "location.h"
+#include <QtCore/qhash.h>
+#include <QtCore/qstringlist.h>
+
QT_BEGIN_NAMESPACE
class Quoter
@@ -48,23 +48,23 @@ public:
Quoter();
void reset();
- void quoteFromFile( const QString& userFriendlyFileName,
- const QString& plainCode, const QString& markedCode );
- QString quoteLine( const Location& docLocation, const QString& command,
- const QString& pattern );
- QString quoteTo( const Location& docLocation, const QString& command,
- const QString& pattern );
- QString quoteUntil( const Location& docLocation, const QString& command,
- const QString& pattern );
+ void quoteFromFile(const QString &userFriendlyFileName,
+ const QString &plainCode, const QString &markedCode);
+ QString quoteLine(const Location &docLocation, const QString &command,
+ const QString &pattern);
+ QString quoteTo(const Location &docLocation, const QString &command,
+ const QString &pattern);
+ QString quoteUntil(const Location &docLocation, const QString &command,
+ const QString &pattern);
QString quoteSnippet(const Location &docLocation, const QString &identifier);
static QStringList splitLines(const QString &line);
private:
QString getLine(int unindent = 0);
- void failedAtEnd( const Location& docLocation, const QString& command );
- bool match( const Location& docLocation, const QString& pattern,
- const QString& line );
+ void failedAtEnd(const Location &docLocation, const QString &command);
+ bool match(const Location &docLocation, const QString &pattern,
+ const QString &line);
QString commentForCode() const;
QString removeSpecialLines(const QString &line, const QString &comment,
int unindent = 0);
diff --git a/src/qdoc/sections.cpp b/src/qdoc/sections.cpp
index e91a1014e..44eea84ea 100644
--- a/src/qdoc/sections.cpp
+++ b/src/qdoc/sections.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -26,11 +26,14 @@
**
****************************************************************************/
-#include <qobjectdefs.h>
-#include "generator.h"
#include "sections.h"
+
#include "config.h"
-#include <qdebug.h>
+#include "generator.h"
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qobjectdefs.h>
+
#include <stdio.h>
QT_BEGIN_NAMESPACE
@@ -113,7 +116,7 @@ void Section::clear()
a set of nodes into equivalence classes. If \a name is provided,
start with that name. Itherwise start with the name in \a node.
*/
-QString Section::sortName(const Node *node, const QString* name)
+QString Section::sortName(const Node *node, const QString *name)
{
QString nodeName;
if (name != nullptr)
@@ -173,7 +176,7 @@ void Section::insert(Node *node)
bool irrelevant = false;
bool inherited = false;
if (!node->isRelatedNonmember()) {
- Aggregate* p = node->parent();
+ Aggregate *p = node->parent();
if (!p->isNamespace() && p != aggregate_) {
if ((!p->isQmlType() && !p->isJsType()) || !p->isAbstract())
inherited = true;
@@ -190,7 +193,7 @@ void Section::insert(Node *node)
else if (node->isClassNode() || node->isEnumType() || node->isTypedef() || node->isVariable()) {
irrelevant = (inherited && style_ != AllMembers);
if (!irrelevant && style_ == Details && node->isTypedef()) {
- const TypedefNode* tdn = static_cast<const TypedefNode*>(node);
+ const TypedefNode *tdn = static_cast<const TypedefNode *>(node);
if (tdn->associatedEnum())
irrelevant = true;
}
@@ -227,10 +230,10 @@ void Section::insert(Node *node)
That is, false is returned if the \a node is already in
the map.
*/
-bool Section::insertReimplementedMember(Node* node)
+bool Section::insertReimplementedMember(Node *node)
{
if (!node->isPrivate() && !node->isRelatedNonmember()) {
- const FunctionNode* fn = static_cast<const FunctionNode*>(node);
+ const FunctionNode *fn = static_cast<const FunctionNode *>(node);
if (!fn->overridesThis().isEmpty() && (status_ == Active)) {
if (fn->parent() == aggregate_) {
QString key = sortName(fn);
@@ -249,10 +252,10 @@ bool Section::insertReimplementedMember(Node* node)
node, append it to the list of class maps, and return a
pointer to the new class map.
*/
-ClassMap *Section::newClassMap(const Aggregate* aggregate)
+ClassMap *Section::newClassMap(const Aggregate *aggregate)
{
ClassMap *classMap = new ClassMap;
- classMap->first = static_cast<const QmlTypeNode*>(aggregate);
+ classMap->first = static_cast<const QmlTypeNode *>(aggregate);
classMapList_.append(classMap);
return classMap;
}
@@ -339,7 +342,7 @@ Sections::Sections(Aggregate *aggregate) : aggregate_(aggregate)
This constructor builds a vector of sections from the \e since
node map, \a nsmap
*/
-Sections::Sections(const NodeMultiMap& nsmap) : aggregate_(nullptr)
+Sections::Sections(const NodeMultiMap &nsmap) : aggregate_(nullptr)
{
initSections();
if (nsmap.isEmpty())
@@ -347,7 +350,7 @@ Sections::Sections(const NodeMultiMap& nsmap) : aggregate_(nullptr)
SectionVector &sections = sinceSections();
NodeMultiMap::const_iterator n = nsmap.constBegin();
while (n != nsmap.constEnd()) {
- Node* node = n.value();
+ Node *node = n.value();
switch (node->nodeType()) {
case Node::JsType:
case Node::QmlType:
@@ -368,7 +371,7 @@ Sections::Sections(const NodeMultiMap& nsmap) : aggregate_(nullptr)
sections[SinceTypedefs].appendMember(node);
break;
case Node::Function: {
- const FunctionNode* fn = static_cast<const FunctionNode*>(node);
+ const FunctionNode *fn = static_cast<const FunctionNode *>(node);
switch (fn->metaness()) {
case FunctionNode::JsSignal:
case FunctionNode::QmlSignal:
@@ -386,7 +389,7 @@ Sections::Sections(const NodeMultiMap& nsmap) : aggregate_(nullptr)
if (fn->isMacro())
sections[SinceMacros].appendMember(node);
else {
- Node* p = fn->parent();
+ Node *p = fn->parent();
if (p) {
if (p->isClassNode())
sections[SinceMemberFunctions].appendMember(node);
@@ -602,9 +605,14 @@ void Sections::reduce(QVector<Section> &v)
/*!
This is a private helper function for buildStdRefPageSections().
*/
-void Sections::stdRefPageSwitch(SectionVector &v, Node *n)
+void Sections::stdRefPageSwitch(SectionVector &v, Node *n, Node *t)
{
- switch (n->nodeType()) {
+ // t is the reference node to be tested, n is the node to be distributed.
+ // t differs from n only for shared comment nodes.
+ if (!t)
+ t = n;
+
+ switch (t->nodeType()) {
case Node::Namespace:
v[StdNamespaces].insert(n);
return;
@@ -619,7 +627,7 @@ void Sections::stdRefPageSwitch(SectionVector &v, Node *n)
return;
case Node::Function:
{
- FunctionNode *func = static_cast<FunctionNode *>(n);
+ FunctionNode *func = static_cast<FunctionNode *>(t);
if (func->isMacro())
v[StdMacros].insert(n);
else
@@ -628,7 +636,7 @@ void Sections::stdRefPageSwitch(SectionVector &v, Node *n)
return;
case Node::Variable:
{
- const VariableNode* var = static_cast<const VariableNode*>(n);
+ const VariableNode *var = static_cast<const VariableNode *>(t);
if (!var->doc().isEmpty()) {
if (var->isStatic())
v[StdStaticVariables].insert(n);
@@ -639,9 +647,9 @@ void Sections::stdRefPageSwitch(SectionVector &v, Node *n)
return;
case Node::SharedComment:
{
- SharedCommentNode *scn = static_cast<SharedCommentNode *>(n);
- if (!scn->doc().isEmpty())
- v[StdFunctions].insert(scn);
+ SharedCommentNode *scn = static_cast<SharedCommentNode *>(t);
+ if (!scn->doc().isEmpty() && scn->collective().count())
+ stdRefPageSwitch(v, scn, scn->collective().first()); // TODO: warn about mixed node types in collective?
}
return;
default:
@@ -667,10 +675,10 @@ void Sections::stdRefPageSwitch(SectionVector &v, Node *n)
*/
void Sections::buildStdRefPageSections()
{
- const NamespaceNode* ns = nullptr;
+ const NamespaceNode *ns = nullptr;
bool documentAll = true; // document all the children
if (aggregate_->isNamespace()) {
- ns = static_cast<const NamespaceNode*>(aggregate_);
+ ns = static_cast<const NamespaceNode *>(aggregate_);
if (!ns->hasDoc())
documentAll = false; // only document children that have documentation
}
@@ -720,7 +728,7 @@ void Sections::distributeNodeInSummaryVector(SectionVector &sv, Node *n)
if (n->isSharedCommentNode())
return;
if (n->isFunction()) {
- FunctionNode *fn = static_cast<FunctionNode*>(n);
+ FunctionNode *fn = static_cast<FunctionNode *>(n);
if (fn->isRelatedNonmember()) {
if (fn->isMacro())
sv[Macros].insert(n);
@@ -810,8 +818,19 @@ void Sections::distributeNodeInDetailsVector(SectionVector &dv, Node *n)
{
if (n->isSharingComment())
return;
- if (n->isFunction()) {
- FunctionNode *fn = static_cast<FunctionNode*>(n);
+
+ // t is the reference node to be tested - typically it's this node (n), but for
+ // shared comment nodes we need to distribute based on the nodes in its collective.
+ Node *t = n;
+
+ if (n->isSharedCommentNode() && n->hasDoc()) {
+ SharedCommentNode *scn = static_cast<SharedCommentNode *>(n);
+ if (scn->collective().count())
+ t = scn->collective().first(); // TODO: warn about mixed node types in collective?
+ }
+
+ if (t->isFunction()) {
+ FunctionNode *fn = static_cast<FunctionNode *>(t);
if (fn->isRelatedNonmember()) {
if (fn->isMacro())
dv[DetailsMacros].insert(n);
@@ -823,69 +842,85 @@ void Sections::distributeNodeInDetailsVector(SectionVector &dv, Node *n)
return;
if (!fn->isSharingComment()) {
if (!fn->hasAssociatedProperties() || !fn->doc().isEmpty())
- dv[DetailsMemberFunctions].insert(fn);
+ dv[DetailsMemberFunctions].insert(n);
}
return;
}
- if (n->isRelatedNonmember()) {
+ if (t->isRelatedNonmember()) {
dv[DetailsRelatedNonmembers].insert(n);
return;
}
- if (n->isEnumType() || n->isTypedef()) {
- if (n->name() != QLatin1String("QtGadgetHelper"))
+ if (t->isEnumType() || t->isTypedef()) {
+ if (t->name() != QLatin1String("QtGadgetHelper"))
dv[DetailsMemberTypes].insert(n);
return;
}
- if (n->isProperty())
+ if (t->isProperty())
dv[DetailsProperties].insert(n);
- else if (n->isVariable() && !n->doc().isEmpty())
+ else if (t->isVariable() && !t->doc().isEmpty())
dv[DetailsMemberVariables].insert(n);
- else if (n->isSharedCommentNode() && !n->doc().isEmpty())
- dv[DetailsMemberFunctions].insert(n);
}
void Sections::distributeQmlNodeInDetailsVector(SectionVector &dv, Node *n)
{
if (n->isSharingComment())
return;
- if (n->isQmlProperty() || n->isJsProperty()) {
- QmlPropertyNode* pn = static_cast<QmlPropertyNode*>(n);
+
+ // t is the reference node to be tested - typically it's this node (n), but for
+ // shared comment nodes we need to distribute based on the nodes in its collective.
+ Node *t = n;
+
+ if (n->isSharedCommentNode() && n->hasDoc()) {
+ if (n->isPropertyGroup()) {
+ dv[QmlProperties].insert(n);
+ return;
+ }
+ SharedCommentNode *scn = static_cast<SharedCommentNode *>(n);
+ if (scn->collective().count())
+ t = scn->collective().first(); // TODO: warn about mixed node types in collective?
+ }
+
+ if (t->isQmlProperty() || t->isJsProperty()) {
+ QmlPropertyNode *pn = static_cast<QmlPropertyNode *>(t);
if (pn->isAttached())
- dv[QmlAttachedProperties].insert(pn);
+ dv[QmlAttachedProperties].insert(n);
else
- dv[QmlProperties].insert(pn);
- } else if (n->isFunction()) {
- FunctionNode* fn = static_cast<FunctionNode*>(n);
+ dv[QmlProperties].insert(n);
+ } else if (t->isFunction()) {
+ FunctionNode *fn = static_cast<FunctionNode *>(t);
if (fn->isQmlSignal() || fn->isJsSignal()) {
if (fn->isAttached())
- dv[QmlAttachedSignals].insert(fn);
+ dv[QmlAttachedSignals].insert(n);
else
- dv[QmlSignals].insert(fn);
+ dv[QmlSignals].insert(n);
} else if (fn->isQmlSignalHandler() || fn->isJsSignalHandler()) {
- dv[QmlSignalHandlers].insert(fn);
+ dv[QmlSignalHandlers].insert(n);
} else if (fn->isQmlMethod() || fn->isJsMethod()) {
if (fn->isAttached())
- dv[QmlAttachedMethods].insert(fn);
+ dv[QmlAttachedMethods].insert(n);
else
- dv[QmlMethods].insert(fn);
+ dv[QmlMethods].insert(n);
}
- } else if (n->isSharedCommentNode() && n->hasDoc()) {
- dv[n->isPropertyGroup() ? QmlProperties : QmlMethods].insert(n);
}
}
-void Sections::distributeQmlNodeInSummaryVector(SectionVector &sv, Node *n)
+/*!
+ Distributes a node \a n into the correct place in the summary section vector \a sv.
+ Nodes that are sharing a comment are handled recursively - for recursion, the \a
+ sharing parameter is set to \c true.
+ */
+void Sections::distributeQmlNodeInSummaryVector(SectionVector &sv, Node *n, bool sharing)
{
- if (n->isSharingComment())
+ if (n->isSharingComment() && !sharing)
return;
if (n->isQmlProperty() || n->isJsProperty()) {
- QmlPropertyNode* pn = static_cast<QmlPropertyNode*>(n);
+ QmlPropertyNode *pn = static_cast<QmlPropertyNode *>(n);
if (pn->isAttached())
sv[QmlAttachedProperties].insert(pn);
else
sv[QmlProperties].insert(pn);
} else if (n->isFunction()) {
- FunctionNode* fn = static_cast<FunctionNode*>(n);
+ FunctionNode *fn = static_cast<FunctionNode *>(n);
if (fn->isQmlSignal() || fn->isJsSignal()) {
if (fn->isAttached())
sv[QmlAttachedSignals].insert(fn);
@@ -901,16 +936,16 @@ void Sections::distributeQmlNodeInSummaryVector(SectionVector &sv, Node *n)
}
} else if (n->isSharedCommentNode()) {
SharedCommentNode *scn = static_cast<SharedCommentNode*>(n);
- if (scn->name().isEmpty()) {
- for (auto child : scn->collective())
- sv[child->isFunction(Node::QML) ? QmlMethods : QmlProperties].insert(child);
- } else {
+ if (scn->isPropertyGroup()) {
sv[QmlProperties].insert(scn);
+ } else {
+ for (auto child : scn->collective())
+ distributeQmlNodeInSummaryVector(sv, child, true);
}
}
}
-static void pushBaseClasses(QStack<ClassNode*> &stack, ClassNode *cn)
+static void pushBaseClasses(QStack<ClassNode *> &stack, ClassNode *cn)
{
QList<RelatedClass>::ConstIterator r = cn->baseClasses().constBegin();
while (r != cn->baseClasses().constEnd()) {
@@ -957,8 +992,8 @@ void Sections::buildStdCppClassRefPageSections()
}
}
- QStack<ClassNode*> stack;
- ClassNode* cn = static_cast<ClassNode*>(aggregate_);
+ QStack<ClassNode *> stack;
+ ClassNode *cn = static_cast<ClassNode *>(aggregate_);
pushBaseClasses(stack, cn);
while (!stack.isEmpty()) {
ClassNode *cn = stack.pop();
@@ -996,7 +1031,7 @@ void Sections::buildStdQmlTypeRefPageSections()
SectionVector &dv = stdQmlTypeDetailsSections();
Section &allMembers = allMembersSection();
- const Aggregate* qtn = aggregate_;
+ const Aggregate *qtn = aggregate_;
while (true) {
if (!qtn->isAbstract() || !classMap)
classMap = allMembers.newClassMap(qtn);
@@ -1007,7 +1042,7 @@ void Sections::buildStdQmlTypeRefPageSections()
++c;
continue;
}
- if (!n->isSharedCommentNode())
+ if (!n->isSharedCommentNode() || n->isPropertyGroup())
allMembers.add(classMap, n);
distributeQmlNodeInSummaryVector(sv, n);
@@ -1021,7 +1056,7 @@ void Sections::buildStdQmlTypeRefPageSections()
qtn = nullptr;
break;
}
- qtn = static_cast<QmlTypeNode*>(qtn->qmlBaseNode());
+ qtn = static_cast<QmlTypeNode *>(qtn->qmlBaseNode());
if (qtn == nullptr)
break;
if (!qtn->isAbstract())
@@ -1048,7 +1083,7 @@ void Sections::buildStdQmlTypeRefPageSections()
qtn = nullptr;
break;
}
- qtn = static_cast<QmlTypeNode*>(qtn->qmlBaseNode());
+ qtn = static_cast<QmlTypeNode *>(qtn->qmlBaseNode());
}
reduce(sv);
reduce(dv);
diff --git a/src/qdoc/sections.h b/src/qdoc/sections.h
index d3af83736..92c2cdd2b 100644
--- a/src/qdoc/sections.h
+++ b/src/qdoc/sections.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -29,18 +29,19 @@
#ifndef SECTIONS_H
#define SECTIONS_H
-#include <qpair.h>
#include "node.h"
+#include <QtCore/qpair.h>
+
QT_BEGIN_NAMESPACE
-typedef QMultiMap<QString, Node*> MemberMap; // the string is the member signature
-typedef QPair<const QmlTypeNode*, MemberMap> ClassMap; // the node is the QML type
-typedef QList<ClassMap*> ClassMapList;
+typedef QMultiMap<QString, Node *> MemberMap; // the string is the member signature
+typedef QPair<const QmlTypeNode *, MemberMap> ClassMap; // the node is the QML type
+typedef QList<ClassMap *> ClassMapList;
typedef QPair<QStringList, NodeVector> KeysAndNodes;
-typedef QPair<const QmlTypeNode*, KeysAndNodes> ClassKeysNodes;
-typedef QList<ClassKeysNodes*> ClassKeysNodesList;
+typedef QPair<const QmlTypeNode *, KeysAndNodes> ClassKeysNodes;
+typedef QList<ClassKeysNodes *> ClassKeysNodesList;
class Section
{
@@ -53,33 +54,33 @@ class Section
Section(Style style, Status status);
~Section();
- void init(const QString& title) {
+ void init(const QString &title) {
title_ = title;
}
- void init(const QString& singular,
- const QString& plural) {
+ void init(const QString &singular,
+ const QString &plural) {
singular_ = singular; plural_ = plural;
}
- void init(const QString& title,
- const QString& singular,
- const QString& plural) {
+ void init(const QString &title,
+ const QString &singular,
+ const QString &plural) {
title_ = title; divClass_.clear(); singular_= singular; plural_ = plural;
}
- void init(const QString& title,
- const QString& divClass,
- const QString& singular,
- const QString& plural) {
+ void init(const QString &title,
+ const QString &divClass,
+ const QString &singular,
+ const QString &plural) {
title_ = title; divClass_ = divClass; singular_= singular; plural_ = plural;
}
void insert(Node *node);
- void insert(const QString& key, Node *node) { memberMap_.insertMulti(key, node); }
- bool insertReimplementedMember(Node* node);
+ void insert(const QString &key, Node *node) { memberMap_.insertMulti(key, node); }
+ bool insertReimplementedMember(Node *node);
ClassMap *newClassMap(const Aggregate *aggregate);
void add(ClassMap *classMap, Node *n);
- void appendMember(Node* node) { members_.append(node); }
- void appendReimplementedMember(Node* node) { reimplementedMembers_.append(node); }
+ void appendMember(Node *node) { members_.append(node); }
+ void appendReimplementedMember(Node *node) { reimplementedMembers_.append(node); }
void clear();
void reduce();
@@ -108,7 +109,7 @@ class Section
void setAggregate(Aggregate *t) { aggregate_ = t; }
private:
- QString sortName(const Node *node, const QString* name = nullptr);
+ QString sortName(const Node *node, const QString *name = nullptr);
private:
Style style_;
@@ -134,7 +135,7 @@ class Section
};
typedef QVector<Section> SectionVector;
-typedef QVector<const Section*> SectionPtrVector;
+typedef QVector<const Section *> SectionPtrVector;
class Sections
{
@@ -197,7 +198,7 @@ class Sections
};
Sections(Aggregate *aggregate);
- Sections(const NodeMultiMap& nsmap);
+ Sections(const NodeMultiMap &nsmap);
~Sections();
void initSections();
@@ -228,15 +229,15 @@ class Sections
Aggregate *aggregate() const { return aggregate_; }
private:
- void stdRefPageSwitch(SectionVector &v, Node *n);
+ void stdRefPageSwitch(SectionVector &v, Node *n, Node *t = nullptr);
void distributeNodeInSummaryVector(SectionVector &sv, Node *n);
void distributeNodeInDetailsVector(SectionVector &dv, Node *n);
void distributeQmlNodeInDetailsVector(SectionVector &dv, Node *n);
- void distributeQmlNodeInSummaryVector(SectionVector &sv, Node *n);
+ void distributeQmlNodeInSummaryVector(SectionVector &sv, Node *n, bool sharing = false);
void initAggregate(SectionVector &v, Aggregate *aggregate);
private:
- Aggregate *aggregate_;
+ Aggregate *aggregate_;
static SectionVector stdSummarySections_;
static SectionVector stdDetailsSections_;
diff --git a/src/qdoc/separator.cpp b/src/qdoc/separator.cpp
index 3cf305188..80dc39559 100644
--- a/src/qdoc/separator.cpp
+++ b/src/qdoc/separator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -31,7 +31,8 @@
*/
#include "separator.h"
-#include <qcoreapplication.h>
+
+#include <QtCore/qcoreapplication.h>
QT_BEGIN_NAMESPACE
diff --git a/src/qdoc/separator.h b/src/qdoc/separator.h
index a8637ddd7..69346bd0c 100644
--- a/src/qdoc/separator.h
+++ b/src/qdoc/separator.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -33,12 +33,12 @@
#ifndef SEPARATOR_H
#define SEPARATOR_H
-#include <qstring.h>
+#include <QtCore/qstring.h>
QT_BEGIN_NAMESPACE
-QString separator( int index, int count );
-QString comma( int index, int count );
+QString separator(int index, int count);
+QString comma(int index, int count);
QT_END_NAMESPACE
diff --git a/src/qdoc/text.cpp b/src/qdoc/text.cpp
index 0560d45eb..c80ef00e3 100644
--- a/src/qdoc/text.cpp
+++ b/src/qdoc/text.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -30,8 +30,10 @@
text.cpp
*/
-#include <qregexp.h>
#include "text.h"
+
+#include <QtCore/qregexp.h>
+
#include <stdio.h>
QT_BEGIN_NAMESPACE
@@ -47,7 +49,7 @@ Text::Text(const QString &str)
operator<<(str);
}
-Text::Text(const Text& text)
+Text::Text(const Text &text)
: first(nullptr), last(nullptr)
{
operator=(text);
@@ -58,7 +60,7 @@ Text::~Text()
clear();
}
-Text& Text::operator=(const Text& text)
+Text &Text::operator=(const Text &text)
{
if (this != &text) {
clear();
@@ -67,17 +69,17 @@ Text& Text::operator=(const Text& text)
return *this;
}
-Text& Text::operator<<(Atom::AtomType atomType)
+Text &Text::operator<<(Atom::AtomType atomType)
{
return operator<<(Atom(atomType));
}
-Text& Text::operator<<(const QString& string)
+Text &Text::operator<<(const QString &string)
{
return operator<<(Atom(Atom::String, string));
}
-Text& Text::operator<<(const Atom& atom)
+Text &Text::operator<<(const Atom& atom)
{
if (atom.count() < 2) {
if (first == nullptr) {
@@ -103,7 +105,7 @@ Text& Text::operator<<(const Atom& atom)
the LinkAtom \a atom and connects the cop;y to the list
in this Text.
*/
-Text& Text::operator<<(const LinkAtom& atom)
+Text &Text::operator<<(const LinkAtom &atom)
{
if (first == nullptr) {
first = new LinkAtom(atom);
@@ -114,9 +116,9 @@ Text& Text::operator<<(const LinkAtom& atom)
return *this;
}
-Text& Text::operator<<(const Text& text)
+Text &Text::operator<<(const Text &text)
{
- const Atom* atom = text.firstAtom();
+ const Atom *atom = text.firstAtom();
while (atom != nullptr) {
operator<<(*atom);
atom = atom->next();
@@ -129,7 +131,7 @@ void Text::stripFirstAtom()
if (first != nullptr) {
if (first == last)
last = nullptr;
- Atom* oldFirst = first;
+ Atom *oldFirst = first;
first = first->next();
delete oldFirst;
}
@@ -138,7 +140,7 @@ void Text::stripFirstAtom()
void Text::stripLastAtom()
{
if (last != nullptr) {
- Atom* oldLast = last;
+ Atom *oldLast = last;
if (first == last) {
first = nullptr;
last = nullptr;
@@ -160,7 +162,7 @@ void Text::stripLastAtom()
QString Text::toString() const
{
QString str;
- const Atom* atom = firstAtom();
+ const Atom *atom = firstAtom();
while (atom != nullptr) {
if (atom->type() == Atom::String ||
atom->type() == Atom::AutoLink ||
@@ -176,7 +178,7 @@ QString Text::toString() const
*/
bool Text::contains(const QString &str) const
{
- const Atom* atom = firstAtom();
+ const Atom *atom = firstAtom();
while (atom != nullptr) {
if (atom->type() == Atom::String ||
atom->type() == Atom::AutoLink ||
@@ -188,10 +190,10 @@ bool Text::contains(const QString &str) const
return false;
}
-Text Text::subText(Atom::AtomType left, Atom::AtomType right, const Atom* from, bool inclusive) const
+Text Text::subText(Atom::AtomType left, Atom::AtomType right, const Atom *from, bool inclusive) const
{
- const Atom* begin = from ? from : firstAtom();
- const Atom* end;
+ const Atom *begin = from ? from : firstAtom();
+ const Atom *end;
while (begin != nullptr && begin->type() != left)
begin = begin->next();
@@ -210,16 +212,16 @@ Text Text::subText(Atom::AtomType left, Atom::AtomType right, const Atom* from,
return subText(begin, end);
}
-Text Text::sectionHeading(const Atom* sectionLeft)
+Text Text::sectionHeading(const Atom *sectionLeft)
{
if (sectionLeft != nullptr) {
- const Atom* begin = sectionLeft;
+ const Atom *begin = sectionLeft;
while (begin != nullptr && begin->type() != Atom::SectionHeadingLeft)
begin = begin->next();
if (begin != nullptr)
begin = begin->next();
- const Atom* end = begin;
+ const Atom *end = begin;
while (end != nullptr && end->type() != Atom::SectionHeadingRight)
end = end->next();
@@ -229,10 +231,10 @@ Text Text::sectionHeading(const Atom* sectionLeft)
return Text();
}
-const Atom* Text::sectionHeadingAtom(const Atom* sectionLeft)
+const Atom *Text::sectionHeadingAtom(const Atom *sectionLeft)
{
if (sectionLeft != nullptr) {
- const Atom* begin = sectionLeft;
+ const Atom *begin = sectionLeft;
while (begin != nullptr && begin->type() != Atom::SectionHeadingLeft)
begin = begin->next();
if (begin != nullptr)
@@ -245,7 +247,7 @@ const Atom* Text::sectionHeadingAtom(const Atom* sectionLeft)
void Text::dump() const
{
- const Atom* atom = firstAtom();
+ const Atom *atom = firstAtom();
while (atom != nullptr) {
QString str = atom->string();
str.replace("\\", "\\\\");
@@ -259,7 +261,7 @@ void Text::dump() const
}
}
-Text Text::subText(const Atom* begin, const Atom* end)
+Text Text::subText(const Atom *begin, const Atom *end)
{
Text text;
if (begin != nullptr) {
@@ -274,7 +276,7 @@ Text Text::subText(const Atom* begin, const Atom* end)
void Text::clear()
{
while (first != nullptr) {
- Atom* atom = first;
+ Atom *atom = first;
first = first->next();
delete atom;
}
@@ -289,8 +291,8 @@ int Text::compare(const Text &text1, const Text &text2)
if (text2.isEmpty())
return 1;
- const Atom* atom1 = text1.firstAtom();
- const Atom* atom2 = text2.firstAtom();
+ const Atom *atom1 = text1.firstAtom();
+ const Atom *atom2 = text2.firstAtom();
for (;;) {
if (atom1->type() != atom2->type())
diff --git a/src/qdoc/text.h b/src/qdoc/text.h
index d72d38469..7c31fcde0 100644
--- a/src/qdoc/text.h
+++ b/src/qdoc/text.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -42,23 +42,23 @@ class Text
public:
Text();
explicit Text(const QString &str);
- Text(const Text& text);
+ Text(const Text &text);
~Text();
- Text& operator=(const Text& text);
+ Text &operator=(const Text &text);
Atom *firstAtom() { return first; }
Atom *lastAtom() { return last; }
- Text& operator<<(Atom::AtomType atomType);
- Text& operator<<(const QString& string);
- Text& operator<<(const Atom& atom);
- Text& operator<<(const LinkAtom& atom);
- Text& operator<<(const Text& text);
+ Text &operator<<(Atom::AtomType atomType);
+ Text &operator<<(const QString &string);
+ Text &operator<<(const Atom& atom);
+ Text &operator<<(const LinkAtom &atom);
+ Text &operator<<(const Text &text);
void stripFirstAtom();
void stripLastAtom();
bool isEmpty() const { return first == nullptr; }
- bool contains(const QString& str) const;
+ bool contains(const QString &str) const;
QString toString() const;
const Atom *firstAtom() const { return first; }
const Atom *lastAtom() const { return last; }
diff --git a/src/qdoc/tokenizer.cpp b/src/qdoc/tokenizer.cpp
index d36e7bb18..45c33fa7c 100644
--- a/src/qdoc/tokenizer.cpp
+++ b/src/qdoc/tokenizer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -26,15 +26,16 @@
**
****************************************************************************/
-#include "config.h"
#include "tokenizer.h"
+
+#include "config.h"
#include "generator.h"
-#include <qfile.h>
-#include <qhash.h>
-#include <qregexp.h>
-#include <qstring.h>
-#include <qtextcodec.h>
+#include <QtCore/qfile.h>
+#include <QtCore/qhash.h>
+#include <QtCore/qregexp.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qtextcodec.h>
#include <ctype.h>
#include <string.h>
@@ -115,7 +116,7 @@ static void insertKwordIntoHash(const char *s, int number)
kwordHashTable[k] = number;
}
-Tokenizer::Tokenizer(const Location& loc, QFile &in)
+Tokenizer::Tokenizer(const Location &loc, QFile &in)
{
init();
yyIn = in.readAll();
@@ -123,7 +124,7 @@ Tokenizer::Tokenizer(const Location& loc, QFile &in)
start(loc);
}
-Tokenizer::Tokenizer(const Location& loc, const QByteArray &in)
+Tokenizer::Tokenizer(const Location &loc, const QByteArray &in)
: yyIn(in)
{
init();
@@ -517,17 +518,18 @@ void Tokenizer::initialize(const Config &config)
ignoredTokensAndDirectives = new QHash<QByteArray, bool>;
- QStringList tokens = config.getStringList(LANGUAGE_CPP + Config::dot + CONFIG_IGNORETOKENS);
- foreach (const QString &t, tokens) {
- const QByteArray tb = t.toLatin1();
+ const QStringList tokens =
+ config.getStringList(LANGUAGE_CPP + Config::dot + CONFIG_IGNORETOKENS);
+ for (const auto &token : tokens) {
+ const QByteArray tb = token.toLatin1();
ignoredTokensAndDirectives->insert(tb, false);
insertKwordIntoHash(tb.data(), -1);
}
- QStringList directives = config.getStringList(LANGUAGE_CPP + Config::dot
+ const QStringList directives = config.getStringList(LANGUAGE_CPP + Config::dot
+ CONFIG_IGNOREDIRECTIVES);
- foreach (const QString &d, directives) {
- const QByteArray db = d.toLatin1();
+ for (const auto &directive : directives) {
+ const QByteArray db = directive.toLatin1();
ignoredTokensAndDirectives->insert(db, true);
insertKwordIntoHash(db.data(), -1);
}
@@ -572,7 +574,7 @@ void Tokenizer::init()
parsingMacro = false;
}
-void Tokenizer::start(const Location& loc)
+void Tokenizer::start(const Location &loc)
{
yyTokLoc = loc;
yyCurLoc = loc;
diff --git a/src/qdoc/tokenizer.h b/src/qdoc/tokenizer.h
index 4ef3195ed..2f0c1937c 100644
--- a/src/qdoc/tokenizer.h
+++ b/src/qdoc/tokenizer.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -33,12 +33,12 @@
#ifndef TOKENIZER_H
#define TOKENIZER_H
-#include <qfile.h>
-#include <qstack.h>
-#include <qstring.h>
-
#include "location.h"
+#include <QtCore/qfile.h>
+#include <QtCore/qstack.h>
+#include <QtCore/qstring.h>
+
QT_BEGIN_NAMESPACE
/*
@@ -88,8 +88,8 @@ class Tokenizer
Q_DECLARE_TR_FUNCTIONS(QDoc::Tokenizer)
public:
- Tokenizer(const Location& loc, const QByteArray &in);
- Tokenizer(const Location& loc, QFile &file);
+ Tokenizer(const Location &loc, const QByteArray &in);
+ Tokenizer(const Location &loc, QFile &file);
~Tokenizer();
@@ -104,7 +104,7 @@ public:
int braceDepth() const { return yyBraceDepth; }
int parenDepth() const { return yyParenDepth; }
int bracketDepth() const { return yyBracketDepth; }
- Location& tokenLocation() { return yyTokLoc; }
+ Location &tokenLocation() { return yyTokLoc; }
static void initialize(const Config &config);
static void terminate();
@@ -112,7 +112,7 @@ public:
private:
void init();
- void start(const Location& loc);
+ void start(const Location &loc);
/*
This limit on the length of a lexeme seems fairly high, but a
doc comment can be arbitrarily long. The previous 65,536 limit
diff --git a/src/qdoc/tree.cpp b/src/qdoc/tree.cpp
index 373080163..1ae07c52b 100644
--- a/src/qdoc/tree.cpp
+++ b/src/qdoc/tree.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -26,15 +26,18 @@
**
****************************************************************************/
+#include "tree.h"
+
#include "doc.h"
#include "htmlgenerator.h"
#include "location.h"
#include "node.h"
-#include "text.h"
-#include "tree.h"
#include "qdocdatabase.h"
+#include "text.h"
+
+#include <QtCore/qdebug.h>
+
#include <limits.h>
-#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -49,7 +52,7 @@ QT_BEGIN_NAMESPACE
though the pointer to the singleton QDocDatabase.
Tree is being converted to a forest. A static member provides a
- map of Tree* values with the module names as the keys. There is
+ map of Tree *values with the module names as the keys. There is
one Tree in the map for each index file read, and there is one
tree that is not in the map for the module whose documentation
is being generated.
@@ -109,8 +112,8 @@ Tree::~Tree()
while (i != targetListMap_->end()) {
TargetList *tlist = i.value();
if (tlist) {
- foreach (TargetLoc *tloc, *tlist)
- delete tloc;
+ for (auto *location : qAsConst(*tlist))
+ delete location;
}
delete tlist;
++i;
@@ -145,7 +148,7 @@ Node *Tree::findNodeForInclude(const QStringList &path) const
Aggregate *Tree::findAggregate(const QString &name)
{
QStringList path = name.split(QLatin1String("::"));
- return static_cast<Aggregate*>(findNodeRecursive(path, 0, const_cast<NamespaceNode*>(root()), &Node::isFirstClassAggregate));
+ return static_cast<Aggregate *>(findNodeRecursive(path, 0, const_cast<NamespaceNode *>(root()), &Node::isFirstClassAggregate));
}
/*!
@@ -157,8 +160,8 @@ Aggregate *Tree::findAggregate(const QString &name)
ClassNode *Tree::findClassNode(const QStringList &path, const Node *start) const
{
if (start == nullptr)
- start = const_cast<NamespaceNode*>(root());
- return static_cast<ClassNode*>(findNodeRecursive(path, 0, start, &Node::isClassNode));
+ start = const_cast<NamespaceNode *>(root());
+ return static_cast<ClassNode *>(findNodeRecursive(path, 0, start, &Node::isClassNode));
}
/*!
@@ -168,8 +171,8 @@ ClassNode *Tree::findClassNode(const QStringList &path, const Node *start) const
*/
NamespaceNode *Tree::findNamespaceNode(const QStringList &path) const
{
- Node *start = const_cast<NamespaceNode*>(root());
- return static_cast<NamespaceNode*>(findNodeRecursive(path, 0, start, &Node::isNamespace));
+ Node *start = const_cast<NamespaceNode *>(root());
+ return static_cast<NamespaceNode *>(findNodeRecursive(path, 0, start, &Node::isNamespace));
}
/*!
@@ -193,7 +196,7 @@ QmlTypeNode *Tree::findQmlTypeNode(const QStringList &path)
if (qcn != nullptr)
return qcn;
}
- return static_cast<QmlTypeNode*>(findNodeRecursive(path, 0, root(), &Node::isQmlType));
+ return static_cast<QmlTypeNode *>(findNodeRecursive(path, 0, root(), &Node::isQmlType));
}
/*!
@@ -211,7 +214,7 @@ QmlTypeNode *Tree::findQmlTypeNode(const QStringList &path)
Aggregate *Tree::findRelatesNode(const QStringList &path)
{
Node *n = findNodeRecursive(path, 0, root(), &Node::isRelatableType);
- return (((n != nullptr) && n->isAggregate()) ? static_cast<Aggregate*>(n) : nullptr);
+ return (((n != nullptr) && n->isAggregate()) ? static_cast<Aggregate *>(n) : nullptr);
}
/*!
@@ -238,7 +241,7 @@ void Tree::resolveBaseClasses(Aggregate *n)
NodeList::ConstIterator c = n->constBegin();
while (c != n->constEnd()) {
if ((*c)->isClassNode()) {
- ClassNode *cn = static_cast<ClassNode*>(*c);
+ ClassNode *cn = static_cast<ClassNode *>(*c);
QList<RelatedClass> &bases = cn->baseClasses();
QList<RelatedClass>::iterator b = bases.begin();
while (b != bases.end()) {
@@ -262,7 +265,7 @@ void Tree::resolveBaseClasses(Aggregate *n)
n = findClassNode((*b).path_, parent);
}
if (n != nullptr) {
- ClassNode *bcn = static_cast<ClassNode*>(n);
+ ClassNode *bcn = static_cast<ClassNode *>(n);
(*b).node_ = bcn;
bcn->addDerivedClass((*b).access_, cn);
}
@@ -271,7 +274,7 @@ void Tree::resolveBaseClasses(Aggregate *n)
}
resolveBaseClasses(cn);
} else if ((*c)->isNamespace()) {
- resolveBaseClasses(static_cast<NamespaceNode*>(*c));
+ resolveBaseClasses(static_cast<NamespaceNode *>(*c));
}
++c;
}
@@ -284,16 +287,16 @@ void Tree::resolvePropertyOverriddenFromPtrs(Aggregate *n)
NodeList::ConstIterator c = n->constBegin();
while (c != n->constEnd()) {
if ((*c)->isClassNode()) {
- ClassNode *cn = static_cast<ClassNode*>(*c);
+ ClassNode *cn = static_cast<ClassNode *>(*c);
NodeList::ConstIterator p = cn->constBegin();
while (p != cn->constEnd()) {
if ((*p)->isProperty())
- cn->resolvePropertyOverriddenFromPtrs(static_cast<PropertyNode*>(*p));
+ cn->resolvePropertyOverriddenFromPtrs(static_cast<PropertyNode *>(*p));
++p;
}
resolvePropertyOverriddenFromPtrs(cn);
} else if ((*c)->isNamespace()) {
- resolvePropertyOverriddenFromPtrs(static_cast<NamespaceNode*>(*c));
+ resolvePropertyOverriddenFromPtrs(static_cast<NamespaceNode *>(*c));
}
++c;
}
@@ -317,7 +320,7 @@ void Tree::resolveProperties()
NodeList::ConstIterator c = parent->constBegin();
while (c != parent->constEnd()) {
if ((*c)->isFunction()) {
- FunctionNode *function = static_cast<FunctionNode*>(*c);
+ FunctionNode *function = static_cast<FunctionNode *>(*c);
if (function->access() == property->access() &&
(function->status() == property->status() ||
function->doc().isEmpty())) {
@@ -361,10 +364,10 @@ void Tree::resolveCppToQmlLinks()
{
const NodeList &children = root_.childNodes();
- foreach (Node *child, children) {
+ for (auto *child : children) {
if (child->isQmlType() || child->isJsType()) {
- QmlTypeNode *qcn = static_cast<QmlTypeNode*>(child);
- ClassNode *cn = const_cast<ClassNode*>(qcn->classNode());
+ QmlTypeNode *qcn = static_cast<QmlTypeNode *>(child);
+ ClassNode *cn = const_cast<ClassNode *>(qcn->classNode());
if (cn)
cn->setQmlElement(qcn);
}
@@ -378,9 +381,9 @@ void Tree::resolveCppToQmlLinks()
void Tree::resolveUsingClauses()
{
const NodeList &children = root_.childNodes();
- foreach (Node *child, children) {
+ for (auto *child : children) {
if (child->isClassNode()) {
- ClassNode *cn = static_cast<ClassNode*>(child);
+ ClassNode *cn = static_cast<ClassNode *>(child);
QList<UsingClause> &usingClauses = cn->usingClauses();
QList<UsingClause>::iterator uc = usingClauses.begin();
while (uc != usingClauses.end()) {
@@ -412,9 +415,9 @@ void Tree::removePrivateAndInternalBases(NamespaceNode *rootNode)
NodeList::ConstIterator c = rootNode->constBegin();
while (c != rootNode->constEnd()) {
if ((*c)->isClassNode())
- static_cast<ClassNode*>(*c)->removePrivateAndInternalBases();
+ static_cast<ClassNode *>(*c)->removePrivateAndInternalBases();
else if ((*c)->isNamespace())
- removePrivateAndInternalBases(static_cast<NamespaceNode*>(*c));
+ removePrivateAndInternalBases(static_cast<NamespaceNode *>(*c));
++c;
}
}
@@ -424,10 +427,11 @@ void Tree::removePrivateAndInternalBases(NamespaceNode *rootNode)
ClassList Tree::allBaseClasses(const ClassNode *classNode) const
{
ClassList result;
- foreach (const RelatedClass &r, classNode->baseClasses()) {
- if (r.node_ != nullptr) {
- result += r.node_;
- result += allBaseClasses(r.node_);
+ const auto &baseClasses = classNode->baseClasses();
+ for (const auto &relatedClass : baseClasses) {
+ if (relatedClass.node_ != nullptr) {
+ result += relatedClass.node_;
+ result += allBaseClasses(relatedClass.node_);
}
}
return result;
@@ -468,29 +472,25 @@ Node *Tree::findNodeRecursive(const QStringList &path,
{
if (start == nullptr || path.isEmpty())
return nullptr;
- Node *node = const_cast<Node*>(start);
+ Node *node = const_cast<Node *>(start);
if (!node->isAggregate())
return ((pathIndex >= path.size()) ? node : nullptr);
-#if 0
- if (pathIndex >= path.size())
- return nullptr;
-#endif
- Aggregate *current = static_cast<Aggregate*>(node);
+ Aggregate *current = static_cast<Aggregate *>(node);
const NodeList &children = current->childNodes();
const QString &name = path.at(pathIndex);
- foreach (Node *n, children) {
- if (n == nullptr)
+ for (auto *node : children) {
+ if (node == nullptr)
continue;
- if (n->name() == name) {
+ if (node->name() == name) {
if (pathIndex+1 >= path.size()) {
- if ((n->*(isMatch))())
- return n;
+ if ((node->*(isMatch))())
+ return node;
continue;
}
else { // Search the children of n for the next name in the path.
- n = findNodeRecursive(path, pathIndex+1, n, isMatch);
- if (n != nullptr)
- return n;
+ node = findNodeRecursive(path, pathIndex+1, node, isMatch);
+ if (node != nullptr)
+ return node;
}
}
}
@@ -633,26 +633,26 @@ const Node *Tree::matchPathAndTarget(const QStringList &path,
QString name = path.at(idx);
if (node->isAggregate()) {
NodeVector nodes;
- static_cast<const Aggregate*>(node)->findChildren(name, nodes);
- foreach (const Node *n, nodes) {
- if (genus != Node::DontCare && n->genus() != genus)
+ static_cast<const Aggregate *>(node)->findChildren(name, nodes);
+ for (const auto *node : qAsConst(nodes)) {
+ if (genus != Node::DontCare && node->genus() != genus)
continue;
- const Node *t = matchPathAndTarget(path, idx + 1, target, n, flags, genus, ref);
+ const Node *t = matchPathAndTarget(path, idx + 1, target, node, flags, genus, ref);
if (t && !t->isPrivate())
return t;
}
}
if (target.isEmpty()) {
if ((idx) == (path.size()-1) && node->isAggregate() && (flags & SearchEnumValues)) {
- const Node *t = static_cast<const Aggregate*>(node)->findEnumNodeForValue(path.at(idx));
+ const Node *t = static_cast<const Aggregate *>(node)->findEnumNodeForValue(path.at(idx));
if (t)
return t;
}
}
if (((genus == Node::CPP) || (genus == Node::DontCare)) &&
node->isClassNode() && (flags & SearchBaseClasses)) {
- ClassList bases = allBaseClasses(static_cast<const ClassNode*>(node));
- foreach (const ClassNode *base, bases) {
+ const ClassList bases = allBaseClasses(static_cast<const ClassNode *>(node));
+ for (const auto *base : bases) {
const Node *t = matchPathAndTarget(path, idx, target, base, flags, genus, ref);
if (t && ! t->isPrivate())
return t;
@@ -715,14 +715,14 @@ const Node *Tree::findNode(const QStringList &path,
// We also ignore module nodes as they are not aggregates and thus have no children.
int tmpFlags = (i < path.size() - 1) ? (flags & ~TypesOnly) | IgnoreModules : flags;
- const Node *next = static_cast<const Aggregate*>(node)->findChildNode(path.at(i), genus, tmpFlags);
+ const Node *next = static_cast<const Aggregate *>(node)->findChildNode(path.at(i), genus, tmpFlags);
if ((next == nullptr) && (flags & SearchEnumValues) && i == path.size()-1) {
- next = static_cast<const Aggregate*>(node)->findEnumNodeForValue(path.at(i));
+ next = static_cast<const Aggregate *>(node)->findEnumNodeForValue(path.at(i));
}
if ((next == nullptr) && ((genus == Node::CPP) || (genus == Node::DontCare)) &&
node->isClassNode() && (flags & SearchBaseClasses)) {
- ClassList bases = allBaseClasses(static_cast<const ClassNode*>(node));
- foreach (const ClassNode *base, bases) {
+ const ClassList bases = allBaseClasses(static_cast<const ClassNode *>(node));
+ for (const auto *base : bases) {
next = base->findChildNode(path.at(i), genus, tmpFlags);
if ((next == nullptr) && (flags & SearchEnumValues) && i == path.size() - 1)
next = base->findEnumNodeForValue(path.at(i));
@@ -789,14 +789,14 @@ void Tree::insertTarget(const QString &name,
*/
void Tree::resolveTargets(Aggregate *root)
{
- foreach (Node *child, root->childNodes()) {
+ for (auto *child : root->childNodes()) {
if (child->isTextPageNode()) {
- PageNode *node = static_cast<PageNode*>(child);
+ PageNode *node = static_cast<PageNode *>(child);
QString key = node->title();
if (!key.isEmpty()) {
if (key.contains(QChar(' ')))
key = Doc::canonicalTitle(key);
- QList<PageNode*> nodes = pageNodesByTitle_.values(key);
+ QList<PageNode *> nodes = pageNodesByTitle_.values(key);
bool alreadyThere = false;
if (!nodes.empty()) {
for (int i=0; i< nodes.size(); ++i) {
@@ -814,7 +814,7 @@ void Tree::resolveTargets(Aggregate *root)
}
if (child->doc().hasTableOfContents()) {
- const QList<Atom*> &toc = child->doc().tableOfContents();
+ const QList<Atom *> &toc = child->doc().tableOfContents();
for (int i = 0; i < toc.size(); ++i) {
QString ref = refForAtom(toc.at(i));
QString title = Text::sectionHeading(toc.at(i)).toString();
@@ -827,7 +827,7 @@ void Tree::resolveTargets(Aggregate *root)
}
}
if (child->doc().hasKeywords()) {
- const QList<Atom*> &keywords = child->doc().keywords();
+ const QList<Atom *> &keywords = child->doc().keywords();
for (int i = 0; i < keywords.size(); ++i) {
QString ref = refForAtom(keywords.at(i));
QString title = keywords.at(i)->string();
@@ -839,7 +839,7 @@ void Tree::resolveTargets(Aggregate *root)
}
}
if (child->doc().hasTargets()) {
- const QList<Atom*> &targets = child->doc().targets();
+ const QList<Atom *> &targets = child->doc().targets();
for (int i = 0; i < targets.size(); ++i) {
QString ref = refForAtom(targets.at(i));
QString title = targets.at(i)->string();
@@ -852,7 +852,7 @@ void Tree::resolveTargets(Aggregate *root)
}
}
if (child->isAggregate())
- resolveTargets(static_cast<Aggregate*>(child));
+ resolveTargets(static_cast<Aggregate *>(child));
}
}
@@ -865,7 +865,7 @@ Tree::findUnambiguousTarget(const QString &target, Node::Genus genus, QString &r
{
int numBestTargets = 0;
TargetRec *bestTarget = nullptr;
- QList<TargetRec*> bestTargetList;
+ QList<TargetRec *> bestTargetList;
QString key = target;
TargetMap::const_iterator i = nodesByTargetTitle_.find(key);
@@ -1182,7 +1182,7 @@ CollectionNode *Tree::addToQmlModule(const QString &name, Node *node)
cn->addMember(node);
node->setQmlModule(cn);
if (node->isQmlType()) {
- QmlTypeNode *n = static_cast<QmlTypeNode*>(node);
+ QmlTypeNode *n = static_cast<QmlTypeNode *>(node);
for (int i=0; i<qmid.size(); ++i) {
QString key = qmid[i] + "::" + node->name();
insertQmlType(key, n);
@@ -1213,7 +1213,7 @@ CollectionNode *Tree::addToJsModule(const QString &name, Node *node)
cn->addMember(node);
node->setQmlModule(cn);
if (node->isJsType()) {
- QmlTypeNode *n = static_cast<QmlTypeNode*>(node);
+ QmlTypeNode *n = static_cast<QmlTypeNode *>(node);
for (int i=0; i<qmid.size(); ++i) {
QString key = qmid[i] + "::" + node->name();
insertQmlType(key, n);
@@ -1256,10 +1256,10 @@ const FunctionNode *Tree::findFunctionNode(const QStringList &path,
QStringList p(path[1]);
Node *n = findNodeByNameAndType(p, &Node::isQmlType);
if ((n != nullptr) && (n->isQmlType() || n->isJsType()))
- qcn = static_cast<QmlTypeNode*>(n);
+ qcn = static_cast<QmlTypeNode *>(n);
}
if (qcn != nullptr)
- return static_cast<const FunctionNode*>(qcn->findFunctionChild(path[2], parameters));
+ return static_cast<const FunctionNode *>(qcn->findFunctionChild(path[2], parameters));
}
if (relative == nullptr)
@@ -1277,7 +1277,7 @@ const FunctionNode *Tree::findFunctionNode(const QStringList &path,
if (node == nullptr || !node->isAggregate())
break;
- Aggregate *aggregate = static_cast<Aggregate*>(node);
+ Aggregate *aggregate = static_cast<Aggregate *>(node);
Node *next = nullptr;
if (i == path.size() - 1)
next = aggregate->findFunctionChild(path.at(i), parameters);
@@ -1285,8 +1285,8 @@ const FunctionNode *Tree::findFunctionNode(const QStringList &path,
next = aggregate->findChildNode(path.at(i), genus);
if ((next == nullptr) && aggregate->isClassNode()) {
- ClassList bases = allBaseClasses(static_cast<const ClassNode*>(aggregate));
- foreach (ClassNode *base, bases) {
+ const ClassList bases = allBaseClasses(static_cast<const ClassNode *>(aggregate));
+ for (auto *base : bases) {
if (i == path.size() - 1)
next = base->findFunctionChild(path.at(i), parameters);
else
@@ -1308,7 +1308,7 @@ const FunctionNode *Tree::findFunctionNode(const QStringList &path,
// be marked private. If all the overloads are
// marked private, return the original function node.
// This should be replace with findOverriddenFunctionNode().
- const FunctionNode *fn = static_cast<const FunctionNode*>(node);
+ const FunctionNode *fn = static_cast<const FunctionNode *>(node);
const FunctionNode *FN = fn;
while (FN->isPrivate() && !FN->overridesThis().isEmpty()) {
QStringList path = FN->overridesThis().split("::");
@@ -1384,13 +1384,13 @@ FunctionNode *Tree::findFunctionNodeForTag(const QString &tag, Aggregate *parent
const NodeList &children = parent->childNodes();
for (Node *n : children) {
if (n != nullptr && n->isFunction() && n->hasTag(tag))
- return static_cast<FunctionNode*>(n);
+ return static_cast<FunctionNode *>(n);
}
for (Node *n : children) {
if (n != nullptr && n->isAggregate()) {
- n = findFunctionNodeForTag(tag, static_cast<Aggregate*>(n));
+ n = findFunctionNodeForTag(tag, static_cast<Aggregate *>(n));
if (n != nullptr)
- return static_cast<FunctionNode*>(n);
+ return static_cast<FunctionNode *>(n);
}
}
return nullptr;
@@ -1407,11 +1407,11 @@ FunctionNode *Tree::findMacroNode(const QString &t, const Aggregate *parent)
const NodeList &children = parent->childNodes();
for (Node *n : children) {
if (n != nullptr && (n->isMacro() || n->isFunction()) && n->name() == t)
- return static_cast<FunctionNode*>(n);
+ return static_cast<FunctionNode *>(n);
}
for (Node *n : children) {
if (n != nullptr && n->isAggregate()) {
- FunctionNode *fn = findMacroNode(t, static_cast<Aggregate*>(n));
+ FunctionNode *fn = findMacroNode(t, static_cast<Aggregate *>(n));
if (fn != nullptr)
return fn;
}
diff --git a/src/qdoc/tree.h b/src/qdoc/tree.h
index a70d0f5d2..b9b507f97 100644
--- a/src/qdoc/tree.h
+++ b/src/qdoc/tree.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -33,9 +33,10 @@
#ifndef TREE_H
#define TREE_H
-#include <QtCore/qstack.h>
#include "node.h"
+#include <QtCore/qstack.h>
+
QT_BEGIN_NAMESPACE
class QStringList;
@@ -46,10 +47,10 @@ struct TargetRec
public:
enum TargetType { Unknown, Target, Keyword, Contents, Class, Function, Page, Subtitle };
- TargetRec(const QString& name,
- const QString& title,
+ TargetRec(const QString &name,
+ const QString &title,
TargetRec::TargetType type,
- Node* node,
+ Node *node,
int priority)
: node_(node), ref_(name), title_(title), priority_(priority), type_(type) {
// Discard the dedicated ref for keywords - they always
@@ -61,7 +62,7 @@ struct TargetRec
bool isEmpty() const { return ref_.isEmpty(); }
Node::Genus genus() { return (node_ ? node_->genus() : Node::DontCare); }
- Node* node_;
+ Node *node_;
QString ref_;
QString title_;
int priority_;
@@ -71,21 +72,21 @@ struct TargetRec
struct TargetLoc
{
public:
- TargetLoc(const Node* loc, const QString& t, const QString& fileName, const QString& text, bool broken)
+ TargetLoc(const Node *loc, const QString &t, const QString &fileName, const QString &text, bool broken)
: loc_(loc), target_(t), fileName_(fileName), text_(text), broken_(broken) { }
- const Node* loc_;
+ const Node *loc_;
QString target_;
QString fileName_;
QString text_;
- bool broken_;
+ bool broken_;
};
-typedef QMultiMap<QString, TargetRec*> TargetMap;
-typedef QMultiMap<QString, PageNode*> PageNodeMultiMap;
-typedef QMap<QString, QmlTypeNode*> QmlTypeMap;
-typedef QMultiMap<QString, const ExampleNode*> ExampleNodeMap;
-typedef QVector<TargetLoc*> TargetList;
-typedef QMap<QString, TargetList*> TargetListMap;
+typedef QMultiMap<QString, TargetRec *> TargetMap;
+typedef QMultiMap<QString, PageNode *> PageNodeMultiMap;
+typedef QMap<QString, QmlTypeNode *> QmlTypeMap;
+typedef QMultiMap<QString, const ExampleNode *> ExampleNodeMap;
+typedef QVector<TargetLoc *> TargetList;
+typedef QMap<QString, TargetList *> TargetListMap;
class Tree
{
@@ -94,9 +95,9 @@ class Tree
private: // Note the constructor and destructor are private.
typedef QMap<PropertyNode::FunctionRole, QString> RoleMap;
- typedef QMap<PropertyNode*, RoleMap> PropertyMap;
+ typedef QMap<PropertyNode *, RoleMap> PropertyMap;
- Tree(const QString& camelCaseModuleName, QDocDatabase* qdb);
+ Tree(const QString &camelCaseModuleName, QDocDatabase *qdb);
~Tree();
public: // Of necessity, a few public functions remain.
@@ -115,55 +116,49 @@ class Tree
private: // The rest of the class is private.
Aggregate *findAggregate(const QString &name);
- Node* findNodeForInclude(const QStringList& path) const;
- ClassNode* findClassNode(const QStringList& path, const Node* start = nullptr) const;
- NamespaceNode* findNamespaceNode(const QStringList& path) const;
+ Node *findNodeForInclude(const QStringList &path) const;
+ ClassNode *findClassNode(const QStringList &path, const Node *start = nullptr) const;
+ NamespaceNode *findNamespaceNode(const QStringList &path) const;
const FunctionNode *findFunctionNode(const QStringList &path,
const Parameters &parameters,
const Node *relative,
Node::Genus genus) const;
- Node* findNodeRecursive(const QStringList& path,
+ Node *findNodeRecursive(const QStringList &path,
int pathIndex,
- const Node* start,
+ const Node *start,
bool (Node::*) () const) const;
-#if 0
- Node* findNodeRecursive(const QStringList& path,
- int pathIndex,
- const Node* start,
- Node::NodeType type) const;
-#endif
- const Node* findNodeForTarget(const QStringList& path,
- const QString& target,
- const Node* node,
+ const Node *findNodeForTarget(const QStringList &path,
+ const QString &target,
+ const Node *node,
int flags,
Node::Genus genus,
- QString& ref) const;
- const Node* matchPathAndTarget(const QStringList& path,
+ QString &ref) const;
+ const Node *matchPathAndTarget(const QStringList &path,
int idx,
- const QString& target,
- const Node* node,
+ const QString &target,
+ const Node *node,
int flags,
Node::Genus genus,
- QString& ref) const;
+ QString &ref) const;
- const Node* findNode(const QStringList &path,
+ const Node *findNode(const QStringList &path,
const Node *relative,
int flags,
Node::Genus genus) const;
- QmlTypeNode* findQmlTypeNode(const QStringList& path);
+ QmlTypeNode *findQmlTypeNode(const QStringList &path);
- Node* findNodeByNameAndType(const QStringList& path, bool (Node::*isMatch) () const) const;
- Aggregate* findRelatesNode(const QStringList& path);
- QString getRef(const QString& target, const Node* node) const;
- void insertTarget(const QString& name,
- const QString& title,
+ Node *findNodeByNameAndType(const QStringList &path, bool (Node::*isMatch) () const) const;
+ Aggregate *findRelatesNode(const QStringList &path);
+ QString getRef(const QString &target, const Node *node) const;
+ void insertTarget(const QString &name,
+ const QString &title,
TargetRec::TargetType type,
- Node* node,
+ Node *node,
int priority);
- void resolveTargets(Aggregate* root);
- const Node* findUnambiguousTarget(const QString& target, Node::Genus genus, QString& ref) const;
- const PageNode* findPageNodeByTitle(const QString& title) const;
+ void resolveTargets(Aggregate *root);
+ const Node *findUnambiguousTarget(const QString &target, Node::Genus genus, QString &ref) const;
+ const PageNode *findPageNodeByTitle(const QString &title) const;
void addPropertyFunction(PropertyNode *property,
const QString &funcName,
@@ -179,49 +174,49 @@ class Tree
const NamespaceNode *root() const { return &root_; }
ClassList allBaseClasses(const ClassNode *classe) const;
- QString refForAtom(const Atom* atom);
-
- CNMap* getCollectionMap(Node::NodeType type);
- const CNMap& groups() const { return groups_; }
- const CNMap& modules() const { return modules_; }
- const CNMap& qmlModules() const { return qmlModules_; }
- const CNMap& jsModules() const { return jsModules_; }
-
- CollectionNode* getCollection(const QString& name, Node::NodeType type);
- CollectionNode* findCollection(const QString& name, Node::NodeType type);
-
- CollectionNode* findGroup(const QString& name) { return findCollection(name, Node::Group); }
- CollectionNode* findModule(const QString& name) { return findCollection(name, Node::Module); }
- CollectionNode* findQmlModule(const QString& name) { return findCollection(name, Node::QmlModule); }
- CollectionNode* findJsModule(const QString& name) { return findCollection(name, Node::JsModule); }
-
- CollectionNode* addGroup(const QString& name) { return findGroup(name); }
- CollectionNode* addModule(const QString& name) { return findModule(name); }
- CollectionNode* addQmlModule(const QString& name) { return findQmlModule(name); }
- CollectionNode* addJsModule(const QString& name) { return findJsModule(name); }
-
- CollectionNode* addToGroup(const QString& name, Node* node);
- CollectionNode* addToModule(const QString& name, Node* node);
- CollectionNode* addToQmlModule(const QString& name, Node* node);
- CollectionNode* addToJsModule(const QString& name, Node* node);
-
- QmlTypeNode* lookupQmlType(const QString& name) const { return qmlTypeMap_.value(name); }
- Aggregate* lookupQmlBasicType(const QString& name) const { return qmlTypeMap_.value(name); }
- void insertQmlType(const QString& key, QmlTypeNode* n);
- void addExampleNode(ExampleNode* n) { exampleNodeMap_.insert(n->title(), n); }
- ExampleNodeMap& exampleNodeMap() { return exampleNodeMap_; }
- void setIndexFileName(const QString& t) { indexFileName_ = t; }
+ QString refForAtom(const Atom *atom);
+
+ CNMap *getCollectionMap(Node::NodeType type);
+ const CNMap &groups() const { return groups_; }
+ const CNMap &modules() const { return modules_; }
+ const CNMap &qmlModules() const { return qmlModules_; }
+ const CNMap &jsModules() const { return jsModules_; }
+
+ CollectionNode *getCollection(const QString &name, Node::NodeType type);
+ CollectionNode *findCollection(const QString &name, Node::NodeType type);
+
+ CollectionNode *findGroup(const QString &name) { return findCollection(name, Node::Group); }
+ CollectionNode *findModule(const QString &name) { return findCollection(name, Node::Module); }
+ CollectionNode *findQmlModule(const QString &name) { return findCollection(name, Node::QmlModule); }
+ CollectionNode *findJsModule(const QString &name) { return findCollection(name, Node::JsModule); }
+
+ CollectionNode *addGroup(const QString &name) { return findGroup(name); }
+ CollectionNode *addModule(const QString &name) { return findModule(name); }
+ CollectionNode *addQmlModule(const QString &name) { return findQmlModule(name); }
+ CollectionNode *addJsModule(const QString &name) { return findJsModule(name); }
+
+ CollectionNode *addToGroup(const QString &name, Node *node);
+ CollectionNode *addToModule(const QString &name, Node *node);
+ CollectionNode *addToQmlModule(const QString &name, Node *node);
+ CollectionNode *addToJsModule(const QString &name, Node *node);
+
+ QmlTypeNode *lookupQmlType(const QString &name) const { return qmlTypeMap_.value(name); }
+ Aggregate *lookupQmlBasicType(const QString &name) const { return qmlTypeMap_.value(name); }
+ void insertQmlType(const QString &key, QmlTypeNode *n);
+ void addExampleNode(ExampleNode *n) { exampleNodeMap_.insert(n->title(), n); }
+ ExampleNodeMap &exampleNodeMap() { return exampleNodeMap_; }
+ void setIndexFileName(const QString &t) { indexFileName_ = t; }
bool treeHasBeenAnalyzed() const { return treeHasBeenAnalyzed_; }
bool docsHaveBeenGenerated() const { return docsHaveBeenGenerated_; }
void setTreeHasBeenAnalyzed() { treeHasBeenAnalyzed_ = true; }
void setdocsHaveBeenGenerated() { docsHaveBeenGenerated_ = true; }
- QString getNewLinkTarget(const Node* locNode,
- const Node* t,
- const QString& fileName,
- QString& text,
+ QString getNewLinkTarget(const Node *locNode,
+ const Node *t,
+ const QString &fileName,
+ QString &text,
bool broken);
- TargetList* getTargetList(const QString& module);
+ TargetList* getTargetList(const QString &module);
QStringList getTargetListKeys() { return targetListMap_->keys(); }
FunctionNode *findFunctionNodeForTag(const QString &tag, Aggregate *parent = nullptr);
FunctionNode *findMacroNode(const QString &t, const Aggregate *parent = nullptr);
@@ -234,21 +229,21 @@ private:
QString physicalModuleName_;
QString indexFileName_;
QString indexTitle_;
- QDocDatabase* qdb_;
+ QDocDatabase *qdb_;
NamespaceNode root_;
PropertyMap unresolvedPropertyMap;
- PageNodeMultiMap pageNodesByTitle_;
- TargetMap nodesByTargetRef_;
- TargetMap nodesByTargetTitle_;
- CNMap groups_;
- CNMap modules_;
- CNMap qmlModules_;
- CNMap jsModules_;
- QmlTypeMap qmlTypeMap_;
- ExampleNodeMap exampleNodeMap_;
- TargetListMap* targetListMap_;
+ PageNodeMultiMap pageNodesByTitle_;
+ TargetMap nodesByTargetRef_;
+ TargetMap nodesByTargetTitle_;
+ CNMap groups_;
+ CNMap modules_;
+ CNMap qmlModules_;
+ CNMap jsModules_;
+ QmlTypeMap qmlTypeMap_;
+ ExampleNodeMap exampleNodeMap_;
+ TargetListMap *targetListMap_;
NodeList proxies_;
- NodeMap dontDocumentMap_;
+ NodeMap dontDocumentMap_;
};
QT_END_NAMESPACE
diff --git a/src/qdoc/utilities.cpp b/src/qdoc/utilities.cpp
new file mode 100644
index 000000000..308bb2c66
--- /dev/null
+++ b/src/qdoc/utilities.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "utilities.h"
+#include "loggingcategory.h"
+
+/*!
+ \namespace Utilities
+ \internal
+ \brief This namespace holds QDoc-internal utility methods.
+ */
+namespace Utilities {
+ static inline void setDebugEnabled(bool value)
+ {
+ const_cast<QLoggingCategory &>(lcQdoc()).setEnabled(QtDebugMsg, value);
+ }
+
+ void startDebugging(const QString &message)
+ {
+ setDebugEnabled(true);
+ qCDebug(lcQdoc, "START DEBUGGING: %ls", qUtf16Printable(message));
+ }
+
+ void stopDebugging(const QString &message)
+ {
+ qCDebug(lcQdoc, "STOP DEBUGGING: %ls", qUtf16Printable(message));
+ setDebugEnabled(false);
+ }
+
+ bool debugging()
+ {
+ return lcQdoc().isEnabled(QtDebugMsg);
+ }
+}
diff --git a/src/qdoc/utilities.h b/src/qdoc/utilities.h
new file mode 100644
index 000000000..da848795e
--- /dev/null
+++ b/src/qdoc/utilities.h
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef UTILITIES_H
+#define UTILITIES_H
+
+#include <QtCore/qstring.h>
+
+namespace Utilities
+{
+ void startDebugging(const QString &message);
+ void stopDebugging(const QString &message);
+ bool debugging();
+};
+
+#endif // UTILITIES_H
diff --git a/src/qdoc/webxmlgenerator.cpp b/src/qdoc/webxmlgenerator.cpp
index cc067b480..05e1c9b42 100644
--- a/src/qdoc/webxmlgenerator.cpp
+++ b/src/qdoc/webxmlgenerator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -27,12 +27,13 @@
****************************************************************************/
#include "webxmlgenerator.h"
+
+#include "helpprojectwriter.h"
#include "node.h"
+#include "qdocdatabase.h"
#include "separator.h"
#include "quoter.h"
#include "tree.h"
-#include "qdocdatabase.h"
-#include "helpprojectwriter.h"
#include <QtCore/qxmlstream.h>
@@ -259,7 +260,7 @@ void WebXMLGenerator::generateDocumentation(Node *node)
if (node->parent()) {
if (node->isNamespace() || node->isClassNode() || node->isHeader())
- generateCppReferencePage(static_cast<Aggregate*>(node), nullptr);
+ generateCppReferencePage(static_cast<Aggregate *>(node), nullptr);
else if (node->isCollectionNode()) {
if (node->wasSeen()) {
// see remarks in base class impl.
@@ -273,7 +274,7 @@ void WebXMLGenerator::generateDocumentation(Node *node)
}
if (node->isAggregate()) {
- Aggregate* aggregate = static_cast<Aggregate*>(node);
+ Aggregate *aggregate = static_cast<Aggregate *>(node);
for (auto c : aggregate->childNodes()) {
if ((c->isAggregate() ||
c->isTextPageNode() ||
@@ -781,7 +782,7 @@ void WebXMLGenerator::startLink(QXmlStreamWriter &writer, const Atom *atom,
break;
}
}
- // fall through
+ Q_FALLTHROUGH();
case Node::Page:
writer.writeAttribute("page", fullName);
break;
@@ -791,8 +792,9 @@ void WebXMLGenerator::startLink(QXmlStreamWriter &writer, const Atom *atom,
if (propertyNode->getters().size() > 0)
writer.writeAttribute("getter", propertyNode->getters().at(0)->fullName());
}
+ break;
default:
- ;
+ break;
}
}
inLink = true;
diff --git a/src/qdoc/webxmlgenerator.h b/src/qdoc/webxmlgenerator.h
index cfb87382b..5e3e0e9e2 100644
--- a/src/qdoc/webxmlgenerator.h
+++ b/src/qdoc/webxmlgenerator.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -34,8 +34,8 @@
#include "htmlgenerator.h"
#include "qdocindexfiles.h"
-#include <QtCore/qxmlstream.h>
#include <QtCore/qscopedpointer.h>
+#include <QtCore/qxmlstream.h>
QT_BEGIN_NAMESPACE
@@ -43,7 +43,6 @@ class WebXMLGenerator : public HtmlGenerator, public IndexSectionWriter
{
public:
explicit WebXMLGenerator() {}
- ~WebXMLGenerator() {}
void initializeGenerator(const Config &config) override;
void terminateGenerator() override;
diff --git a/src/qdoc/yyindent.cpp b/src/qdoc/yyindent.cpp
index 0f6ea4494..6e4b1a6ca 100644
--- a/src/qdoc/yyindent.cpp
+++ b/src/qdoc/yyindent.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
@@ -65,8 +65,8 @@
as comments and string literals are removed beforehand.
*/
-#include <qregexp.h>
-#include <qstringlist.h>
+#include <QtCore/qregexp.h>
+#include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE
@@ -102,12 +102,12 @@ static int ppContinuationIndentSize = 8;
static const int ppCommentOffset = 2;
-void setTabSize( int size )
+void setTabSize(int size)
{
ppHardwareTabSize = size;
}
-void setIndentSize( int size )
+void setIndentSize(int size)
{
ppIndentSize = size;
ppContinuationIndentSize = 2 * size;
@@ -123,11 +123,11 @@ static QRegExp *iflikeKeyword = nullptr;
Returns the first non-space character in the string t, or
QChar::Null if the string is made only of white space.
*/
-static QChar firstNonWhiteSpace( const QString& t )
+static QChar firstNonWhiteSpace(const QString &t)
{
int i = 0;
- while ( i < (int) t.length() ) {
- if ( !t[i].isSpace() )
+ while (i < (int) t.length()) {
+ if (!t[i].isSpace())
return t[i];
i++;
}
@@ -138,9 +138,9 @@ static QChar firstNonWhiteSpace( const QString& t )
Returns \c true if string t is made only of white space; otherwise
returns \c false.
*/
-static bool isOnlyWhiteSpace( const QString& t )
+static bool isOnlyWhiteSpace(const QString &t)
{
- return firstNonWhiteSpace( t ).isNull();
+ return firstNonWhiteSpace(t).isNull();
}
/*
@@ -148,15 +148,15 @@ static bool isOnlyWhiteSpace( const QString& t )
index. Column numbers and index are identical for strings that don't
contain '\t's.
*/
-int columnForIndex( const QString& t, int index )
+int columnForIndex(const QString &t, int index)
{
int col = 0;
- if ( index > (int) t.length() )
+ if (index > (int) t.length())
index = t.length();
- for ( int i = 0; i < index; i++ ) {
- if ( t[i] == QChar('\t') ) {
- col = ( (col / ppHardwareTabSize) + 1 ) * ppHardwareTabSize;
+ for (int i = 0; i < index; i++) {
+ if (t[i] == QChar('\t')) {
+ col = ((col / ppHardwareTabSize) + 1) * ppHardwareTabSize;
} else {
col++;
}
@@ -167,9 +167,9 @@ int columnForIndex( const QString& t, int index )
/*
Returns the indentation size of string t.
*/
-int indentOfLine( const QString& t )
+int indentOfLine(const QString &t)
{
- return columnForIndex( t, t.indexOf(firstNonWhiteSpace(t)) );
+ return columnForIndex(t, t.indexOf(firstNonWhiteSpace(t)));
}
/*
@@ -178,9 +178,9 @@ int indentOfLine( const QString& t )
provisions are taken against '\n' or '\r', which shouldn't occur in
t anyway.
*/
-static inline void eraseChar( QString& t, int k, QChar ch )
+static inline void eraseChar(QString &t, int k, QChar ch)
{
- if ( t[k] != '\t' )
+ if (t[k] != '\t')
t[k] = ch;
}
@@ -188,7 +188,7 @@ static inline void eraseChar( QString& t, int k, QChar ch )
Removes some nefast constructs from a code line and returns the
resulting line.
*/
-static QString trimmedCodeLine( const QString& t )
+static QString trimmedCodeLine(const QString &t)
{
QString trimmed = t;
int k;
@@ -201,9 +201,9 @@ static QString trimmedCodeLine( const QString& t )
continuation lines.
*/
k = 0;
- while ( (k = trimmed.indexOf(*literal, k)) != -1 ) {
- for ( int i = 0; i < literal->matchedLength(); i++ )
- eraseChar( trimmed, k + i, 'X' );
+ while ((k = trimmed.indexOf(*literal, k)) != -1) {
+ for (int i = 0; i < literal->matchedLength(); i++)
+ eraseChar(trimmed, k + i, 'X');
k += literal->matchedLength();
}
@@ -212,9 +212,9 @@ static QString trimmedCodeLine( const QString& t )
handled elsewhere.
*/
k = 0;
- while ( (k = trimmed.indexOf(*inlineCComment, k)) != -1 ) {
- for ( int i = 0; i < inlineCComment->matchedLength(); i++ )
- eraseChar( trimmed, k + i, ' ' );
+ while ((k = trimmed.indexOf(*inlineCComment, k)) != -1) {
+ for (int i = 0; i < inlineCComment->matchedLength(); i++)
+ eraseChar(trimmed, k + i, ' ');
k += inlineCComment->matchedLength();
}
@@ -225,21 +225,21 @@ static QString trimmedCodeLine( const QString& t )
foo1: bar1;
bar2;
*/
- while ( trimmed.lastIndexOf(':') != -1 && trimmed.indexOf(*label) != -1 ) {
- QString cap1 = label->cap( 1 );
- int pos1 = label->pos( 1 );
+ while (trimmed.lastIndexOf(':') != -1 && trimmed.indexOf(*label) != -1) {
+ QString cap1 = label->cap(1);
+ int pos1 = label->pos(1);
int stop = cap1.length();
- if ( pos1 + stop < (int) trimmed.length() && ppIndentSize < stop )
+ if (pos1 + stop < (int) trimmed.length() && ppIndentSize < stop)
stop = ppIndentSize;
int i = 0;
- while ( i < stop ) {
- eraseChar( trimmed, pos1 + i, ' ' );
+ while (i < stop) {
+ eraseChar(trimmed, pos1 + i, ' ');
i++;
}
- while ( i < (int) cap1.length() ) {
- eraseChar( trimmed, pos1 + i, ';' );
+ while (i < (int) cap1.length()) {
+ eraseChar(trimmed, pos1 + i, ';');
i++;
}
}
@@ -248,8 +248,8 @@ static QString trimmedCodeLine( const QString& t )
Remove C++-style comments.
*/
k = trimmed.indexOf( "//" );
- if ( k != -1 )
- trimmed.truncate( k );
+ if (k != -1)
+ trimmed.truncate(k);
return trimmed;
}
@@ -258,12 +258,12 @@ static QString trimmedCodeLine( const QString& t )
Returns '(' if the last parenthesis is opening, ')' if it is
closing, and QChar::Null if there are no parentheses in t.
*/
-static inline QChar lastParen( const QString& t )
+static inline QChar lastParen(const QString &t)
{
int i = t.length();
- while ( i > 0 ) {
+ while (i > 0) {
i--;
- if ( t[i] == QChar('(') || t[i] == QChar(')') )
+ if (t[i] == QChar('(') || t[i] == QChar(')'))
return t[i];
}
return QChar::Null;
@@ -273,7 +273,7 @@ static inline QChar lastParen( const QString& t )
Returns \c true if typedIn the same as okayCh or is null; otherwise
returns \c false.
*/
-static inline bool okay( QChar typedIn, QChar okayCh )
+static inline bool okay(QChar typedIn, QChar okayCh)
{
return typedIn == QChar::Null || typedIn == okayCh;
}
@@ -324,10 +324,10 @@ static bool readLine()
int k;
yyLinizerState->leftBraceFollows =
- ( firstNonWhiteSpace(yyLinizerState->line) == QChar('{') );
+ (firstNonWhiteSpace(yyLinizerState->line) == QChar('{'));
do {
- if ( yyLinizerState->iter == yyProgram->constBegin() ) {
+ if (yyLinizerState->iter == yyProgram->constBegin()) {
yyLinizerState->line.clear();
return false;
}
@@ -335,7 +335,7 @@ static bool readLine()
--yyLinizerState->iter;
yyLinizerState->line = *yyLinizerState->iter;
- yyLinizerState->line = trimmedCodeLine( yyLinizerState->line );
+ yyLinizerState->line = trimmedCodeLine(yyLinizerState->line);
/*
Remove C-style comments that span multiple lines. If the
@@ -347,25 +347,25 @@ static bool readLine()
the first if. The order of the if's is also important.
*/
- if ( yyLinizerState->inCComment ) {
- QString slashAster( "/*" );
+ if (yyLinizerState->inCComment) {
+ QString slashAster("/*");
- k = yyLinizerState->line.indexOf( slashAster );
- if ( k == -1 ) {
+ k = yyLinizerState->line.indexOf(slashAster);
+ if (k == -1) {
yyLinizerState->line.clear();
} else {
- yyLinizerState->line.truncate( k );
+ yyLinizerState->line.truncate(k);
yyLinizerState->inCComment = false;
}
}
- if ( !yyLinizerState->inCComment ) {
- QString asterSlash( "*/" );
+ if (!yyLinizerState->inCComment) {
+ QString asterSlash("*/");
- k = yyLinizerState->line.indexOf( asterSlash );
- if ( k != -1 ) {
- for ( int i = 0; i < k + 2; i++ )
- eraseChar( yyLinizerState->line, i, ' ' );
+ k = yyLinizerState->line.indexOf(asterSlash);
+ if (k != -1) {
+ for (int i = 0; i < k + 2; i++)
+ eraseChar(yyLinizerState->line, i, ' ');
yyLinizerState->inCComment = true;
}
}
@@ -374,11 +374,11 @@ static bool readLine()
Remove preprocessor directives.
*/
k = 0;
- while ( k < (int) yyLinizerState->line.length() ) {
+ while (k < (int) yyLinizerState->line.length()) {
QChar ch = yyLinizerState->line[k];
- if ( ch == QChar('#') ) {
+ if (ch == QChar('#')) {
yyLinizerState->line.clear();
- } else if ( !ch.isSpace() ) {
+ } else if (!ch.isSpace()) {
break;
}
k++;
@@ -388,17 +388,17 @@ static bool readLine()
Remove trailing spaces.
*/
k = yyLinizerState->line.length();
- while ( k > 0 && yyLinizerState->line[k - 1].isSpace() )
+ while (k > 0 && yyLinizerState->line[k - 1].isSpace())
k--;
- yyLinizerState->line.truncate( k );
+ yyLinizerState->line.truncate(k);
/*
'}' increment the brace depth and '{' decrements it and not
the other way around, as we are parsing backwards.
*/
yyLinizerState->braceDepth +=
- yyLinizerState->line.count( '}' ) -
- yyLinizerState->line.count( '{' );
+ yyLinizerState->line.count('}') -
+ yyLinizerState->line.count('{');
/*
We use a dirty trick for
@@ -411,13 +411,13 @@ static bool readLine()
}
else ...
*/
- if ( yyLinizerState->pendingRightBrace )
+ if (yyLinizerState->pendingRightBrace)
yyLinizerState->braceDepth++;
yyLinizerState->pendingRightBrace =
- ( yyLinizerState->line.indexOf(*braceX) == 0 );
- if ( yyLinizerState->pendingRightBrace )
+ (yyLinizerState->line.indexOf(*braceX) == 0);
+ if (yyLinizerState->pendingRightBrace)
yyLinizerState->braceDepth--;
- } while ( yyLinizerState->line.isEmpty() );
+ } while (yyLinizerState->line.isEmpty());
return true;
}
@@ -449,8 +449,8 @@ static void startLinizer()
*/
static bool bottomLineStartsInCComment()
{
- QString slashAster( "/*" );
- QString asterSlash( "*/" );
+ QString slashAster("/*");
+ QString asterSlash("*/");
/*
We could use the linizer here, but that would slow us down
@@ -459,17 +459,17 @@ static bool bottomLineStartsInCComment()
QStringList::ConstIterator p = yyProgram->constEnd();
--p; // skip bottom line
- for ( int i = 0; i < BigRoof; i++ ) {
- if ( p == yyProgram->constBegin() )
+ for (int i = 0; i < BigRoof; i++) {
+ if (p == yyProgram->constBegin())
return false;
--p;
- if ( (*p).indexOf(slashAster) != -1 || (*p).indexOf(asterSlash) != -1 ) {
- QString trimmed = trimmedCodeLine( *p );
+ if ((*p).indexOf(slashAster) != -1 || (*p).indexOf(asterSlash) != -1) {
+ QString trimmed = trimmedCodeLine(*p);
- if ( trimmed.indexOf(slashAster) != -1 ) {
+ if (trimmed.indexOf(slashAster) != -1) {
return true;
- } else if ( trimmed.indexOf(asterSlash) != -1 ) {
+ } else if (trimmed.indexOf(asterSlash) != -1) {
return false;
}
}
@@ -487,24 +487,24 @@ static bool bottomLineStartsInCComment()
*/
static int indentWhenBottomLineStartsInCComment()
{
- int k = yyLine->lastIndexOf( "/*" );
- if ( k == -1 ) {
+ int k = yyLine->lastIndexOf("/*");
+ if (k == -1) {
/*
We found a normal text line in a comment. Align the
bottom line with the text on this line.
*/
- return indentOfLine( *yyLine );
+ return indentOfLine(*yyLine);
} else {
/*
The C-style comment starts on this line. If there is
text on the same line, align with it. Otherwise, align
with the slash-aster plus a given offset.
*/
- int indent = columnForIndex( *yyLine, k );
+ int indent = columnForIndex(*yyLine, k);
k += 2;
- while ( k < (int) yyLine->length() ) {
- if ( !(*yyLine)[k].isSpace() )
- return columnForIndex( *yyLine, k );
+ while (k < (int) yyLine->length()) {
+ if (!(*yyLine)[k].isSpace())
+ return columnForIndex(*yyLine, k);
k++;
}
return indent + ppCommentOffset;
@@ -533,26 +533,26 @@ static bool matchBracelessControlStatement()
{
int delimDepth = 0;
- if ( yyLine->endsWith("else") )
+ if (yyLine->endsWith("else"))
return true;
- if ( !yyLine->endsWith(QLatin1Char(')')) )
+ if (!yyLine->endsWith(QLatin1Char(')')))
return false;
- for ( int i = 0; i < SmallRoof; i++ ) {
+ for (int i = 0; i < SmallRoof; i++) {
int j = yyLine->length();
- while ( j > 0 ) {
+ while (j > 0) {
j--;
QChar ch = (*yyLine)[j];
- switch ( ch.unicode() ) {
+ switch (ch.unicode()) {
case ')':
delimDepth++;
break;
case '(':
delimDepth--;
- if ( delimDepth == 0 ) {
- if ( yyLine->indexOf(*iflikeKeyword) != -1 ) {
+ if (delimDepth == 0) {
+ if (yyLine->indexOf(*iflikeKeyword) != -1) {
/*
We have
@@ -565,7 +565,7 @@ static bool matchBracelessControlStatement()
return true;
}
}
- if ( delimDepth == -1 ) {
+ if (delimDepth == -1) {
/*
We have
@@ -589,12 +589,12 @@ static bool matchBracelessControlStatement()
continuation line. Be careful with ';' in for,
though.
*/
- if ( ch != QChar(';') || delimDepth == 0 )
+ if (ch != QChar(';') || delimDepth == 0)
return false;
}
}
- if ( !readLine() )
+ if (!readLine())
break;
}
return false;
@@ -620,27 +620,27 @@ static bool isUnfinishedLine()
YY_SAVE();
- if ( yyLine->isEmpty() )
+ if (yyLine->isEmpty())
return false;
QChar lastCh = (*yyLine)[(int) yyLine->length() - 1];
- if ( QString("{};").indexOf(lastCh) == -1 && !yyLine->endsWith("...") ) {
+ if (QString("{};").indexOf(lastCh) == -1 && !yyLine->endsWith("...")) {
/*
It doesn't end with ';' or similar. If it's neither
"Q_OBJECT" nor "if ( x )", it must be an unfinished line.
*/
- unf = ( yyLine->indexOf("Q_OBJECT") == -1 &&
- !matchBracelessControlStatement() );
- } else if ( lastCh == QChar(';') ) {
- if ( lastParen(*yyLine) == QChar('(') ) {
+ unf = (yyLine->indexOf("Q_OBJECT") == -1 &&
+ !matchBracelessControlStatement());
+ } else if (lastCh == QChar(';')) {
+ if (lastParen(*yyLine) == QChar('(')) {
/*
Exception:
for ( int i = 1; i < 10;
*/
unf = true;
- } else if ( readLine() && yyLine->endsWith(QLatin1Char(';')) &&
- lastParen(*yyLine) == QChar('(') ) {
+ } else if (readLine() && yyLine->endsWith(QLatin1Char(';')) &&
+ lastParen(*yyLine) == QChar('(')) {
/*
Exception:
@@ -664,7 +664,7 @@ static bool isContinuationLine()
bool cont = false;
YY_SAVE();
- if ( readLine() )
+ if (readLine())
cont = isUnfinishedLine();
YY_RESTORE();
return cont;
@@ -685,15 +685,15 @@ static int indentForContinuationLine()
bool leftBraceFollowed = *yyLeftBraceFollows;
- for ( int i = 0; i < SmallRoof; i++ ) {
+ for (int i = 0; i < SmallRoof; i++) {
int hook = -1;
int j = yyLine->length();
- while ( j > 0 && hook < 0 ) {
+ while (j > 0 && hook < 0) {
j--;
QChar ch = (*yyLine)[j];
- switch ( ch.unicode() ) {
+ switch (ch.unicode()) {
case ')':
case ']':
delimDepth++;
@@ -708,7 +708,7 @@ static int indentForContinuationLine()
An unclosed delimiter is a good place to align at,
at least for some styles (including Qt's).
*/
- if ( delimDepth == -1 )
+ if (delimDepth == -1)
hook = j;
break;
case '{':
@@ -720,7 +720,7 @@ static int indentForContinuationLine()
delimiters.
*/
if ( braceDepth == -1 ) {
- if ( j < (int) yyLine->length() - 1 ) {
+ if (j < (int) yyLine->length() - 1) {
hook = j;
} else {
return 0; // shouldn't happen
@@ -753,18 +753,18 @@ static int indentForContinuationLine()
end of the unfinished lines or by unbalanced
parentheses.
*/
- if ( QString("!=<>").indexOf((*yyLine)[j - 1]) == -1 &&
- (*yyLine)[j + 1] != '=' ) {
- if ( braceDepth == 0 && delimDepth == 0 &&
+ if (QString("!=<>").indexOf((*yyLine)[j - 1]) == -1 &&
+ (*yyLine)[j + 1] != '=') {
+ if (braceDepth == 0 && delimDepth == 0 &&
j < (int) yyLine->length() - 1 &&
!yyLine->endsWith(QLatin1Char(',')) &&
- (yyLine->contains('(') == yyLine->contains(')')) )
+ (yyLine->contains('(') == yyLine->contains(')')))
hook = j;
}
}
}
- if ( hook >= 0 ) {
+ if (hook >= 0) {
/*
Yes, we have a delimiter or an operator to align
against! We don't really align against it, but rather
@@ -780,23 +780,23 @@ static int indentForContinuationLine()
"foo foo foo foo foo foo foo foo foo") );
*/
hook++;
- while ( hook < (int) yyLine->length() ) {
- if ( !(*yyLine)[hook].isSpace() )
- return columnForIndex( *yyLine, hook );
+ while (hook < (int) yyLine->length()) {
+ if (!(*yyLine)[hook].isSpace())
+ return columnForIndex(*yyLine, hook);
hook++;
}
- return indentOfLine( *yyLine ) + ppContinuationIndentSize;
+ return indentOfLine(*yyLine) + ppContinuationIndentSize;
}
- if ( braceDepth != 0 )
+ if (braceDepth != 0)
break;
/*
The line's delimiters are balanced. It looks like a
continuation line or something.
*/
- if ( delimDepth == 0 ) {
- if ( leftBraceFollowed ) {
+ if (delimDepth == 0) {
+ if (leftBraceFollowed) {
/*
We have
@@ -811,9 +811,9 @@ static int indentForContinuationLine()
The "{" should be flush left.
*/
- if ( !isContinuationLine() )
- return indentOfLine( *yyLine );
- } else if ( isContinuationLine() || yyLine->endsWith(QLatin1Char(',')) ) {
+ if (!isContinuationLine())
+ return indentOfLine(*yyLine);
+ } else if (isContinuationLine() || yyLine->endsWith(QLatin1Char(','))) {
/*
We have
@@ -830,7 +830,7 @@ static int indentForContinuationLine()
The "c;" should fall right under the "b +", and the
"4, 5, 6" right under the "1, 2, 3,".
*/
- return indentOfLine( *yyLine );
+ return indentOfLine(*yyLine);
} else {
/*
We have
@@ -848,11 +848,11 @@ static int indentForContinuationLine()
We do have a special trick above for the assignment
operator above, though.
*/
- return indentOfLine( *yyLine ) + ppContinuationIndentSize;
+ return indentOfLine(*yyLine) + ppContinuationIndentSize;
}
}
- if ( !readLine() )
+ if (!readLine())
break;
}
return 0;
@@ -911,11 +911,11 @@ static int indentForContinuationLine()
*/
static int indentForStandaloneLine()
{
- for ( int i = 0; i < SmallRoof; i++ ) {
- if ( !*yyLeftBraceFollows ) {
+ for (int i = 0; i < SmallRoof; i++) {
+ if (!*yyLeftBraceFollows) {
YY_SAVE();
- if ( matchBracelessControlStatement() ) {
+ if (matchBracelessControlStatement()) {
/*
The situation is this, and we want to indent "z;":
@@ -925,12 +925,12 @@ static int indentForStandaloneLine()
yyLine is "if ( x &&".
*/
- return indentOfLine( *yyLine ) + ppIndentSize;
+ return indentOfLine(*yyLine) + ppIndentSize;
}
YY_RESTORE();
}
- if ( yyLine->endsWith(QLatin1Char(';')) || yyLine->contains('{') ) {
+ if (yyLine->endsWith(QLatin1Char(';')) || yyLine->contains('{')) {
/*
The situation is possibly this, and we want to indent
"z;":
@@ -943,42 +943,42 @@ static int indentForStandaloneLine()
any arbitrarily complex compound statement can appear.
*/
- if ( *yyBraceDepth > 0 ) {
+ if (*yyBraceDepth > 0) {
do {
- if ( !readLine() )
+ if (!readLine())
break;
- } while ( *yyBraceDepth > 0 );
+ } while (*yyBraceDepth > 0);
}
LinizerState hookState;
- while ( isContinuationLine() )
+ while (isContinuationLine())
readLine();
hookState = *yyLinizerState;
readLine();
- if ( *yyBraceDepth <= 0 ) {
+ if (*yyBraceDepth <= 0) {
do {
- if ( !matchBracelessControlStatement() )
+ if (!matchBracelessControlStatement())
break;
hookState = *yyLinizerState;
- } while ( readLine() );
+ } while (readLine());
}
*yyLinizerState = hookState;
- while ( isContinuationLine() )
+ while (isContinuationLine())
readLine();
/*
Never trust lines containing only '{' or '}', as some
people (Richard M. Stallman) format them weirdly.
*/
- if ( yyLine->trimmed().length() > 1 )
- return indentOfLine( *yyLine ) - *yyBraceDepth * ppIndentSize;
+ if (yyLine->trimmed().length() > 1)
+ return indentOfLine(*yyLine) - *yyBraceDepth * ppIndentSize;
}
- if ( !readLine() )
+ if (!readLine())
return -*yyBraceDepth * ppIndentSize;
}
return 0;
@@ -989,14 +989,14 @@ static int indentForStandaloneLine()
*/
static void initializeIndenter()
{
- literal = new QRegExp( "([\"'])(?:\\\\.|[^\\\\])*\\1" );
- literal->setMinimal( true );
+ literal = new QRegExp("([\"'])(?:\\\\.|[^\\\\])*\\1");
+ literal->setMinimal(true);
label = new QRegExp(
- "^\\s*((?:case\\b([^:]|::)+|[a-zA-Z_0-9]+)(?:\\s+slots)?:)(?!:)" );
- inlineCComment = new QRegExp( "/\\*.*\\*/" );
- inlineCComment->setMinimal( true );
- braceX = new QRegExp( "^\\s*\\}\\s*(?:else|catch)\\b" );
- iflikeKeyword = new QRegExp( "\\b(?:catch|do|for|if|while)\\b" );
+ "^\\s*((?:case\\b([^:]|::)+|[a-zA-Z_0-9]+)(?:\\s+slots)?:)(?!:)");
+ inlineCComment = new QRegExp("/\\*.*\\*/");
+ inlineCComment->setMinimal(true);
+ braceX = new QRegExp("^\\s*\\}\\s*(?:else|catch)\\b");
+ iflikeKeyword = new QRegExp("\\b(?:catch|do|for|if|while)\\b");
yyLinizerState = new LinizerState;
}
@@ -1024,56 +1024,56 @@ static void terminateIndenter()
slighly more liberal if typedIn is always null. The user might be
annoyed by the liberal behavior.
*/
-int indentForBottomLine( const QStringList& program, QChar typedIn )
+int indentForBottomLine(const QStringList &program, QChar typedIn)
{
- if ( program.isEmpty() )
+ if (program.isEmpty())
return 0;
initializeIndenter();
- yyProgram = new QStringList( program );
+ yyProgram = new QStringList(program);
startLinizer();
- const QString& bottomLine = program.last();
- QChar firstCh = firstNonWhiteSpace( bottomLine );
+ const QString &bottomLine = program.last();
+ QChar firstCh = firstNonWhiteSpace(bottomLine);
int indent;
- if ( bottomLineStartsInCComment() ) {
+ if (bottomLineStartsInCComment()) {
/*
The bottom line starts in a C-style comment. Indent it
smartly, unless the user has already played around with it,
in which case it's better to leave her stuff alone.
*/
- if ( isOnlyWhiteSpace(bottomLine) ) {
+ if (isOnlyWhiteSpace(bottomLine)) {
indent = indentWhenBottomLineStartsInCComment();
} else {
- indent = indentOfLine( bottomLine );
+ indent = indentOfLine(bottomLine);
}
- } else if ( okay(typedIn, '#') && firstCh == QChar('#') ) {
+ } else if (okay(typedIn, '#') && firstCh == QChar('#')) {
/*
Preprocessor directives go flush left.
*/
indent = 0;
} else {
- if ( isUnfinishedLine() ) {
+ if (isUnfinishedLine()) {
indent = indentForContinuationLine();
} else {
indent = indentForStandaloneLine();
}
- if ( okay(typedIn, '}') && firstCh == QChar('}') ) {
+ if (okay(typedIn, '}') && firstCh == QChar('}')) {
/*
A closing brace is one level more to the left than the
code it follows.
*/
indent -= ppIndentSize;
- } else if ( okay(typedIn, ':') ) {
+ } else if (okay(typedIn, ':')) {
QRegExp caseLabel(
"\\s*(?:case\\b(?:[^:]|::)+"
"|(?:public|protected|private|signals|default)(?:\\s+slots)?\\s*"
")?:.*" );
- if ( caseLabel.exactMatch(bottomLine) ) {
+ if (caseLabel.exactMatch(bottomLine)) {
/*
Move a case label (or the ':' in front of a
constructor initialization list) one level to the
@@ -1087,16 +1087,16 @@ int indentForBottomLine( const QStringList& program, QChar typedIn )
user is probably the middle of "foo::bar". (Who
uses goto, anyway?)
*/
- if ( indentOfLine(bottomLine) <= indent )
+ if (indentOfLine(bottomLine) <= indent)
indent -= ppIndentSize;
else
- indent = indentOfLine( bottomLine );
+ indent = indentOfLine(bottomLine);
}
}
}
delete yyProgram;
terminateIndenter();
- return qMax( 0, indent );
+ return qMax(0, indent);
}
QT_END_NAMESPACE
@@ -1113,7 +1113,7 @@ QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
-static QString fileContents( const QString& fileName )
+static QString fileContents( const QString &fileName )
{
QFile f( fileName );
if ( !f.open(QFile::ReadOnly) ) {
diff --git a/src/qtattributionsscanner/Qt5AttributionsScannerTools.cmake.in b/src/qtattributionsscanner/Qt5AttributionsScannerTools.cmake.in
new file mode 100644
index 000000000..9e9381c24
--- /dev/null
+++ b/src/qtattributionsscanner/Qt5AttributionsScannerTools.cmake.in
@@ -0,0 +1,56 @@
+if (CMAKE_VERSION VERSION_LESS 2.8.3)
+ message(FATAL_ERROR \"Qt 5 requires at least CMake version 2.8.3\")
+endif()
+
+!!IF !isEmpty(CMAKE_USR_MOVE_WORKAROUND)
+!!IF !isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+set(_qt5_qattributionsscannertools_install_prefix \"$$[QT_INSTALL_PREFIX]\")
+!!ELSE
+get_filename_component(_IMPORT_PREFIX \"${CMAKE_CURRENT_LIST_FILE}\" PATH)
+# Use original install prefix when loaded through a
+# cross-prefix symbolic link such as /lib -> /usr/lib.
+get_filename_component(_realCurr \"${_IMPORT_PREFIX}\" REALPATH)
+get_filename_component(_realOrig \"$$CMAKE_INSTALL_LIBS_DIR/cmake/Qt5AttributionsScannerTools\" REALPATH)
+if(_realCurr STREQUAL _realOrig)
+ get_filename_component(_qt5_qattributionsscannertools_install_prefix \"$$CMAKE_INSTALL_LIBS_DIR/$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}\" ABSOLUTE)
+else()
+ get_filename_component(_qt5_qattributionsscannertools_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+endif()
+unset(_realOrig)
+unset(_realCurr)
+unset(_IMPORT_PREFIX)
+!!ENDIF
+!!ELIF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+get_filename_component(_qt5_qattributionsscannertools_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+!!ELSE
+set(_qt5_qattributionsscannertools_install_prefix \"$$[QT_INSTALL_PREFIX]\")
+!!ENDIF
+
+macro(_qt5_AttributionsScannerTools_check_file_exists file)
+ if(NOT EXISTS \"${file}\" )
+ message(FATAL_ERROR \"The package \\\"Qt5AttributionsScannerTools\\\" references the file
+ \\\"${file}\\\"
+but this file does not exist. Possible reasons include:
+* The file was deleted, renamed, or moved to another location.
+* An install or uninstall procedure did not complete successfully.
+* The installation package was faulty and contained
+ \\\"${CMAKE_CURRENT_LIST_FILE}\\\"
+but not all the files it references.
+\")
+ endif()
+endmacro()
+
+if (NOT TARGET Qt5::qtattributionsscanner)
+ add_executable(Qt5::qtattributionsscanner IMPORTED)
+
+!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+ set(imported_location \"${_qt5_qattributionsscannertools_install_prefix}/$${CMAKE_BIN_DIR}qtattributionsscanner$$CMAKE_BIN_SUFFIX\")
+!!ELSE
+ set(imported_location \"$${CMAKE_BIN_DIR}qtattributionsscanner$$CMAKE_BIN_SUFFIX\")
+!!ENDIF
+ _qt5_AttributionsScannerTools_check_file_exists(${imported_location})
+
+ set_target_properties(Qt5::qtattributionsscanner PROPERTIES
+ IMPORTED_LOCATION ${imported_location}
+ )
+endif()
diff --git a/src/qtattributionsscanner/qtattributionsscanner.pro b/src/qtattributionsscanner/qtattributionsscanner.pro
index c3c57b35d..839af9b08 100644
--- a/src/qtattributionsscanner/qtattributionsscanner.pro
+++ b/src/qtattributionsscanner/qtattributionsscanner.pro
@@ -20,3 +20,38 @@ DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
QMAKE_TARGET_DESCRIPTION = "Qt Source Code Attribution Scanner"
load(qt_tool)
+
+load(cmake_functions)
+
+CMAKE_INSTALL_LIBS_DIR = $$cmakeTargetPath($$[QT_INSTALL_LIBS])
+contains(CMAKE_INSTALL_LIBS_DIR, ^(/usr)?/lib(64)?.*): CMAKE_USR_MOVE_WORKAROUND = $$CMAKE_INSTALL_LIBS_DIR
+
+CMAKE_LIB_DIR = $$cmakeRelativePath($$[QT_INSTALL_LIBS], $$[QT_INSTALL_PREFIX])
+!contains(CMAKE_LIB_DIR,"^\\.\\./.*") {
+ CMAKE_RELATIVE_INSTALL_LIBS_DIR = $$cmakeRelativePath($$[QT_INSTALL_PREFIX], $$[QT_INSTALL_LIBS])
+ # We need to go up another two levels because the CMake files are
+ # installed in $${CMAKE_LIB_DIR}/cmake/Qt5$${CMAKE_MODULE_NAME}
+ CMAKE_RELATIVE_INSTALL_DIR = "$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}../../"
+} else {
+ CMAKE_LIB_DIR_IS_ABSOLUTE = True
+}
+
+CMAKE_BIN_DIR = $$cmakeRelativePath($$[QT_HOST_BINS], $$[QT_INSTALL_PREFIX])
+contains(CMAKE_BIN_DIR, "^\\.\\./.*") {
+ CMAKE_BIN_DIR = $$[QT_HOST_BINS]/
+ CMAKE_BIN_DIR_IS_ABSOLUTE = True
+}
+
+load(qt_build_paths)
+
+cmake_qattributionsscanner_config_file.input = $$PWD/Qt5AttributionsScannerTools.cmake.in
+cmake_qattributionsscanner_config_version_file.input = $$[QT_HOST_DATA/src]/mkspecs/features/data/cmake/Qt5ConfigVersion.cmake.in
+CMAKE_PACKAGE_VERSION = $$MODULE_VERSION
+cmake_qattributionsscanner_config_file.output = $$MODULE_BASE_OUTDIR/lib/cmake/Qt5AttributionsScannerTools/Qt5AttributionsScannerToolsConfig.cmake
+cmake_qattributionsscanner_config_version_file.output = $$MODULE_BASE_OUTDIR/lib/cmake/Qt5AttributionsScannerTools/Qt5AttributionsScannerToolsConfigVersion.cmake
+QMAKE_SUBSTITUTES += cmake_qattributionsscanner_config_file cmake_qattributionsscanner_config_version_file
+
+cmake_qattributionsscanner_tools_files.files += $$cmake_qattributionsscanner_config_file.output $$cmake_qattributionsscanner_config_version_file.output
+cmake_qattributionsscanner_tools_files.path = $$[QT_INSTALL_LIBS]/cmake/Qt5AttributionsScannerTools
+cmake_qattributionsscanner_tools_files.CONFIG = no_check_exist
+INSTALLS += cmake_qattributionsscanner_tools_files
diff --git a/src/qtdiag/qtdiag.cpp b/src/qtdiag/qtdiag.cpp
index 448b3d6cb..9b082e37e 100644
--- a/src/qtdiag/qtdiag.cpp
+++ b/src/qtdiag/qtdiag.cpp
@@ -207,7 +207,7 @@ void dumpGlInfo(QTextStream &str, bool listExtensions)
str << '\n';
# endif // !QT_OPENGL_ES_2
if (listExtensions) {
- QList<QByteArray> extensionList = context.extensions().toList();
+ QByteArrayList extensionList = context.extensions().values();
std::sort(extensionList.begin(), extensionList.end());
str << " \nFound " << extensionList.size() << " extensions:\n";
for (const QByteArray &extension : qAsConst(extensionList))
diff --git a/src/shared/qtgradienteditor/qtcolorbutton.h b/src/shared/qtgradienteditor/qtcolorbutton.h
index 8684c41a9..65aa67701 100644
--- a/src/shared/qtgradienteditor/qtcolorbutton.h
+++ b/src/shared/qtgradienteditor/qtcolorbutton.h
@@ -75,7 +75,7 @@ protected:
private:
QScopedPointer<class QtColorButtonPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtColorButton)
- Q_DISABLE_COPY(QtColorButton)
+ Q_DISABLE_COPY_MOVE(QtColorButton)
Q_PRIVATE_SLOT(d_func(), void slotEditColor())
};
diff --git a/src/shared/qtgradienteditor/qtcolorline.h b/src/shared/qtgradienteditor/qtcolorline.h
index 6d19ed4d9..8a9aec90c 100644
--- a/src/shared/qtgradienteditor/qtcolorline.h
+++ b/src/shared/qtgradienteditor/qtcolorline.h
@@ -114,7 +114,7 @@ private:
QScopedPointer<class QtColorLinePrivate> d_ptr;
Q_DECLARE_PRIVATE(QtColorLine)
- Q_DISABLE_COPY(QtColorLine)
+ Q_DISABLE_COPY_MOVE(QtColorLine)
};
QT_END_NAMESPACE
diff --git a/src/shared/qtgradienteditor/qtgradientdialog.h b/src/shared/qtgradienteditor/qtgradientdialog.h
index d263ef066..852c3a143 100644
--- a/src/shared/qtgradienteditor/qtgradientdialog.h
+++ b/src/shared/qtgradienteditor/qtgradientdialog.h
@@ -76,7 +76,7 @@ public:
private:
QScopedPointer<class QtGradientDialogPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtGradientDialog)
- Q_DISABLE_COPY(QtGradientDialog)
+ Q_DISABLE_COPY_MOVE(QtGradientDialog)
Q_PRIVATE_SLOT(d_func(), void slotAboutToShowDetails(bool details, int extensionWidthHint))
};
diff --git a/src/shared/qtgradienteditor/qtgradienteditor.h b/src/shared/qtgradienteditor/qtgradienteditor.h
index ace096d4e..5d91fb0d4 100644
--- a/src/shared/qtgradienteditor/qtgradienteditor.h
+++ b/src/shared/qtgradienteditor/qtgradienteditor.h
@@ -78,7 +78,7 @@ signals:
private:
QScopedPointer<class QtGradientEditorPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtGradientEditor)
- Q_DISABLE_COPY(QtGradientEditor)
+ Q_DISABLE_COPY_MOVE(QtGradientEditor)
Q_PRIVATE_SLOT(d_func(), void slotGradientStopsChanged(const QGradientStops &stops))
Q_PRIVATE_SLOT(d_func(), void slotTypeChanged(int type))
Q_PRIVATE_SLOT(d_func(), void slotSpreadChanged(int type))
diff --git a/src/shared/qtgradienteditor/qtgradientstopscontroller.h b/src/shared/qtgradienteditor/qtgradientstopscontroller.h
index 86e1ac00a..1b3bbd391 100644
--- a/src/shared/qtgradienteditor/qtgradientstopscontroller.h
+++ b/src/shared/qtgradienteditor/qtgradientstopscontroller.h
@@ -70,7 +70,7 @@ signals:
private:
QScopedPointer<class QtGradientStopsControllerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtGradientStopsController)
- Q_DISABLE_COPY(QtGradientStopsController)
+ Q_DISABLE_COPY_MOVE(QtGradientStopsController)
Q_PRIVATE_SLOT(d_func(), void slotHsvClicked())
Q_PRIVATE_SLOT(d_func(), void slotRgbClicked())
Q_PRIVATE_SLOT(d_func(), void slotCurrentStopChanged(QtGradientStop *stop))
diff --git a/src/shared/qtgradienteditor/qtgradientstopsmodel.cpp b/src/shared/qtgradienteditor/qtgradientstopsmodel.cpp
index 0dac9b867..d35c1f025 100644
--- a/src/shared/qtgradienteditor/qtgradientstopsmodel.cpp
+++ b/src/shared/qtgradienteditor/qtgradientstopsmodel.cpp
@@ -418,21 +418,21 @@ void QtGradientStopsModel::clearSelection()
selectStop(stop, false);
}
+namespace {
+ template <typename BidirectionalIterator>
+ std::reverse_iterator<BidirectionalIterator> rev(BidirectionalIterator it)
+ { return std::reverse_iterator<BidirectionalIterator>(it); }
+}
+
void QtGradientStopsModel::flipAll()
{
QMap<qreal, QtGradientStop *> stopsMap = stops();
- QMapIterator<qreal, QtGradientStop *> itStop(stopsMap);
- itStop.toBack();
-
QMap<QtGradientStop *, bool> swappedList;
-
- while (itStop.hasPrevious()) {
- itStop.previous();
-
- QtGradientStop *stop = itStop.value();
+ for (auto itStop = rev(stopsMap.keyValueEnd()), end = rev(stopsMap.keyValueBegin()); itStop != end; ++itStop) {
+ QtGradientStop *stop = (*itStop).second;
if (swappedList.contains(stop))
continue;
- const double newPos = 1.0 - itStop.key();
+ const double newPos = 1.0 - (*itStop).first;
if (stopsMap.contains(newPos)) {
QtGradientStop *swapped = stopsMap.value(newPos);
swappedList[swapped] = true;
diff --git a/src/shared/qtgradienteditor/qtgradientstopsmodel.h b/src/shared/qtgradienteditor/qtgradientstopsmodel.h
index 121417813..71a8783e0 100644
--- a/src/shared/qtgradienteditor/qtgradientstopsmodel.h
+++ b/src/shared/qtgradienteditor/qtgradientstopsmodel.h
@@ -111,7 +111,7 @@ signals:
private:
QScopedPointer<class QtGradientStopsModelPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtGradientStopsModel)
- Q_DISABLE_COPY(QtGradientStopsModel)
+ Q_DISABLE_COPY_MOVE(QtGradientStopsModel)
};
QT_END_NAMESPACE
diff --git a/src/shared/qtgradienteditor/qtgradientstopswidget.cpp b/src/shared/qtgradienteditor/qtgradientstopswidget.cpp
index 0798a9c08..3bfd30627 100644
--- a/src/shared/qtgradienteditor/qtgradientstopswidget.cpp
+++ b/src/shared/qtgradienteditor/qtgradientstopswidget.cpp
@@ -960,7 +960,7 @@ void QtGradientStopsWidget::contextMenuEvent(QContextMenuEvent *e)
void QtGradientStopsWidget::wheelEvent(QWheelEvent *e)
{
- int numDegrees = e->delta() / 8;
+ int numDegrees = e->angleDelta().y() / 8;
int numSteps = numDegrees / 15;
int shift = numSteps;
diff --git a/src/shared/qtgradienteditor/qtgradientstopswidget.h b/src/shared/qtgradienteditor/qtgradientstopswidget.h
index 841ff43e6..d3593ae81 100644
--- a/src/shared/qtgradienteditor/qtgradientstopswidget.h
+++ b/src/shared/qtgradienteditor/qtgradientstopswidget.h
@@ -91,7 +91,7 @@ protected:
private:
QScopedPointer<QtGradientStopsWidgetPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtGradientStopsWidget)
- Q_DISABLE_COPY(QtGradientStopsWidget)
+ Q_DISABLE_COPY_MOVE(QtGradientStopsWidget)
Q_PRIVATE_SLOT(d_func(), void slotStopAdded(QtGradientStop *stop))
Q_PRIVATE_SLOT(d_func(), void slotStopRemoved(QtGradientStop *stop))
Q_PRIVATE_SLOT(d_func(), void slotStopMoved(QtGradientStop *stop, qreal newPos))
diff --git a/src/shared/qtgradienteditor/qtgradientwidget.cpp b/src/shared/qtgradienteditor/qtgradientwidget.cpp
index 08e83419e..9db1b82e6 100644
--- a/src/shared/qtgradienteditor/qtgradientwidget.cpp
+++ b/src/shared/qtgradienteditor/qtgradientwidget.cpp
@@ -203,11 +203,9 @@ void QtGradientWidgetPrivate::setupDrag(QtGradientStop *stop, int x)
int viewportX = qRound(toViewport(stop->position()));
m_dragOffset = x - viewportX;
- QList<QtGradientStop *> stops = m_stops;
+ const QList<QtGradientStop *> stops = m_stops;
m_stops.clear();
- QListIterator<QtGradientStop *> itStop(stops);
- while (itStop.hasNext()) {
- QtGradientStop *s = itStop.next();
+ for (QtGradientStop *s : stops) {
if (m_model->isSelected(s) || s == stop) {
m_dragStops[s] = s->position() - stop->position();
m_stops.append(s);
@@ -215,9 +213,7 @@ void QtGradientWidgetPrivate::setupDrag(QtGradientStop *stop, int x)
m_dragOriginal[s->position()] = s->color();
}
}
- itStop.toFront();
- while (itStop.hasNext()) {
- QtGradientStop *s = itStop.next();
+ for (QtGradientStop *s : stops) {
if (!m_model->isSelected(s))
m_stops.append(s);
}
diff --git a/src/shared/qtgradienteditor/qtgradientwidget.h b/src/shared/qtgradienteditor/qtgradientwidget.h
index 4ac3da8fb..2c701b28c 100644
--- a/src/shared/qtgradienteditor/qtgradientwidget.h
+++ b/src/shared/qtgradienteditor/qtgradientwidget.h
@@ -110,7 +110,7 @@ protected:
private:
QScopedPointer<class QtGradientWidgetPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtGradientWidget)
- Q_DISABLE_COPY(QtGradientWidget)
+ Q_DISABLE_COPY_MOVE(QtGradientWidget)
};
QT_END_NAMESPACE
diff --git a/src/shared/qtpropertybrowser/qtbuttonpropertybrowser.h b/src/shared/qtpropertybrowser/qtbuttonpropertybrowser.h
index 18b76b96f..d97613153 100644
--- a/src/shared/qtpropertybrowser/qtbuttonpropertybrowser.h
+++ b/src/shared/qtpropertybrowser/qtbuttonpropertybrowser.h
@@ -71,7 +71,7 @@ private:
QScopedPointer<QtButtonPropertyBrowserPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtButtonPropertyBrowser)
- Q_DISABLE_COPY(QtButtonPropertyBrowser)
+ Q_DISABLE_COPY_MOVE(QtButtonPropertyBrowser)
Q_PRIVATE_SLOT(d_func(), void slotUpdate())
Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed())
Q_PRIVATE_SLOT(d_func(), void slotToggled(bool))
diff --git a/src/shared/qtpropertybrowser/qteditorfactory.h b/src/shared/qtpropertybrowser/qteditorfactory.h
index b53669e2d..0bdc07cc4 100644
--- a/src/shared/qtpropertybrowser/qteditorfactory.h
+++ b/src/shared/qtpropertybrowser/qteditorfactory.h
@@ -60,7 +60,7 @@ protected:
private:
QScopedPointer<QtSpinBoxFactoryPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtSpinBoxFactory)
- Q_DISABLE_COPY(QtSpinBoxFactory)
+ Q_DISABLE_COPY_MOVE(QtSpinBoxFactory)
Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, int))
Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, int, int))
Q_PRIVATE_SLOT(d_func(), void slotSingleStepChanged(QtProperty *, int))
@@ -84,7 +84,7 @@ protected:
private:
QScopedPointer<QtSliderFactoryPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtSliderFactory)
- Q_DISABLE_COPY(QtSliderFactory)
+ Q_DISABLE_COPY_MOVE(QtSliderFactory)
Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, int))
Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, int, int))
Q_PRIVATE_SLOT(d_func(), void slotSingleStepChanged(QtProperty *, int))
@@ -108,7 +108,7 @@ protected:
private:
QScopedPointer<QtScrollBarFactoryPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtScrollBarFactory)
- Q_DISABLE_COPY(QtScrollBarFactory)
+ Q_DISABLE_COPY_MOVE(QtScrollBarFactory)
Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, int))
Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, int, int))
Q_PRIVATE_SLOT(d_func(), void slotSingleStepChanged(QtProperty *, int))
@@ -132,7 +132,7 @@ protected:
private:
QScopedPointer<QtCheckBoxFactoryPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtCheckBoxFactory)
- Q_DISABLE_COPY(QtCheckBoxFactory)
+ Q_DISABLE_COPY_MOVE(QtCheckBoxFactory)
Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, bool))
Q_PRIVATE_SLOT(d_func(), void slotSetValue(bool))
Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed(QObject *))
@@ -154,7 +154,7 @@ protected:
private:
QScopedPointer<QtDoubleSpinBoxFactoryPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtDoubleSpinBoxFactory)
- Q_DISABLE_COPY(QtDoubleSpinBoxFactory)
+ Q_DISABLE_COPY_MOVE(QtDoubleSpinBoxFactory)
Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, double))
Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, double, double))
Q_PRIVATE_SLOT(d_func(), void slotSingleStepChanged(QtProperty *, double))
@@ -179,7 +179,7 @@ protected:
private:
QScopedPointer<QtLineEditFactoryPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtLineEditFactory)
- Q_DISABLE_COPY(QtLineEditFactory)
+ Q_DISABLE_COPY_MOVE(QtLineEditFactory)
Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, const QString &))
Q_PRIVATE_SLOT(d_func(), void slotRegExpChanged(QtProperty *, const QRegExp &))
Q_PRIVATE_SLOT(d_func(), void slotSetValue(const QString &))
@@ -202,7 +202,7 @@ protected:
private:
QScopedPointer<QtDateEditFactoryPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtDateEditFactory)
- Q_DISABLE_COPY(QtDateEditFactory)
+ Q_DISABLE_COPY_MOVE(QtDateEditFactory)
Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, const QDate &))
Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *,
const QDate &, const QDate &))
@@ -226,7 +226,7 @@ protected:
private:
QScopedPointer<QtTimeEditFactoryPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtTimeEditFactory)
- Q_DISABLE_COPY(QtTimeEditFactory)
+ Q_DISABLE_COPY_MOVE(QtTimeEditFactory)
Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, const QTime &))
Q_PRIVATE_SLOT(d_func(), void slotSetValue(const QTime &))
Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed(QObject *))
@@ -248,7 +248,7 @@ protected:
private:
QScopedPointer<QtDateTimeEditFactoryPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtDateTimeEditFactory)
- Q_DISABLE_COPY(QtDateTimeEditFactory)
+ Q_DISABLE_COPY_MOVE(QtDateTimeEditFactory)
Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, const QDateTime &))
Q_PRIVATE_SLOT(d_func(), void slotSetValue(const QDateTime &))
Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed(QObject *))
@@ -270,7 +270,7 @@ protected:
private:
QScopedPointer<QtKeySequenceEditorFactoryPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtKeySequenceEditorFactory)
- Q_DISABLE_COPY(QtKeySequenceEditorFactory)
+ Q_DISABLE_COPY_MOVE(QtKeySequenceEditorFactory)
Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, const QKeySequence &))
Q_PRIVATE_SLOT(d_func(), void slotSetValue(const QKeySequence &))
Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed(QObject *))
@@ -292,7 +292,7 @@ protected:
private:
QScopedPointer<QtCharEditorFactoryPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtCharEditorFactory)
- Q_DISABLE_COPY(QtCharEditorFactory)
+ Q_DISABLE_COPY_MOVE(QtCharEditorFactory)
Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, const QChar &))
Q_PRIVATE_SLOT(d_func(), void slotSetValue(const QChar &))
Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed(QObject *))
@@ -314,7 +314,7 @@ protected:
private:
QScopedPointer<QtEnumEditorFactoryPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtEnumEditorFactory)
- Q_DISABLE_COPY(QtEnumEditorFactory)
+ Q_DISABLE_COPY_MOVE(QtEnumEditorFactory)
Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, int))
Q_PRIVATE_SLOT(d_func(), void slotEnumNamesChanged(QtProperty *,
const QStringList &))
@@ -340,7 +340,7 @@ protected:
private:
QScopedPointer<QtCursorEditorFactoryPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtCursorEditorFactory)
- Q_DISABLE_COPY(QtCursorEditorFactory)
+ Q_DISABLE_COPY_MOVE(QtCursorEditorFactory)
Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, const QCursor &))
Q_PRIVATE_SLOT(d_func(), void slotEnumChanged(QtProperty *, int))
Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed(QObject *))
@@ -362,7 +362,7 @@ protected:
private:
QScopedPointer<QtColorEditorFactoryPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtColorEditorFactory)
- Q_DISABLE_COPY(QtColorEditorFactory)
+ Q_DISABLE_COPY_MOVE(QtColorEditorFactory)
Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, const QColor &))
Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed(QObject *))
Q_PRIVATE_SLOT(d_func(), void slotSetValue(const QColor &))
@@ -384,7 +384,7 @@ protected:
private:
QScopedPointer<QtFontEditorFactoryPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtFontEditorFactory)
- Q_DISABLE_COPY(QtFontEditorFactory)
+ Q_DISABLE_COPY_MOVE(QtFontEditorFactory)
Q_PRIVATE_SLOT(d_func(), void slotPropertyChanged(QtProperty *, const QFont &))
Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed(QObject *))
Q_PRIVATE_SLOT(d_func(), void slotSetValue(const QFont &))
diff --git a/src/shared/qtpropertybrowser/qtgroupboxpropertybrowser.h b/src/shared/qtpropertybrowser/qtgroupboxpropertybrowser.h
index bfc81e032..bb44a01b5 100644
--- a/src/shared/qtpropertybrowser/qtgroupboxpropertybrowser.h
+++ b/src/shared/qtpropertybrowser/qtgroupboxpropertybrowser.h
@@ -63,7 +63,7 @@ private:
QScopedPointer<QtGroupBoxPropertyBrowserPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtGroupBoxPropertyBrowser)
- Q_DISABLE_COPY(QtGroupBoxPropertyBrowser)
+ Q_DISABLE_COPY_MOVE(QtGroupBoxPropertyBrowser)
Q_PRIVATE_SLOT(d_func(), void slotUpdate())
Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed())
diff --git a/src/shared/qtpropertybrowser/qtpropertybrowser.h b/src/shared/qtpropertybrowser/qtpropertybrowser.h
index 8a1b63521..f85d622da 100644
--- a/src/shared/qtpropertybrowser/qtpropertybrowser.h
+++ b/src/shared/qtpropertybrowser/qtpropertybrowser.h
@@ -122,7 +122,7 @@ private:
friend class QtProperty;
QScopedPointer<QtAbstractPropertyManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtAbstractPropertyManager)
- Q_DISABLE_COPY(QtAbstractPropertyManager)
+ Q_DISABLE_COPY_MOVE(QtAbstractPropertyManager)
};
class QtAbstractEditorFactoryBase : public QObject
@@ -288,7 +288,7 @@ private:
QScopedPointer<QtAbstractPropertyBrowserPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtAbstractPropertyBrowser)
- Q_DISABLE_COPY(QtAbstractPropertyBrowser)
+ Q_DISABLE_COPY_MOVE(QtAbstractPropertyBrowser)
Q_PRIVATE_SLOT(d_func(), void slotPropertyInserted(QtProperty *,
QtProperty *, QtProperty *))
Q_PRIVATE_SLOT(d_func(), void slotPropertyRemoved(QtProperty *,
diff --git a/src/shared/qtpropertybrowser/qtpropertymanager.h b/src/shared/qtpropertybrowser/qtpropertymanager.h
index 4298c4418..4ec80f821 100644
--- a/src/shared/qtpropertybrowser/qtpropertymanager.h
+++ b/src/shared/qtpropertybrowser/qtpropertymanager.h
@@ -94,7 +94,7 @@ protected:
private:
QScopedPointer<QtIntPropertyManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtIntPropertyManager)
- Q_DISABLE_COPY(QtIntPropertyManager)
+ Q_DISABLE_COPY_MOVE(QtIntPropertyManager)
};
class QtBoolPropertyManagerPrivate;
@@ -120,7 +120,7 @@ protected:
private:
QScopedPointer<QtBoolPropertyManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtBoolPropertyManager)
- Q_DISABLE_COPY(QtBoolPropertyManager)
+ Q_DISABLE_COPY_MOVE(QtBoolPropertyManager)
};
class QtDoublePropertyManagerPrivate;
@@ -157,7 +157,7 @@ protected:
private:
QScopedPointer<QtDoublePropertyManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtDoublePropertyManager)
- Q_DISABLE_COPY(QtDoublePropertyManager)
+ Q_DISABLE_COPY_MOVE(QtDoublePropertyManager)
};
class QtStringPropertyManagerPrivate;
@@ -185,7 +185,7 @@ protected:
private:
QScopedPointer<QtStringPropertyManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtStringPropertyManager)
- Q_DISABLE_COPY(QtStringPropertyManager)
+ Q_DISABLE_COPY_MOVE(QtStringPropertyManager)
};
class QtDatePropertyManagerPrivate;
@@ -216,7 +216,7 @@ protected:
private:
QScopedPointer<QtDatePropertyManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtDatePropertyManager)
- Q_DISABLE_COPY(QtDatePropertyManager)
+ Q_DISABLE_COPY_MOVE(QtDatePropertyManager)
};
class QtTimePropertyManagerPrivate;
@@ -241,7 +241,7 @@ protected:
private:
QScopedPointer<QtTimePropertyManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtTimePropertyManager)
- Q_DISABLE_COPY(QtTimePropertyManager)
+ Q_DISABLE_COPY_MOVE(QtTimePropertyManager)
};
class QtDateTimePropertyManagerPrivate;
@@ -266,7 +266,7 @@ protected:
private:
QScopedPointer<QtDateTimePropertyManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtDateTimePropertyManager)
- Q_DISABLE_COPY(QtDateTimePropertyManager)
+ Q_DISABLE_COPY_MOVE(QtDateTimePropertyManager)
};
class QtKeySequencePropertyManagerPrivate;
@@ -291,7 +291,7 @@ protected:
private:
QScopedPointer<QtKeySequencePropertyManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtKeySequencePropertyManager)
- Q_DISABLE_COPY(QtKeySequencePropertyManager)
+ Q_DISABLE_COPY_MOVE(QtKeySequencePropertyManager)
};
class QtCharPropertyManagerPrivate;
@@ -316,7 +316,7 @@ protected:
private:
QScopedPointer<QtCharPropertyManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtCharPropertyManager)
- Q_DISABLE_COPY(QtCharPropertyManager)
+ Q_DISABLE_COPY_MOVE(QtCharPropertyManager)
};
class QtEnumPropertyManager;
@@ -344,7 +344,7 @@ protected:
private:
QScopedPointer<QtLocalePropertyManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtLocalePropertyManager)
- Q_DISABLE_COPY(QtLocalePropertyManager)
+ Q_DISABLE_COPY_MOVE(QtLocalePropertyManager)
Q_PRIVATE_SLOT(d_func(), void slotEnumChanged(QtProperty *, int))
Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *))
};
@@ -373,7 +373,7 @@ protected:
private:
QScopedPointer<QtPointPropertyManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtPointPropertyManager)
- Q_DISABLE_COPY(QtPointPropertyManager)
+ Q_DISABLE_COPY_MOVE(QtPointPropertyManager)
Q_PRIVATE_SLOT(d_func(), void slotIntChanged(QtProperty *, int))
Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *))
};
@@ -405,7 +405,7 @@ protected:
private:
QScopedPointer<QtPointFPropertyManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtPointFPropertyManager)
- Q_DISABLE_COPY(QtPointFPropertyManager)
+ Q_DISABLE_COPY_MOVE(QtPointFPropertyManager)
Q_PRIVATE_SLOT(d_func(), void slotDoubleChanged(QtProperty *, double))
Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *))
};
@@ -440,7 +440,7 @@ protected:
private:
QScopedPointer<QtSizePropertyManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtSizePropertyManager)
- Q_DISABLE_COPY(QtSizePropertyManager)
+ Q_DISABLE_COPY_MOVE(QtSizePropertyManager)
Q_PRIVATE_SLOT(d_func(), void slotIntChanged(QtProperty *, int))
Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *))
};
@@ -478,7 +478,7 @@ protected:
private:
QScopedPointer<QtSizeFPropertyManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtSizeFPropertyManager)
- Q_DISABLE_COPY(QtSizeFPropertyManager)
+ Q_DISABLE_COPY_MOVE(QtSizeFPropertyManager)
Q_PRIVATE_SLOT(d_func(), void slotDoubleChanged(QtProperty *, double))
Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *))
};
@@ -510,7 +510,7 @@ protected:
private:
QScopedPointer<QtRectPropertyManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtRectPropertyManager)
- Q_DISABLE_COPY(QtRectPropertyManager)
+ Q_DISABLE_COPY_MOVE(QtRectPropertyManager)
Q_PRIVATE_SLOT(d_func(), void slotIntChanged(QtProperty *, int))
Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *))
};
@@ -545,7 +545,7 @@ protected:
private:
QScopedPointer<QtRectFPropertyManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtRectFPropertyManager)
- Q_DISABLE_COPY(QtRectFPropertyManager)
+ Q_DISABLE_COPY_MOVE(QtRectFPropertyManager)
Q_PRIVATE_SLOT(d_func(), void slotDoubleChanged(QtProperty *, double))
Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *))
};
@@ -579,7 +579,7 @@ protected:
private:
QScopedPointer<QtEnumPropertyManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtEnumPropertyManager)
- Q_DISABLE_COPY(QtEnumPropertyManager)
+ Q_DISABLE_COPY_MOVE(QtEnumPropertyManager)
};
class QtFlagPropertyManagerPrivate;
@@ -609,7 +609,7 @@ protected:
private:
QScopedPointer<QtFlagPropertyManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtFlagPropertyManager)
- Q_DISABLE_COPY(QtFlagPropertyManager)
+ Q_DISABLE_COPY_MOVE(QtFlagPropertyManager)
Q_PRIVATE_SLOT(d_func(), void slotBoolChanged(QtProperty *, bool))
Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *))
};
@@ -639,7 +639,7 @@ protected:
private:
QScopedPointer<QtSizePolicyPropertyManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtSizePolicyPropertyManager)
- Q_DISABLE_COPY(QtSizePolicyPropertyManager)
+ Q_DISABLE_COPY_MOVE(QtSizePolicyPropertyManager)
Q_PRIVATE_SLOT(d_func(), void slotIntChanged(QtProperty *, int))
Q_PRIVATE_SLOT(d_func(), void slotEnumChanged(QtProperty *, int))
Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *))
@@ -672,7 +672,7 @@ protected:
private:
QScopedPointer<QtFontPropertyManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtFontPropertyManager)
- Q_DISABLE_COPY(QtFontPropertyManager)
+ Q_DISABLE_COPY_MOVE(QtFontPropertyManager)
Q_PRIVATE_SLOT(d_func(), void slotIntChanged(QtProperty *, int))
Q_PRIVATE_SLOT(d_func(), void slotEnumChanged(QtProperty *, int))
Q_PRIVATE_SLOT(d_func(), void slotBoolChanged(QtProperty *, bool))
@@ -706,7 +706,7 @@ protected:
private:
QScopedPointer<QtColorPropertyManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtColorPropertyManager)
- Q_DISABLE_COPY(QtColorPropertyManager)
+ Q_DISABLE_COPY_MOVE(QtColorPropertyManager)
Q_PRIVATE_SLOT(d_func(), void slotIntChanged(QtProperty *, int))
Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *))
};
@@ -736,7 +736,7 @@ protected:
private:
QScopedPointer<QtCursorPropertyManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtCursorPropertyManager)
- Q_DISABLE_COPY(QtCursorPropertyManager)
+ Q_DISABLE_COPY_MOVE(QtCursorPropertyManager)
};
QT_END_NAMESPACE
diff --git a/src/shared/qtpropertybrowser/qttreepropertybrowser.h b/src/shared/qtpropertybrowser/qttreepropertybrowser.h
index 9ff4d5f50..e8716c898 100644
--- a/src/shared/qtpropertybrowser/qttreepropertybrowser.h
+++ b/src/shared/qtpropertybrowser/qttreepropertybrowser.h
@@ -118,7 +118,7 @@ private:
QScopedPointer<QtTreePropertyBrowserPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtTreePropertyBrowser)
- Q_DISABLE_COPY(QtTreePropertyBrowser)
+ Q_DISABLE_COPY_MOVE(QtTreePropertyBrowser)
Q_PRIVATE_SLOT(d_func(), void slotCollapsed(const QModelIndex &))
Q_PRIVATE_SLOT(d_func(), void slotExpanded(const QModelIndex &))
diff --git a/src/shared/qtpropertybrowser/qtvariantproperty.h b/src/shared/qtpropertybrowser/qtvariantproperty.h
index 81859c56a..ff5af83e6 100644
--- a/src/shared/qtpropertybrowser/qtvariantproperty.h
+++ b/src/shared/qtpropertybrowser/qtvariantproperty.h
@@ -148,7 +148,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void slotPropertyInserted(QtProperty *, QtProperty *, QtProperty *))
Q_PRIVATE_SLOT(d_func(), void slotPropertyRemoved(QtProperty *, QtProperty *))
Q_DECLARE_PRIVATE(QtVariantPropertyManager)
- Q_DISABLE_COPY(QtVariantPropertyManager)
+ Q_DISABLE_COPY_MOVE(QtVariantPropertyManager)
};
class QtVariantEditorFactory : public QtAbstractEditorFactory<QtVariantPropertyManager>
@@ -165,7 +165,7 @@ protected:
private:
QScopedPointer<class QtVariantEditorFactoryPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtVariantEditorFactory)
- Q_DISABLE_COPY(QtVariantEditorFactory)
+ Q_DISABLE_COPY_MOVE(QtVariantEditorFactory)
};
QT_END_NAMESPACE
diff --git a/src/shared/qttoolbardialog/qttoolbardialog.cpp b/src/shared/qttoolbardialog/qttoolbardialog.cpp
index 4df2d00d5..bce8e4345 100644
--- a/src/shared/qttoolbardialog/qttoolbardialog.cpp
+++ b/src/shared/qttoolbardialog/qttoolbardialog.cpp
@@ -121,7 +121,7 @@ signals:
private:
QScopedPointer<QtFullToolBarManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtFullToolBarManager)
- Q_DISABLE_COPY(QtFullToolBarManager)
+ Q_DISABLE_COPY_MOVE(QtFullToolBarManager)
};
class QtFullToolBarManagerPrivate
diff --git a/src/shared/qttoolbardialog/qttoolbardialog.h b/src/shared/qttoolbardialog/qttoolbardialog.h
index bd54c01d2..72d34bafb 100644
--- a/src/shared/qttoolbardialog/qttoolbardialog.h
+++ b/src/shared/qttoolbardialog/qttoolbardialog.h
@@ -88,7 +88,7 @@ private:
friend class QtToolBarDialog;
QScopedPointer<QtToolBarManagerPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtToolBarManager)
- Q_DISABLE_COPY(QtToolBarManager)
+ Q_DISABLE_COPY_MOVE(QtToolBarManager)
};
class QtToolBarDialogPrivate;
@@ -112,7 +112,7 @@ private:
QScopedPointer<QtToolBarDialogPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtToolBarDialog)
- Q_DISABLE_COPY(QtToolBarDialog)
+ Q_DISABLE_COPY_MOVE(QtToolBarDialog)
Q_PRIVATE_SLOT(d_func(), void newClicked())
Q_PRIVATE_SLOT(d_func(), void removeClicked())
diff --git a/src/windeployqt/main.cpp b/src/windeployqt/main.cpp
index 00fa4fbc4..1fefc6d21 100644
--- a/src/windeployqt/main.cpp
+++ b/src/windeployqt/main.cpp
@@ -1493,9 +1493,12 @@ static DeployResult deploy(const Options &options,
if (options.patchQt && !options.dryRun && !options.isWinRt()) {
const QString qt5CoreName = QFileInfo(libraryPath(libraryLocation, "Qt5Core", qtLibInfix,
options.platform, isDebug)).fileName();
-
- if (!patchQtCore(targetPath + QLatin1Char('/') + qt5CoreName, errorMessage))
- return result;
+#ifndef QT_RELOCATABLE
+ if (!patchQtCore(targetPath + QLatin1Char('/') + qt5CoreName, errorMessage)) {
+ std::wcerr << "Warning: " << *errorMessage << '\n';
+ errorMessage->clear();
+ }
+#endif
}
} // optLibraries
diff --git a/src/windeployqt/windeployqt.pro b/src/windeployqt/windeployqt.pro
index fb12a12f3..cd09c238f 100644
--- a/src/windeployqt/windeployqt.pro
+++ b/src/windeployqt/windeployqt.pro
@@ -10,4 +10,7 @@ CONFIG += force_bootstrap
win32: LIBS += -lshlwapi
QMAKE_TARGET_DESCRIPTION = "Qt Windows Deployment Tool"
+
+qtConfig(relocatable): DEFINES += QT_RELOCATABLE
+
load(qt_tool)
diff --git a/src/winrtrunner/main.cpp b/src/winrtrunner/main.cpp
index bf4e8fabf..6a738b098 100644
--- a/src/winrtrunner/main.cpp
+++ b/src/winrtrunner/main.cpp
@@ -96,7 +96,7 @@ int main(int argc, char *argv[])
"The package is installed if it is not already "
"installed. Pass --install to force "
"reinstallation."),
- QLatin1Literal("debugger"));
+ QLatin1String("debugger"));
parser.addOption(debugOption);
QCommandLineOption debuggerArgumentsOption(QStringLiteral("debugger-arguments"),
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 945ec3395..0d3966a7e 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -16,7 +16,7 @@ SUBDIRS=\
installed_cmake.depends = cmake
# These tests don't make sense for cross-compiled builds
-cross_compile:SUBDIRS -= linguist qdoc qtattributionsscanner windeployqt qhelpgenerator
+cross_compile:SUBDIRS -= linguist qdoc qtattributionsscanner windeployqt qhelpgenerator qtdiag
# Tests that might make sense, but currently use SRCDIR
cross_compile:SUBDIRS -= qhelpcontentmodel qhelpenginecore qhelpindexmodel qhelpprojectdata
@@ -30,5 +30,4 @@ cross_compile:SUBDIRS -= qhelpcontentmodel qhelpenginecore qhelpindexmodel qhelp
qhelpprojectdata \
!qtConfig(process): SUBDIRS -= qtattributionsscanner linguist qtdiag windeployqt
-android|qnx: SUBDIRS -= qtdiag
!win32|winrt: SUBDIRS -= windeployqt
diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp
index eb5367b55..2b3729d6c 100644
--- a/tests/auto/linguist/lconvert/tst_lconvert.cpp
+++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp
@@ -173,7 +173,7 @@ void tst_lconvert::convertChain(const QString &_inFileName, const QString &_outF
for (QProcess *cvt : qAsConst(cvts))
QVERIFY2(cvt->waitForStarted(), qPrintable(cvt->errorString()));
int st = 0;
- foreach (QProcess *cvt, cvts)
+ for (QProcess *cvt : qAsConst(cvts))
doWait(cvt, ++st);
if (!QTest::currentTestFailed())
diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp
index ea049a1f9..c55167a55 100644
--- a/tests/auto/linguist/lupdate/tst_lupdate.cpp
+++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp
@@ -223,7 +223,7 @@ void tst_lupdate::good_data()
dirs.removeAll(QLatin1String("backslashes"));
#endif
- foreach (const QString &dir, dirs)
+ for (const QString &dir : qAsConst(dirs))
QTest::newRow(dir.toLocal8Bit()) << dir;
}
@@ -253,7 +253,8 @@ void tst_lupdate::good()
} else if (cmdstring.startsWith("TRANSLATION:")) {
cmdstring.remove(0, 12);
generatedtsfiles.clear();
- foreach (const QByteArray &s, cmdstring.split(' '))
+ const auto parts = cmdstring.split(' ');
+ for (const QByteArray &s : parts)
if (!s.isEmpty())
generatedtsfiles << s;
} else if (cmdstring.startsWith("cd ")) {
@@ -264,7 +265,7 @@ void tst_lupdate::good()
file.close();
}
- foreach (const QString &ts, generatedtsfiles) {
+ for (const QString &ts : qAsConst(generatedtsfiles)) {
QString genTs = workDir + QLatin1Char('/') + ts;
QFile::remove(genTs);
QString beforetsfile = dir + QLatin1Char('/') + ts + QLatin1String(".before");
@@ -304,7 +305,7 @@ void tst_lupdate::good()
return;
}
- foreach (const QString &ts, generatedtsfiles)
+ for (const QString &ts : qAsConst(generatedtsfiles))
doCompare(workDir + QLatin1Char('/') + ts,
dir + QLatin1Char('/') + ts + QLatin1String(".result"), false);
}
diff --git a/tests/auto/qdoc/generatedoutput/TestCPP b/tests/auto/qdoc/generatedoutput/TestCPP
new file mode 100644
index 000000000..50cce69ff
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/TestCPP
@@ -0,0 +1 @@
+#include "testcpp.h"
diff --git a/tests/auto/qdoc/qmlcomponentoutput/componentset/ProgressBar.qml b/tests/auto/qdoc/generatedoutput/componentset/ProgressBar.qml
index 2a40cc488..2a40cc488 100644
--- a/tests/auto/qdoc/qmlcomponentoutput/componentset/ProgressBar.qml
+++ b/tests/auto/qdoc/generatedoutput/componentset/ProgressBar.qml
diff --git a/tests/auto/qdoc/qmlcomponentoutput/componentset/Switch.qml b/tests/auto/qdoc/generatedoutput/componentset/Switch.qml
index db9616b69..db9616b69 100644
--- a/tests/auto/qdoc/qmlcomponentoutput/componentset/Switch.qml
+++ b/tests/auto/qdoc/generatedoutput/componentset/Switch.qml
diff --git a/tests/auto/qdoc/qmlcomponentoutput/componentset/TabWidget.qml b/tests/auto/qdoc/generatedoutput/componentset/TabWidget.qml
index 07fd40db9..07fd40db9 100644
--- a/tests/auto/qdoc/qmlcomponentoutput/componentset/TabWidget.qml
+++ b/tests/auto/qdoc/generatedoutput/componentset/TabWidget.qml
diff --git a/tests/auto/qdoc/qmlcomponentoutput/componentset/componentset.pro b/tests/auto/qdoc/generatedoutput/componentset/componentset.pro
index 5b44737c2..5b44737c2 100644
--- a/tests/auto/qdoc/qmlcomponentoutput/componentset/componentset.pro
+++ b/tests/auto/qdoc/generatedoutput/componentset/componentset.pro
diff --git a/tests/auto/qdoc/qmlcomponentoutput/componentset/uicomponents.qdoc.sample b/tests/auto/qdoc/generatedoutput/componentset/uicomponents.qdoc.sample
index 0c6d187ed..0c6d187ed 100644
--- a/tests/auto/qdoc/qmlcomponentoutput/componentset/uicomponents.qdoc.sample
+++ b/tests/auto/qdoc/generatedoutput/componentset/uicomponents.qdoc.sample
diff --git a/tests/auto/qdoc/qmlcomponentoutput/examples.qdoc b/tests/auto/qdoc/generatedoutput/examples.qdoc
index 7c780eca8..7c780eca8 100644
--- a/tests/auto/qdoc/qmlcomponentoutput/examples.qdoc
+++ b/tests/auto/qdoc/generatedoutput/examples.qdoc
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/qdoctests-qdocfileoutput-linking.html b/tests/auto/qdoc/generatedoutput/expected_output/qdoctests-qdocfileoutput-linking.html
new file mode 100644
index 000000000..da5398612
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/expected_output/qdoctests-qdocfileoutput-linking.html
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<!-- qdoctests-outputfromqdocfiles.qdoc -->
+ <title>Testing QDoc's link command | Test</title>
+</head>
+<body>
+<div class="sidebar">
+<div class="toc">
+<h3><a name="toc">Contents</a></h3>
+<ul>
+<li class="level1"><a href="#link-targets">Link targets</a></li>
+</ul>
+</div>
+<div class="sidebar-content" id="sidebar-content"></div></div>
+<h1 class="title">Testing QDoc's link command</h1>
+<span class="subtitle"></span>
+<!-- $$$qdoctests-qdocfileoutput-linking.html-description -->
+<div class="descr"> <a name="details"></a>
+<a name="link-test-target"></a><a name="link-targets"></a>
+<h2 id="link-targets">Link targets</h2>
+<p>Valid parameters for the link command (<code>\l</code>) are page and section titles, targets defined with \target or \keyword commands, and API reference keywords (types, methods, namespaces, and so on).</p>
+</div>
+<!-- @@@qdoctests-qdocfileoutput-linking.html -->
+</body>
+</html>
diff --git a/tests/auto/qdoc/qdocfileoutput/expected_output/qdoctests-qdocfileoutput.html b/tests/auto/qdoc/generatedoutput/expected_output/qdoctests-qdocfileoutput.html
index 199d63ef1..6f444482d 100644
--- a/tests/auto/qdoc/qdocfileoutput/expected_output/qdoctests-qdocfileoutput.html
+++ b/tests/auto/qdoc/generatedoutput/expected_output/qdoctests-qdocfileoutput.html
@@ -13,6 +13,7 @@
<ul>
<li class="level1"><a href="#supported-file-types">Supported file types</a></li>
<li class="level1"><a href="#further-information">Further information</a></li>
+<li class="level1"><a href="#linking">Linking</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
@@ -38,6 +39,15 @@
<li><code>\li</code></li>
<li><code>\endlist</code></li>
</ul>
+<a name="linking"></a>
+<h2 id="linking">Linking</h2>
+<p>There are multiple ways to create hyperlinks to other topics:</p>
+<ul>
+<li><a href="qdoctests-qdocfileoutput-linking.html">Linking to a page title</a></li>
+<li><a href="qdoctests-qdocfileoutput-linking.html#link-targets">Linking to a section title</a></li>
+<li><a href="qdoctests-qdocfileoutput-linking.html#link-test-target">Linking using a \target string</a></li>
+<li><a href="qdoctests-qdocfileoutput-linking.html">Linking using a \keyword string</a></li>
+</ul>
</div>
<!-- @@@qdoctests-qdocfileoutput.html -->
</body>
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/test-componentset-example.html b/tests/auto/qdoc/generatedoutput/expected_output/test-componentset-example.html
new file mode 100644
index 000000000..40c874a3c
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/expected_output/test-componentset-example.html
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<!-- examples.qdoc -->
+ <title>QML Documentation Example | Test</title>
+</head>
+<body>
+<div class="sidebar">
+<div class="toc">
+<h3><a name="toc">Contents</a></h3>
+<ul>
+<li class="level1"><a href="#qml-class">QML Class</a></li>
+<li class="level1"><a href="#properties-signals-handlers-and-methods">Properties, Signals, Handlers, and Methods</a></li>
+<li class="level2"><a href="#internal-documentation">Internal Documentation</a></li>
+<li class="level1"><a href="#qml-types-with-c-implementation">QML Types with C++ Implementation</a></li>
+</ul>
+</div>
+<div class="sidebar-content" id="sidebar-content"></div></div>
+<h1 class="title">QML Documentation Example</h1>
+<span class="subtitle"></span>
+<!-- $$$componentset-description -->
+<div class="descr"> <a name="details"></a>
+<p>This example demonstrates one of the ways to document QML types.</p>
+<p>In particular, there are sample types that are documented with QDoc commands comments. There are documentation comments for the QML types and their public interfaces. The types are grouped into a module, the <a href="uicomponents-qmlmodule.html">UI Components</a> module.</p>
+<p>The uicomponents.qdoc file generates the overview page for the <a href="uicomponents-qmlmodule.html">UI Components</a> module page.</p>
+<p>The generated documentation is available in the <a href="uicomponents-qmlmodule.html">UI Components</a> module.</p>
+<a name="qml-class"></a>
+<h4 id="qml-class">QML Class</h4>
+<p>The QML types use the \qmltype to document the type. In addition, they have the \inmodule command in order for QDoc to associate them to the <code>UIComponents</code> module.</p>
+<p>QDoc uses the \brief command to place a basic description when listing the types.</p>
+<a name="properties-signals-handlers-and-methods"></a>
+<h4 id="properties-signals-handlers-and-methods">Properties, Signals, Handlers, and Methods</h4>
+<p>The types have their properties, signals, handlers, and methods defined in their respective QML files. QDoc associates the properties and methods to the types, therefore, you only need to place the documentation above the property, method, or signal.</p>
+<p>To document the type of a <i>property alias</i>, you must use the \qmlproperty command to specify the data type.</p>
+<pre class="cpp">\qmlproperty <span class="type">int</span> anAliasedProperty
+An aliased property of type <span class="type">int</span><span class="operator">.</span></pre>
+<a name="internal-documentation"></a>
+<h5 id="internal-documentation">Internal Documentation</h5>
+<p>You may declare that a documentation is for internal use by placing the \internal command after the beginning QDoc comment <code>/*</code>. QDoc will prevent the internal documentation from appearing in the public API.</p>
+<p>If you wish to omit certain parts of the documentation, you may use the \omit and \endomit command.</p>
+<a name="qml-types-with-c-implementation"></a>
+<h4 id="qml-types-with-c-implementation">QML Types with C++ Implementation</h4>
+<p>This example only demonstrates the documentation for types in QML files, but the regular QML commands may be placed inside C++ classes to define the public API of the QML type.</p>
+</div>
+<!-- @@@componentset -->
+</body>
+</html>
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testcpp-module.html b/tests/auto/qdoc/generatedoutput/expected_output/testcpp-module.html
new file mode 100644
index 000000000..fc05a8d14
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/expected_output/testcpp-module.html
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<!-- testcpp.cpp -->
+ <title>QDoc Test C++ Classes | TestCPP</title>
+</head>
+<body>
+<div class="sidebar">
+<div class="toc">
+<h3><a name="toc">Contents</a></h3>
+<ul>
+<li class="level1"><a href="#namespaces">Namespaces</a></li>
+<li class="level1"><a href="#classes">Classes</a></li>
+<li class="level1"><a href="#details">Detailed Description</a></li>
+</ul>
+</div>
+<div class="sidebar-content" id="sidebar-content"></div></div>
+<h1 class="title">QDoc Test C++ Classes</h1>
+<span class="subtitle"></span>
+<!-- $$$TestCPP-brief -->
+<p>A test module page. <a href="#details">More...</a></p>
+<!-- @@@TestCPP -->
+<a name="namespaces"></a>
+<h2 id="namespaces">Namespaces</h2>
+<div class="table"><table class="annotated">
+<tr class="odd topAlign"><td class="tblName"><p><a href="testqdoc.html">TestQDoc</a></p></td><td class="tblDescr"><p>A namespace</p></td></tr>
+</table></div>
+<a name="classes"></a>
+<h2 id="classes">Classes</h2>
+<div class="table"><table class="annotated">
+<tr class="odd topAlign"><td class="tblName"><p><a href="testqdoc-test.html">TestQDoc::Test</a></p></td><td class="tblDescr"><p>A class in a namespace</p></td></tr>
+<tr class="even topAlign"><td class="tblName"><p><a href="testqdoc-testderived.html">TestQDoc::TestDerived</a></p></td><td class="tblDescr"><p>A derived class in a namespace</p></td></tr>
+</table></div>
+<!-- $$$TestCPP-description -->
+<a name="details"></a>
+<div class="descr">
+<h2 id="details">Detailed Description</h2>
+</div>
+<!-- @@@TestCPP -->
+</body>
+</html>
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test-members.html b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test-members.html
new file mode 100644
index 000000000..a52123a32
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test-members.html
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<!-- testcpp.cpp -->
+ <title>List of All Members for Test | TestCPP</title>
+</head>
+<body>
+<li>Test</li>
+<div class="sidebar"><div class="sidebar-content" id="sidebar-content"></div></div>
+<h1 class="title">List of All Members for Test</h1>
+<p>This is the complete list of members for <a href="testqdoc-test.html">TestQDoc::Test</a>, including inherited members.</p>
+<ul>
+<li class="fn"><span class="name"><b><a href="testqdoc-test.html#inlineFunction">inlineFunction</a></b></span>()</li>
+<li class="fn"><span class="name"><b><a href="testqdoc-test.html#someFunction">someFunction</a></b></span>(int ) : int</li>
+<li class="fn"><span class="name"><b><a href="testqdoc-test.html#someFunctionDefaultArg">someFunctionDefaultArg</a></b></span>(int , bool )</li>
+<li class="fn"><span class="name"><b><a href="testqdoc-test.html#virtualFun">virtualFun</a></b></span>()</li>
+</ul>
+</body>
+</html>
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test-obsolete.html b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test-obsolete.html
new file mode 100644
index 000000000..732300dd3
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test-obsolete.html
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<!-- testcpp.cpp -->
+ <title>Obsolete Members for Test | TestCPP</title>
+</head>
+<body>
+<li>Test</li>
+<div class="sidebar"><div class="sidebar-content" id="sidebar-content"></div></div>
+<h1 class="title">Obsolete Members for Test</h1>
+<p><b>The following members of class <a href="testqdoc-test.html">Test</a> are obsolete.</b> They are provided to keep old source code working. We strongly advise against using them in new code.</p>
+<h2>Public Functions</h2>
+<div class="table"><table class="alignedsummary">
+<tr><td class="memItemLeft topAlign rightAlign"> <code>(obsolete) </code>void </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test-obsolete.html#anotherObsoleteMember">anotherObsoleteMember</a></b>()</td></tr>
+<tr><td class="memItemLeft topAlign rightAlign"> <code>(obsolete) </code>void </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test-obsolete.html#deprecatedMember">deprecatedMember</a></b>()</td></tr>
+<tr><td class="memItemLeft topAlign rightAlign"> <code>(obsolete) </code>void </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test-obsolete.html#obsoleteMember">obsoleteMember</a></b>()</td></tr>
+</table></div>
+<h2>Member Function Documentation</h2>
+<!-- $$$anotherObsoleteMember[overload1]$$$anotherObsoleteMember -->
+<h3 class="fn" id="anotherObsoleteMember"><a name="anotherObsoleteMember"></a><span class="type">void</span> Test::<span class="name">anotherObsoleteMember</span>()</h3>
+<p>This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.</p>
+<p>Use <a href="testqdoc-test-obsolete.html#obsoleteMember">obsoleteMember</a>() instead.</p>
+<!-- @@@anotherObsoleteMember -->
+<!-- $$$deprecatedMember[overload1]$$$deprecatedMember -->
+<h3 class="fn" id="deprecatedMember"><a name="deprecatedMember"></a><span class="type">void</span> Test::<span class="name">deprecatedMember</span>()</h3>
+<p>This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.</p>
+<p>Use <a href="testqdoc-test.html#someFunction">someFunction</a>() instead.</p>
+<!-- @@@deprecatedMember -->
+<!-- $$$obsoleteMember[overload1]$$$obsoleteMember -->
+<h3 class="fn" id="obsoleteMember"><a name="obsoleteMember"></a><span class="type">void</span> Test::<span class="name">obsoleteMember</span>()</h3>
+<p>This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.</p>
+<p>Use <a href="testqdoc-test.html#someFunction">someFunction</a>() instead.</p>
+<!-- @@@obsoleteMember -->
+</body>
+</html>
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html
new file mode 100644
index 000000000..32fb9efa0
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<!-- testcpp.cpp -->
+ <title>Test Class | TestCPP</title>
+</head>
+<body>
+<li>Test</li>
+<div class="sidebar">
+<div class="toc">
+<h3><a name="toc">Contents</a></h3>
+<ul>
+<li class="level1"><a href="#public-functions">Public Functions</a></li>
+<li class="level1"><a href="#macros">Macros</a></li>
+<li class="level1"><a href="#details">Detailed Description</a></li>
+</ul>
+</div>
+<div class="sidebar-content" id="sidebar-content"></div></div>
+<h1 class="title">Test Class</h1>
+<span class="small-subtitle">(<a href="testqdoc-test.html">TestQDoc::Test</a>)<br/></span>
+<!-- $$$Test-brief -->
+<p>A class in a namespace. <a href="#details">More...</a></p>
+<!-- @@@Test -->
+<div class="table"><table class="alignedsummary">
+<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include &lt;Test&gt;</span>
+</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += testcpp</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherited By:</td><td class="memItemRight bottomAlign"> <p><a href="testqdoc-testderived.html">TestQDoc::TestDerived</a></p>
+</td></tr></table></div><ul>
+<li><a href="testqdoc-test-members.html">List of all members, including inherited members</a></li>
+<li><a href="testqdoc-test-obsolete.html">Obsolete members</a></li>
+</ul>
+<a name="public-functions"></a>
+<h2 id="public-functions">Public Functions</h2>
+<div class="table"><table class="alignedsummary">
+<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#inlineFunction">inlineFunction</a></b>()</td></tr>
+<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#someFunction">someFunction</a></b>(int <i>v</i>)</td></tr>
+<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#someFunctionDefaultArg">someFunctionDefaultArg</a></b>(int <i>i</i>, bool <i>b</i> = false)</td></tr>
+<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#virtualFun">virtualFun</a></b>()</td></tr>
+</table></div>
+<a name="macros"></a>
+<h2 id="macros">Macros</h2>
+<div class="table"><table class="alignedsummary">
+<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#QDOCTEST_MACRO2">QDOCTEST_MACRO2</a></b>(<i>x</i>)</td></tr>
+</table></div>
+<a name="details"></a>
+<!-- $$$Test-description -->
+<div class="descr">
+<h2 id="details">Detailed Description</h2>
+</div>
+<!-- @@@Test -->
+<div class="func">
+<h2>Member Function Documentation</h2>
+<!-- $$$inlineFunction[overload1]$$$inlineFunction -->
+<h3 class="fn" id="inlineFunction"><a name="inlineFunction"></a><span class="type">void</span> Test::<span class="name">inlineFunction</span>()</h3>
+<p>An inline function, documented using the \fn QDoc command.</p>
+<!-- @@@inlineFunction -->
+<!-- $$$someFunction[overload1]$$$someFunctionint -->
+<h3 class="fn" id="someFunction"><a name="someFunction"></a><span class="type">int</span> Test::<span class="name">someFunction</span>(<span class="type">int</span> <i>v</i>)</h3>
+<p>Function that takes a parameter <i>v</i>. Also returns the value of <i>v</i>.</p>
+<!-- @@@someFunction -->
+<!-- $$$someFunctionDefaultArg[overload1]$$$someFunctionDefaultArgintbool -->
+<h3 class="fn" id="someFunctionDefaultArg"><a name="someFunctionDefaultArg"></a><span class="type">void</span> Test::<span class="name">someFunctionDefaultArg</span>(<span class="type">int</span> <i>i</i>, <span class="type">bool</span> <i>b</i> = false)</h3>
+<p>Function that takes a parameter <i>i</i> and <i>b</i>.</p>
+<!-- @@@someFunctionDefaultArg -->
+<!-- $$$virtualFun[overload1]$$$virtualFun -->
+<h3 class="fn" id="virtualFun"><a name="virtualFun"></a><code>[virtual] </code><span class="type">void</span> Test::<span class="name">virtualFun</span>()</h3>
+<p>Function that must be reimplemented.</p>
+<!-- @@@virtualFun -->
+</div>
+<div class="macros">
+<h2>Macro Documentation</h2>
+<!-- $$$QDOCTEST_MACRO2[overload1]$$$QDOCTEST_MACRO2 -->
+<h3 class="fn" id="QDOCTEST_MACRO2"><a name="QDOCTEST_MACRO2"></a><span class="name">QDOCTEST_MACRO2</span>(<i>x</i>)</h3>
+<p>A macro with argument <i>x</i>.</p>
+<p>This function was introduced in Test 1.1.</p>
+<!-- @@@QDOCTEST_MACRO2 -->
+</div>
+</body>
+</html>
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-testderived-members.html b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-testderived-members.html
new file mode 100644
index 000000000..f5adf249c
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-testderived-members.html
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<!-- testcpp.cpp -->
+ <title>List of All Members for TestDerived | TestCPP</title>
+</head>
+<body>
+<li>TestDerived</li>
+<div class="sidebar"><div class="sidebar-content" id="sidebar-content"></div></div>
+<h1 class="title">List of All Members for TestDerived</h1>
+<p>This is the complete list of members for <a href="testqdoc-testderived.html">TestQDoc::TestDerived</a>, including inherited members.</p>
+<ul>
+<li class="fn"><span class="name"><b><a href="testqdoc-test.html#QDOCTEST_MACRO2">QDOCTEST_MACRO2</a></b></span>()</li>
+<li class="fn"><span class="name"><b><a href="testqdoc-test.html#inlineFunction">inlineFunction</a></b></span>()</li>
+<li class="fn"><span class="name"><b><a href="testqdoc-test.html#someFunction">someFunction</a></b></span>(int ) : int</li>
+<li class="fn"><span class="name"><b><a href="testqdoc-test.html#someFunctionDefaultArg">someFunctionDefaultArg</a></b></span>(int , bool )</li>
+<li class="fn"><span class="name"><b><a href="testqdoc-testderived.html#virtualFun">virtualFun</a></b></span>()</li>
+</ul>
+</body>
+</html>
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-testderived.html b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-testderived.html
new file mode 100644
index 000000000..a5478fc66
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-testderived.html
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<!-- testcpp.cpp -->
+ <title>TestDerived Class | TestCPP</title>
+</head>
+<body>
+<li>TestDerived</li>
+<div class="sidebar">
+<div class="toc">
+<h3><a name="toc">Contents</a></h3>
+<ul>
+<li class="level1"><a href="#reimplemented-public-functions">Reimplemented Public Functions</a></li>
+<li class="level1"><a href="#details">Detailed Description</a></li>
+</ul>
+</div>
+<div class="sidebar-content" id="sidebar-content"></div></div>
+<h1 class="title">TestDerived Class</h1>
+<span class="small-subtitle">(<a href="testqdoc-testderived.html">TestQDoc::TestDerived</a>)<br/></span>
+<!-- $$$TestDerived-brief -->
+<p>A derived class in a namespace. <a href="#details">More...</a></p>
+<!-- @@@TestDerived -->
+<div class="table"><table class="alignedsummary">
+<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include &lt;TestDerived&gt;</span>
+</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += testcpp</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="testqdoc-test.html">TestQDoc::Test</a></td></tr></table></div><ul>
+<li><a href="testqdoc-testderived-members.html">List of all members, including inherited members</a></li>
+</ul>
+<a name="reimplemented-public-functions"></a>
+<h2 id="reimplemented-public-functions">Reimplemented Public Functions</h2>
+<div class="table"><table class="alignedsummary">
+<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-testderived.html#virtualFun">virtualFun</a></b>() override</td></tr>
+</table></div>
+<a name="details"></a>
+<!-- $$$TestDerived-description -->
+<div class="descr">
+<h2 id="details">Detailed Description</h2>
+</div>
+<!-- @@@TestDerived -->
+<div class="func">
+<h2>Member Function Documentation</h2>
+<!-- $$$virtualFun[overload1]$$$virtualFun -->
+<h3 class="fn" id="virtualFun"><a name="virtualFun"></a><code>[override virtual] </code><span class="type">void</span> TestDerived::<span class="name">virtualFun</span>()</h3>
+<p>Reimplements: <a href="testqdoc-test.html#virtualFun">Test::virtualFun</a>().</p>
+<!-- @@@virtualFun -->
+</div>
+</body>
+</html>
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc.html b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc.html
new file mode 100644
index 000000000..94ef710fc
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc.html
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<!-- testcpp.cpp -->
+ <title>TestQDoc Namespace | TestCPP</title>
+</head>
+<body>
+<div class="sidebar">
+<div class="toc">
+<h3><a name="toc">Contents</a></h3>
+<ul>
+<li class="level1"><a href="#classes">Classes</a></li>
+<li class="level1"><a href="#macros">Macros</a></li>
+<li class="level1"><a href="#details">Detailed Description</a></li>
+<li class="level2"><a href="#usage">Usage</a></li>
+</ul>
+</div>
+<div class="sidebar-content" id="sidebar-content"></div></div>
+<h1 class="title">TestQDoc Namespace</h1>
+<!-- $$$TestQDoc-brief -->
+<p>A namespace. <a href="#details">More...</a></p>
+<!-- @@@TestQDoc -->
+<div class="table"><table class="alignedsummary">
+<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include &lt;TestCPP&gt;</span>
+</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += testcpp</td></tr></table></div><ul>
+</ul>
+<a name="classes"></a>
+<h2 id="classes">Classes</h2>
+<div class="table"><table class="alignedsummary">
+<tr><td class="memItemLeft rightAlign topAlign"> class </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html">Test</a></b></td></tr>
+<tr><td class="memItemLeft rightAlign topAlign"> class </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-testderived.html">TestDerived</a></b></td></tr>
+</table></div>
+<a name="macros"></a>
+<h2 id="macros">Macros</h2>
+<div class="table"><table class="alignedsummary">
+<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="testqdoc.html#QDOCTEST_MACRO">QDOCTEST_MACRO</a></b></td></tr>
+</table></div>
+<a name="details"></a>
+<!-- $$$TestQDoc-description -->
+<div class="descr">
+<h2 id="details">Detailed Description</h2>
+<a name="usage"></a>
+<h3 id="usage">Usage</h3>
+<p>This namespace is for testing QDoc output.</p>
+</div>
+<!-- @@@TestQDoc -->
+<div class="classes">
+<h2>Classes</h2>
+<h3> class <a href="testqdoc-test.html">Test</a></h3><!-- $$$Test-brief -->
+<p>A class in a namespace. <a href="testqdoc-test.html#details">More...</a></p>
+<!-- @@@Test -->
+<h3> class <a href="testqdoc-testderived.html">TestDerived</a></h3><!-- $$$TestDerived-brief -->
+<p>A derived class in a namespace. <a href="testqdoc-testderived.html#details">More...</a></p>
+<!-- @@@TestDerived -->
+</div>
+<div class="macros">
+<h2>Macro Documentation</h2>
+<!-- $$$QDOCTEST_MACRO[overload1]$$$QDOCTEST_MACRO -->
+<h3 class="fn" id="QDOCTEST_MACRO"><a name="QDOCTEST_MACRO"></a><span class="name">QDOCTEST_MACRO</span></h3>
+<!-- @@@QDOCTEST_MACRO -->
+</div>
+</body>
+</html>
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/uicomponents-qmlmodule.html b/tests/auto/qdoc/generatedoutput/expected_output/uicomponents-qmlmodule.html
new file mode 100644
index 000000000..8c577ab7f
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/expected_output/uicomponents-qmlmodule.html
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<!-- examples.qdoc -->
+ <title>UI Components | Test</title>
+</head>
+<body>
+<div class="sidebar"><div class="sidebar-content" id="sidebar-content"></div></div>
+<h1 class="title">UI Components</h1>
+<span class="subtitle"></span>
+<!-- $$$UIComponents-description -->
+<div class="descr"> <a name="details"></a>
+<p>This is a listing of a list of UI components implemented by QML types. These files are available for general import and they are based on the Qt Quick Code Samples.</p>
+<p>This module is part of the <a href="test-componentset-example.html">UIComponents</a> example.</p>
+</div>
+<!-- @@@UIComponents -->
+</body>
+</html>
diff --git a/tests/auto/qdoc/qdocfileoutput/qdocfileoutput.pro b/tests/auto/qdoc/generatedoutput/generatedoutput.pro
index a03f5ab6e..81434cebc 100644
--- a/tests/auto/qdoc/qdocfileoutput/qdocfileoutput.pro
+++ b/tests/auto/qdoc/generatedoutput/generatedoutput.pro
@@ -1,9 +1,9 @@
CONFIG += testcase
QT = core testlib
-TARGET = tst_qdocfileoutput
+TARGET = tst_generatedOutput
SOURCES += \
- tst_qdocfileoutput.cpp
+ tst_generatedoutput.cpp
QMAKE_DOCS = $$PWD/test.qdocconf
diff --git a/tests/auto/qdoc/qdocfileoutput/qdoctests-outputfromqdocfiles.qdoc b/tests/auto/qdoc/generatedoutput/qdoctests-outputfromqdocfiles.qdoc
index fc3a5d870..e56c447c4 100644
--- a/tests/auto/qdoc/qdocfileoutput/qdoctests-outputfromqdocfiles.qdoc
+++ b/tests/auto/qdoc/generatedoutput/qdoctests-outputfromqdocfiles.qdoc
@@ -55,4 +55,29 @@
\li \c {\li}
\li \c {\endlist}
\endlist
+
+ \section1 Linking
+
+ There are multiple ways to create hyperlinks to other topics:
+
+ \list
+ \li \l {Testing QDoc's link command}{Linking to a page title}
+ \li \l {Link targets}{Linking to a section title}
+ \li \l {link-test-target}{Linking using a \\target string}
+ \li \l {QDoc Linking Test}{Linking using a \\keyword string}
+ \endlist
+*/
+
+/*!
+ \keyword QDoc Linking Test
+ \page qdoctests-qdocfileoutput-linking.html
+ \title Testing QDoc's link command
+ \brief This is a page for testing QDoc's link command.
+
+ \target link-test-target
+ \section1 Link targets
+
+ Valid parameters for the link command (\c {\l}) are page and section
+ titles, targets defined with \\target or \\keyword commands, and API
+ reference keywords (types, methods, namespaces, and so on).
*/
diff --git a/tests/auto/qdoc/qdocfileoutput/test.qdocconf b/tests/auto/qdoc/generatedoutput/test.qdocconf
index 47ed6a919..fe51e1c67 100644
--- a/tests/auto/qdoc/qdocfileoutput/test.qdocconf
+++ b/tests/auto/qdoc/generatedoutput/test.qdocconf
@@ -2,10 +2,7 @@ project = Test
description = "A test project for QDoc build artifacts"
moduleheader =
-headerdirs = .
-sourcedirs = .
-
-sources.fileextensions = *.qdoc
+sources = qdoctests-outputfromqdocfiles.qdoc
macro.beginqdoc = "\\c {/*!}"
macro.endqdoc = "\\c */"
diff --git a/tests/auto/qdoc/generatedoutput/testcpp.cpp b/tests/auto/qdoc/generatedoutput/testcpp.cpp
new file mode 100644
index 000000000..3277d496d
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/testcpp.cpp
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "testcpp.h"
+
+namespace TestQDoc {
+
+/*!
+ \module TestCPP
+ \qtvariable testcpp
+ \title QDoc Test C++ Classes
+ \brief A test module page.
+*/
+
+/*!
+ \namespace TestQDoc
+ \inheaderfile TestCPP
+ \inmodule TestCPP
+ \brief A namespace.
+
+ \section1 Usage
+ This namespace is for testing QDoc output.
+*/
+
+/*!
+ \class TestQDoc::Test
+ \inmodule TestCPP
+ \brief A class in a namespace.
+*/
+
+/*!
+ \class TestQDoc::TestDerived
+ \inmodule TestCPP
+ \brief A derived class in a namespace.
+*/
+
+/*!
+ \macro QDOCTEST_MACRO
+ \relates TestQDoc
+*/
+
+/*!
+ \macro QDOCTEST_MACRO2(x)
+ \relates TestQDoc::Test
+ \since Test 1.1
+ \brief A macro with argument \a x.
+*/
+
+/*!
+ \deprecated
+
+ Use someFunction() instead.
+*/
+void Test::deprecatedMember()
+{
+ return;
+}
+
+/*!
+ \obsolete
+
+ Use someFunction() instead.
+*/
+void Test::obsoleteMember()
+{
+ return;
+}
+
+/*!
+ \obsolete
+
+ Use obsoleteMember() instead.
+*/
+void Test::anotherObsoleteMember()
+{
+ return;
+}
+
+/*!
+ Function that takes a parameter \a i and \a b.
+*/
+void Test::someFunctionDefaultArg(int i, bool b = false)
+{
+ return;
+}
+
+/*!
+ Function that takes a parameter \a v.
+ Also returns the value of \a v.
+*/
+int Test::someFunction(int v)
+{
+ return v;
+}
+
+/*!
+ \fn void TestQDoc::Test::inlineFunction()
+
+ \brief An inline function, documented using the \CMDFN QDoc command.
+*/
+
+/*!
+ Function that must be reimplemented.
+*/
+void Test::virtualFun()
+{
+ return;
+}
+
+/*!
+ \reimp
+*/
+void TestDerived::virtualFun()
+{
+ return;
+}
+
+} // namespace TestQDoc
diff --git a/tests/auto/qdoc/generatedoutput/testcpp.h b/tests/auto/qdoc/generatedoutput/testcpp.h
new file mode 100644
index 000000000..733f9e751
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/testcpp.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#pragma once
+#define QDOCTEST_MACRO test
+#define QDOCTEST_MACRO2(x) (x) < 0 ? 0 : (x))
+
+namespace TestQDoc {
+
+class Test {
+public:
+ int someFunction(int v);
+ void someFunctionDefaultArg(int i, bool b);
+ void obsoleteMember();
+ void anotherObsoleteMember();
+ void deprecatedMember();
+ inline void inlineFunction() {};
+ virtual void virtualFun();
+};
+
+class TestDerived : public Test {
+public:
+ void virtualFun() override;
+};
+
+} // namespace TestQDoc
diff --git a/tests/auto/qdoc/generatedoutput/testcpp.qdocconf b/tests/auto/qdoc/generatedoutput/testcpp.qdocconf
new file mode 100644
index 000000000..70c226cf2
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/testcpp.qdocconf
@@ -0,0 +1,7 @@
+project = TestCPP
+includepaths += -I.
+
+headers = testcpp.h
+sources = testcpp.cpp
+
+macro.CMDFN = \\\\fn
diff --git a/tests/auto/qdoc/generatedoutput/testqml.qdocconf b/tests/auto/qdoc/generatedoutput/testqml.qdocconf
new file mode 100644
index 000000000..769c3d627
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/testqml.qdocconf
@@ -0,0 +1,10 @@
+project = Test
+description = "A test project for QDoc build artifacts"
+moduleheader=
+outputdir = ./html
+
+exampledirs = .
+sources.fileextensions = \
+ examples.qdoc
+
+macro.begincomment = "\\c{/*}"
diff --git a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp
new file mode 100644
index 000000000..09709ac6c
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp
@@ -0,0 +1,162 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QProcess>
+#include <QTemporaryDir>
+#include <QtTest>
+
+class tst_generatedOutput : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void initTestCase();
+ void init();
+
+ void htmlFromQDocFile();
+ void htmlFromCpp();
+ void htmlFromQml();
+
+private:
+ QScopedPointer<QTemporaryDir> m_outputDir;
+ QString m_qdoc;
+
+ void runQDocProcess(const QStringList &arguments);
+ void compareLineByLine(const QStringList &expectedFiles);
+ void testAndCompare(const char *input,
+ const char *outNames,
+ const char *extraParams = nullptr);
+};
+
+void tst_generatedOutput::initTestCase()
+{
+ // Build the path to the QDoc binary the same way moc tests do for moc.
+ const auto binpath = QLibraryInfo::location(QLibraryInfo::BinariesPath);
+ const auto extension = QSysInfo::productType() == "windows" ? ".exe" : "";
+ m_qdoc = binpath + QLatin1String("/qdoc") + extension;
+}
+
+void tst_generatedOutput::init()
+{
+ m_outputDir.reset(new QTemporaryDir());
+ if (!m_outputDir->isValid()) {
+ const QString errorMessage =
+ "Couldn't create temporary directory: " + m_outputDir->errorString();
+ QFAIL(qPrintable(errorMessage));
+ }
+}
+
+void tst_generatedOutput::runQDocProcess(const QStringList &arguments)
+{
+ QProcess qdocProcess;
+ qdocProcess.setProgram(m_qdoc);
+ qdocProcess.setArguments(arguments);
+ qdocProcess.start();
+ qdocProcess.waitForFinished();
+
+ if (qdocProcess.exitCode() == 0)
+ return;
+
+ QString output = qdocProcess.readAllStandardOutput();
+ QString errors = qdocProcess.readAllStandardError();
+
+ qInfo() << "QDoc exited with exit code" << qdocProcess.exitCode();
+ if (output.size() > 0)
+ qInfo() << "Received output:\n" << output;
+ if (errors.size() > 0)
+ qInfo() << "Received errors:\n" << errors;
+
+ QFAIL("Running QDoc failed. See output above.");
+}
+
+void tst_generatedOutput::compareLineByLine(const QStringList &expectedFiles)
+{
+ for (const auto &file : expectedFiles) {
+ QString expected(QFINDTESTDATA("/expected_output/" + file));
+ QString actual(m_outputDir->path() + "/" + file);
+
+ QFile expectedFile(expected);
+ if (!expectedFile.open(QIODevice::ReadOnly))
+ QFAIL("Cannot open expected data file!");
+ QTextStream expectedIn(&expectedFile);
+
+ QFile actualFile(actual);
+ if (!actualFile.open(QIODevice::ReadOnly))
+ QFAIL("Cannot open actual data file!");
+ QTextStream actualIn(&actualFile);
+
+ const QLatin1String delim(": ");
+ int lineNumber = 0;
+ while (!expectedIn.atEnd() && !actualIn.atEnd()) {
+ lineNumber++;
+ QString prefix = file + delim + QString::number(lineNumber) + delim;
+ QString expectedLine = prefix + expectedIn.readLine();
+ QString actualLine = prefix + actualIn.readLine();
+ QCOMPARE(actualLine, expectedLine);
+ }
+ }
+}
+
+void tst_generatedOutput::testAndCompare(const char *input,
+ const char *outNames,
+ const char *extraParams)
+{
+ QStringList args{ "-outputdir", m_outputDir->path(), QFINDTESTDATA(input) };
+ if (extraParams)
+ args << QString(QLatin1String(extraParams)).split(QChar(' '));
+ runQDocProcess(args);
+ if (QTest::currentTestFailed())
+ return;
+ compareLineByLine(QString(QLatin1String(outNames)).split(QChar(' ')));
+}
+
+void tst_generatedOutput::htmlFromQDocFile()
+{
+ testAndCompare("test.qdocconf",
+ "qdoctests-qdocfileoutput.html "
+ "qdoctests-qdocfileoutput-linking.html");
+}
+
+void tst_generatedOutput::htmlFromCpp()
+{
+ testAndCompare("testcpp.qdocconf",
+ "testcpp-module.html "
+ "testqdoc-test.html "
+ "testqdoc-test-members.html "
+ "testqdoc.html");
+}
+
+void tst_generatedOutput::htmlFromQml()
+{
+ testAndCompare("testqml.qdocconf",
+ "test-componentset-example.html "
+ "uicomponents-qmlmodule.html");
+}
+
+QTEST_APPLESS_MAIN(tst_generatedOutput)
+
+#include "tst_generatedoutput.moc"
diff --git a/tests/auto/qdoc/qdoc.pro b/tests/auto/qdoc/qdoc.pro
index fd4953df8..97117dc6f 100644
--- a/tests/auto/qdoc/qdoc.pro
+++ b/tests/auto/qdoc/qdoc.pro
@@ -1,6 +1,4 @@
TEMPLATE = subdirs
SUBDIRS = \
- qdocfileoutput \
- qdocglobals
-
+ generatedoutput
diff --git a/tests/auto/qdoc/qdocfileoutput/tst_qdocfileoutput.cpp b/tests/auto/qdoc/qdocfileoutput/tst_qdocfileoutput.cpp
deleted file mode 100644
index 1be519786..000000000
--- a/tests/auto/qdoc/qdocfileoutput/tst_qdocfileoutput.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <QProcess>
-#include <QTemporaryDir>
-#include <QtTest>
-
-class tstQDocFileOutput : public QObject
-{
- Q_OBJECT
-
-private slots:
- void initTestCase();
- void compareQDocOutputWithExpectedData();
-
-private:
- QTemporaryDir m_outputDir;
-};
-
-void tstQDocFileOutput::initTestCase()
-{
- if (!m_outputDir.isValid()) {
- const QString errorMessage =
- "Couldn't create temporary directory:" + m_outputDir.errorString();
- QFAIL(qPrintable(errorMessage));
- }
-}
-
-void tstQDocFileOutput::compareQDocOutputWithExpectedData()
-{
- // Build the path to the QDoc binary the same way moc tests do for moc.
- QString binpath = QLibraryInfo::location(QLibraryInfo::BinariesPath);
- QString extension;
- if (QSysInfo::productType() == "windows")
- extension += ".exe";
- const QString qdoc = QString("%1/qdoc" + extension).arg(binpath);
-
- const QStringList arguments = {
- "--outputdir",
- m_outputDir.path(),
- QFINDTESTDATA("test.qdocconf")
- };
-
- QProcess qdocProcess;
- qdocProcess.setProgram(qdoc);
- qdocProcess.setArguments(arguments);
- qdocProcess.start();
- qdocProcess.waitForFinished();
- QString output(qdocProcess.readAllStandardOutput());
- QString errors(qdocProcess.readAllStandardError());
-
- if (qdocProcess.exitCode() != 0) {
- qInfo() << "QDoc exited with exit code" << qdocProcess.exitCode();
- if (output.size() > 0)
- qInfo() << "Received output:\n" << output;
- if (errors.size() > 0)
- qInfo() << "Received errors:\n" << errors;
- QFAIL("Running QDoc failed. See output above.");
- }
-
- QFile expected(QFINDTESTDATA("/expected_output/qdoctests-qdocfileoutput.html"));
- QFile actual(m_outputDir.path() + "/qdoctests-qdocfileoutput.html");
-
- if (!expected.open(QIODevice::ReadOnly))
- QFAIL("Cannot open expected data file!");
- QTextStream expectedIn(&expected);
-
- if (!actual.open(QIODevice::ReadOnly))
- QFAIL("Cannot open actual data file!");
- QTextStream actualIn(&actual);
-
- int lineNumber = 0;
- while (!expectedIn.atEnd()) {
- while (!actualIn.atEnd()) {
- lineNumber++;
- QString expectedLine =
- QString::number(lineNumber) + ": " + expectedIn.readLine();
- QString actualLine =
- QString::number(lineNumber) + ": " + actualIn.readLine();
- QCOMPARE(expectedLine, actualLine);
- }
- }
-}
-
-QTEST_APPLESS_MAIN(tstQDocFileOutput)
-
-#include "tst_qdocfileoutput.moc"
diff --git a/tests/auto/qdoc/qdocglobals/qdocglobals.pro b/tests/auto/qdoc/qdocglobals/qdocglobals.pro
deleted file mode 100644
index fa7ddb8e0..000000000
--- a/tests/auto/qdoc/qdocglobals/qdocglobals.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-CONFIG += testcase
-QT = core testlib
-TARGET = tst_qdocglobals
-INCLUDEPATH += $$PWD/../../../../src/qdoc
-
-HEADERS += $$PWD/../../../../src/qdoc/qdocglobals.h
-
-SOURCES += $$PWD/../../../../src/qdoc/qdocglobals.cpp \
- tst_qdocglobals.cpp
diff --git a/tests/auto/qdoc/qdocglobals/tst_qdocglobals.cpp b/tests/auto/qdoc/qdocglobals/tst_qdocglobals.cpp
deleted file mode 100644
index 286363500..000000000
--- a/tests/auto/qdoc/qdocglobals/tst_qdocglobals.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdocglobals.h"
-
-#include <QtCore/qhash.h>
-#include <QtCore/qstringlist.h>
-#include <QtTest/QtTest>
-
-class testQDocGlobals : public QObject
-{
- Q_OBJECT
-
-private slots:
- void testClassMembersInitializeToFalseOrEmpty();
- void testEnableHighlighting();
- void testSetShowInternal();
- void testSetSingleExec();
- void testSetWriteQaPages();
- void testRedirectDocumentationToDevNull();
- void testSetNoLinkErrors();
- void testSetAutoLinkErrors();
- void testSetObsoleteLinks();
-
- void testAddDefine();
- void testAddIncludePath();
- void testDependModules();
- void testAppendToIndexDirs();
- void testSetCurrentDir();
- void testPreviousCurrentDir();
- void testDefaults();
-};
-
-void testQDocGlobals::testClassMembersInitializeToFalseOrEmpty()
-{
- QDocGlobals qdocTestGlobals;
- QCOMPARE(qdocTestGlobals.highlighting(), false);
- QCOMPARE(qdocTestGlobals.showInternal(), false);
- QCOMPARE(qdocTestGlobals.singleExec(), false);
- QCOMPARE(qdocTestGlobals.writeQaPages(), false);
- QCOMPARE(qdocTestGlobals.redirectDocumentationToDevNull(), false);
- QCOMPARE(qdocTestGlobals.noLinkErrors(), false);
- QCOMPARE(qdocTestGlobals.autolinkErrors(), false);
- QCOMPARE(qdocTestGlobals.obsoleteLinks(), false);
-
- QVERIFY(qdocTestGlobals.defines().isEmpty());
- QVERIFY(qdocTestGlobals.includesPaths().isEmpty());
- QVERIFY(qdocTestGlobals.dependModules().isEmpty());
- QVERIFY(qdocTestGlobals.indexDirs().isEmpty());
- QVERIFY(qdocTestGlobals.currentDir().isEmpty());
- QVERIFY(qdocTestGlobals.previousCurrentDir().isEmpty());
- QVERIFY(qdocTestGlobals.defaults().isEmpty());
-}
-
-void testQDocGlobals::testEnableHighlighting()
-{
- QDocGlobals qdocTestGlobals;
- qdocTestGlobals.enableHighlighting(true);
- QVERIFY(qdocTestGlobals.highlighting());
-}
-
-void testQDocGlobals::testSetShowInternal()
-{
- QDocGlobals qdocTestGlobals;
- qdocTestGlobals.setShowInternal(true);
- QVERIFY(qdocTestGlobals.showInternal());
-}
-
-void testQDocGlobals::testSetSingleExec()
-{
- QDocGlobals qdocTestGlobals;
- qdocTestGlobals.setSingleExec(true);
- QVERIFY(qdocTestGlobals.singleExec());
-}
-
-void testQDocGlobals::testSetWriteQaPages()
-{
- QDocGlobals qdocTestGlobals;
- qdocTestGlobals.setWriteQaPages(true);
- QVERIFY(qdocTestGlobals.writeQaPages());
-}
-
-void testQDocGlobals::testRedirectDocumentationToDevNull()
-{
- QDocGlobals qdocTestGlobals;
- qdocTestGlobals.setRedirectDocumentationToDevNull(true);
- QVERIFY(qdocTestGlobals.redirectDocumentationToDevNull());
-}
-
-void testQDocGlobals::testSetNoLinkErrors()
-{
- QDocGlobals qdocTestGlobals;
- qdocTestGlobals.setNoLinkErrors(true);
- QVERIFY(qdocTestGlobals.noLinkErrors());
-}
-
-void testQDocGlobals::testSetAutoLinkErrors()
-{
- QDocGlobals qdocTestGlobals;
- qdocTestGlobals.setAutolinkErrors(true);
- QVERIFY(qdocTestGlobals.autolinkErrors());
-}
-
-void testQDocGlobals::testSetObsoleteLinks()
-{
- QDocGlobals qdocTestGlobals;
- qdocTestGlobals.setObsoleteLinks(true);
- QVERIFY(qdocTestGlobals.obsoleteLinks());
-}
-
-void testQDocGlobals::testAddDefine()
-{
- QDocGlobals qdocTestGlobals;
- QStringList defineTestList1 = { QStringLiteral("qtforpython") };
- QStringList defineTestList2 = { QStringLiteral("example") };
- QStringList expected;
- expected << defineTestList1 << defineTestList2;
-
- qdocTestGlobals.addDefine(defineTestList1);
- QCOMPARE(qdocTestGlobals.defines().size(), 1);
- qdocTestGlobals.addDefine(defineTestList2);
- QCOMPARE(qdocTestGlobals.defines().size(), 2);
- QCOMPARE(qdocTestGlobals.defines(), expected);
-}
-
-void testQDocGlobals::testAddIncludePath()
-{
- QDocGlobals qdocTestGlobals;
- QString testFlag = "-I";
- QString testPath0 = "/qt5/qtdoc/doc/.";
- QString testPath1 = "/qt5/qtbase/mkspecs/linux-g++";
- QStringList expected = { "-I/qt5/qtdoc/doc/.",
- "-I/qt5/qtbase/mkspecs/linux-g++" };
-
- qdocTestGlobals.addIncludePath(testFlag, testPath0);
- qdocTestGlobals.addIncludePath(testFlag, testPath1);
- QStringList result = qdocTestGlobals.includesPaths();
- QCOMPARE(result, expected);
-}
-
-void testQDocGlobals::testDependModules()
-{
- QDocGlobals qdocTestGlobals;
- QStringList expected = { "qdoc", "qmake", "qtcore", "qthelp", "qtqml" };
-
- qdocTestGlobals.dependModules() = expected;
- QCOMPARE(qdocTestGlobals.dependModules().size(), 5);
- QCOMPARE(qdocTestGlobals.dependModules(), expected);
-}
-
-void testQDocGlobals::testAppendToIndexDirs()
-{
- QDocGlobals qdocTestGlobals;
- QString testPath = "/qt5/qtbase/doc";
- QStringList expected;
- expected << testPath;
-
- qdocTestGlobals.appendToIndexDirs(testPath);
- QCOMPARE(qdocTestGlobals.indexDirs(), expected);
-}
-
-void testQDocGlobals::testSetCurrentDir()
-{
- QDocGlobals qdocTestGlobals;
- QString expected = "/qt5/qtdoc/doc/config";
-
- qdocTestGlobals.setCurrentDir(expected);
- QCOMPARE(qdocTestGlobals.currentDir(), expected);
-}
-
-void testQDocGlobals::testPreviousCurrentDir()
-{
- QDocGlobals qdocTestGlobals;
- QString expected = "/qt5/qtdoc/doc";
-
- qdocTestGlobals.setCurrentDir(expected);
- QCOMPARE(qdocTestGlobals.currentDir(), expected);
-}
-
-void testQDocGlobals::testDefaults()
-{
- QDocGlobals qdocTestGlobals;
-
- QHash<QString, QString> expected = {
- {"codeindent", "0"}, {"falsehoods", "0"},
- {"fileextensions", "*.cpp *.h *.qdoc *.qml"}, {"language", "Cpp"},
- {"outputformats", "HTML"}, {"tabsize", "8"}};
-
- qdocTestGlobals.defaults().insert(QStringLiteral("codeindent"),
- QLatin1String("0"));
- qdocTestGlobals.defaults().insert(QStringLiteral("falsehoods"),
- QLatin1String("0"));
- qdocTestGlobals.defaults().insert(QStringLiteral("fileextensions"),
- QLatin1String("*.cpp *.h *.qdoc *.qml"));
- qdocTestGlobals.defaults().insert(QStringLiteral("language"),
- QLatin1String("Cpp"));
- qdocTestGlobals.defaults().insert(QStringLiteral("outputformats"),
- QLatin1String("HTML"));
- qdocTestGlobals.defaults().insert(QStringLiteral("tabsize"),
- QLatin1String("8"));
-
- QHash<QString, QString> result = qdocTestGlobals.defaults();
- QCOMPARE(result, expected);
-}
-
-QTEST_APPLESS_MAIN(testQDocGlobals)
-
-#include "tst_qdocglobals.moc"
diff --git a/tests/auto/qhelpenginecore/tst_qhelpenginecore.cpp b/tests/auto/qhelpenginecore/tst_qhelpenginecore.cpp
index ba2b1532d..ddadda10b 100644
--- a/tests/auto/qhelpenginecore/tst_qhelpenginecore.cpp
+++ b/tests/auto/qhelpenginecore/tst_qhelpenginecore.cpp
@@ -29,6 +29,7 @@
#include <QtCore/QUrl>
#include <QtCore/QFileInfo>
+#include <QtCore/QScopeGuard>
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlQuery>
@@ -189,12 +190,12 @@ void tst_QHelpEngineCore::registeredDocumentations()
{
QHelpEngineCore help(m_colFile, 0);
QCOMPARE(help.setupData(), true);
- QStringList docs = help.registeredDocumentations();
+ const QStringList docs = help.registeredDocumentations();
QCOMPARE(docs.count(), 3);
QStringList lst;
lst << "trolltech.com.3-3-8.qmake" << "trolltech.com.4-3-0.qmake"
<< "trolltech.com.1.0.0.test";
- foreach (QString s, docs)
+ for (const QString &s : docs)
lst.removeAll(s);
QCOMPARE(lst.isEmpty(), true);
}
@@ -259,12 +260,12 @@ void tst_QHelpEngineCore::customFilters()
{
QHelpEngineCore help(m_colFile, 0);
QCOMPARE(help.setupData(), true);
- QStringList custom = help.customFilters();
+ const QStringList custom = help.customFilters();
QCOMPARE(custom.count(), 4);
QStringList lst;
lst << "qmake Manual" << "Custom Filter 1"
<< "Custom Filter 2" << "unfiltered";
- foreach (QString s, custom)
+ for (const QString &s : custom)
lst.removeAll(s);
QCOMPARE(lst.count(), 0);
}
@@ -293,11 +294,11 @@ void tst_QHelpEngineCore::filterAttributes()
{
QHelpEngineCore help(m_colFile, 0);
QCOMPARE(help.setupData(), true);
- QStringList atts = help.filterAttributes("qmake Manual");
+ const QStringList atts = help.filterAttributes("qmake Manual");
QCOMPARE(atts.count(), 3);
QStringList lst;
lst << "qmake" << "tools" << "qt";
- foreach (QString s, atts)
+ for (const QString &s : atts)
lst.removeAll(s);
QCOMPARE(lst.count(), 0);
}
@@ -352,11 +353,13 @@ void tst_QHelpEngineCore::files()
QCOMPARE(lst.count(), 0);
lst = help.files("trolltech.com.4-3-0.qmake",
QStringList() << "qt" << "qmake", "foo");
- QCOMPARE(lst.count(), 0);
- foreach (QUrl url, lst)
- qDebug() << url;
+ // print 'lst' if test fails:
+ auto printRemainder = qScopeGuard([&]{ for (const QUrl &url : lst) qDebug() << url; });
+
+ QCOMPARE(lst.count(), 0);
+ printRemainder.dismiss();
}
void tst_QHelpEngineCore::fileData()
diff --git a/tests/auto/qhelpindexmodel/tst_qhelpindexmodel.cpp b/tests/auto/qhelpindexmodel/tst_qhelpindexmodel.cpp
index 713c229ce..d304c3f3b 100644
--- a/tests/auto/qhelpindexmodel/tst_qhelpindexmodel.cpp
+++ b/tests/auto/qhelpindexmodel/tst_qhelpindexmodel.cpp
@@ -119,8 +119,9 @@ void tst_QHelpIndexModel::setupIndex()
QStringList lst;
lst << "foo" << "bar" << "bla" << "einstein" << "newton";
- QCOMPARE(m->stringList().count(), 5);
- foreach (QString s, m->stringList())
+ const auto stringList = m->stringList();
+ QCOMPARE(stringList.count(), 5);
+ for (const QString &s : stringList)
lst.removeAll(s);
QCOMPARE(lst.isEmpty(), true);
}
diff --git a/tests/auto/qhelpprojectdata/tst_qhelpprojectdata.cpp b/tests/auto/qhelpprojectdata/tst_qhelpprojectdata.cpp
index a09135d7c..9b47be519 100644
--- a/tests/auto/qhelpprojectdata/tst_qhelpprojectdata.cpp
+++ b/tests/auto/qhelpprojectdata/tst_qhelpprojectdata.cpp
@@ -85,18 +85,18 @@ void tst_QHelpProjectData::customFilters()
if (!data.readData(m_inputFile))
QFAIL("Cannot read qhp file!");
- QList<QHelpDataCustomFilter> filters = data.customFilters();
+ const QList<QHelpDataCustomFilter> filters = data.customFilters();
QCOMPARE(filters.count(), 2);
- foreach (QHelpDataCustomFilter f, filters) {
+ for (const QHelpDataCustomFilter &f : filters) {
if (f.name == QLatin1String("Custom Filter 1")) {
- foreach (QString id, f.filterAttributes) {
+ for (const QString &id : f.filterAttributes) {
if (id != QLatin1String("test")
&& id != QLatin1String("filter1"))
QFAIL("Wrong filter attribute!");
}
} else if (f.name == QLatin1String("Custom Filter 2")) {
- foreach (QString id, f.filterAttributes) {
+ for (const QString &id : f.filterAttributes) {
if (id != QLatin1String("test")
&& id != QLatin1String("filter2"))
QFAIL("Wrong filter attribute!");
@@ -113,13 +113,14 @@ void tst_QHelpProjectData::filterSections()
if (!data.readData(m_inputFile))
QFAIL("Cannot read qhp file!");
- QList<QHelpDataFilterSection> sections = data.filterSections();
+ const QList<QHelpDataFilterSection> sections = data.filterSections();
QCOMPARE(sections.count(), 2);
- foreach (QHelpDataFilterSection s, sections) {
+ for (const QHelpDataFilterSection &s : sections) {
if (s.filterAttributes().contains("filter1")) {
- QCOMPARE(s.indices().count(), 5);
- foreach (QHelpDataIndexItem idx, s.indices()) {
+ const auto indices = s.indices();
+ QCOMPARE(indices.size(), 5);
+ for (const QHelpDataIndexItem &idx : indices) {
if (idx.name == QLatin1String("foo")) {
QCOMPARE(idx.identifier, QString("Test::foo"));
} else if (idx.name == QLatin1String("bar")) {
@@ -138,11 +139,14 @@ void tst_QHelpProjectData::filterSections()
QCOMPARE(s.contents().first()->children().count(), 5);
} else if (s.filterAttributes().contains("filter2")) {
QCOMPARE(s.contents().count(), 1);
- QStringList lst;
- lst << "classic.css" << "fancy.html" << "cars.html";
- foreach (QString f, s.files())
- lst.removeAll(f);
- QCOMPARE(lst.count(), 0);
+ const QStringList lst = {
+ "cars.html",
+ "classic.css",
+ "fancy.html",
+ };
+ auto files = s.files();
+ std::sort(files.begin(), files.end());
+ QCOMPARE(files, lst);
} else {
QFAIL("Unexpected filter attribute!");
}