summaryrefslogtreecommitdiffstats
path: root/src/designer
diff options
context:
space:
mode:
Diffstat (limited to 'src/designer')
-rw-r--r--src/designer/CMakeLists.txt3
-rw-r--r--src/designer/data/README2
-rw-r--r--src/designer/data/generate_header.xsl2
-rw-r--r--src/designer/data/generate_impl.xsl50
-rw-r--r--src/designer/data/generate_shared.xsl8
-rwxr-xr-xsrc/designer/data/generate_ui126
-rw-r--r--src/designer/data/generate_ui.py96
-rw-r--r--src/designer/data/ui4.xsd4
-rw-r--r--src/designer/src/CMakeLists.txt6
-rw-r--r--src/designer/src/components/CMakeLists.txt3
-rw-r--r--src/designer/src/components/buddyeditor/buddyeditor.cpp55
-rw-r--r--src/designer/src/components/buddyeditor/buddyeditor.h29
-rw-r--r--src/designer/src/components/buddyeditor/buddyeditor_global.h29
-rw-r--r--src/designer/src/components/buddyeditor/buddyeditor_plugin.cpp41
-rw-r--r--src/designer/src/components/buddyeditor/buddyeditor_plugin.h29
-rw-r--r--src/designer/src/components/buddyeditor/buddyeditor_tool.cpp33
-rw-r--r--src/designer/src/components/buddyeditor/buddyeditor_tool.h29
-rw-r--r--src/designer/src/components/formeditor/default_actionprovider.cpp29
-rw-r--r--src/designer/src/components/formeditor/default_actionprovider.h29
-rw-r--r--src/designer/src/components/formeditor/default_container.cpp33
-rw-r--r--src/designer/src/components/formeditor/default_container.h29
-rw-r--r--src/designer/src/components/formeditor/default_layoutdecoration.cpp29
-rw-r--r--src/designer/src/components/formeditor/default_layoutdecoration.h29
-rw-r--r--src/designer/src/components/formeditor/deviceprofiledialog.cpp48
-rw-r--r--src/designer/src/components/formeditor/deviceprofiledialog.h29
-rw-r--r--src/designer/src/components/formeditor/deviceprofiledialog.ui2
-rw-r--r--src/designer/src/components/formeditor/dpi_chooser.cpp29
-rw-r--r--src/designer/src/components/formeditor/dpi_chooser.h29
-rw-r--r--src/designer/src/components/formeditor/embeddedoptionspage.cpp42
-rw-r--r--src/designer/src/components/formeditor/embeddedoptionspage.h29
-rw-r--r--src/designer/src/components/formeditor/formeditor.cpp43
-rw-r--r--src/designer/src/components/formeditor/formeditor.h31
-rw-r--r--src/designer/src/components/formeditor/formeditor.qrc179
-rw-r--r--src/designer/src/components/formeditor/formeditor_global.h29
-rw-r--r--src/designer/src/components/formeditor/formeditor_optionspage.cpp29
-rw-r--r--src/designer/src/components/formeditor/formeditor_optionspage.h29
-rw-r--r--src/designer/src/components/formeditor/formwindow.cpp380
-rw-r--r--src/designer/src/components/formeditor/formwindow.h39
-rw-r--r--src/designer/src/components/formeditor/formwindow_dnditem.cpp33
-rw-r--r--src/designer/src/components/formeditor/formwindow_dnditem.h29
-rw-r--r--src/designer/src/components/formeditor/formwindow_widgetstack.cpp41
-rw-r--r--src/designer/src/components/formeditor/formwindow_widgetstack.h29
-rw-r--r--src/designer/src/components/formeditor/formwindowcursor.cpp31
-rw-r--r--src/designer/src/components/formeditor/formwindowcursor.h29
-rw-r--r--src/designer/src/components/formeditor/formwindowmanager.cpp173
-rw-r--r--src/designer/src/components/formeditor/formwindowmanager.h29
-rw-r--r--src/designer/src/components/formeditor/formwindowsettings.cpp79
-rw-r--r--src/designer/src/components/formeditor/formwindowsettings.h31
-rw-r--r--src/designer/src/components/formeditor/formwindowsettings.ui32
-rw-r--r--src/designer/src/components/formeditor/images/cleartext.pngbin474 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/cursors/arrow.pngbin171 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/cursors/busy.pngbin201 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/cursors/closedhand.pngbin147 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/cursors/cross.pngbin130 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/cursors/hand.pngbin159 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/cursors/hsplit.pngbin155 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/cursors/ibeam.pngbin124 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/cursors/no.pngbin199 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/cursors/openhand.pngbin160 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/cursors/sizeall.pngbin174 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/cursors/sizeb.pngbin161 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/cursors/sizef.pngbin161 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/cursors/sizeh.pngbin145 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/cursors/sizev.pngbin141 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/cursors/uparrow.pngbin132 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/cursors/vsplit.pngbin161 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/cursors/wait.pngbin172 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/cursors/whatsthis.pngbin191 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/mac/resourceeditortool.pngbin2171 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/plus-16.pngbin383 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/qt3logo.pngbin1101 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/qtlogo128x128.pngbin0 -> 2143 bytes
-rw-r--r--src/designer/src/components/formeditor/images/qtlogo16x16.pngbin1263 -> 367 bytes
-rw-r--r--src/designer/src/components/formeditor/images/qtlogo24x24.pngbin349 -> 594 bytes
-rw-r--r--src/designer/src/components/formeditor/images/qtlogo32x32.pngbin15518 -> 775 bytes
-rw-r--r--src/designer/src/components/formeditor/images/qtlogo64x64.pngbin1936 -> 1219 bytes
-rw-r--r--src/designer/src/components/formeditor/images/widgets/groupboxcollapsible.pngbin702 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/widgets/hsplit.pngbin164 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/widgets/tabbar.pngbin623 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/widgets/wizard.pngbin898 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/images/win/resourceeditortool.pngbin1429 -> 0 bytes
-rw-r--r--src/designer/src/components/formeditor/itemview_propertysheet.cpp95
-rw-r--r--src/designer/src/components/formeditor/itemview_propertysheet.h29
-rw-r--r--src/designer/src/components/formeditor/layout_propertysheet.cpp137
-rw-r--r--src/designer/src/components/formeditor/layout_propertysheet.h31
-rw-r--r--src/designer/src/components/formeditor/line_propertysheet.cpp37
-rw-r--r--src/designer/src/components/formeditor/line_propertysheet.h29
-rw-r--r--src/designer/src/components/formeditor/previewactiongroup.cpp53
-rw-r--r--src/designer/src/components/formeditor/previewactiongroup.h29
-rw-r--r--src/designer/src/components/formeditor/qdesigner_resource.cpp281
-rw-r--r--src/designer/src/components/formeditor/qdesigner_resource.h29
-rw-r--r--src/designer/src/components/formeditor/qlayoutwidget_propertysheet.cpp38
-rw-r--r--src/designer/src/components/formeditor/qlayoutwidget_propertysheet.h29
-rw-r--r--src/designer/src/components/formeditor/qmainwindow_container.cpp48
-rw-r--r--src/designer/src/components/formeditor/qmainwindow_container.h29
-rw-r--r--src/designer/src/components/formeditor/qmdiarea_container.cpp55
-rw-r--r--src/designer/src/components/formeditor/qmdiarea_container.h29
-rw-r--r--src/designer/src/components/formeditor/qwizard_container.cpp43
-rw-r--r--src/designer/src/components/formeditor/qwizard_container.h29
-rw-r--r--src/designer/src/components/formeditor/spacer_propertysheet.cpp34
-rw-r--r--src/designer/src/components/formeditor/spacer_propertysheet.h29
-rw-r--r--src/designer/src/components/formeditor/templateoptionspage.cpp42
-rw-r--r--src/designer/src/components/formeditor/templateoptionspage.h29
-rw-r--r--src/designer/src/components/formeditor/tool_widgeteditor.cpp71
-rw-r--r--src/designer/src/components/formeditor/tool_widgeteditor.h30
-rw-r--r--src/designer/src/components/formeditor/widgetselection.cpp33
-rw-r--r--src/designer/src/components/formeditor/widgetselection.h29
-rw-r--r--src/designer/src/components/lib/CMakeLists.txt39
-rw-r--r--src/designer/src/components/lib/lib_pch.h29
-rw-r--r--src/designer/src/components/lib/qdesigner_components.cpp73
-rw-r--r--src/designer/src/components/objectinspector/objectinspector.cpp83
-rw-r--r--src/designer/src/components/objectinspector/objectinspector.h33
-rw-r--r--src/designer/src/components/objectinspector/objectinspector_global.h33
-rw-r--r--src/designer/src/components/objectinspector/objectinspectormodel.cpp78
-rw-r--r--src/designer/src/components/objectinspector/objectinspectormodel_p.h47
-rw-r--r--src/designer/src/components/propertyeditor/brushpropertymanager.cpp67
-rw-r--r--src/designer/src/components/propertyeditor/brushpropertymanager.h45
-rw-r--r--src/designer/src/components/propertyeditor/designerpropertymanager.cpp878
-rw-r--r--src/designer/src/components/propertyeditor/designerpropertymanager.h159
-rw-r--r--src/designer/src/components/propertyeditor/fontmapping.xml33
-rw-r--r--src/designer/src/components/propertyeditor/fontpropertymanager.cpp224
-rw-r--r--src/designer/src/components/propertyeditor/fontpropertymanager.h52
-rw-r--r--src/designer/src/components/propertyeditor/newdynamicpropertydialog.cpp97
-rw-r--r--src/designer/src/components/propertyeditor/newdynamicpropertydialog.h31
-rw-r--r--src/designer/src/components/propertyeditor/paletteeditor.cpp135
-rw-r--r--src/designer/src/components/propertyeditor/paletteeditor.h44
-rw-r--r--src/designer/src/components/propertyeditor/paletteeditor.ui33
-rw-r--r--src/designer/src/components/propertyeditor/paletteeditorbutton.cpp33
-rw-r--r--src/designer/src/components/propertyeditor/paletteeditorbutton.h29
-rw-r--r--src/designer/src/components/propertyeditor/pixmapeditor.cpp420
-rw-r--r--src/designer/src/components/propertyeditor/pixmapeditor.h128
-rw-r--r--src/designer/src/components/propertyeditor/previewframe.cpp29
-rw-r--r--src/designer/src/components/propertyeditor/previewframe.h29
-rw-r--r--src/designer/src/components/propertyeditor/previewwidget.cpp32
-rw-r--r--src/designer/src/components/propertyeditor/previewwidget.h29
-rw-r--r--src/designer/src/components/propertyeditor/previewwidget.ui32
-rw-r--r--src/designer/src/components/propertyeditor/propertyeditor.cpp213
-rw-r--r--src/designer/src/components/propertyeditor/propertyeditor.h37
-rw-r--r--src/designer/src/components/propertyeditor/propertyeditor.qrc5
-rw-r--r--src/designer/src/components/propertyeditor/propertyeditor_global.h29
-rw-r--r--src/designer/src/components/propertyeditor/qlonglongvalidator.cpp41
-rw-r--r--src/designer/src/components/propertyeditor/qlonglongvalidator.h29
-rw-r--r--src/designer/src/components/propertyeditor/stringlisteditor.cpp60
-rw-r--r--src/designer/src/components/propertyeditor/stringlisteditor.h39
-rw-r--r--src/designer/src/components/propertyeditor/stringlisteditor.ui31
-rw-r--r--src/designer/src/components/propertyeditor/stringlisteditorbutton.cpp33
-rw-r--r--src/designer/src/components/propertyeditor/stringlisteditorbutton.h29
-rw-r--r--src/designer/src/components/signalsloteditor/connectdialog.cpp47
-rw-r--r--src/designer/src/components/signalsloteditor/connectdialog_p.h31
-rw-r--r--src/designer/src/components/signalsloteditor/signalslot_utils.cpp31
-rw-r--r--src/designer/src/components/signalsloteditor/signalslot_utils_p.h29
-rw-r--r--src/designer/src/components/signalsloteditor/signalsloteditor.cpp84
-rw-r--r--src/designer/src/components/signalsloteditor/signalsloteditor.h29
-rw-r--r--src/designer/src/components/signalsloteditor/signalsloteditor_global.h29
-rw-r--r--src/designer/src/components/signalsloteditor/signalsloteditor_p.h29
-rw-r--r--src/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp41
-rw-r--r--src/designer/src/components/signalsloteditor/signalsloteditor_plugin.h29
-rw-r--r--src/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp33
-rw-r--r--src/designer/src/components/signalsloteditor/signalsloteditor_tool.h29
-rw-r--r--src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp44
-rw-r--r--src/designer/src/components/signalsloteditor/signalsloteditorwindow.h29
-rw-r--r--src/designer/src/components/tabordereditor/tabordereditor.cpp51
-rw-r--r--src/designer/src/components/tabordereditor/tabordereditor.h29
-rw-r--r--src/designer/src/components/tabordereditor/tabordereditor_global.h29
-rw-r--r--src/designer/src/components/tabordereditor/tabordereditor_plugin.cpp41
-rw-r--r--src/designer/src/components/tabordereditor/tabordereditor_plugin.h29
-rw-r--r--src/designer/src/components/tabordereditor/tabordereditor_tool.cpp33
-rw-r--r--src/designer/src/components/tabordereditor/tabordereditor_tool.h29
-rw-r--r--src/designer/src/components/taskmenu/button_taskmenu.cpp86
-rw-r--r--src/designer/src/components/taskmenu/button_taskmenu.h29
-rw-r--r--src/designer/src/components/taskmenu/combobox_taskmenu.cpp33
-rw-r--r--src/designer/src/components/taskmenu/combobox_taskmenu.h29
-rw-r--r--src/designer/src/components/taskmenu/containerwidget_taskmenu.cpp33
-rw-r--r--src/designer/src/components/taskmenu/containerwidget_taskmenu.h29
-rw-r--r--src/designer/src/components/taskmenu/groupbox_taskmenu.cpp33
-rw-r--r--src/designer/src/components/taskmenu/groupbox_taskmenu.h31
-rw-r--r--src/designer/src/components/taskmenu/inplace_editor.cpp33
-rw-r--r--src/designer/src/components/taskmenu/inplace_editor.h34
-rw-r--r--src/designer/src/components/taskmenu/inplace_widget_helper.cpp29
-rw-r--r--src/designer/src/components/taskmenu/inplace_widget_helper.h29
-rw-r--r--src/designer/src/components/taskmenu/itemlisteditor.cpp92
-rw-r--r--src/designer/src/components/taskmenu/itemlisteditor.h47
-rw-r--r--src/designer/src/components/taskmenu/itemlisteditor.ui31
-rw-r--r--src/designer/src/components/taskmenu/label_taskmenu.cpp39
-rw-r--r--src/designer/src/components/taskmenu/label_taskmenu.h29
-rw-r--r--src/designer/src/components/taskmenu/layouttaskmenu.cpp29
-rw-r--r--src/designer/src/components/taskmenu/layouttaskmenu.h29
-rw-r--r--src/designer/src/components/taskmenu/lineedit_taskmenu.cpp33
-rw-r--r--src/designer/src/components/taskmenu/lineedit_taskmenu.h29
-rw-r--r--src/designer/src/components/taskmenu/listwidget_taskmenu.cpp33
-rw-r--r--src/designer/src/components/taskmenu/listwidget_taskmenu.h29
-rw-r--r--src/designer/src/components/taskmenu/listwidgeteditor.cpp34
-rw-r--r--src/designer/src/components/taskmenu/listwidgeteditor.h29
-rw-r--r--src/designer/src/components/taskmenu/menutaskmenu.cpp29
-rw-r--r--src/designer/src/components/taskmenu/menutaskmenu.h29
-rw-r--r--src/designer/src/components/taskmenu/tablewidget_taskmenu.cpp33
-rw-r--r--src/designer/src/components/taskmenu/tablewidget_taskmenu.h29
-rw-r--r--src/designer/src/components/taskmenu/tablewidgeteditor.cpp93
-rw-r--r--src/designer/src/components/taskmenu/tablewidgeteditor.h57
-rw-r--r--src/designer/src/components/taskmenu/tablewidgeteditor.ui31
-rw-r--r--src/designer/src/components/taskmenu/taskmenu_component.cpp38
-rw-r--r--src/designer/src/components/taskmenu/taskmenu_component.h29
-rw-r--r--src/designer/src/components/taskmenu/taskmenu_global.h29
-rw-r--r--src/designer/src/components/taskmenu/textedit_taskmenu.cpp35
-rw-r--r--src/designer/src/components/taskmenu/textedit_taskmenu.h29
-rw-r--r--src/designer/src/components/taskmenu/toolbar_taskmenu.cpp29
-rw-r--r--src/designer/src/components/taskmenu/toolbar_taskmenu.h29
-rw-r--r--src/designer/src/components/taskmenu/treewidget_taskmenu.cpp33
-rw-r--r--src/designer/src/components/taskmenu/treewidget_taskmenu.h31
-rw-r--r--src/designer/src/components/taskmenu/treewidgeteditor.cpp118
-rw-r--r--src/designer/src/components/taskmenu/treewidgeteditor.h65
-rw-r--r--src/designer/src/components/taskmenu/treewidgeteditor.ui31
-rw-r--r--src/designer/src/components/widgetbox/widgetbox.cpp31
-rw-r--r--src/designer/src/components/widgetbox/widgetbox.h29
-rw-r--r--src/designer/src/components/widgetbox/widgetbox.qrc5
-rw-r--r--src/designer/src/components/widgetbox/widgetbox.xml32
-rw-r--r--src/designer/src/components/widgetbox/widgetbox_dnditem.cpp36
-rw-r--r--src/designer/src/components/widgetbox/widgetbox_dnditem.h29
-rw-r--r--src/designer/src/components/widgetbox/widgetbox_global.h29
-rw-r--r--src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp102
-rw-r--r--src/designer/src/components/widgetbox/widgetboxcategorylistview.h31
-rw-r--r--src/designer/src/components/widgetbox/widgetboxtreewidget.cpp157
-rw-r--r--src/designer/src/components/widgetbox/widgetboxtreewidget.h35
-rw-r--r--src/designer/src/designer/CMakeLists.txt12
-rw-r--r--src/designer/src/designer/appfontdialog.cpp105
-rw-r--r--src/designer/src/designer/appfontdialog.h29
-rw-r--r--src/designer/src/designer/assistantclient.cpp54
-rw-r--r--src/designer/src/designer/assistantclient.h31
-rw-r--r--src/designer/src/designer/designer.qrc5
-rw-r--r--src/designer/src/designer/designer_enums.h29
-rw-r--r--src/designer/src/designer/doc/qtdesigner.qdocconf25
-rw-r--r--src/designer/src/designer/doc/snippets/CMakeLists.txt10
-rw-r--r--src/designer/src/designer/doc/snippets/autoconnection/CMakeLists.txt24
-rw-r--r--src/designer/src/designer/doc/snippets/autoconnection/autoconnection.pro1
-rw-r--r--src/designer/src/designer/doc/snippets/autoconnection/imagedialog.cpp62
-rw-r--r--src/designer/src/designer/doc/snippets/autoconnection/imagedialog.h53
-rw-r--r--src/designer/src/designer/doc/snippets/autoconnection/main.cpp51
-rw-r--r--src/designer/src/designer/doc/snippets/imagedialog/CMakeLists.txt24
-rw-r--r--src/designer/src/designer/doc/snippets/imagedialog/imagedialog.pro1
-rw-r--r--src/designer/src/designer/doc/snippets/imagedialog/main.cpp51
-rw-r--r--src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_extension_default_extensionfactory.cpp70
-rw-r--r--src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_extension_extension.cpp56
-rw-r--r--src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_extension_qextensionmanager.cpp55
-rw-r--r--src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractformeditor.cpp61
-rw-r--r--src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractformwindow.cpp63
-rw-r--r--src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractformwindowcursor.cpp54
-rw-r--r--src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractformwindowmanager.cpp58
-rw-r--r--src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractobjectinspector.cpp58
-rw-r--r--src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractpropertyeditor.cpp68
-rw-r--r--src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractwidgetbox.cpp54
-rw-r--r--src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_uilib_abstractformbuilder.cpp67
-rw-r--r--src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_uilib_formbuilder.cpp54
-rw-r--r--src/designer/src/designer/doc/snippets/manual/doc_src_designer-manual.cpp51
-rw-r--r--src/designer/src/designer/doc/snippets/manual/doc_src_designer-manual.js51
-rw-r--r--src/designer/src/designer/doc/snippets/manual/doc_src_designer-manual.pro51
-rw-r--r--src/designer/src/designer/doc/snippets/multipleinheritance/CMakeLists.txt24
-rw-r--r--src/designer/src/designer/doc/snippets/multipleinheritance/imagedialog.cpp57
-rw-r--r--src/designer/src/designer/doc/snippets/multipleinheritance/imagedialog.h53
-rw-r--r--src/designer/src/designer/doc/snippets/multipleinheritance/main.cpp51
-rw-r--r--src/designer/src/designer/doc/snippets/multipleinheritance/multipleinheritance.pro1
-rw-r--r--src/designer/src/designer/doc/snippets/noautoconnection/CMakeLists.txt24
-rw-r--r--src/designer/src/designer/doc/snippets/noautoconnection/imagedialog.cpp64
-rw-r--r--src/designer/src/designer/doc/snippets/noautoconnection/imagedialog.h53
-rw-r--r--src/designer/src/designer/doc/snippets/noautoconnection/main.cpp51
-rw-r--r--src/designer/src/designer/doc/snippets/noautoconnection/noautoconnection.pro1
-rw-r--r--src/designer/src/designer/doc/snippets/plugins/doc_src_qtdesigner.cpp58
-rw-r--r--src/designer/src/designer/doc/snippets/plugins/doc_src_qtdesigner.pro53
-rw-r--r--src/designer/src/designer/doc/snippets/singleinheritance/CMakeLists.txt24
-rw-r--r--src/designer/src/designer/doc/snippets/singleinheritance/imagedialog.cpp57
-rw-r--r--src/designer/src/designer/doc/snippets/singleinheritance/imagedialog.h53
-rw-r--r--src/designer/src/designer/doc/snippets/singleinheritance/main.cpp51
-rw-r--r--src/designer/src/designer/doc/snippets/singleinheritance/singleinheritance.pro1
-rw-r--r--src/designer/src/designer/doc/snippets/uitools/calculatorform/CMakeLists.txt26
-rw-r--r--src/designer/src/designer/doc/snippets/uitools/calculatorform/main.cpp51
-rw-r--r--src/designer/src/designer/doc/src/designer-custom-widgets.qdoc32
-rw-r--r--src/designer/src/designer/doc/src/designer-examples.qdoc43
-rw-r--r--src/designer/src/designer/doc/src/designer-manual.qdoc425
-rw-r--r--src/designer/src/designer/doc/src/qtdesigner-index.qdoc61
-rw-r--r--src/designer/src/designer/doc/src/qtdesigner-module.qdoc41
-rw-r--r--src/designer/src/designer/images/mdi.pngbin59505 -> 0 bytes
-rw-r--r--src/designer/src/designer/images/sdi.pngbin61037 -> 0 bytes
-rw-r--r--src/designer/src/designer/images/workbench.pngbin2085 -> 0 bytes
-rw-r--r--src/designer/src/designer/main.cpp38
-rw-r--r--src/designer/src/designer/mainwindow.cpp89
-rw-r--r--src/designer/src/designer/mainwindow.h31
-rw-r--r--src/designer/src/designer/newform.cpp43
-rw-r--r--src/designer/src/designer/newform.h31
-rw-r--r--src/designer/src/designer/preferencesdialog.cpp38
-rw-r--r--src/designer/src/designer/preferencesdialog.h29
-rw-r--r--src/designer/src/designer/qdesigner.cpp150
-rw-r--r--src/designer/src/designer/qdesigner.h39
-rw-r--r--src/designer/src/designer/qdesigner_actions.cpp319
-rw-r--r--src/designer/src/designer/qdesigner_actions.h33
-rw-r--r--src/designer/src/designer/qdesigner_appearanceoptions.cpp36
-rw-r--r--src/designer/src/designer/qdesigner_appearanceoptions.h52
-rw-r--r--src/designer/src/designer/qdesigner_formwindow.cpp46
-rw-r--r--src/designer/src/designer/qdesigner_formwindow.h33
-rw-r--r--src/designer/src/designer/qdesigner_pch.h29
-rw-r--r--src/designer/src/designer/qdesigner_server.cpp40
-rw-r--r--src/designer/src/designer/qdesigner_server.h31
-rw-r--r--src/designer/src/designer/qdesigner_settings.cpp103
-rw-r--r--src/designer/src/designer/qdesigner_settings.h29
-rw-r--r--src/designer/src/designer/qdesigner_toolwindow.cpp115
-rw-r--r--src/designer/src/designer/qdesigner_toolwindow.h58
-rw-r--r--src/designer/src/designer/qdesigner_workbench.cpp246
-rw-r--r--src/designer/src/designer/qdesigner_workbench.h63
-rw-r--r--src/designer/src/designer/saveformastemplate.cpp38
-rw-r--r--src/designer/src/designer/saveformastemplate.h29
-rw-r--r--src/designer/src/designer/saveformastemplate.ui31
-rw-r--r--src/designer/src/designer/versiondialog.cpp53
-rw-r--r--src/designer/src/designer/versiondialog.h29
-rw-r--r--src/designer/src/lib/CMakeLists.txt47
-rw-r--r--src/designer/src/lib/components/qdesigner_components.h34
-rw-r--r--src/designer/src/lib/components/qdesigner_components_global.h29
-rw-r--r--src/designer/src/lib/extension/default_extensionfactory.cpp41
-rw-r--r--src/designer/src/lib/extension/default_extensionfactory.h37
-rw-r--r--src/designer/src/lib/extension/extension.cpp41
-rw-r--r--src/designer/src/lib/extension/extension.h41
-rw-r--r--src/designer/src/lib/extension/extension_global.h29
-rw-r--r--src/designer/src/lib/extension/qextensionmanager.cpp52
-rw-r--r--src/designer/src/lib/extension/qextensionmanager.h32
-rw-r--r--src/designer/src/lib/lib_pch.h29
-rw-r--r--src/designer/src/lib/sdk/abstractactioneditor.cpp31
-rw-r--r--src/designer/src/lib/sdk/abstractactioneditor.h29
-rw-r--r--src/designer/src/lib/sdk/abstractdialoggui.cpp29
-rw-r--r--src/designer/src/lib/sdk/abstractdialoggui_p.h29
-rw-r--r--src/designer/src/lib/sdk/abstractdnditem.h29
-rw-r--r--src/designer/src/lib/sdk/abstractdnditem.qdoc28
-rw-r--r--src/designer/src/lib/sdk/abstractformeditor.cpp39
-rw-r--r--src/designer/src/lib/sdk/abstractformeditor.h29
-rw-r--r--src/designer/src/lib/sdk/abstractformeditorplugin.cpp31
-rw-r--r--src/designer/src/lib/sdk/abstractformeditorplugin.h29
-rw-r--r--src/designer/src/lib/sdk/abstractformwindow.cpp35
-rw-r--r--src/designer/src/lib/sdk/abstractformwindow.h29
-rw-r--r--src/designer/src/lib/sdk/abstractformwindowcursor.cpp29
-rw-r--r--src/designer/src/lib/sdk/abstractformwindowcursor.h29
-rw-r--r--src/designer/src/lib/sdk/abstractformwindowmanager.cpp35
-rw-r--r--src/designer/src/lib/sdk/abstractformwindowmanager.h29
-rw-r--r--src/designer/src/lib/sdk/abstractformwindowtool.cpp29
-rw-r--r--src/designer/src/lib/sdk/abstractformwindowtool.h29
-rw-r--r--src/designer/src/lib/sdk/abstractintegration.cpp60
-rw-r--r--src/designer/src/lib/sdk/abstractintegration.h29
-rw-r--r--src/designer/src/lib/sdk/abstractintrospection.cpp29
-rw-r--r--src/designer/src/lib/sdk/abstractintrospection_p.h30
-rw-r--r--src/designer/src/lib/sdk/abstractlanguage.h29
-rw-r--r--src/designer/src/lib/sdk/abstractmetadatabase.cpp33
-rw-r--r--src/designer/src/lib/sdk/abstractmetadatabase.h29
-rw-r--r--src/designer/src/lib/sdk/abstractnewformwidget.cpp29
-rw-r--r--src/designer/src/lib/sdk/abstractnewformwidget.h29
-rw-r--r--src/designer/src/lib/sdk/abstractobjectinspector.cpp31
-rw-r--r--src/designer/src/lib/sdk/abstractobjectinspector.h29
-rw-r--r--src/designer/src/lib/sdk/abstractoptionspage.h29
-rw-r--r--src/designer/src/lib/sdk/abstractoptionspage.qdoc28
-rw-r--r--src/designer/src/lib/sdk/abstractpromotioninterface.cpp29
-rw-r--r--src/designer/src/lib/sdk/abstractpromotioninterface.h29
-rw-r--r--src/designer/src/lib/sdk/abstractpropertyeditor.cpp31
-rw-r--r--src/designer/src/lib/sdk/abstractpropertyeditor.h29
-rw-r--r--src/designer/src/lib/sdk/abstractresourcebrowser.cpp29
-rw-r--r--src/designer/src/lib/sdk/abstractresourcebrowser.h29
-rw-r--r--src/designer/src/lib/sdk/abstractsettings.h29
-rw-r--r--src/designer/src/lib/sdk/abstractsettings.qdoc28
-rw-r--r--src/designer/src/lib/sdk/abstractwidgetbox.cpp35
-rw-r--r--src/designer/src/lib/sdk/abstractwidgetbox.h31
-rw-r--r--src/designer/src/lib/sdk/abstractwidgetdatabase.cpp43
-rw-r--r--src/designer/src/lib/sdk/abstractwidgetdatabase.h29
-rw-r--r--src/designer/src/lib/sdk/abstractwidgetfactory.cpp31
-rw-r--r--src/designer/src/lib/sdk/abstractwidgetfactory.h29
-rw-r--r--src/designer/src/lib/sdk/container.h29
-rw-r--r--src/designer/src/lib/sdk/container.qdoc32
-rw-r--r--src/designer/src/lib/sdk/dynamicpropertysheet.h29
-rw-r--r--src/designer/src/lib/sdk/dynamicpropertysheet.qdoc30
-rw-r--r--src/designer/src/lib/sdk/extrainfo.cpp31
-rw-r--r--src/designer/src/lib/sdk/extrainfo.h29
-rw-r--r--src/designer/src/lib/sdk/layoutdecoration.h29
-rw-r--r--src/designer/src/lib/sdk/layoutdecoration.qdoc30
-rw-r--r--src/designer/src/lib/sdk/membersheet.h29
-rw-r--r--src/designer/src/lib/sdk/membersheet.qdoc32
-rw-r--r--src/designer/src/lib/sdk/propertysheet.h29
-rw-r--r--src/designer/src/lib/sdk/propertysheet.qdoc32
-rw-r--r--src/designer/src/lib/sdk/sdk_global.h29
-rw-r--r--src/designer/src/lib/sdk/taskmenu.cpp13
-rw-r--r--src/designer/src/lib/sdk/taskmenu.h38
-rw-r--r--src/designer/src/lib/sdk/taskmenu.qdoc34
-rw-r--r--src/designer/src/lib/shared/actioneditor.cpp139
-rw-r--r--src/designer/src/lib/shared/actioneditor_p.h31
-rw-r--r--src/designer/src/lib/shared/actionprovider_p.h36
-rw-r--r--src/designer/src/lib/shared/actionrepository.cpp81
-rw-r--r--src/designer/src/lib/shared/actionrepository_p.h31
-rw-r--r--src/designer/src/lib/shared/codedialog.cpp63
-rw-r--r--src/designer/src/lib/shared/codedialog_p.h29
-rw-r--r--src/designer/src/lib/shared/connectionedit.cpp65
-rw-r--r--src/designer/src/lib/shared/connectionedit_p.h29
-rw-r--r--src/designer/src/lib/shared/csshighlighter.cpp62
-rw-r--r--src/designer/src/lib/shared/csshighlighter_p.h46
-rw-r--r--src/designer/src/lib/shared/deviceprofile.cpp89
-rw-r--r--src/designer/src/lib/shared/deviceprofile_p.h44
-rw-r--r--src/designer/src/lib/shared/dialoggui.cpp29
-rw-r--r--src/designer/src/lib/shared/dialoggui_p.h29
-rw-r--r--src/designer/src/lib/shared/extensionfactory_p.h29
-rw-r--r--src/designer/src/lib/shared/formlayoutmenu.cpp75
-rw-r--r--src/designer/src/lib/shared/formlayoutmenu_p.h29
-rw-r--r--src/designer/src/lib/shared/formwindowbase.cpp68
-rw-r--r--src/designer/src/lib/shared/formwindowbase_p.h29
-rw-r--r--src/designer/src/lib/shared/grid.cpp63
-rw-r--r--src/designer/src/lib/shared/grid_p.h42
-rw-r--r--src/designer/src/lib/shared/gridpanel.cpp31
-rw-r--r--src/designer/src/lib/shared/gridpanel_p.h29
-rw-r--r--src/designer/src/lib/shared/htmlhighlighter.cpp76
-rw-r--r--src/designer/src/lib/shared/htmlhighlighter_p.h29
-rw-r--r--src/designer/src/lib/shared/icon-naming-spec.txt309
-rw-r--r--src/designer/src/lib/shared/iconloader.cpp77
-rw-r--r--src/designer/src/lib/shared/iconloader_p.h36
-rw-r--r--src/designer/src/lib/shared/iconselector.cpp346
-rw-r--r--src/designer/src/lib/shared/iconselector_p.h69
-rw-r--r--src/designer/src/lib/shared/invisible_widget.cpp29
-rw-r--r--src/designer/src/lib/shared/invisible_widget_p.h29
-rw-r--r--src/designer/src/lib/shared/layout.cpp168
-rw-r--r--src/designer/src/lib/shared/layout_p.h32
-rw-r--r--src/designer/src/lib/shared/layoutinfo.cpp44
-rw-r--r--src/designer/src/lib/shared/layoutinfo_p.h29
-rw-r--r--src/designer/src/lib/shared/metadatabase.cpp32
-rw-r--r--src/designer/src/lib/shared/metadatabase_p.h32
-rw-r--r--src/designer/src/lib/shared/morphmenu.cpp98
-rw-r--r--src/designer/src/lib/shared/morphmenu_p.h29
-rw-r--r--src/designer/src/lib/shared/newactiondialog.cpp80
-rw-r--r--src/designer/src/lib/shared/newactiondialog.ui87
-rw-r--r--src/designer/src/lib/shared/newactiondialog_p.h49
-rw-r--r--src/designer/src/lib/shared/newformwidget.cpp93
-rw-r--r--src/designer/src/lib/shared/newformwidget.ui32
-rw-r--r--src/designer/src/lib/shared/newformwidget_p.h37
-rw-r--r--src/designer/src/lib/shared/orderdialog.cpp58
-rw-r--r--src/designer/src/lib/shared/orderdialog.ui31
-rw-r--r--src/designer/src/lib/shared/orderdialog_p.h38
-rw-r--r--src/designer/src/lib/shared/plaintexteditor.cpp45
-rw-r--r--src/designer/src/lib/shared/plaintexteditor_p.h29
-rw-r--r--src/designer/src/lib/shared/plugindialog.cpp52
-rw-r--r--src/designer/src/lib/shared/plugindialog.ui32
-rw-r--r--src/designer/src/lib/shared/plugindialog_p.h35
-rw-r--r--src/designer/src/lib/shared/pluginmanager.cpp168
-rw-r--r--src/designer/src/lib/shared/pluginmanager_p.h37
-rw-r--r--src/designer/src/lib/shared/previewconfigurationwidget.cpp74
-rw-r--r--src/designer/src/lib/shared/previewconfigurationwidget_p.h29
-rw-r--r--src/designer/src/lib/shared/previewmanager.cpp82
-rw-r--r--src/designer/src/lib/shared/previewmanager_p.h29
-rw-r--r--src/designer/src/lib/shared/promotionmodel.cpp41
-rw-r--r--src/designer/src/lib/shared/promotionmodel_p.h29
-rw-r--r--src/designer/src/lib/shared/promotiontaskmenu.cpp40
-rw-r--r--src/designer/src/lib/shared/promotiontaskmenu_p.h29
-rw-r--r--src/designer/src/lib/shared/propertylineedit.cpp35
-rw-r--r--src/designer/src/lib/shared/propertylineedit_p.h29
-rw-r--r--src/designer/src/lib/shared/qdesigner_command.cpp205
-rw-r--r--src/designer/src/lib/shared/qdesigner_command2.cpp29
-rw-r--r--src/designer/src/lib/shared/qdesigner_command2_p.h29
-rw-r--r--src/designer/src/lib/shared/qdesigner_command_p.h89
-rw-r--r--src/designer/src/lib/shared/qdesigner_dnditem.cpp72
-rw-r--r--src/designer/src/lib/shared/qdesigner_dnditem_p.h29
-rw-r--r--src/designer/src/lib/shared/qdesigner_dockwidget.cpp35
-rw-r--r--src/designer/src/lib/shared/qdesigner_dockwidget_p.h29
-rw-r--r--src/designer/src/lib/shared/qdesigner_formbuilder.cpp49
-rw-r--r--src/designer/src/lib/shared/qdesigner_formbuilder_p.h29
-rw-r--r--src/designer/src/lib/shared/qdesigner_formeditorcommand.cpp29
-rw-r--r--src/designer/src/lib/shared/qdesigner_formeditorcommand_p.h29
-rw-r--r--src/designer/src/lib/shared/qdesigner_formwindowcommand.cpp33
-rw-r--r--src/designer/src/lib/shared/qdesigner_formwindowcommand_p.h29
-rw-r--r--src/designer/src/lib/shared/qdesigner_formwindowmanager.cpp33
-rw-r--r--src/designer/src/lib/shared/qdesigner_formwindowmanager_p.h29
-rw-r--r--src/designer/src/lib/shared/qdesigner_introspection.cpp38
-rw-r--r--src/designer/src/lib/shared/qdesigner_introspection_p.h36
-rw-r--r--src/designer/src/lib/shared/qdesigner_membersheet.cpp81
-rw-r--r--src/designer/src/lib/shared/qdesigner_membersheet_p.h29
-rw-r--r--src/designer/src/lib/shared/qdesigner_menu.cpp138
-rw-r--r--src/designer/src/lib/shared/qdesigner_menu_p.h29
-rw-r--r--src/designer/src/lib/shared/qdesigner_menubar.cpp112
-rw-r--r--src/designer/src/lib/shared/qdesigner_menubar_p.h29
-rw-r--r--src/designer/src/lib/shared/qdesigner_objectinspector.cpp29
-rw-r--r--src/designer/src/lib/shared/qdesigner_objectinspector_p.h29
-rw-r--r--src/designer/src/lib/shared/qdesigner_promotion.cpp87
-rw-r--r--src/designer/src/lib/shared/qdesigner_promotion_p.h29
-rw-r--r--src/designer/src/lib/shared/qdesigner_promotiondialog.cpp53
-rw-r--r--src/designer/src/lib/shared/qdesigner_promotiondialog_p.h29
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertycommand.cpp315
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertycommand_p.h59
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertyeditor.cpp77
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertyeditor_p.h31
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertysheet.cpp312
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertysheet_p.h33
-rw-r--r--src/designer/src/lib/shared/qdesigner_qsettings.cpp29
-rw-r--r--src/designer/src/lib/shared/qdesigner_qsettings_p.h29
-rw-r--r--src/designer/src/lib/shared/qdesigner_stackedbox.cpp56
-rw-r--r--src/designer/src/lib/shared/qdesigner_stackedbox_p.h29
-rw-r--r--src/designer/src/lib/shared/qdesigner_tabwidget.cpp75
-rw-r--r--src/designer/src/lib/shared/qdesigner_tabwidget_p.h32
-rw-r--r--src/designer/src/lib/shared/qdesigner_taskmenu.cpp94
-rw-r--r--src/designer/src/lib/shared/qdesigner_taskmenu_p.h29
-rw-r--r--src/designer/src/lib/shared/qdesigner_toolbar.cpp86
-rw-r--r--src/designer/src/lib/shared/qdesigner_toolbar_p.h31
-rw-r--r--src/designer/src/lib/shared/qdesigner_toolbox.cpp69
-rw-r--r--src/designer/src/lib/shared/qdesigner_toolbox_p.h31
-rw-r--r--src/designer/src/lib/shared/qdesigner_utils.cpp285
-rw-r--r--src/designer/src/lib/shared/qdesigner_utils_p.h176
-rw-r--r--src/designer/src/lib/shared/qdesigner_widget.cpp29
-rw-r--r--src/designer/src/lib/shared/qdesigner_widget_p.h31
-rw-r--r--src/designer/src/lib/shared/qdesigner_widgetbox.cpp52
-rw-r--r--src/designer/src/lib/shared/qdesigner_widgetbox_p.h29
-rw-r--r--src/designer/src/lib/shared/qdesigner_widgetitem.cpp29
-rw-r--r--src/designer/src/lib/shared/qdesigner_widgetitem_p.h29
-rw-r--r--src/designer/src/lib/shared/qlayout_widget.cpp184
-rw-r--r--src/designer/src/lib/shared/qlayout_widget_p.h36
-rw-r--r--src/designer/src/lib/shared/qsimpleresource.cpp41
-rw-r--r--src/designer/src/lib/shared/qsimpleresource_p.h29
-rw-r--r--src/designer/src/lib/shared/qtresourceeditordialog.cpp355
-rw-r--r--src/designer/src/lib/shared/qtresourceeditordialog_p.h64
-rw-r--r--src/designer/src/lib/shared/qtresourcemodel.cpp110
-rw-r--r--src/designer/src/lib/shared/qtresourcemodel_p.h31
-rw-r--r--src/designer/src/lib/shared/qtresourceview.cpp170
-rw-r--r--src/designer/src/lib/shared/qtresourceview_p.h42
-rw-r--r--src/designer/src/lib/shared/rcc.cpp1109
-rw-r--r--src/designer/src/lib/shared/rcc_p.h87
-rw-r--r--src/designer/src/lib/shared/richtexteditor.cpp148
-rw-r--r--src/designer/src/lib/shared/richtexteditor_p.h29
-rw-r--r--src/designer/src/lib/shared/selectsignaldialog.cpp34
-rw-r--r--src/designer/src/lib/shared/selectsignaldialog_p.h31
-rw-r--r--src/designer/src/lib/shared/shared.qrc20
-rw-r--r--src/designer/src/lib/shared/shared_enums_p.h29
-rw-r--r--src/designer/src/lib/shared/shared_global_p.h29
-rw-r--r--src/designer/src/lib/shared/shared_settings.cpp139
-rw-r--r--src/designer/src/lib/shared/shared_settings_p.h29
-rw-r--r--src/designer/src/lib/shared/sheet_delegate.cpp29
-rw-r--r--src/designer/src/lib/shared/sheet_delegate_p.h29
-rw-r--r--src/designer/src/lib/shared/signalslotdialog.cpp165
-rw-r--r--src/designer/src/lib/shared/signalslotdialog_p.h39
-rw-r--r--src/designer/src/lib/shared/spacer_widget.cpp33
-rw-r--r--src/designer/src/lib/shared/spacer_widget_p.h29
-rw-r--r--src/designer/src/lib/shared/stylesheeteditor.cpp136
-rw-r--r--src/designer/src/lib/shared/stylesheeteditor_p.h29
-rw-r--r--src/designer/src/lib/shared/textpropertyeditor.cpp92
-rw-r--r--src/designer/src/lib/shared/textpropertyeditor_p.h31
-rw-r--r--src/designer/src/lib/shared/widgetdatabase.cpp249
-rw-r--r--src/designer/src/lib/shared/widgetdatabase_p.h35
-rw-r--r--src/designer/src/lib/shared/widgetfactory.cpp230
-rw-r--r--src/designer/src/lib/shared/widgetfactory_p.h68
-rw-r--r--src/designer/src/lib/shared/zoomwidget.cpp37
-rw-r--r--src/designer/src/lib/shared/zoomwidget_p.h29
-rw-r--r--src/designer/src/lib/uilib/abstractformbuilder.cpp427
-rw-r--r--src/designer/src/lib/uilib/abstractformbuilder.h46
-rw-r--r--src/designer/src/lib/uilib/formbuilder.cpp85
-rw-r--r--src/designer/src/lib/uilib/formbuilder.h50
-rw-r--r--src/designer/src/lib/uilib/formbuilderextra.cpp196
-rw-r--r--src/designer/src/lib/uilib/formbuilderextra_p.h111
-rw-r--r--src/designer/src/lib/uilib/properties.cpp164
-rw-r--r--src/designer/src/lib/uilib/properties_p.h46
-rw-r--r--src/designer/src/lib/uilib/resourcebuilder.cpp143
-rw-r--r--src/designer/src/lib/uilib/resourcebuilder_p.h45
-rw-r--r--src/designer/src/lib/uilib/textbuilder.cpp40
-rw-r--r--src/designer/src/lib/uilib/textbuilder_p.h40
-rw-r--r--src/designer/src/lib/uilib/ui4.cpp1303
-rw-r--r--src/designer/src/lib/uilib/ui4_p.h56
-rw-r--r--src/designer/src/lib/uilib/uilib_global.h40
-rw-r--r--src/designer/src/lib/uilib/widgets.table5
-rw-r--r--src/designer/src/plugins/CMakeLists.txt3
-rw-r--r--src/designer/src/plugins/activeqt/CMakeLists.txt4
-rw-r--r--src/designer/src/plugins/activeqt/qaxwidgetextrainfo.cpp36
-rw-r--r--src/designer/src/plugins/activeqt/qaxwidgetextrainfo.h29
-rw-r--r--src/designer/src/plugins/activeqt/qaxwidgetplugin.cpp37
-rw-r--r--src/designer/src/plugins/activeqt/qaxwidgetplugin.h29
-rw-r--r--src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.cpp41
-rw-r--r--src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.h34
-rw-r--r--src/designer/src/plugins/activeqt/qaxwidgettaskmenu.cpp41
-rw-r--r--src/designer/src/plugins/activeqt/qaxwidgettaskmenu.h31
-rw-r--r--src/designer/src/plugins/activeqt/qdesigneraxwidget.cpp29
-rw-r--r--src/designer/src/plugins/activeqt/qdesigneraxwidget.h35
-rw-r--r--src/designer/src/plugins/qquickwidget/CMakeLists.txt3
-rw-r--r--src/designer/src/plugins/qquickwidget/qquickwidget_plugin.cpp47
-rw-r--r--src/designer/src/plugins/qquickwidget/qquickwidget_plugin.h29
-rw-r--r--src/designer/src/plugins/qquickwidget/qquickwidget_plugin.qrc5
-rw-r--r--src/designer/src/plugins/qwebview/CMakeLists.txt7
-rw-r--r--src/designer/src/plugins/qwebview/qwebview_plugin.cpp43
-rw-r--r--src/designer/src/plugins/qwebview/qwebview_plugin.h29
-rw-r--r--src/designer/src/plugins/qwebview/qwebview_plugin.qrc5
-rw-r--r--src/designer/src/plugins/tools/view3d/CMakeLists.txt3
-rw-r--r--src/designer/src/plugins/tools/view3d/view3d.cpp38
-rw-r--r--src/designer/src/plugins/tools/view3d/view3d.h29
-rw-r--r--src/designer/src/plugins/tools/view3d/view3d_global.h33
-rw-r--r--src/designer/src/plugins/tools/view3d/view3d_plugin.cpp29
-rw-r--r--src/designer/src/plugins/tools/view3d/view3d_plugin.h33
-rw-r--r--src/designer/src/plugins/tools/view3d/view3d_tool.cpp29
-rw-r--r--src/designer/src/plugins/tools/view3d/view3d_tool.h33
-rw-r--r--src/designer/src/uiplugin/CMakeLists.txt27
-rw-r--r--src/designer/src/uiplugin/customwidget.h87
-rw-r--r--src/designer/src/uiplugin/customwidget.qdoc293
-rw-r--r--src/designer/src/uiplugin/qdesignerexportwidget.h49
-rw-r--r--src/designer/src/uitools/CMakeLists.txt47
-rw-r--r--src/designer/src/uitools/doc/images/textfinder-example-find.pngbin15837 -> 0 bytes
-rw-r--r--src/designer/src/uitools/doc/images/textfinder-example-find2.pngbin15745 -> 0 bytes
-rw-r--r--src/designer/src/uitools/doc/images/textfinder-example.pngbin15424 -> 0 bytes
-rw-r--r--src/designer/src/uitools/doc/images/uitools-examples.pngbin12021 -> 0 bytes
-rw-r--r--src/designer/src/uitools/doc/qtuitools.qdocconf42
-rw-r--r--src/designer/src/uitools/doc/snippets/quiloader/doc_src_qtuiloader.cpp53
-rw-r--r--src/designer/src/uitools/doc/snippets/quiloader/doc_src_qtuiloader.pro53
-rw-r--r--src/designer/src/uitools/doc/snippets/quiloader/main.cpp80
-rw-r--r--src/designer/src/uitools/doc/snippets/quiloader/myform.ui130
-rw-r--r--src/designer/src/uitools/doc/snippets/quiloader/mywidget.cpp70
-rw-r--r--src/designer/src/uitools/doc/snippets/quiloader/mywidget.h62
-rw-r--r--src/designer/src/uitools/doc/snippets/quiloader/mywidget.qrc5
-rw-r--r--src/designer/src/uitools/doc/snippets/quiloader/quiloader.pro4
-rw-r--r--src/designer/src/uitools/doc/src/qtuitools-examples.qdoc51
-rw-r--r--src/designer/src/uitools/doc/src/qtuitools-index.qdoc76
-rw-r--r--src/designer/src/uitools/doc/src/qtuitools-module.qdoc62
-rw-r--r--src/designer/src/uitools/qtuitoolsglobal.h60
-rw-r--r--src/designer/src/uitools/quiloader.cpp949
-rw-r--r--src/designer/src/uitools/quiloader.h97
-rw-r--r--src/designer/src/uitools/quiloader_p.h113
612 files changed, 10273 insertions, 24313 deletions
diff --git a/src/designer/CMakeLists.txt b/src/designer/CMakeLists.txt
index 35b6eeace..b4deaf956 100644
--- a/src/designer/CMakeLists.txt
+++ b/src/designer/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from designer.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
if(NOT QT_FEATURE_designer)
return()
diff --git a/src/designer/data/README b/src/designer/data/README
index b7160b8f6..5b05ffa26 100644
--- a/src/designer/data/README
+++ b/src/designer/data/README
@@ -1,4 +1,4 @@
-You may generate ui4.h and ui4.cpp parser files by using the generate_ui script
+You may generate ui4.h and ui4.cpp parser files by using the generate_ui.py script
or manually by invoking the xsltproc command:
xsltproc generate_header.xsl ui4.xsd > ui4.h
diff --git a/src/designer/data/generate_header.xsl b/src/designer/data/generate_header.xsl
index af39044be..c2b12dfa8 100644
--- a/src/designer/data/generate_header.xsl
+++ b/src/designer/data/generate_header.xsl
@@ -407,7 +407,7 @@
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
-// of Qt Designer. This header
+// of Qt Widgets Designer. This header
// file may change from version to version without notice, or even be removed.
//
// We mean it.
diff --git a/src/designer/data/generate_impl.xsl b/src/designer/data/generate_impl.xsl
index 2002c71a1..7ce02f41b 100644
--- a/src/designer/data/generate_impl.xsl
+++ b/src/designer/data/generate_impl.xsl
@@ -161,29 +161,12 @@
</xsl:template>
- <!-- Format a string constant for comparison as QLatin1String("foo") - they're all ascii-only -->
- <xsl:template name="string-constant-for-comparison">
- <xsl:param name="literal"/>
- <xsl:text>QLatin1String("</xsl:text>
- <xsl:value-of select="$literal"/>
- <xsl:text>")</xsl:text>
- </xsl:template>
-
- <!-- Format a string constant for storage as QString(QLatin1Char('X')) or QLatin1String("foo"), respectively -->
- <xsl:template name="string-constant-for-storage">
+ <!-- Format a string constant -->
+ <xsl:template name="string-constant">
<xsl:param name="literal"/>
- <xsl:choose>
- <xsl:when test="string-length($literal) &lt; 2">
- <xsl:text>QString(QLatin1Char('</xsl:text>
- <xsl:value-of select="$literal"/>
- <xsl:text>'))</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>QStringLiteral("</xsl:text>
- <xsl:value-of select="$literal"/>
- <xsl:text>")</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:text>u"</xsl:text>
+ <xsl:value-of select="$literal"/>
+ <xsl:text>"_s</xsl:text>
</xsl:template>
<!-- Implementation: read(QXmlStreamReader) -->
@@ -217,7 +200,7 @@
</xsl:variable>
<xsl:text> if (name == </xsl:text>
- <xsl:call-template name="string-constant-for-comparison">
+ <xsl:call-template name="string-constant">
<xsl:with-param name="literal" select="@name"/>
</xsl:call-template>
<xsl:text>) {&endl;</xsl:text>
@@ -230,7 +213,7 @@
<xsl:text> }&endl;</xsl:text>
</xsl:for-each>
- <xsl:text> reader.raiseError(QLatin1String("Unexpected attribute ") + name);&endl;</xsl:text>
+ <xsl:text> reader.raiseError("Unexpected attribute "_L1 + name);&endl;</xsl:text>
<xsl:text> }&endl;</xsl:text>
<xsl:text>&endl;</xsl:text>
</xsl:if>
@@ -264,7 +247,7 @@
<xsl:variable name="array" select="@maxOccurs = 'unbounded'"/>
<xsl:text> if (!tag.compare(</xsl:text>
- <xsl:call-template name="string-constant-for-comparison">
+ <xsl:call-template name="string-constant">
<xsl:with-param name="literal" select="$lower-name"/>
</xsl:call-template>
<xsl:text>, Qt::CaseInsensitive)) {&endl;</xsl:text>
@@ -355,7 +338,7 @@
</xsl:call-template>
</xsl:for-each>
- <xsl:text> reader.raiseError(QLatin1String("Unexpected element ") + tag);&endl;</xsl:text>
+ <xsl:text> reader.raiseError("Unexpected element "_L1 + tag);&endl;</xsl:text>
<xsl:text> }&endl;</xsl:text>
<xsl:text> break;&endl;</xsl:text>
<xsl:text> case QXmlStreamReader::EndElement :&endl;</xsl:text>
@@ -402,7 +385,7 @@
<xsl:value-of select="$cap-name"/>
<xsl:text>())&endl;</xsl:text>
<xsl:text> writer.writeAttribute(</xsl:text>
- <xsl:call-template name="string-constant-for-storage">
+ <xsl:call-template name="string-constant">
<xsl:with-param name="literal" select="$lower-name"/>
</xsl:call-template>
@@ -458,7 +441,7 @@
</xsl:variable>
<xsl:text> writer.writeTextElement(</xsl:text>
- <xsl:call-template name="string-constant-for-storage">
+ <xsl:call-template name="string-constant">
<xsl:with-param name="literal" select="$camel-case-name"/>
</xsl:call-template>
<xsl:text>, </xsl:text>
@@ -478,7 +461,7 @@
<xsl:text> m_</xsl:text>
<xsl:value-of select="$camel-case-name"/>
<xsl:text>->write(writer, </xsl:text>
- <xsl:call-template name="string-constant-for-storage">
+ <xsl:call-template name="string-constant">
<xsl:with-param name="literal" select="$lower-name"/>
</xsl:call-template>
<xsl:text>);&endl;</xsl:text>
@@ -533,7 +516,7 @@
<xsl:choose>
<xsl:when test="$xs-type-cat = 'pointer'">
<xsl:text> v->write(writer, </xsl:text>
- <xsl:call-template name="string-constant-for-storage">
+ <xsl:call-template name="string-constant">
<xsl:with-param name="literal" select="$lower-name"/>
</xsl:call-template>
<xsl:text>);&endl;</xsl:text>
@@ -547,7 +530,7 @@
</xsl:variable>
<xsl:text> writer.writeTextElement(</xsl:text>
- <xsl:call-template name="string-constant-for-storage">
+ <xsl:call-template name="string-constant">
<xsl:with-param name="literal" select="$lower-name"/>
</xsl:call-template>
<xsl:text>, </xsl:text>
@@ -566,7 +549,7 @@
<xsl:text> m_</xsl:text>
<xsl:value-of select="$camel-case-name"/>
<xsl:text>->write(writer, </xsl:text>
- <xsl:call-template name="string-constant-for-storage">
+ <xsl:call-template name="string-constant">
<xsl:with-param name="literal" select="$lower-name"/>
</xsl:call-template>
<xsl:text>);&endl;</xsl:text>
@@ -579,7 +562,7 @@
</xsl:call-template>
</xsl:variable>
<xsl:text> writer.writeTextElement(</xsl:text>
- <xsl:call-template name="string-constant-for-storage">
+ <xsl:call-template name="string-constant">
<xsl:with-param name="literal" select="$lower-name"/>
</xsl:call-template>
<xsl:text>, </xsl:text>
@@ -838,6 +821,7 @@
<xsl:text>&endl;</xsl:text>
<xsl:text>&endl;</xsl:text>
<xsl:text>QT_BEGIN_NAMESPACE&endl;</xsl:text>
+ <xsl:text>&endl;using namespace Qt::StringLiterals;&endl;&endl;</xsl:text>
<xsl:text>#ifdef QFORMINTERNAL_NAMESPACE&endl;</xsl:text>
<xsl:text>using namespace QFormInternal;&endl;</xsl:text>
diff --git a/src/designer/data/generate_shared.xsl b/src/designer/data/generate_shared.xsl
index 38269cd61..d1ca2b94b 100644
--- a/src/designer/data/generate_shared.xsl
+++ b/src/designer/data/generate_shared.xsl
@@ -48,6 +48,8 @@
<xsl:when test="$text='pointsize'">pointSize</xsl:when>
<xsl:when test="$text='strikeout'">strikeOut</xsl:when>
<xsl:when test="$text='stylestrategy'">styleStrategy</xsl:when>
+ <xsl:when test="$text='hintingpreference'">hintingPreference</xsl:when>
+ <xsl:when test="$text='fontweight'">fontWeight</xsl:when>
<xsl:when test="$text='hsizetype'">hSizeType</xsl:when>
<xsl:when test="$text='vsizetype'">vSizeType</xsl:when>
<xsl:when test="$text='horstretch'">horStretch</xsl:when>
@@ -142,7 +144,7 @@
</xsl:when>
<xsl:when test="$xs-type='xs:boolean'">
<xsl:value-of select="$val"/>
- <xsl:text> == QLatin1String("true")</xsl:text>
+ <xsl:text> == u"true"_s</xsl:text>
</xsl:when>
<xsl:when test="$xs-type='xs:long'">
<xsl:value-of select="$val"/>
@@ -217,9 +219,7 @@
<xsl:when test="$xs-type='xs:boolean'">
<xsl:text>(</xsl:text>
<xsl:value-of select="$val"/>
- <!-- Note: Do not use QStringLiteral here as the types are not compatible:
- QConstStringData<5> vs QConstStringData<4> -->
- <xsl:text> ? QLatin1String("true") : QLatin1String("false"))</xsl:text>
+ <xsl:text> ? u"true"_s : u"false"_s)</xsl:text>
</xsl:when>
<xsl:otherwise>### BZZZZT! ###</xsl:otherwise>
</xsl:choose>
diff --git a/src/designer/data/generate_ui b/src/designer/data/generate_ui
deleted file mode 100755
index 4c723a61c..000000000
--- a/src/designer/data/generate_ui
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/usr/bin/perl -w
-####################################################################################################
-#
-# Helper script for Qt 5
-#
-# Copyright (C) 2015 The Qt Company Ltd.
-# Contact: http://www.qt.io/licensing/
-#
-####################################################################################################
-
-############################################################################################
-#
-# Generates the source files ui4.cpp, ui4.h used in the uic tool, the QtUiTools library and
-# Qt Designer from the XML schema used for .ui files.
-#
-############################################################################################
-
-use strict;
-
-use File::Basename;
-use File::Spec;
-use File::Copy;
-use IO::File;
-use File::Path;
-use File::Temp;
-
-my $USAGE=<<EOF;
-Usage: generate_ui
-
-Generates the source files ui4.cpp, ui4.h used in the uic tool, the QtUiTools library and
-Qt Designer from the XML schema used for .ui files.
-
-Requires the environment variable QTDIR to point to qtbase and xalan.
-EOF
-
-my $qtDir = $ENV{'QTDIR'};
-die ('QTDIR not set') unless defined $qtDir && -d $qtDir;
-
-print 'Generating ui4.cpp/ui4.h ',$qtDir,"\n";
-
-my $uicDir = File::Spec->catfile($qtDir, 'src', 'tools', 'uic');
-my $toolsDir = File::Spec->catfile($qtDir, '..', 'qttools');
-my $designerDir = File::Spec->catfile($toolsDir, 'src', 'designer');
-my $uiLibDir = File::Spec->catfile($designerDir, 'src', 'lib', 'uilib');
-my $xmlDir = File::Spec->catfile($designerDir, 'data');
-my $qtXmlPatterns = File::Spec->catfile($qtDir, 'bin', 'xmlpatterns');
-
-print 'uic at: ',$uicDir, ' Designer at: ',$designerDir, ' uilib at: ',$uiLibDir,' XML at ',$xmlDir,"\n";
-die ('Invalid folder structure') unless -d $xmlDir && -d $uicDir && -d $uiLibDir;
-
-# Read out license delimited by '/** .. **/' from a C++ source
-sub readCppLicense
-{
- my ($fileName) = @_;
- my $license = '';
- my $file = new IO::File('<' . $fileName) or die ('Unable to open ' . $fileName . ' for reading: ' . $!);
- while (my $line = <$file>) {
- $license .= $line;
- last if index($line, '*****/') >= 0;
- }
- $file->close();
- return $license;
-}
-
-# Replace special keys in XSL files and return a handle to temporary file
-sub replaceXslKeys
-{
- my ($xslSourceFileName, $license, $uiHeaderName) = @_;
-
- my $xslSourceFile = new IO::File('<' . $xslSourceFileName) or die ('Unable to open ' . $xslSourceFileName . ' for reading: ' . $!);
- my $xsl = '';
- while (my $line = <$xslSourceFile>) {
- $xsl .= $line;
- }
- $xslSourceFile->close();
- $xsl =~ s/\@LICENSE\@/$license/g;
- $xsl =~ s/\@HEADER\@/$uiHeaderName/g if defined $uiHeaderName;
-
- my $xslHandle = File::Temp->new(DIR => dirname($xslSourceFileName), SUFFIX => '.xsl');
- print $xslHandle $xsl;
- $xslHandle->close();
- return $xslHandle;
-}
-
-# Run xalan. Note: xmlpatterns currently reports a syntax error on the sheets
-sub runXSLT
-{
- my ($source, $sheet, $target) = @_;
- my $rc = system('xalan', '-in', $source, '-xsl', $sheet, '-out', $target);
-# my $rc = system($qtXmlPatterns, '-output', $target, $sheet, $source);
- die ('Xalan failed on ' . $source . ' ' . $sheet) unless $rc == 0;
-}
-
-# Generate uilib header and source.
-
-my $uiLibImpl = File::Spec->catfile($uiLibDir, 'ui4.cpp');
-my $uiLibHeader = File::Spec->catfile($uiLibDir, 'ui4_p.h');
-my $license = readCppLicense($uiLibImpl);
-
-print "Running XSLT processor for uilib header...\n";
-
-my $ui4Xsd = File::Spec->catfile($xmlDir, 'ui4.xsd');
-my $headerXslSource = File::Spec->catfile($xmlDir, 'generate_header.xsl');
-my $headerXsl = replaceXslKeys($headerXslSource, $license);
-runXSLT($ui4Xsd, $headerXsl->filename, $uiLibHeader);
-
-print "Running XSLT processor for uilib source...\n";
-my $implXslSource = File::Spec->catfile($xmlDir, 'generate_impl.xsl');
-my $implXsl = replaceXslKeys($implXslSource, $license, 'ui4_p.h');
-runXSLT($ui4Xsd, $implXsl->filename, $uiLibImpl);
-
-# uic: Header is called 'ui4.h' instead of 'ui4_p.h'
-
-my $uicImpl = File::Spec->catfile($uicDir, 'ui4.cpp');
-my $uicHeader = File::Spec->catfile($uicDir, 'ui4.h');
-$license = readCppLicense($uicImpl);
-
-print "Running XSLT processor for uic header...\n";
-$headerXsl = replaceXslKeys($headerXslSource, $license);
-runXSLT($ui4Xsd, $headerXsl->filename, $uicHeader);
-
-print "Running XSLT processor for uic source...\n";
-$implXsl = replaceXslKeys($implXslSource, $license, 'ui4.h');
-runXSLT($ui4Xsd, $implXsl->filename, $uicImpl);
-
-system('git', 'diff');
diff --git a/src/designer/data/generate_ui.py b/src/designer/data/generate_ui.py
new file mode 100644
index 000000000..05472c7f5
--- /dev/null
+++ b/src/designer/data/generate_ui.py
@@ -0,0 +1,96 @@
+#!/usr/bin/python3
+
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import os
+import subprocess
+
+from argparse import ArgumentParser, RawTextHelpFormatter
+from pathlib import Path
+from tempfile import NamedTemporaryFile
+
+
+DESCRIPTION = """
+Usage: generate_ui.py
+
+Generates the source files ui4.cpp, ui4.h used in the uic tool, the QtUiTools library and
+Qt Widgets Designer from the XML schema used for .ui files.
+
+Requires xalan.
+"""
+
+
+opt_delete_temp_files = True
+
+
+def read_cpp_license(path):
+ """Read out the license from a C++ source"""
+ result = ""
+ for line in path.read_text().splitlines():
+ result += line + "\n"
+ if 'SPDX-License-Identifier' in line:
+ break
+ return result
+
+
+def replace_xsl_keys(xsl_source_file, license, ui_header_name=None):
+ """Replace special keys in XSL files and return a handle to temporary file"""
+ xsl = xsl_source_file.read_text()
+ xsl = xsl.replace("@LICENSE@", license)
+ if ui_header_name:
+ xsl = xsl.replace("@HEADER@", ui_header_name)
+
+ result = NamedTemporaryFile(mode='w', suffix='.xsl',
+ dir=Path.cwd(),
+ delete=opt_delete_temp_files)
+ result.write(xsl)
+ return result
+
+
+def run_xslt(source, sheet, target):
+ """Run xalan."""
+ cmd = ['xalan', '-in', os.fspath(source), '-xsl', os.fspath(sheet),
+ '-out', os.fspath(target)]
+ subprocess.check_call(cmd)
+
+
+if __name__ == '__main__':
+ argument_parser = ArgumentParser(description=DESCRIPTION,
+ formatter_class=RawTextHelpFormatter)
+ argument_parser.add_argument('--keep', '-k', action='store_true',
+ help='Keep temporary files')
+ options = argument_parser.parse_args()
+ opt_delete_temp_files = not options.keep
+
+ # Generate uilib header and source.
+ xml_dir = Path(__file__).parent.resolve()
+ ui4_xsd = xml_dir / 'ui4.xsd'
+
+ designer_dir = xml_dir.parent
+ uilib_dir = designer_dir / "src" / "lib" / "uilib"
+ uilib_impl = uilib_dir / 'ui4.cpp'
+ license = read_cpp_license(uilib_impl)
+
+ print("Running XSLT processor for uilib header...\n")
+ header_xsl_source = xml_dir / 'generate_header.xsl'
+ header_xsl = replace_xsl_keys(header_xsl_source, license)
+ run_xslt(ui4_xsd, header_xsl.name, uilib_dir / 'ui4_p.h')
+
+ print("Running XSLT processor for uilib source...\n")
+ impl_xsl_source = xml_dir / 'generate_impl.xsl'
+ impl_xsl = replace_xsl_keys(impl_xsl_source, license, 'ui4_p.h')
+ run_xslt(ui4_xsd, impl_xsl.name, uilib_impl)
+
+ # uic: Header is called 'ui4.h' instead of 'ui4_p.h'
+ uic_dir = designer_dir.parents[2] / "qtbase" / "src" / "tools" / "uic"
+ uic_impl = uic_dir / 'ui4.cpp'
+ license = read_cpp_license(uic_impl)
+ print("Running XSLT processor for uic header...\n")
+ header_xsl = replace_xsl_keys(header_xsl_source, license)
+ run_xslt(ui4_xsd, header_xsl.name, uic_dir / 'ui4.h')
+ print("Running XSLT processor for uic source...\n")
+ impl_xsl = replace_xsl_keys(impl_xsl_source, license, 'ui4.h')
+ run_xslt(ui4_xsd, impl_xsl.name, uic_impl)
+
+ subprocess.call(['git', 'diff'])
diff --git a/src/designer/data/ui4.xsd b/src/designer/data/ui4.xsd
index e1dc35d49..0063f473b 100644
--- a/src/designer/data/ui4.xsd
+++ b/src/designer/data/ui4.xsd
@@ -301,6 +301,7 @@
<xs:all>
<xs:element name="family" type="xs:string" minOccurs="0" />
<xs:element name="pointsize" type="xs:integer" minOccurs="0" />
+ <!-- Qt 4 legacy (int) -->
<xs:element name="weight" type="xs:integer" minOccurs="0" />
<xs:element name="italic" type="xs:boolean" minOccurs="0" />
<xs:element name="bold" type="xs:boolean" minOccurs="0" />
@@ -309,6 +310,9 @@
<xs:element name="antialiasing" type="xs:boolean" minOccurs="0" />
<xs:element name="stylestrategy" type="xs:string" minOccurs="0" />
<xs:element name="kerning" type="xs:boolean" minOccurs="0" />
+ <xs:element name="hintingpreference" type="xs:string" minOccurs="0"/>
+ <!-- Qt 5/6 (enum) -->
+ <xs:element name="fontweight" type="xs:string" minOccurs="0"/>
</xs:all>
</xs:complexType>
diff --git a/src/designer/src/CMakeLists.txt b/src/designer/src/CMakeLists.txt
index 32fb45160..00d2a48e2 100644
--- a/src/designer/src/CMakeLists.txt
+++ b/src/designer/src/CMakeLists.txt
@@ -1,5 +1,5 @@
-# Generated from src.pro.
-
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
qt_exclude_tool_directories_from_default_target(
lib
@@ -8,8 +8,6 @@ qt_exclude_tool_directories_from_default_target(
plugins
)
-add_subdirectory(uiplugin)
-add_subdirectory(uitools)
if(QT_FEATURE_process)
add_subdirectory(lib)
add_subdirectory(components)
diff --git a/src/designer/src/components/CMakeLists.txt b/src/designer/src/components/CMakeLists.txt
index df5b03f92..ec6a9a8fd 100644
--- a/src/designer/src/components/CMakeLists.txt
+++ b/src/designer/src/components/CMakeLists.txt
@@ -1,3 +1,4 @@
-# Generated from components.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(lib)
diff --git a/src/designer/src/components/buddyeditor/buddyeditor.cpp b/src/designer/src/components/buddyeditor/buddyeditor.cpp
index 38a865cee..452d33771 100644
--- a/src/designer/src/components/buddyeditor/buddyeditor.cpp
+++ b/src/designer/src/components/buddyeditor/buddyeditor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "buddyeditor.h"
@@ -53,7 +28,9 @@
QT_BEGIN_NAMESPACE
-static const char *buddyPropertyC = "buddy";
+using namespace Qt::StringLiterals;
+
+static constexpr auto buddyPropertyC = "buddy"_L1;
static bool canBeBuddy(QWidget *w, QDesignerFormWindowInterface *form)
{
@@ -64,7 +41,7 @@ static bool canBeBuddy(QWidget *w, QDesignerFormWindowInterface *form)
QExtensionManager *ext = form->core()->extensionManager();
if (QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(ext, w)) {
- const int index = sheet->indexOf(QStringLiteral("focusPolicy"));
+ const int index = sheet->indexOf(u"focusPolicy"_s);
if (index != -1) {
bool ok = false;
const Qt::FocusPolicy q = static_cast<Qt::FocusPolicy>(qdesigner_internal::Utils::valueOf(sheet->property(index), &ok));
@@ -80,7 +57,7 @@ static QString buddy(QLabel *label, QDesignerFormEditorInterface *core)
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), label);
if (sheet == nullptr)
return QString();
- const int prop_idx = sheet->indexOf(QLatin1String(buddyPropertyC));
+ const int prop_idx = sheet->indexOf(buddyPropertyC);
if (prop_idx == -1)
return QString();
return sheet->property(prop_idx).toString();
@@ -183,11 +160,11 @@ void BuddyEditor::updateBackground()
if (!toRemove.isEmpty()) {
DeleteConnectionsCommand command(this, toRemove);
command.redo();
- for (Connection *con : qAsConst(toRemove))
+ for (Connection *con : std::as_const(toRemove))
delete takeConnection(con);
}
- for (Connection *newConn : qAsConst(newList)) {
+ for (Connection *newConn : std::as_const(newList)) {
bool found = false;
const int c = connectionCount();
for (int i = 0; i < c; i++) {
@@ -234,7 +211,7 @@ void BuddyEditor::setBackground(QWidget *background)
static QUndoCommand *createBuddyCommand(QDesignerFormWindowInterface *fw, QLabel *label, QWidget *buddy)
{
SetPropertyCommand *command = new SetPropertyCommand(fw);
- command->init(label, QLatin1String(buddyPropertyC), buddy->objectName());
+ command->init(label, buddyPropertyC, buddy->objectName());
command->setText(BuddyEditor::tr("Add buddy"));
return command;
}
@@ -278,7 +255,7 @@ void BuddyEditor::widgetRemoved(QWidget *widget)
child_list.prepend(widget);
ConnectionSet remove_set;
- for (QWidget *w : qAsConst(child_list)) {
+ for (QWidget *w : std::as_const(child_list)) {
const ConnectionList &cl = connectionList();
for (Connection *con : cl) {
if (con->widget(EndPoint::Source) == w || con->widget(EndPoint::Target) == w)
@@ -288,7 +265,7 @@ void BuddyEditor::widgetRemoved(QWidget *widget)
if (!remove_set.isEmpty()) {
undoStack()->beginMacro(tr("Remove buddies"));
- for (Connection *con : qAsConst(remove_set)) {
+ for (Connection *con : std::as_const(remove_set)) {
setSelected(con, false);
con->update();
QWidget *source = con->widget(EndPoint::Source);
@@ -296,7 +273,7 @@ void BuddyEditor::widgetRemoved(QWidget *widget)
qDebug("BuddyConnection::widgetRemoved(): not a label");
} else {
ResetPropertyCommand *command = new ResetPropertyCommand(formWindow());
- command->init(source, QLatin1String(buddyPropertyC));
+ command->init(source, buddyPropertyC);
undoStack()->push(command);
}
delete takeConnection(con);
@@ -320,7 +297,7 @@ void BuddyEditor::deleteSelected()
qDebug("BuddyConnection::deleteSelected(): not a label");
} else {
ResetPropertyCommand *command = new ResetPropertyCommand(formWindow());
- command->init(source, QLatin1String(buddyPropertyC));
+ command->init(source, buddyPropertyC);
undoStack()->push(command);
}
delete takeConnection(con);
@@ -360,10 +337,10 @@ void BuddyEditor::autoBuddy()
// Add the list in one go.
if (labelList.isEmpty())
return;
- const int count = labelList.size();
+ const auto count = labelList.size();
Q_ASSERT(count == buddies.size());
undoStack()->beginMacro(tr("Add %n buddies", nullptr, count));
- for (int i = 0; i < count; i++)
+ for (qsizetype i = 0; i < count; ++i)
undoStack()->push(createBuddyCommand(m_formWindow, labelList.at(i), buddies.at(i)));
undoStack()->endMacro();
// Now select all new ones
diff --git a/src/designer/src/components/buddyeditor/buddyeditor.h b/src/designer/src/components/buddyeditor/buddyeditor.h
index 86ce41f6a..d844b997c 100644
--- a/src/designer/src/components/buddyeditor/buddyeditor.h
+++ b/src/designer/src/components/buddyeditor/buddyeditor.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef BUDDYEDITOR_H
#define BUDDYEDITOR_H
diff --git a/src/designer/src/components/buddyeditor/buddyeditor_global.h b/src/designer/src/components/buddyeditor/buddyeditor_global.h
index 75d5323d1..1085e409b 100644
--- a/src/designer/src/components/buddyeditor/buddyeditor_global.h
+++ b/src/designer/src/components/buddyeditor/buddyeditor_global.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef BUDDYEDITOR_GLOBAL_H
#define BUDDYEDITOR_GLOBAL_H
diff --git a/src/designer/src/components/buddyeditor/buddyeditor_plugin.cpp b/src/designer/src/components/buddyeditor/buddyeditor_plugin.cpp
index 868c52125..b4128bad4 100644
--- a/src/designer/src/components/buddyeditor/buddyeditor_plugin.cpp
+++ b/src/designer/src/components/buddyeditor/buddyeditor_plugin.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtGui/qaction.h>
@@ -37,7 +12,9 @@
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+using namespace Qt::StringLiterals;
+
+namespace qdesigner_internal {
BuddyEditorPlugin::BuddyEditorPlugin() = default;
@@ -53,9 +30,9 @@ void BuddyEditorPlugin::initialize(QDesignerFormEditorInterface *core)
Q_ASSERT(!isInitialized());
m_action = new QAction(tr("Edit Buddies"), this);
- m_action->setObjectName(QStringLiteral("__qt_edit_buddies_action"));
- QIcon buddyIcon = QIcon::fromTheme(QStringLiteral("designer-edit-buddy"),
- QIcon(core->resourceLocation() + QStringLiteral("/buddytool.png")));
+ m_action->setObjectName(u"__qt_edit_buddies_action"_s);
+ QIcon buddyIcon = QIcon::fromTheme(u"designer-edit-buddy"_s,
+ QIcon(core->resourceLocation() + "/buddytool.png"_L1));
m_action->setIcon(buddyIcon);
m_action->setEnabled(false);
@@ -112,4 +89,6 @@ void BuddyEditorPlugin::activeFormWindowChanged(QDesignerFormWindowInterface *fo
m_action->setEnabled(formWindow != nullptr);
}
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
diff --git a/src/designer/src/components/buddyeditor/buddyeditor_plugin.h b/src/designer/src/components/buddyeditor/buddyeditor_plugin.h
index 340c239b0..1e38f0ed9 100644
--- a/src/designer/src/components/buddyeditor/buddyeditor_plugin.h
+++ b/src/designer/src/components/buddyeditor/buddyeditor_plugin.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef BUDDYEDITOR_PLUGIN_H
#define BUDDYEDITOR_PLUGIN_H
diff --git a/src/designer/src/components/buddyeditor/buddyeditor_tool.cpp b/src/designer/src/components/buddyeditor/buddyeditor_tool.cpp
index 2cbb5ec8b..0ed4e7e64 100644
--- a/src/designer/src/components/buddyeditor/buddyeditor_tool.cpp
+++ b/src/designer/src/components/buddyeditor/buddyeditor_tool.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "buddyeditor_tool.h"
#include "buddyeditor.h"
@@ -35,7 +10,7 @@
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+namespace qdesigner_internal {
BuddyEditorTool::BuddyEditorTool(QDesignerFormWindowInterface *formWindow, QObject *parent)
: QDesignerFormWindowToolInterface(parent),
@@ -94,4 +69,6 @@ QAction *BuddyEditorTool::action() const
return m_action;
}
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
diff --git a/src/designer/src/components/buddyeditor/buddyeditor_tool.h b/src/designer/src/components/buddyeditor/buddyeditor_tool.h
index 1bcee7d7e..136711ebb 100644
--- a/src/designer/src/components/buddyeditor/buddyeditor_tool.h
+++ b/src/designer/src/components/buddyeditor/buddyeditor_tool.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef BUDDYEDITOR_TOOL_H
#define BUDDYEDITOR_TOOL_H
diff --git a/src/designer/src/components/formeditor/default_actionprovider.cpp b/src/designer/src/components/formeditor/default_actionprovider.cpp
index 6a479e4b1..890391857 100644
--- a/src/designer/src/components/formeditor/default_actionprovider.cpp
+++ b/src/designer/src/components/formeditor/default_actionprovider.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "default_actionprovider.h"
#include "invisible_widget_p.h"
diff --git a/src/designer/src/components/formeditor/default_actionprovider.h b/src/designer/src/components/formeditor/default_actionprovider.h
index 15e5683bd..88e7fabc2 100644
--- a/src/designer/src/components/formeditor/default_actionprovider.h
+++ b/src/designer/src/components/formeditor/default_actionprovider.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef DEFAULT_ACTIONPROVIDER_H
#define DEFAULT_ACTIONPROVIDER_H
diff --git a/src/designer/src/components/formeditor/default_container.cpp b/src/designer/src/components/formeditor/default_container.cpp
index 747000aa6..ea68b9b21 100644
--- a/src/designer/src/components/formeditor/default_container.cpp
+++ b/src/designer/src/components/formeditor/default_container.cpp
@@ -1,36 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "default_container.h"
#include <QtCore/qdebug.h>
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
template <class Container>
static inline void setCurrentContainerIndex(int index, Container *container)
{
@@ -46,7 +23,7 @@ static inline void ensureNoParent(QWidget *widget)
widget->setParent(nullptr);
}
-static const char *PageLabel = "Page";
+static constexpr auto PageLabel = "Page"_L1;
namespace qdesigner_internal {
diff --git a/src/designer/src/components/formeditor/default_container.h b/src/designer/src/components/formeditor/default_container.h
index 3781d713d..a22abad42 100644
--- a/src/designer/src/components/formeditor/default_container.h
+++ b/src/designer/src/components/formeditor/default_container.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef DEFAULT_CONTAINER_H
#define DEFAULT_CONTAINER_H
diff --git a/src/designer/src/components/formeditor/default_layoutdecoration.cpp b/src/designer/src/components/formeditor/default_layoutdecoration.cpp
index 9a45b01b6..171bd0f4a 100644
--- a/src/designer/src/components/formeditor/default_layoutdecoration.cpp
+++ b/src/designer/src/components/formeditor/default_layoutdecoration.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "default_layoutdecoration.h"
#include "qlayout_widget_p.h"
diff --git a/src/designer/src/components/formeditor/default_layoutdecoration.h b/src/designer/src/components/formeditor/default_layoutdecoration.h
index 412824ff5..b9cf5939f 100644
--- a/src/designer/src/components/formeditor/default_layoutdecoration.h
+++ b/src/designer/src/components/formeditor/default_layoutdecoration.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef DEFAULT_LAYOUTDECORATION_H
#define DEFAULT_LAYOUTDECORATION_H
diff --git a/src/designer/src/components/formeditor/deviceprofiledialog.cpp b/src/designer/src/components/formeditor/deviceprofiledialog.cpp
index ef1693c39..188e24cf0 100644
--- a/src/designer/src/components/formeditor/deviceprofiledialog.cpp
+++ b/src/designer/src/components/formeditor/deviceprofiledialog.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "deviceprofiledialog.h"
#include "ui_deviceprofiledialog.h"
@@ -44,11 +19,13 @@
QT_BEGIN_NAMESPACE
-static const char *profileExtensionC = "qdp";
+using namespace Qt::StringLiterals;
+
+static constexpr auto profileExtensionC = "qdp"_L1;
static inline QString fileFilter()
{
- return qdesigner_internal::DeviceProfileDialog::tr("Device Profiles (*.%1)").arg(QLatin1String(profileExtensionC));
+ return qdesigner_internal::DeviceProfileDialog::tr("Device Profiles (*.%1)").arg(profileExtensionC);
}
// Populate a combo with a sequence of integers, also set them as data.
@@ -67,7 +44,7 @@ namespace qdesigner_internal {
DeviceProfileDialog::DeviceProfileDialog(QDesignerDialogGuiInterface *dlgGui, QWidget *parent) :
QDialog(parent),
- m_ui(new Ui::DeviceProfileDialog),
+ m_ui(new QT_PREPEND_NAMESPACE(Ui)::DeviceProfileDialog),
m_dlgGui(dlgGui)
{
setModal(true);
@@ -84,9 +61,8 @@ DeviceProfileDialog::DeviceProfileDialog(QDesignerDialogGuiInterface *dlgGui, QW
// Styles
const QStringList styles = QStyleFactory::keys();
m_ui->m_styleCombo->addItem(tr("Default"), QVariant(QString()));
- const QStringList::const_iterator cend = styles.constEnd();
- for (QStringList::const_iterator it = styles.constBegin(); it != cend; ++it)
- m_ui->m_styleCombo->addItem(*it, *it);
+ for (const auto &s : styles)
+ m_ui->m_styleCombo->addItem(s, s);
connect(m_ui->m_nameLineEdit, &QLineEdit::textChanged, this, &DeviceProfileDialog::nameChanged);
connect(m_ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
@@ -156,10 +132,8 @@ void DeviceProfileDialog::save()
QString fn = m_dlgGui->getSaveFileName(this, tr("Save Profile"), QString(), fileFilter());
if (fn.isEmpty())
return;
- if (QFileInfo(fn).completeSuffix().isEmpty()) {
- fn += QLatin1Char('.');
- fn += QLatin1String(profileExtensionC);
- }
+ if (QFileInfo(fn).completeSuffix().isEmpty())
+ fn += u'.' + profileExtensionC;
QFile file(fn);
if (!file.open(QIODevice::WriteOnly|QIODevice::Text)) {
diff --git a/src/designer/src/components/formeditor/deviceprofiledialog.h b/src/designer/src/components/formeditor/deviceprofiledialog.h
index ebccd31d9..34a9fe5b0 100644
--- a/src/designer/src/components/formeditor/deviceprofiledialog.h
+++ b/src/designer/src/components/formeditor/deviceprofiledialog.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/components/formeditor/deviceprofiledialog.ui b/src/designer/src/components/formeditor/deviceprofiledialog.ui
index 2915eb996..1671d9780 100644
--- a/src/designer/src/components/formeditor/deviceprofiledialog.ui
+++ b/src/designer/src/components/formeditor/deviceprofiledialog.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DeviceProfileDialog</class>
- <widget class="QDialog" name="dialog">
+ <widget class="QDialog" name="DeviceProfileDialog">
<property name="geometry">
<rect>
<x>0</x>
diff --git a/src/designer/src/components/formeditor/dpi_chooser.cpp b/src/designer/src/components/formeditor/dpi_chooser.cpp
index 8155016c0..5a34f124a 100644
--- a/src/designer/src/components/formeditor/dpi_chooser.cpp
+++ b/src/designer/src/components/formeditor/dpi_chooser.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "dpi_chooser.h"
diff --git a/src/designer/src/components/formeditor/dpi_chooser.h b/src/designer/src/components/formeditor/dpi_chooser.h
index 0efa2cdd0..ba8af375f 100644
--- a/src/designer/src/components/formeditor/dpi_chooser.h
+++ b/src/designer/src/components/formeditor/dpi_chooser.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/components/formeditor/embeddedoptionspage.cpp b/src/designer/src/components/formeditor/embeddedoptionspage.cpp
index 4a1c27035..3d9b7f9d5 100644
--- a/src/designer/src/components/formeditor/embeddedoptionspage.cpp
+++ b/src/designer/src/components/formeditor/embeddedoptionspage.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "embeddedoptionspage.h"
#include "deviceprofiledialog.h"
@@ -58,6 +33,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
using DeviceProfileList = QList<DeviceProfile>;
@@ -148,7 +125,7 @@ void EmbeddedOptionsControlPrivate::init(EmbeddedOptionsControl *q)
EmbeddedOptionsControl::connect(m_profileCombo, &QComboBox::currentIndexChanged,
m_q, &EmbeddedOptionsControl::slotProfileIndexChanged);
- m_addButton->setIcon(createIconSet(QString::fromUtf8("plus.png")));
+ m_addButton->setIcon(createIconSet("plus.png"_L1));
m_addButton->setToolTip(EmbeddedOptionsControl::tr("Add a profile"));
EmbeddedOptionsControl::connect(m_addButton, &QAbstractButton::clicked,
m_q, &EmbeddedOptionsControl::slotAdd);
@@ -156,11 +133,11 @@ void EmbeddedOptionsControlPrivate::init(EmbeddedOptionsControl *q)
EmbeddedOptionsControl::connect(m_editButton, &QAbstractButton::clicked,
m_q, &EmbeddedOptionsControl::slotEdit);
- m_editButton->setIcon(createIconSet(QString::fromUtf8("edit.png")));
+ m_editButton->setIcon(createIconSet("edit.png"_L1));
m_editButton->setToolTip(EmbeddedOptionsControl::tr("Edit the selected profile"));
hLayout->addWidget(m_editButton);
- m_deleteButton->setIcon(createIconSet(QString::fromUtf8("minus.png")));
+ m_deleteButton->setIcon(createIconSet("minus.png"_L1));
m_deleteButton->setToolTip(EmbeddedOptionsControl::tr("Delete the selected profile"));
EmbeddedOptionsControl::connect(m_deleteButton, &QAbstractButton::clicked,
m_q, &EmbeddedOptionsControl::slotDelete);
@@ -175,9 +152,8 @@ void EmbeddedOptionsControlPrivate::init(EmbeddedOptionsControl *q)
QStringList EmbeddedOptionsControlPrivate::existingProfileNames() const
{
QStringList rc;
- const DeviceProfileList::const_iterator dcend = m_sortedProfiles.constEnd();
- for (DeviceProfileList::const_iterator it = m_sortedProfiles.constBegin(); it != dcend; ++it)
- rc.push_back(it->name());
+ for (const auto &dp : m_sortedProfiles)
+ rc.append(dp.name());
return rc;
}
diff --git a/src/designer/src/components/formeditor/embeddedoptionspage.h b/src/designer/src/components/formeditor/embeddedoptionspage.h
index 8a412ed4c..d1d2d0fb7 100644
--- a/src/designer/src/components/formeditor/embeddedoptionspage.h
+++ b/src/designer/src/components/formeditor/embeddedoptionspage.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef EMBEDDEDOPTIONSPAGE_H
#define EMBEDDEDOPTIONSPAGE_H
diff --git a/src/designer/src/components/formeditor/formeditor.cpp b/src/designer/src/components/formeditor/formeditor.cpp
index 05e7fc4ee..4d92608f7 100644
--- a/src/designer/src/components/formeditor/formeditor.cpp
+++ b/src/designer/src/components/formeditor/formeditor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "formeditor.h"
#include "formeditor_optionspage.h"
@@ -65,14 +40,21 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
-FormEditor::FormEditor(QObject *parent)
+FormEditor::FormEditor(QObject *parent) : FormEditor(QStringList{}, parent)
+{
+}
+
+FormEditor::FormEditor(const QStringList &pluginPaths,
+ QObject *parent)
: QDesignerFormEditorInterface(parent)
{
setIntrospection(new QDesignerIntrospection);
setDialogGui(new DialogGui);
- QDesignerPluginManager *pluginManager = new QDesignerPluginManager(this);
+ auto *pluginManager = new QDesignerPluginManager(pluginPaths, this);
setPluginManager(pluginManager);
WidgetDataBase *widgetDatabase = new WidgetDataBase(this, this);
@@ -127,8 +109,7 @@ FormEditor::FormEditor(QObject *parent)
QTreeViewPropertySheetFactory::registerExtension(mgr);
QTableViewPropertySheetFactory::registerExtension(mgr);
- const QString internalTaskMenuId = QStringLiteral("QDesignerInternalTaskMenuExtension");
- QDesignerTaskMenuFactory::registerExtension(mgr, internalTaskMenuId);
+ QDesignerTaskMenuFactory::registerExtension(mgr, u"QDesignerInternalTaskMenuExtension"_s);
mgr->registerExtensions(new QDesignerMemberSheetFactory(mgr),
Q_TYPEID(QDesignerMemberSheetExtension));
diff --git a/src/designer/src/components/formeditor/formeditor.h b/src/designer/src/components/formeditor/formeditor.h
index 25698c23d..483bd6b69 100644
--- a/src/designer/src/components/formeditor/formeditor.h
+++ b/src/designer/src/components/formeditor/formeditor.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef FORMEDITOR_H
#define FORMEDITOR_H
@@ -44,6 +19,8 @@ class QT_FORMEDITOR_EXPORT FormEditor: public QDesignerFormEditorInterface
Q_OBJECT
public:
FormEditor(QObject *parent = nullptr);
+ FormEditor(const QStringList &pluginPaths,
+ QObject *parent = nullptr);
~FormEditor() override;
public slots:
void slotQrcFileChangedExternally(const QString &path);
diff --git a/src/designer/src/components/formeditor/formeditor.qrc b/src/designer/src/components/formeditor/formeditor.qrc
deleted file mode 100644
index 351658088..000000000
--- a/src/designer/src/components/formeditor/formeditor.qrc
+++ /dev/null
@@ -1,179 +0,0 @@
-<RCC>
- <qresource prefix="/qt-project.org/formeditor">
- <file>images/submenu.png</file>
- <file>images/cursors/arrow.png</file>
- <file>images/cursors/busy.png</file>
- <file>images/cursors/closedhand.png</file>
- <file>images/cursors/cross.png</file>
- <file>images/cursors/hand.png</file>
- <file>images/cursors/hsplit.png</file>
- <file>images/cursors/ibeam.png</file>
- <file>images/cursors/no.png</file>
- <file>images/cursors/openhand.png</file>
- <file>images/cursors/sizeall.png</file>
- <file>images/cursors/sizeb.png</file>
- <file>images/cursors/sizef.png</file>
- <file>images/cursors/sizeh.png</file>
- <file>images/cursors/sizev.png</file>
- <file>images/cursors/uparrow.png</file>
- <file>images/cursors/vsplit.png</file>
- <file>images/cursors/wait.png</file>
- <file>images/cursors/whatsthis.png</file>
- <file>images/emptyicon.png</file>
- <file>images/filenew-16.png</file>
- <file>images/fileopen-16.png</file>
- <file>images/editdelete-16.png</file>
- <file>images/plus-16.png</file>
- <file>images/minus-16.png</file>
- <file>images/prefix-add.png</file>
- <file>images/downplus.png</file>
- <file>images/leveldown.png</file>
- <file>images/levelup.png</file>
- <file>images/righttoleft.png</file>
- <file>images/mac/adjustsize.png</file>
- <file>images/mac/widgettool.png</file>
- <file>images/mac/signalslottool.png</file>
- <file>images/mac/tabordertool.png</file>
- <file>images/mac/buddytool.png</file>
- <file>images/mac/editbreaklayout.png</file>
- <file>images/mac/editcopy.png</file>
- <file>images/mac/editcut.png</file>
- <file>images/mac/editdelete.png</file>
- <file>images/mac/editgrid.png</file>
- <file>images/mac/editform.png</file>
- <file>images/mac/edithlayout.png</file>
- <file>images/mac/edithlayoutsplit.png</file>
- <file>images/mac/editlower.png</file>
- <file>images/mac/editpaste.png</file>
- <file>images/mac/editraise.png</file>
- <file>images/mac/editvlayout.png</file>
- <file>images/mac/editvlayoutsplit.png</file>
- <file>images/mac/filenew.png</file>
- <file>images/mac/insertimage.png</file>
- <file>images/mac/undo.png</file>
- <file>images/mac/redo.png</file>
- <file>images/mac/fileopen.png</file>
- <file>images/mac/filesave.png</file>
- <file>images/mac/resourceeditortool.png</file>
- <file>images/mac/plus.png</file>
- <file>images/mac/minus.png</file>
- <file>images/mac/back.png</file>
- <file>images/mac/forward.png</file>
- <file>images/mac/down.png</file>
- <file>images/mac/up.png</file>
- <file>images/qtlogo16x16.png</file>
- <file>images/qtlogo24x24.png</file>
- <file>images/qtlogo32x32.png</file>
- <file>images/qtlogo64x64.png</file>
- <file>images/qt3logo.png</file>
- <file>images/resetproperty.png</file>
- <file>images/cleartext.png</file>
- <file>images/sort.png</file>
- <file>images/edit.png</file>
- <file>images/reload.png</file>
- <file>images/configure.png</file>
- <file>images/color.png</file>
- <file>images/dropdownbutton.png</file>
- <file>images/widgets/calendarwidget.png</file>
- <file>images/widgets/checkbox.png</file>
- <file>images/widgets/columnview.png</file>
- <file>images/widgets/combobox.png</file>
- <file>images/widgets/commandlinkbutton.png</file>
- <file>images/widgets/dateedit.png</file>
- <file>images/widgets/datetimeedit.png</file>
- <file>images/widgets/dial.png</file>
- <file>images/widgets/dialogbuttonbox.png</file>
- <file>images/widgets/dockwidget.png</file>
- <file>images/widgets/doublespinbox.png</file>
- <file>images/widgets/fontcombobox.png</file>
- <file>images/widgets/frame.png</file>
- <file>images/widgets/graphicsview.png</file>
- <file>images/widgets/groupbox.png</file>
- <file>images/widgets/hscrollbar.png</file>
- <file>images/widgets/hslider.png</file>
- <file>images/widgets/hsplit.png</file>
- <file>images/widgets/label.png</file>
- <file>images/widgets/lcdnumber.png</file>
- <file>images/widgets/line.png</file>
- <file>images/widgets/lineedit.png</file>
- <file>images/widgets/listbox.png</file>
- <file>images/widgets/listview.png</file>
- <file>images/widgets/mdiarea.png</file>
- <file>images/widgets/plaintextedit.png</file>
- <file>images/widgets/progress.png</file>
- <file>images/widgets/pushbutton.png</file>
- <file>images/widgets/radiobutton.png</file>
- <file>images/widgets/scrollarea.png</file>
- <file>images/widgets/spacer.png</file>
- <file>images/widgets/spinbox.png</file>
- <file>images/widgets/table.png</file>
- <file>images/widgets/tabwidget.png</file>
- <file>images/widgets/textedit.png</file>
- <file>images/widgets/timeedit.png</file>
- <file>images/widgets/toolbox.png</file>
- <file>images/widgets/toolbutton.png</file>
- <file>images/widgets/vline.png</file>
- <file>images/widgets/vscrollbar.png</file>
- <file>images/widgets/vslider.png</file>
- <file>images/widgets/vspacer.png</file>
- <file>images/widgets/widget.png</file>
- <file>images/widgets/widgetstack.png</file>
- <file>images/widgets/wizard.png</file>
- <file>images/win/adjustsize.png</file>
- <file>images/win/widgettool.png</file>
- <file>images/win/signalslottool.png</file>
- <file>images/win/tabordertool.png</file>
- <file>images/win/buddytool.png</file>
- <file>images/win/editbreaklayout.png</file>
- <file>images/win/editcopy.png</file>
- <file>images/win/editcut.png</file>
- <file>images/win/editdelete.png</file>
- <file>images/win/editgrid.png</file>
- <file>images/win/editform.png</file>
- <file>images/win/edithlayout.png</file>
- <file>images/win/edithlayoutsplit.png</file>
- <file>images/win/editlower.png</file>
- <file>images/win/editpaste.png</file>
- <file>images/win/editraise.png</file>
- <file>images/win/editvlayout.png</file>
- <file>images/win/editvlayoutsplit.png</file>
- <file>images/win/filenew.png</file>
- <file>images/win/insertimage.png</file>
- <file>images/win/undo.png</file>
- <file>images/win/redo.png</file>
- <file>images/win/fileopen.png</file>
- <file>images/win/filesave.png</file>
- <file>images/win/resourceeditortool.png</file>
- <file>images/win/plus.png</file>
- <file>images/win/minus.png</file>
- <file>images/win/textanchor.png</file>
- <file>images/win/textbold.png</file>
- <file>images/win/textitalic.png</file>
- <file>images/win/textunder.png</file>
- <file>images/win/textleft.png</file>
- <file>images/win/textcenter.png</file>
- <file>images/win/textright.png</file>
- <file>images/win/textjustify.png</file>
- <file>images/win/textsuperscript.png</file>
- <file>images/win/textsubscript.png</file>
- <file>images/win/simplifyrichtext.png</file>
- <file>images/win/back.png</file>
- <file>images/win/forward.png</file>
- <file>images/win/down.png</file>
- <file>images/win/up.png</file>
- <file>images/mac/textanchor.png</file>
- <file>images/mac/textbold.png</file>
- <file>images/mac/textitalic.png</file>
- <file>images/mac/textunder.png</file>
- <file>images/mac/textleft.png</file>
- <file>images/mac/textcenter.png</file>
- <file>images/mac/textright.png</file>
- <file>images/mac/textjustify.png</file>
- <file>images/mac/textsuperscript.png</file>
- <file>images/mac/textsubscript.png</file>
- <file>images/mac/simplifyrichtext.png</file>
- </qresource>
- <qresource prefix="/qt-project.org/brushes">
- <file>defaultbrushes.xml</file>
- </qresource>
-</RCC>
diff --git a/src/designer/src/components/formeditor/formeditor_global.h b/src/designer/src/components/formeditor/formeditor_global.h
index 9dad63d70..37af044be 100644
--- a/src/designer/src/components/formeditor/formeditor_global.h
+++ b/src/designer/src/components/formeditor/formeditor_global.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef FORMEDITOR_GLOBAL_H
#define FORMEDITOR_GLOBAL_H
diff --git a/src/designer/src/components/formeditor/formeditor_optionspage.cpp b/src/designer/src/components/formeditor/formeditor_optionspage.cpp
index c7ca46b42..ffd93f263 100644
--- a/src/designer/src/components/formeditor/formeditor_optionspage.cpp
+++ b/src/designer/src/components/formeditor/formeditor_optionspage.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "formeditor_optionspage.h"
diff --git a/src/designer/src/components/formeditor/formeditor_optionspage.h b/src/designer/src/components/formeditor/formeditor_optionspage.h
index 160d7340a..69758d28e 100644
--- a/src/designer/src/components/formeditor/formeditor_optionspage.h
+++ b/src/designer/src/components/formeditor/formeditor_optionspage.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef FORMEDITOR_OPTIONSPAGE_H
#define FORMEDITOR_OPTIONSPAGE_H
diff --git a/src/designer/src/components/formeditor/formwindow.cpp b/src/designer/src/components/formeditor/formwindow.cpp
index dda88489f..35cb0eca6 100644
--- a/src/designer/src/components/formeditor/formwindow.cpp
+++ b/src/designer/src/components/formeditor/formwindow.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "formwindow.h"
#include "formeditor.h"
@@ -102,6 +77,8 @@ Q_DECLARE_METATYPE(QWidget*)
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace {
class BlockSelection
{
@@ -168,8 +145,7 @@ private:
using SelectionPool = QList<WidgetSelection *>;
SelectionPool m_selectionPool;
- typedef QHash<QWidget *, WidgetSelection *> SelectionHash;
- SelectionHash m_usedSelections;
+ QHash<QWidget *, WidgetSelection *> m_usedSelections;
};
FormWindow::Selection::Selection() = default;
@@ -204,9 +180,9 @@ WidgetSelection *FormWindow::Selection::addWidget(FormWindow* fw, QWidget *w)
return rc;
}
// find a free one in the pool
- for (auto it = m_selectionPool.constBegin(), pend = m_selectionPool.constEnd(); it != pend; ++it) {
- if (! (*it)->isUsed()) {
- rc = *it;
+ for (auto *s : std::as_const(m_selectionPool)) {
+ if (!s->isUsed()) {
+ rc = s;
break;
}
}
@@ -479,11 +455,11 @@ void FormWindow::setMainContainer(QWidget *w)
manageWidget(m_mainContainer);
if (QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), m_mainContainer)) {
- sheet->setVisible(sheet->indexOf(QStringLiteral("windowTitle")), true);
- sheet->setVisible(sheet->indexOf(QStringLiteral("windowIcon")), true);
- sheet->setVisible(sheet->indexOf(QStringLiteral("windowModality")), true);
- sheet->setVisible(sheet->indexOf(QStringLiteral("windowOpacity")), true);
- sheet->setVisible(sheet->indexOf(QStringLiteral("windowFilePath")), true);
+ sheet->setVisible(sheet->indexOf(u"windowTitle"_s), true);
+ sheet->setVisible(sheet->indexOf(u"windowIcon"_s), true);
+ sheet->setVisible(sheet->indexOf(u"windowModality"_s), true);
+ sheet->setVisible(sheet->indexOf(u"windowOpacity"_s), true);
+ sheet->setVisible(sheet->indexOf(u"windowFilePath"_s), true);
// ### generalize
}
@@ -692,7 +668,7 @@ bool FormWindow::handleMouseMoveEvent(QWidget *, QWidget *, QMouseEvent *e)
QSet<QWidget*> widget_set;
- for (QWidget *child : qAsConst(sel)) { // Move parent layout or container?
+ for (QWidget *child : std::as_const(sel)) { // Move parent layout or container?
QWidget *current = child;
bool done = false;
@@ -729,7 +705,7 @@ bool FormWindow::handleMouseMoveEvent(QWidget *, QWidget *, QMouseEvent *e)
const QPoint globalPos = mapToGlobal(m_startPos);
const QDesignerDnDItemInterface::DropType dropType = (mouseFlags(e->modifiers()) & CopyDragModifier) ?
QDesignerDnDItemInterface::CopyDrop : QDesignerDnDItemInterface::MoveDrop;
- for (QWidget *widget : qAsConst(sel)) {
+ for (QWidget *widget : std::as_const(sel)) {
item_list.append(new FormWindowDnDItem(dropType, this, widget, globalPos));
if (dropType == QDesignerDnDItemInterface::MoveDrop) {
m_selection->hide(widget);
@@ -746,7 +722,7 @@ bool FormWindow::handleMouseMoveEvent(QWidget *, QWidget *, QMouseEvent *e)
if (!sel.isEmpty()) // reshow selection?
if (QDesignerMimeData::execDrag(item_list, core()->topLevel()) == Qt::IgnoreAction && dropType == QDesignerDnDItemInterface::MoveDrop)
- for (QWidget *widget : qAsConst(sel))
+ for (QWidget *widget : std::as_const(sel))
m_selection->show(widget);
m_startPos = QPoint();
@@ -949,13 +925,9 @@ bool FormWindow::isMainContainer(const QWidget *w) const
void FormWindow::updateChildSelections(QWidget *w)
{
const QWidgetList l = w->findChildren<QWidget*>();
- if (!l.isEmpty()) {
- const QWidgetList::const_iterator lcend = l.constEnd();
- for (QWidgetList::const_iterator it = l.constBegin(); it != lcend; ++it) {
- QWidget *w = *it;
- if (isManaged(w))
- updateSelection(w);
- }
+ for (auto *w : l) {
+ if (isManaged(w))
+ updateSelection(w);
}
}
@@ -1018,129 +990,98 @@ static inline void insertNames(const QDesignerMetaDataBaseInterface *metaDataBas
static QSet<QString> languageKeywords()
{
- static QSet<QString> keywords;
- if (keywords.isEmpty()) {
+ static const QSet<QString> keywords = {
// C++ keywords
- keywords.insert(QStringLiteral("asm"));
- keywords.insert(QStringLiteral("auto"));
- keywords.insert(QStringLiteral("bool"));
- keywords.insert(QStringLiteral("break"));
- keywords.insert(QStringLiteral("case"));
- keywords.insert(QStringLiteral("catch"));
- keywords.insert(QStringLiteral("char"));
- keywords.insert(QStringLiteral("class"));
- keywords.insert(QStringLiteral("const"));
- keywords.insert(QStringLiteral("const_cast"));
- keywords.insert(QStringLiteral("continue"));
- keywords.insert(QStringLiteral("default"));
- keywords.insert(QStringLiteral("delete"));
- keywords.insert(QStringLiteral("do"));
- keywords.insert(QStringLiteral("double"));
- keywords.insert(QStringLiteral("dynamic_cast"));
- keywords.insert(QStringLiteral("else"));
- keywords.insert(QStringLiteral("enum"));
- keywords.insert(QStringLiteral("explicit"));
- keywords.insert(QStringLiteral("export"));
- keywords.insert(QStringLiteral("extern"));
- keywords.insert(QStringLiteral("false"));
- keywords.insert(QStringLiteral("float"));
- keywords.insert(QStringLiteral("for"));
- keywords.insert(QStringLiteral("friend"));
- keywords.insert(QStringLiteral("goto"));
- keywords.insert(QStringLiteral("if"));
- keywords.insert(QStringLiteral("inline"));
- keywords.insert(QStringLiteral("int"));
- keywords.insert(QStringLiteral("long"));
- keywords.insert(QStringLiteral("mutable"));
- keywords.insert(QStringLiteral("namespace"));
- keywords.insert(QStringLiteral("new"));
- keywords.insert(QStringLiteral("NULL"));
- keywords.insert(QStringLiteral("operator"));
- keywords.insert(QStringLiteral("private"));
- keywords.insert(QStringLiteral("protected"));
- keywords.insert(QStringLiteral("public"));
- keywords.insert(QStringLiteral("register"));
- keywords.insert(QStringLiteral("reinterpret_cast"));
- keywords.insert(QStringLiteral("return"));
- keywords.insert(QStringLiteral("short"));
- keywords.insert(QStringLiteral("signed"));
- keywords.insert(QStringLiteral("sizeof"));
- keywords.insert(QStringLiteral("static"));
- keywords.insert(QStringLiteral("static_cast"));
- keywords.insert(QStringLiteral("struct"));
- keywords.insert(QStringLiteral("switch"));
- keywords.insert(QStringLiteral("template"));
- keywords.insert(QStringLiteral("this"));
- keywords.insert(QStringLiteral("throw"));
- keywords.insert(QStringLiteral("true"));
- keywords.insert(QStringLiteral("try"));
- keywords.insert(QStringLiteral("typedef"));
- keywords.insert(QStringLiteral("typeid"));
- keywords.insert(QStringLiteral("typename"));
- keywords.insert(QStringLiteral("union"));
- keywords.insert(QStringLiteral("unsigned"));
- keywords.insert(QStringLiteral("using"));
- keywords.insert(QStringLiteral("virtual"));
- keywords.insert(QStringLiteral("void"));
- keywords.insert(QStringLiteral("volatile"));
- keywords.insert(QStringLiteral("wchar_t"));
- keywords.insert(QStringLiteral("while"));
+ u"asm"_s,
+ u"assert"_s,
+ u"auto"_s,
+ u"bool"_s,
+ u"break"_s,
+ u"case"_s,
+ u"catch"_s,
+ u"char"_s,
+ u"class"_s,
+ u"const"_s,
+ u"const_cast"_s,
+ u"continue"_s,
+ u"default"_s,
+ u"delete"_s,
+ u"do"_s,
+ u"double"_s,
+ u"dynamic_cast"_s,
+ u"else"_s,
+ u"enum"_s,
+ u"explicit"_s,
+ u"export"_s,
+ u"extern"_s,
+ u"false"_s,
+ u"final"_s,
+ u"float"_s,
+ u"for"_s,
+ u"friend"_s,
+ u"goto"_s,
+ u"if"_s,
+ u"inline"_s,
+ u"int"_s,
+ u"long"_s,
+ u"mutable"_s,
+ u"namespace"_s,
+ u"new"_s,
+ u"noexcept"_s,
+ u"NULL"_s,
+ u"nullptr"_s,
+ u"operator"_s,
+ u"override"_s,
+ u"private"_s,
+ u"protected"_s,
+ u"public"_s,
+ u"register"_s,
+ u"reinterpret_cast"_s,
+ u"return"_s,
+ u"short"_s,
+ u"signed"_s,
+ u"sizeof"_s,
+ u"static"_s,
+ u"static_cast"_s,
+ u"struct"_s,
+ u"switch"_s,
+ u"template"_s,
+ u"this"_s,
+ u"throw"_s,
+ u"true"_s,
+ u"try"_s,
+ u"typedef"_s,
+ u"typeid"_s,
+ u"typename"_s,
+ u"union"_s,
+ u"unsigned"_s,
+ u"using"_s,
+ u"virtual"_s,
+ u"void"_s,
+ u"volatile"_s,
+ u"wchar_t"_s,
+ u"while"_s,
// java keywords
- keywords.insert(QStringLiteral("abstract"));
- keywords.insert(QStringLiteral("assert"));
- keywords.insert(QStringLiteral("boolean"));
- keywords.insert(QStringLiteral("break"));
- keywords.insert(QStringLiteral("byte"));
- keywords.insert(QStringLiteral("case"));
- keywords.insert(QStringLiteral("catch"));
- keywords.insert(QStringLiteral("char"));
- keywords.insert(QStringLiteral("class"));
- keywords.insert(QStringLiteral("const"));
- keywords.insert(QStringLiteral("continue"));
- keywords.insert(QStringLiteral("default"));
- keywords.insert(QStringLiteral("do"));
- keywords.insert(QStringLiteral("double"));
- keywords.insert(QStringLiteral("else"));
- keywords.insert(QStringLiteral("enum"));
- keywords.insert(QStringLiteral("extends"));
- keywords.insert(QStringLiteral("false"));
- keywords.insert(QStringLiteral("final"));
- keywords.insert(QStringLiteral("finality"));
- keywords.insert(QStringLiteral("float"));
- keywords.insert(QStringLiteral("for"));
- keywords.insert(QStringLiteral("goto"));
- keywords.insert(QStringLiteral("if"));
- keywords.insert(QStringLiteral("implements"));
- keywords.insert(QStringLiteral("import"));
- keywords.insert(QStringLiteral("instanceof"));
- keywords.insert(QStringLiteral("int"));
- keywords.insert(QStringLiteral("interface"));
- keywords.insert(QStringLiteral("long"));
- keywords.insert(QStringLiteral("native"));
- keywords.insert(QStringLiteral("new"));
- keywords.insert(QStringLiteral("null"));
- keywords.insert(QStringLiteral("package"));
- keywords.insert(QStringLiteral("private"));
- keywords.insert(QStringLiteral("protected"));
- keywords.insert(QStringLiteral("public"));
- keywords.insert(QStringLiteral("return"));
- keywords.insert(QStringLiteral("short"));
- keywords.insert(QStringLiteral("static"));
- keywords.insert(QStringLiteral("strictfp"));
- keywords.insert(QStringLiteral("super"));
- keywords.insert(QStringLiteral("switch"));
- keywords.insert(QStringLiteral("synchronized"));
- keywords.insert(QStringLiteral("this"));
- keywords.insert(QStringLiteral("throw"));
- keywords.insert(QStringLiteral("throws"));
- keywords.insert(QStringLiteral("transient"));
- keywords.insert(QStringLiteral("true"));
- keywords.insert(QStringLiteral("try"));
- keywords.insert(QStringLiteral("void"));
- keywords.insert(QStringLiteral("volatile"));
- keywords.insert(QStringLiteral("while"));
- }
+ u"abstract"_s,
+ u"boolean"_s,
+ u"byte"_s,
+ u"extends"_s,
+ u"finality"_s,
+ u"implements"_s,
+ u"import"_s,
+ u"instanceof"_s,
+ u"interface"_s,
+ u"native"_s,
+ u"null"_s,
+ u"package"_s,
+ u"strictfp"_s,
+ u"super"_s,
+ u"synchronized"_s,
+ u"throws"_s,
+ u"transient"_s,
+ };
+
return keywords;
}
@@ -1174,8 +1115,7 @@ bool FormWindow::unify(QObject *w, QString &s, bool changeIt)
if (!buttonGroupChildren.isEmpty())
insertNames(metaDataBase, buttonGroupChildren.constBegin(), buttonGroupChildren.constEnd(), w, existingNames);
- const StringSet::const_iterator enEnd = existingNames.constEnd();
- if (existingNames.constFind(s) == enEnd)
+ if (!existingNames.contains(s))
return true;
if (!changeIt)
return false;
@@ -1183,26 +1123,26 @@ bool FormWindow::unify(QObject *w, QString &s, bool changeIt)
// split 'name_number'
qlonglong num = 0;
qlonglong factor = 1;
- int idx = s.length()-1;
- const ushort zeroUnicode = QLatin1Char('0').unicode();
+ qsizetype idx = s.size() - 1;
+ const char16_t zeroUnicode = u'0';
for ( ; idx > 0 && s.at(idx).isDigit(); --idx) {
num += (s.at(idx).unicode() - zeroUnicode) * factor;
factor *= 10;
}
// Position index past '_'.
- const QChar underscore = QLatin1Char('_');
+ const QChar underscore = u'_';
if (idx >= 0 && s.at(idx) == underscore) {
idx++;
} else {
num = 1;
s += underscore;
- idx = s.length();
+ idx = s.size();
}
// try 'name_n', 'name_n+1'
for (num++ ; ;num++) {
s.truncate(idx);
s += QString::number(num);
- if (existingNames.constFind(s) == enEnd)
+ if (!existingNames.contains(s))
break;
}
return false;
@@ -1222,7 +1162,7 @@ void FormWindow::insertWidget(QWidget *w, const QRect &rect, QWidget *container,
QRect r = rect;
Q_ASSERT(r.isValid());
SetPropertyCommand *geom_cmd = new SetPropertyCommand(this);
- geom_cmd->init(w, QStringLiteral("geometry"), r); // ### use rc.size()
+ geom_cmd->init(w, u"geometry"_s, r); // ### use rc.size()
if (w->parentWidget() != container) {
ReparentWidgetCommand *cmd = new ReparentWidgetCommand(this);
@@ -1287,7 +1227,7 @@ void FormWindow::resizeWidget(QWidget *widget, const QRect &geometry)
QRect r = geometry;
SetPropertyCommand *cmd = new SetPropertyCommand(this);
- cmd->init(widget, QStringLiteral("geometry"), r);
+ cmd->init(widget, u"geometry"_s, r);
cmd->setText(tr("Resize"));
m_undoStack.push(cmd);
}
@@ -1310,7 +1250,7 @@ QWidget *FormWindow::containerAt(const QPoint &pos, QWidget *notParentOf)
depth = widgetDepth(container);
}
- for (QWidget *wit : qAsConst(m_widgets)) {
+ for (QWidget *wit : std::as_const(m_widgets)) {
if (qobject_cast<QLayoutWidget*>(wit) || qobject_cast<QSplitter*>(wit))
continue;
if (!wit->isVisibleTo(this))
@@ -1487,10 +1427,12 @@ public:
QDesignerPropertySheetExtension *s, int i) :
PropertyHelper(o, sp, s, i) {}
- Value setValue(QDesignerFormWindowInterface *fw, const QVariant &value, bool changed, unsigned subPropertyMask) override;
+ Value setValue(QDesignerFormWindowInterface *fw, const QVariant &value, bool changed,
+ quint64 subPropertyMask) override;
};
-PropertyHelper::Value ArrowKeyPropertyHelper::setValue(QDesignerFormWindowInterface *fw, const QVariant &value, bool changed, unsigned subPropertyMask)
+PropertyHelper::Value ArrowKeyPropertyHelper::setValue(QDesignerFormWindowInterface *fw, const QVariant &value,
+ bool changed, quint64 subPropertyMask)
{
// Apply operation to obtain the new geometry value.
QWidget *w = qobject_cast<QWidget*>(object());
@@ -1510,9 +1452,10 @@ public:
void init(QWidgetList &l, const ArrowKeyOperation &op);
protected:
- PropertyHelper *createPropertyHelper(QObject *o, SpecialProperty sp,
- QDesignerPropertySheetExtension *s, int i) const override
- { return new ArrowKeyPropertyHelper(o, sp, s, i); }
+ std::unique_ptr<PropertyHelper>
+ createPropertyHelper(QObject *o, SpecialProperty sp,
+ QDesignerPropertySheetExtension *s, int i) const override
+ { return std::make_unique<ArrowKeyPropertyHelper>(o, sp, s, i); }
QVariant mergeValue(const QVariant &newValue) override;
};
@@ -1527,9 +1470,9 @@ ArrowKeyPropertyCommand::ArrowKeyPropertyCommand(QDesignerFormWindowInterface *f
void ArrowKeyPropertyCommand::init(QWidgetList &l, const ArrowKeyOperation &op)
{
QObjectList ol;
- for (QWidget *w : qAsConst(l))
+ for (QWidget *w : std::as_const(l))
ol.push_back(w);
- SetPropertyCommand::init(ol, QStringLiteral("geometry"), QVariant::fromValue(op));
+ SetPropertyCommand::init(ol, u"geometry"_s, QVariant::fromValue(op));
setText(op.resize ? FormWindow::tr("Key Resize") : FormWindow::tr("Key Move"));
}
@@ -1602,7 +1545,7 @@ bool FormWindow::handleKeyReleaseEvent(QWidget *, QWidget *, QKeyEvent *e)
void FormWindow::selectAll()
{
bool selectionChanged = false;
- for (QWidget *widget : qAsConst(m_widgets)) {
+ for (QWidget *widget : std::as_const(m_widgets)) {
if (widget->isVisibleTo(this) && trySelectWidget(widget, true))
selectionChanged = true;
}
@@ -1754,15 +1697,14 @@ static inline DomUI *domUIFromClipboard(int *widgetCount, int *actionCount)
{
*widgetCount = *actionCount = 0;
const QString clipboardText = qApp->clipboard()->text();
- if (clipboardText.isEmpty() || clipboardText.indexOf(QLatin1Char('<')) == -1)
+ if (clipboardText.isEmpty() || clipboardText.indexOf(u'<') == -1)
return nullptr;
QXmlStreamReader reader(clipboardText);
DomUI *ui = nullptr;
- const QString uiElement = QStringLiteral("ui");
while (!reader.atEnd()) {
if (reader.readNext() == QXmlStreamReader::StartElement) {
- if (reader.name().compare(uiElement, Qt::CaseInsensitive) == 0 && !ui) {
+ if (reader.name().compare("ui"_L1, Qt::CaseInsensitive) == 0 && !ui) {
ui = new DomUI();
ui->read(reader);
break;
@@ -1814,9 +1756,8 @@ static void positionPastedWidgetsAtMousePosition(FormWindow *fw, const QPoint &c
cursorPos = grid.snapPoint(QPoint(0, 0));
// Determine area of pasted widgets
QRect pasteArea;
- const QWidgetList::const_iterator lcend = l.constEnd();
- for (QWidgetList::const_iterator it = l.constBegin(); it != lcend; ++it)
- pasteArea =pasteArea.isNull() ? (*it)->geometry() : pasteArea.united((*it)->geometry());
+ for (auto *w : l)
+ pasteArea = pasteArea.isNull() ? w->geometry() : pasteArea.united(w->geometry());
// Mouse on some child? (try to position bottomRight on a free spot to
// get the stacked-offset effect of Designer 4.3, that is, offset by grid if Ctrl-V is pressed continuously
@@ -1828,8 +1769,8 @@ static void positionPastedWidgetsAtMousePosition(FormWindow *fw, const QPoint &c
} while (true);
// Move.
const QPoint offset = cursorPos - pasteArea.topLeft();
- for (QWidgetList::const_iterator it = l.constBegin(); it != lcend; ++it)
- (*it)->move((*it)->pos() + offset);
+ for (auto *w : l)
+ w->move(w->pos() + offset);
}
void FormWindow::paste(PasteMode pasteMode)
@@ -2007,15 +1948,14 @@ void FormWindow::breakLayout(QWidget *w)
// Find the first-order managed child widgets
QWidgetList widgets;
- const QObjectList children = w->children();
- const QObjectList::const_iterator cend = children.constEnd();
const QDesignerMetaDataBaseInterface *mdb = core()->metaDataBase();
- for (QObjectList::const_iterator it = children.constBegin(); it != cend; ++it)
- if ( (*it)->isWidgetType()) {
- QWidget *w = static_cast<QWidget*>(*it);
+ for (auto *o : w->children()) {
+ if (o->isWidgetType()) {
+ auto *w = static_cast<QWidget*>(o);
if (mdb->item(w))
widgets.push_back(w);
}
+ }
BreakLayoutCommand *cmd = new BreakLayoutCommand(this);
cmd->init(widgets, w);
@@ -2042,7 +1982,7 @@ void FormWindow::raiseWidgets()
return;
beginCommand(tr("Raise widgets"));
- for (QWidget *widget : qAsConst(widgets)) {
+ for (QWidget *widget : std::as_const(widgets)) {
RaiseWidgetCommand *cmd = new RaiseWidgetCommand(this);
cmd->init(widget);
m_undoStack.push(cmd);
@@ -2059,7 +1999,7 @@ void FormWindow::lowerWidgets()
return;
beginCommand(tr("Lower widgets"));
- for (QWidget *widget : qAsConst(widgets)) {
+ for (QWidget *widget : std::as_const(widgets)) {
LowerWidgetCommand *cmd = new LowerWidgetCommand(this);
cmd->init(widget);
m_undoStack.push(cmd);
@@ -2199,16 +2139,15 @@ void FormWindow::layoutContainer(QWidget *w, int type)
w = core()->widgetFactory()->containerOfWidget(w);
- const QObjectList l = w->children();
// find managed widget children
QWidgetList widgets;
- const QObjectList::const_iterator ocend = l.constEnd();
- for (QObjectList::const_iterator it = l.constBegin(); it != ocend; ++it)
- if ( (*it)->isWidgetType() ) {
- QWidget *widget = static_cast<QWidget*>(*it);
+ for (auto *o : w->children()) {
+ if (o->isWidgetType() ) {
+ auto *widget = static_cast<QWidget*>(o);
if (widget->isVisibleTo(this) && isManaged(widget))
widgets.append(widget);
}
+ }
if (widgets.isEmpty()) // QTBUG-50563, observed when using hand-edited forms.
return;
@@ -2278,9 +2217,7 @@ QAction *FormWindow::createSelectAncestorSubMenu(QWidget *w)
QMenu *menu = new QMenu;
QActionGroup *ag = new QActionGroup(menu);
QObject::connect(ag, &QActionGroup::triggered, this, &FormWindow::slotSelectWidget);
- const int size = parents.size();
- for (int i = 0; i < size; i++) {
- QWidget *w = parents.at(i);
+ for (auto *w : std::as_const(parents)) {
QAction *a = ag->addAction(objectNameOf(w));
a->setData(QVariant::fromValue(w));
menu->addAction(a);
@@ -2379,7 +2316,7 @@ QPoint FormWindow::mapToForm(const QWidget *w, const QPoint &pos) const
bool FormWindow::canBeBuddy(QWidget *w) const // ### rename me.
{
if (QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), w)) {
- const int index = sheet->indexOf(QStringLiteral("focusPolicy"));
+ const int index = sheet->indexOf(u"focusPolicy"_s);
if (index != -1) {
bool ok = false;
const Qt::FocusPolicy q = static_cast<Qt::FocusPolicy>(Utils::valueOf(sheet->property(index), &ok));
@@ -2439,9 +2376,7 @@ void FormWindow::simplifySelection(QWidgetList *sel) const
}
QWidgetList toBeRemoved;
toBeRemoved.reserve(sel->size());
- const QWidgetList::const_iterator scend = sel->constEnd();
- for (QWidgetList::const_iterator it = sel->constBegin(); it != scend; ++it) {
- QWidget *child = *it;
+ for (auto *child : std::as_const(*sel)) {
for (QWidget *w = child; true ; ) { // Is any of the parents also selected?
QWidget *parent = w->parentWidget();
if (!parent || parent == mainC)
@@ -2455,11 +2390,8 @@ void FormWindow::simplifySelection(QWidgetList *sel) const
}
// Now we can actually remove the widgets that were marked
// for removal in the previous pass.
- if (!toBeRemoved.isEmpty()) {
- const QWidgetList::const_iterator rcend = toBeRemoved.constEnd();
- for (QWidgetList::const_iterator it = toBeRemoved.constBegin(); it != rcend; ++it)
- sel->removeAll(*it);
- }
+ for (auto *r : std::as_const(toBeRemoved))
+ sel->removeAll(r);
}
FormWindow *FormWindow::findFormWindow(QWidget *w)
@@ -2489,8 +2421,8 @@ QWidget *FormWindow::containerAt(const QPoint &pos)
static QWidget *childAt_SkipDropLine(QWidget *w, QPoint pos)
{
const QObjectList &child_list = w->children();
- for (int i = child_list.size() - 1; i >= 0; --i) {
- QObject *child_obj = child_list[i];
+ for (auto i = child_list.size() - 1; i >= 0; --i) {
+ QObject *child_obj = child_list.at(i);
if (qobject_cast<WidgetHandle*>(child_obj) != nullptr)
continue;
QWidget *child = qobject_cast<QWidget*>(child_obj);
@@ -2551,7 +2483,7 @@ void FormWindow::highlightWidget(QWidget *widget, const QPoint &pos, HighlightMo
return;
if (mode == Restore) {
- const WidgetPaletteMap::iterator pit = m_palettesBeforeHighlight.find(container);
+ const auto pit = m_palettesBeforeHighlight.find(container);
if (pit != m_palettesBeforeHighlight.end()) {
container->setPalette(pit.value().first);
container->setAutoFillBackground(pit.value().second);
@@ -2711,7 +2643,7 @@ bool FormWindow::blockSelectionChanged(bool b)
void FormWindow::editContents()
{
const QWidgetList sel = selectedWidgets();
- if (sel.count() == 1) {
+ if (sel.size() == 1) {
QWidget *widget = sel.first();
if (QAction *a = preferredEditAction(core(), widget))
@@ -2829,7 +2761,7 @@ bool FormWindow::dropDockWidget(QDesignerDnDItemInterface *item, const QPoint &g
QDesignerPropertySheetExtension *propertySheet = qobject_cast<QDesignerPropertySheetExtension*>(m_core->extensionManager()->extension(widget, Q_TYPEID(QDesignerPropertySheetExtension)));
if (propertySheet) {
- const QString dockWidgetAreaName = QStringLiteral("dockWidgetArea");
+ const QString dockWidgetAreaName = u"dockWidgetArea"_s;
PropertySheetEnumValue e = qvariant_cast<PropertySheetEnumValue>(propertySheet->property(propertySheet->indexOf(dockWidgetAreaName)));
e.value = area;
QVariant v;
@@ -2875,7 +2807,7 @@ bool FormWindow::dropWidgets(const QList<QDesignerDnDItemInterface*> &item_list,
QPoint offset;
QDesignerDnDItemInterface *current = nullptr;
QDesignerFormWindowCursorInterface *c = cursor();
- for (QDesignerDnDItemInterface *item : qAsConst(item_list)) {
+ for (QDesignerDnDItemInterface *item : std::as_const(item_list)) {
QWidget *w = item->widget();
if (!current)
current = item;
@@ -2890,7 +2822,7 @@ bool FormWindow::dropWidgets(const QList<QDesignerDnDItemInterface*> &item_list,
offset = designerGrid().snapPoint(topLeft) - topLeft;
}
- for (QDesignerDnDItemInterface *item : qAsConst(item_list)) {
+ for (QDesignerDnDItemInterface *item : std::as_const(item_list)) {
DomUI *dom_ui = item->domUi();
QRect geometry = item->decoration()->geometry();
Q_ASSERT(dom_ui != nullptr);
diff --git a/src/designer/src/components/formeditor/formwindow.h b/src/designer/src/components/formeditor/formwindow.h
index a2d16fe5f..c9aefee37 100644
--- a/src/designer/src/components/formeditor/formwindow.h
+++ b/src/designer/src/components/formeditor/formwindow.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef FORMWINDOW_H
#define FORMWINDOW_H
@@ -36,10 +11,11 @@
#include <QtGui/qundostack.h>
#include <QtCore/qhash.h>
#include <QtCore/qlist.h>
-#include <QtCore/qmap.h>
#include <QtCore/qset.h>
#include <QtCore/qpointer.h>
+#include <utility>
+
QT_BEGIN_NAMESPACE
class QDesignerDnDItemInterface;
@@ -148,7 +124,7 @@ public:
void raiseSelection(QWidget *w);
inline const QWidgetList& widgets() const { return m_widgets; }
- inline int widgetCount() const { return m_widgets.count(); }
+ inline int widgetCount() const { return m_widgets.size(); }
inline QWidget *widgetAt(int index) const { return m_widgets.at(index); }
QWidgetList widgets(QWidget *widget) const;
@@ -340,9 +316,8 @@ private:
QString m_fileName;
- using PaletteAndFill = QPair<QPalette ,bool>;
- using WidgetPaletteMap = QMap<QWidget*, PaletteAndFill>;
- WidgetPaletteMap m_palettesBeforeHighlight;
+ using PaletteAndFill = std::pair<QPalette, bool>;
+ QHash<QWidget *, PaletteAndFill> m_palettesBeforeHighlight;
QRubberBand *m_rubberBand = nullptr;
diff --git a/src/designer/src/components/formeditor/formwindow_dnditem.cpp b/src/designer/src/components/formeditor/formwindow_dnditem.cpp
index 2df8c9aa6..928922e3b 100644
--- a/src/designer/src/components/formeditor/formwindow_dnditem.cpp
+++ b/src/designer/src/components/formeditor/formwindow_dnditem.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "formwindow_dnditem.h"
#include "formwindow.h"
@@ -41,7 +16,7 @@
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+namespace qdesigner_internal {
static QWidget *decorationFromWidget(QWidget *w)
{
@@ -101,4 +76,6 @@ DomUI *FormWindowDnDItem::domUi() const
return result;
}
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
diff --git a/src/designer/src/components/formeditor/formwindow_dnditem.h b/src/designer/src/components/formeditor/formwindow_dnditem.h
index 9ff1b0fb9..72012f27d 100644
--- a/src/designer/src/components/formeditor/formwindow_dnditem.h
+++ b/src/designer/src/components/formeditor/formwindow_dnditem.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef FORMWINDOW_DNDITEM_H
#define FORMWINDOW_DNDITEM_H
diff --git a/src/designer/src/components/formeditor/formwindow_widgetstack.cpp b/src/designer/src/components/formeditor/formwindow_widgetstack.cpp
index da6512211..e42345b41 100644
--- a/src/designer/src/components/formeditor/formwindow_widgetstack.cpp
+++ b/src/designer/src/components/formeditor/formwindow_widgetstack.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "formwindow_widgetstack.h"
#include <QtDesigner/abstractformwindowtool.h>
@@ -40,7 +15,9 @@
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+using namespace Qt::StringLiterals;
+
+namespace qdesigner_internal {
FormWindowWidgetStack::FormWindowWidgetStack(QObject *parent) :
QObject(parent),
@@ -56,7 +33,7 @@ FormWindowWidgetStack::FormWindowWidgetStack(QObject *parent) :
// the form windows as it ignores the sizePolicy of
// its child (for example, Fixed would cause undesired side effects).
m_formContainerLayout->setContentsMargins(QMargins());
- m_formContainer->setObjectName(QStringLiteral("formContainer"));
+ m_formContainer->setObjectName(u"formContainer"_s);
m_formContainer->setLayout(m_formContainerLayout);
m_formContainerLayout->setStackingMode(QStackedLayout::StackAll);
// System settings might have different background colors, autofill them
@@ -68,7 +45,7 @@ FormWindowWidgetStack::~FormWindowWidgetStack() = default;
int FormWindowWidgetStack::count() const
{
- return m_tools.count();
+ return m_tools.size();
}
QDesignerFormWindowToolInterface *FormWindowWidgetStack::currentTool() const
@@ -112,7 +89,7 @@ void FormWindowWidgetStack::setSenderAsCurrentTool()
return;
}
- for (QDesignerFormWindowToolInterface *t : qAsConst(m_tools)) {
+ for (QDesignerFormWindowToolInterface *t : std::as_const(m_tools)) {
if (action == t->action()) {
tool = t;
break;
@@ -202,4 +179,6 @@ QLayout *FormWindowWidgetStack::layout() const
return m_layout;
}
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
diff --git a/src/designer/src/components/formeditor/formwindow_widgetstack.h b/src/designer/src/components/formeditor/formwindow_widgetstack.h
index 01ee921fd..9961754c8 100644
--- a/src/designer/src/components/formeditor/formwindow_widgetstack.h
+++ b/src/designer/src/components/formeditor/formwindow_widgetstack.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef FORMWINDOW_WIDGETSTACK_H
#define FORMWINDOW_WIDGETSTACK_H
diff --git a/src/designer/src/components/formeditor/formwindowcursor.cpp b/src/designer/src/components/formeditor/formwindowcursor.cpp
index 31dcdfebb..4bf230e16 100644
--- a/src/designer/src/components/formeditor/formwindowcursor.cpp
+++ b/src/designer/src/components/formeditor/formwindowcursor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "formwindowcursor.h"
#include "formwindow.h"
@@ -122,7 +97,7 @@ bool FormWindowCursor::hasSelection() const
int FormWindowCursor::selectedWidgetCount() const
{
- int N = m_formWindow->selectedWidgets().count();
+ int N = m_formWindow->selectedWidgets().size();
return N ? N : 1;
}
diff --git a/src/designer/src/components/formeditor/formwindowcursor.h b/src/designer/src/components/formeditor/formwindowcursor.h
index e8f699928..c3559a5e0 100644
--- a/src/designer/src/components/formeditor/formwindowcursor.h
+++ b/src/designer/src/components/formeditor/formwindowcursor.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef FORMWINDOWCURSOR_H
#define FORMWINDOWCURSOR_H
diff --git a/src/designer/src/components/formeditor/formwindowmanager.cpp b/src/designer/src/components/formeditor/formwindowmanager.cpp
index c0f84061a..2f94397cd 100644
--- a/src/designer/src/components/formeditor/formwindowmanager.cpp
+++ b/src/designer/src/components/formeditor/formwindowmanager.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
// components/formeditor
#include "formwindowmanager.h"
@@ -78,6 +53,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace {
enum { debugFWM = 0 };
}
@@ -365,151 +342,161 @@ QWidget *FormWindowManager::findManagedWidget(FormWindow *fw, QWidget *w)
void FormWindowManager::setupActions()
{
#if QT_CONFIG(clipboard)
- const QIcon cutIcon = QIcon::fromTheme(QStringLiteral("edit-cut"), createIconSet(QStringLiteral("editcut.png")));
+ const QIcon cutIcon = createIconSet(QIcon::ThemeIcon::EditCut,
+ "editcut.png"_L1);
m_actionCut = new QAction(cutIcon, tr("Cu&t"), this);
- m_actionCut->setObjectName(QStringLiteral("__qt_cut_action"));
+ m_actionCut->setObjectName(u"__qt_cut_action"_s);
m_actionCut->setShortcut(QKeySequence::Cut);
m_actionCut->setStatusTip(tr("Cuts the selected widgets and puts them on the clipboard"));
- m_actionCut->setWhatsThis(whatsThisFrom(QStringLiteral("Edit|Cut")));
+ m_actionCut->setWhatsThis(whatsThisFrom(u"Edit|Cut"_s));
connect(m_actionCut, &QAction::triggered, this, &FormWindowManager::slotActionCutActivated);
m_actionCut->setEnabled(false);
- const QIcon copyIcon = QIcon::fromTheme(QStringLiteral("edit-copy"), createIconSet(QStringLiteral("editcopy.png")));
+ const QIcon copyIcon = createIconSet(QIcon::ThemeIcon::EditCopy, "editcopy.png"_L1);
m_actionCopy = new QAction(copyIcon, tr("&Copy"), this);
- m_actionCopy->setObjectName(QStringLiteral("__qt_copy_action"));
+ m_actionCopy->setObjectName(u"__qt_copy_action"_s);
m_actionCopy->setShortcut(QKeySequence::Copy);
m_actionCopy->setStatusTip(tr("Copies the selected widgets to the clipboard"));
- m_actionCopy->setWhatsThis(whatsThisFrom(QStringLiteral("Edit|Copy")));
+ m_actionCopy->setWhatsThis(whatsThisFrom(u"Edit|Copy"_s));
connect(m_actionCopy, &QAction::triggered, this, &FormWindowManager::slotActionCopyActivated);
m_actionCopy->setEnabled(false);
- const QIcon pasteIcon = QIcon::fromTheme(QStringLiteral("edit-paste"), createIconSet(QStringLiteral("editpaste.png")));
+ const QIcon pasteIcon = createIconSet(QIcon::ThemeIcon::EditPaste, "editpaste.png"_L1);
m_actionPaste = new QAction(pasteIcon, tr("&Paste"), this);
- m_actionPaste->setObjectName(QStringLiteral("__qt_paste_action"));
+ m_actionPaste->setObjectName(u"__qt_paste_action"_s);
m_actionPaste->setShortcut(QKeySequence::Paste);
m_actionPaste->setStatusTip(tr("Pastes the clipboard's contents"));
- m_actionPaste->setWhatsThis(whatsThisFrom(QStringLiteral("Edit|Paste")));
+ m_actionPaste->setWhatsThis(whatsThisFrom(u"Edit|Paste"_s));
connect(m_actionPaste, &QAction::triggered, this, &FormWindowManager::slotActionPasteActivated);
m_actionPaste->setEnabled(false);
#endif
- m_actionDelete = new QAction(QIcon::fromTheme(QStringLiteral("edit-delete")), tr("&Delete"), this);
- m_actionDelete->setObjectName(QStringLiteral("__qt_delete_action"));
+ m_actionDelete = new QAction(QIcon::fromTheme(QIcon::ThemeIcon::EditDelete),
+ tr("&Delete"), this);
+ m_actionDelete->setObjectName(u"__qt_delete_action"_s);
m_actionDelete->setStatusTip(tr("Deletes the selected widgets"));
- m_actionDelete->setWhatsThis(whatsThisFrom(QStringLiteral("Edit|Delete")));
+ m_actionDelete->setWhatsThis(whatsThisFrom(u"Edit|Delete"_s));
connect(m_actionDelete, &QAction::triggered, this, &FormWindowManager::slotActionDeleteActivated);
m_actionDelete->setEnabled(false);
m_actionSelectAll = new QAction(tr("Select &All"), this);
- m_actionSelectAll->setObjectName(QStringLiteral("__qt_select_all_action"));
+ m_actionSelectAll->setObjectName(u"__qt_select_all_action"_s);
m_actionSelectAll->setShortcut(QKeySequence::SelectAll);
m_actionSelectAll->setStatusTip(tr("Selects all widgets"));
- m_actionSelectAll->setWhatsThis(whatsThisFrom(QStringLiteral("Edit|Select All")));
+ m_actionSelectAll->setWhatsThis(whatsThisFrom(u"Edit|Select All"_s));
connect(m_actionSelectAll, &QAction::triggered, this, &FormWindowManager::slotActionSelectAllActivated);
m_actionSelectAll->setEnabled(false);
- m_actionRaise = new QAction(createIconSet(QStringLiteral("editraise.png")), tr("Bring to &Front"), this);
- m_actionRaise->setObjectName(QStringLiteral("__qt_raise_action"));
+ m_actionRaise = new QAction(createIconSet("editraise.png"_L1),
+ tr("Bring to &Front"), this);
+ m_actionRaise->setObjectName(u"__qt_raise_action"_s);
m_actionRaise->setShortcut(Qt::CTRL | Qt::Key_L);
m_actionRaise->setStatusTip(tr("Raises the selected widgets"));
m_actionRaise->setWhatsThis(tr("Raises the selected widgets"));
connect(m_actionRaise, &QAction::triggered, this, &FormWindowManager::slotActionRaiseActivated);
m_actionRaise->setEnabled(false);
- m_actionLower = new QAction(createIconSet(QStringLiteral("editlower.png")), tr("Send to &Back"), this);
- m_actionLower->setObjectName(QStringLiteral("__qt_lower_action"));
+ m_actionLower = new QAction(createIconSet("editlower.png"_L1),
+ tr("Send to &Back"), this);
+ m_actionLower->setObjectName(u"__qt_lower_action"_s);
m_actionLower->setShortcut(Qt::CTRL | Qt::Key_K);
m_actionLower->setStatusTip(tr("Lowers the selected widgets"));
m_actionLower->setWhatsThis(tr("Lowers the selected widgets"));
connect(m_actionLower, &QAction::triggered, this, &FormWindowManager::slotActionLowerActivated);
m_actionLower->setEnabled(false);
- m_actionAdjustSize = new QAction(createIconSet(QStringLiteral("adjustsize.png")), tr("Adjust &Size"), this);
- m_actionAdjustSize->setObjectName(QStringLiteral("__qt_adjust_size_action"));
+ m_actionAdjustSize = new QAction(createIconSet("adjustsize.png"_L1),
+ tr("Adjust &Size"), this);
+ m_actionAdjustSize->setObjectName(u"__qt_adjust_size_action"_s);
m_actionAdjustSize->setShortcut(Qt::CTRL | Qt::Key_J);
m_actionAdjustSize->setStatusTip(tr("Adjusts the size of the selected widget"));
- m_actionAdjustSize->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Adjust Size")));
+ m_actionAdjustSize->setWhatsThis(whatsThisFrom(u"Layout|Adjust Size"_s));
connect(m_actionAdjustSize, &QAction::triggered, this, &FormWindowManager::slotActionAdjustSizeActivated);
m_actionAdjustSize->setEnabled(false);
- m_actionHorizontalLayout = new QAction(createIconSet(QStringLiteral("edithlayout.png")), tr("Lay Out &Horizontally"), this);
- m_actionHorizontalLayout->setObjectName(QStringLiteral("__qt_horizontal_layout_action"));
+ m_actionHorizontalLayout = new QAction(createIconSet("edithlayout.png"_L1),
+ tr("Lay Out &Horizontally"), this);
+ m_actionHorizontalLayout->setObjectName(u"__qt_horizontal_layout_action"_s);
m_actionHorizontalLayout->setShortcut(Qt::CTRL | Qt::Key_1);
m_actionHorizontalLayout->setStatusTip(tr("Lays out the selected widgets horizontally"));
- m_actionHorizontalLayout->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Lay Out Horizontally")));
+ m_actionHorizontalLayout->setWhatsThis(whatsThisFrom(u"Layout|Lay Out Horizontally"_s));
m_actionHorizontalLayout->setData(LayoutInfo::HBox);
m_actionHorizontalLayout->setEnabled(false);
connect(m_actionHorizontalLayout, &QAction::triggered, this, &FormWindowManager::createLayout);
- m_actionVerticalLayout = new QAction(createIconSet(QStringLiteral("editvlayout.png")), tr("Lay Out &Vertically"), this);
- m_actionVerticalLayout->setObjectName(QStringLiteral("__qt_vertical_layout_action"));
+ m_actionVerticalLayout = new QAction(createIconSet("editvlayout.png"_L1),
+ tr("Lay Out &Vertically"), this);
+ m_actionVerticalLayout->setObjectName(u"__qt_vertical_layout_action"_s);
m_actionVerticalLayout->setShortcut(Qt::CTRL | Qt::Key_2);
m_actionVerticalLayout->setStatusTip(tr("Lays out the selected widgets vertically"));
- m_actionVerticalLayout->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Lay Out Vertically")));
+ m_actionVerticalLayout->setWhatsThis(whatsThisFrom(u"Layout|Lay Out Vertically"_s));
m_actionVerticalLayout->setData(LayoutInfo::VBox);
m_actionVerticalLayout->setEnabled(false);
connect(m_actionVerticalLayout, &QAction::triggered, this, &FormWindowManager::createLayout);
- QIcon formIcon = QIcon::fromTheme(QStringLiteral("designer-form-layout"), createIconSet(QStringLiteral("editform.png")));
+ QIcon formIcon = QIcon::fromTheme(u"designer-form-layout"_s,
+ createIconSet("editform.png"_L1));
m_actionFormLayout = new QAction(formIcon, tr("Lay Out in a &Form Layout"), this);
- m_actionFormLayout->setObjectName(QStringLiteral("__qt_form_layout_action"));
+ m_actionFormLayout->setObjectName(u"__qt_form_layout_action"_s);
m_actionFormLayout->setShortcut(Qt::CTRL | Qt::Key_6);
m_actionFormLayout->setStatusTip(tr("Lays out the selected widgets in a form layout"));
- m_actionFormLayout->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Lay Out in a Form")));
+ m_actionFormLayout->setWhatsThis(whatsThisFrom(u"Layout|Lay Out in a Form"_s));
m_actionFormLayout->setData(LayoutInfo::Form);
m_actionFormLayout->setEnabled(false);
connect(m_actionFormLayout, &QAction::triggered, this, &FormWindowManager::createLayout);
- m_actionGridLayout = new QAction(createIconSet(QStringLiteral("editgrid.png")), tr("Lay Out in a &Grid"), this);
- m_actionGridLayout->setObjectName(QStringLiteral("__qt_grid_layout_action"));
+ m_actionGridLayout = new QAction(createIconSet("editgrid.png"_L1),
+ tr("Lay Out in a &Grid"), this);
+ m_actionGridLayout->setObjectName(u"__qt_grid_layout_action"_s);
m_actionGridLayout->setShortcut(Qt::CTRL | Qt::Key_5);
m_actionGridLayout->setStatusTip(tr("Lays out the selected widgets in a grid"));
- m_actionGridLayout->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Lay Out in a Grid")));
+ m_actionGridLayout->setWhatsThis(whatsThisFrom(u"Layout|Lay Out in a Grid"_s));
m_actionGridLayout->setData(LayoutInfo::Grid);
m_actionGridLayout->setEnabled(false);
connect(m_actionGridLayout, &QAction::triggered, this, &FormWindowManager::createLayout);
- m_actionSplitHorizontal = new QAction(createIconSet(QStringLiteral("edithlayoutsplit.png")),
+ m_actionSplitHorizontal = new QAction(createIconSet("edithlayoutsplit.png"_L1),
tr("Lay Out Horizontally in S&plitter"), this);
- m_actionSplitHorizontal->setObjectName(QStringLiteral("__qt_split_horizontal_action"));
+ m_actionSplitHorizontal->setObjectName(u"__qt_split_horizontal_action"_s);
m_actionSplitHorizontal->setShortcut(Qt::CTRL | Qt::Key_3);
m_actionSplitHorizontal->setStatusTip(tr("Lays out the selected widgets horizontally in a splitter"));
- m_actionSplitHorizontal->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Lay Out Horizontally in Splitter")));
+ m_actionSplitHorizontal->setWhatsThis(whatsThisFrom(u"Layout|Lay Out Horizontally in Splitter"_s));
m_actionSplitHorizontal->setData(LayoutInfo::HSplitter);
m_actionSplitHorizontal->setEnabled(false);
connect(m_actionSplitHorizontal, &QAction::triggered, this, &FormWindowManager::createLayout);
- m_actionSplitVertical = new QAction(createIconSet(QStringLiteral("editvlayoutsplit.png")),
+ m_actionSplitVertical = new QAction(createIconSet("editvlayoutsplit.png"_L1),
tr("Lay Out Vertically in Sp&litter"), this);
- m_actionSplitVertical->setObjectName(QStringLiteral("__qt_split_vertical_action"));
+ m_actionSplitVertical->setObjectName(u"__qt_split_vertical_action"_s);
m_actionSplitVertical->setShortcut(Qt::CTRL | Qt::Key_4);
m_actionSplitVertical->setStatusTip(tr("Lays out the selected widgets vertically in a splitter"));
- m_actionSplitVertical->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Lay Out Vertically in Splitter")));
+ m_actionSplitVertical->setWhatsThis(whatsThisFrom(u"Layout|Lay Out Vertically in Splitter"_s));
connect(m_actionSplitVertical, &QAction::triggered, this, &FormWindowManager::createLayout);
m_actionSplitVertical->setData(LayoutInfo::VSplitter);
m_actionSplitVertical->setEnabled(false);
- m_actionBreakLayout = new QAction(createIconSet(QStringLiteral("editbreaklayout.png")), tr("&Break Layout"), this);
- m_actionBreakLayout->setObjectName(QStringLiteral("__qt_break_layout_action"));
+ m_actionBreakLayout = new QAction(createIconSet("editbreaklayout.png"_L1),
+ tr("&Break Layout"), this);
+ m_actionBreakLayout->setObjectName(u"__qt_break_layout_action"_s);
m_actionBreakLayout->setShortcut(Qt::CTRL | Qt::Key_0);
m_actionBreakLayout->setStatusTip(tr("Breaks the selected layout"));
- m_actionBreakLayout->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Break Layout")));
+ m_actionBreakLayout->setWhatsThis(whatsThisFrom(u"Layout|Break Layout"_s));
connect(m_actionBreakLayout, &QAction::triggered, this, &FormWindowManager::slotActionBreakLayoutActivated);
m_actionBreakLayout->setEnabled(false);
m_actionSimplifyLayout = new QAction(tr("Si&mplify Grid Layout"), this);
- m_actionSimplifyLayout->setObjectName(QStringLiteral("__qt_simplify_layout_action"));
+ m_actionSimplifyLayout->setObjectName(u"__qt_simplify_layout_action"_s);
m_actionSimplifyLayout->setStatusTip(tr("Removes empty columns and rows"));
- m_actionSimplifyLayout->setWhatsThis(whatsThisFrom(QStringLiteral("Layout|Simplify Layout")));
+ m_actionSimplifyLayout->setWhatsThis(whatsThisFrom(u"Layout|Simplify Layout"_s));
connect(m_actionSimplifyLayout, &QAction::triggered, this, &FormWindowManager::slotActionSimplifyLayoutActivated);
m_actionSimplifyLayout->setEnabled(false);
m_actionDefaultPreview = new QAction(tr("&Preview..."), this);
- m_actionDefaultPreview->setObjectName(QStringLiteral("__qt_default_preview_action"));
+ m_actionDefaultPreview->setObjectName(u"__qt_default_preview_action"_s);
m_actionDefaultPreview->setStatusTip(tr("Preview current form"));
- m_actionDefaultPreview->setWhatsThis(whatsThisFrom(QStringLiteral("Form|Preview")));
+ m_actionDefaultPreview->setWhatsThis(whatsThisFrom(u"Form|Preview"_s));
connect(m_actionDefaultPreview, &QAction::triggered,
this, &FormWindowManager::showPreview);
@@ -518,13 +505,13 @@ void FormWindowManager::setupActions()
m_actionUndo = m_undoGroup->createUndoAction(this);
m_actionUndo->setEnabled(false);
- m_actionUndo->setIcon(QIcon::fromTheme(QStringLiteral("edit-undo"), createIconSet(QStringLiteral("undo.png"))));
+ m_actionUndo->setIcon(createIconSet(QIcon::ThemeIcon::EditUndo, "undo.png"_L1));
m_actionRedo = m_undoGroup->createRedoAction(this);
m_actionRedo->setEnabled(false);
- m_actionRedo->setIcon(QIcon::fromTheme(QStringLiteral("edit-redo"), createIconSet(QStringLiteral("redo.png"))));
+ m_actionRedo->setIcon(createIconSet(QIcon::ThemeIcon::EditRedo, "redo.png"_L1));
m_actionShowFormWindowSettingsDialog = new QAction(tr("Form &Settings..."), this);
- m_actionShowFormWindowSettingsDialog->setObjectName(QStringLiteral("__qt_form_settings_action"));
+ m_actionShowFormWindowSettingsDialog->setObjectName(u"__qt_form_settings_action"_s);
connect(m_actionShowFormWindowSettingsDialog, &QAction::triggered,
this, &FormWindowManager::slotActionShowFormWindowSettingsDialog);
m_actionShowFormWindowSettingsDialog->setEnabled(false);
@@ -639,7 +626,7 @@ void FormWindowManager::slotActionAdjustSizeActivated()
}
// Always count the main container as unlaid-out
- for (QWidget *widget : qAsConst(selectedWidgets)) {
+ for (QWidget *widget : std::as_const(selectedWidgets)) {
bool unlaidout = LayoutInfo::layoutType(core(), widget->parentWidget()) == LayoutInfo::NoLayout;
bool isMainContainer = m_activeFormWindow->isMainContainer(widget);
@@ -751,7 +738,7 @@ QSet<QWidget *> FormWindowManager::getUnsortedLayoutsToBeBroken(bool firstOnly)
if (selection.isEmpty() && m_activeFormWindow->mainContainer())
selection.append(m_activeFormWindow->mainContainer());
- for (QWidget *selectedWidget : qAsConst(selection)) {
+ for (QWidget *selectedWidget : std::as_const(selection)) {
// find all layouts
const QWidgetList &list = layoutsToBeBroken(selectedWidget);
if (!list.isEmpty()) {
@@ -780,7 +767,7 @@ QWidgetList FormWindowManager::layoutsToBeBroken() const
for (QWidget *wToBeInserted : unsortedLayouts) {
if (!orderedLayoutList.contains(wToBeInserted)) {
// try to find first child, use as insertion position, else append
- const QWidgetList::iterator firstChildPos = findFirstChildOf(orderedLayoutList.begin(), orderedLayoutList.end(), wToBeInserted);
+ const auto firstChildPos = findFirstChildOf(orderedLayoutList.begin(), orderedLayoutList.end(), wToBeInserted);
if (firstChildPos == orderedLayoutList.end()) {
orderedLayoutList.push_back(wToBeInserted);
} else {
@@ -811,8 +798,7 @@ void FormWindowManager::slotUpdateActions()
bool canMorphIntoHBoxLayout = false;
bool canMorphIntoGridLayout = false;
bool canMorphIntoFormLayout = false;
- int selectedWidgetCount = 0;
- int laidoutWidgetCount = 0;
+ bool hasSelectedWidgets = false;
int unlaidoutWidgetCount = 0;
#if QT_CONFIG(clipboard)
bool pasteAvailable = false;
@@ -831,7 +817,7 @@ void FormWindowManager::slotUpdateActions()
QWidgetList simplifiedSelection = m_activeFormWindow->selectedWidgets();
- selectedWidgetCount = simplifiedSelection.count();
+ hasSelectedWidgets = !simplifiedSelection.isEmpty();
#if QT_CONFIG(clipboard)
pasteAvailable = qApp->clipboard()->mimeData() && qApp->clipboard()->mimeData()->hasText();
#endif
@@ -842,19 +828,16 @@ void FormWindowManager::slotUpdateActions()
simplifiedSelection.append(mainContainer);
// Always count the main container as unlaid-out
- const QWidgetList::const_iterator cend = simplifiedSelection.constEnd();
- for (QWidgetList::const_iterator it = simplifiedSelection.constBegin(); it != cend; ++it) {
- if (*it != mainContainer && LayoutInfo::isWidgetLaidout(m_core, *it)) {
- ++laidoutWidgetCount;
- } else {
+ for (auto *w : std::as_const(simplifiedSelection)) {
+ if (w == mainContainer || !LayoutInfo::isWidgetLaidout(m_core, w))
++unlaidoutWidgetCount;
- }
- if (qobject_cast<const QLayoutWidget *>(*it) || qobject_cast<const Spacer *>(*it))
+
+ if (qobject_cast<const QLayoutWidget *>(w) || qobject_cast<const Spacer *>(w))
canChangeZOrder = false;
}
// Figure out layouts: Looking at a group of dangling widgets
- if (simplifiedSelection.count() != 1) {
+ if (simplifiedSelection.size() != 1) {
layoutAvailable = unlaidoutWidgetCount > 1;
//breakAvailable = false;
break;
@@ -903,13 +886,13 @@ void FormWindowManager::slotUpdateActions()
} while(false);
#if QT_CONFIG(clipboard)
- m_actionCut->setEnabled(selectedWidgetCount > 0);
- m_actionCopy->setEnabled(selectedWidgetCount > 0);
+ m_actionCut->setEnabled(hasSelectedWidgets);
+ m_actionCopy->setEnabled(hasSelectedWidgets);
m_actionPaste->setEnabled(pasteAvailable);
#endif
- m_actionDelete->setEnabled(selectedWidgetCount > 0);
- m_actionLower->setEnabled(canChangeZOrder && selectedWidgetCount > 0);
- m_actionRaise->setEnabled(canChangeZOrder && selectedWidgetCount > 0);
+ m_actionDelete->setEnabled(hasSelectedWidgets);
+ m_actionLower->setEnabled(canChangeZOrder && hasSelectedWidgets);
+ m_actionRaise->setEnabled(canChangeZOrder && hasSelectedWidgets);
m_actionSelectAll->setEnabled(m_activeFormWindow != nullptr);
diff --git a/src/designer/src/components/formeditor/formwindowmanager.h b/src/designer/src/components/formeditor/formwindowmanager.h
index d9723cea6..001390bb4 100644
--- a/src/designer/src/components/formeditor/formwindowmanager.h
+++ b/src/designer/src/components/formeditor/formwindowmanager.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef FORMWINDOWMANAGER_H
#define FORMWINDOWMANAGER_H
diff --git a/src/designer/src/components/formeditor/formwindowsettings.cpp b/src/designer/src/components/formeditor/formwindowsettings.cpp
index 3e24b7623..ad0e32f48 100644
--- a/src/designer/src/components/formeditor/formwindowsettings.cpp
+++ b/src/designer/src/components/formeditor/formwindowsettings.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "formwindowsettings.h"
#include "ui_formwindowsettings.h"
@@ -34,6 +9,7 @@
#include <QtWidgets/qstyle.h>
+#include <QtCore/qcompare.h>
#include <QtCore/qregularexpression.h>
#include <QtCore/qdebug.h>
@@ -41,12 +17,12 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
// Data structure containing form dialog data providing comparison
struct FormWindowData {
- bool equals(const FormWindowData&) const;
-
void fromFormWindow(FormWindowBase* fw);
void applyToFormWindow(FormWindowBase* fw) const;
@@ -68,10 +44,11 @@ struct FormWindowData {
Grid grid;
bool idBasedTranslations{false};
bool connectSlotsByName{true};
-};
-inline bool operator==(const FormWindowData &fd1, const FormWindowData &fd2) { return fd1.equals(fd2); }
-inline bool operator!=(const FormWindowData &fd1, const FormWindowData &fd2) { return !fd1.equals(fd2); }
+ friend bool comparesEqual(const FormWindowData &lhs,
+ const FormWindowData &rhs) noexcept;
+ Q_DECLARE_EQUALITY_COMPARABLE(FormWindowData)
+};
QDebug operator<<(QDebug str, const FormWindowData &d)
{
@@ -86,21 +63,21 @@ QDebug operator<<(QDebug str, const FormWindowData &d)
return str;
}
-bool FormWindowData::equals(const FormWindowData &rhs) const
+bool comparesEqual(const FormWindowData &lhs, const FormWindowData &rhs) noexcept
{
- return layoutDefaultEnabled == rhs.layoutDefaultEnabled &&
- defaultMargin == rhs.defaultMargin &&
- defaultSpacing == rhs.defaultSpacing &&
- layoutFunctionsEnabled == rhs.layoutFunctionsEnabled &&
- marginFunction == rhs.marginFunction &&
- spacingFunction == rhs.spacingFunction &&
- pixFunction == rhs.pixFunction &&
- author == rhs.author &&
- includeHints == rhs.includeHints &&
- hasFormGrid == rhs.hasFormGrid &&
- grid == rhs.grid &&
- idBasedTranslations == rhs.idBasedTranslations &&
- connectSlotsByName == rhs.connectSlotsByName;
+ return lhs.layoutDefaultEnabled == rhs.layoutDefaultEnabled &&
+ lhs.defaultMargin == rhs.defaultMargin &&
+ lhs.defaultSpacing == rhs.defaultSpacing &&
+ lhs.layoutFunctionsEnabled == rhs.layoutFunctionsEnabled &&
+ lhs.marginFunction == rhs.marginFunction &&
+ lhs.spacingFunction == rhs.spacingFunction &&
+ lhs.pixFunction == rhs.pixFunction &&
+ lhs.author == rhs.author &&
+ lhs.includeHints == rhs.includeHints &&
+ lhs.hasFormGrid == rhs.hasFormGrid &&
+ lhs.grid == rhs.grid &&
+ lhs.idBasedTranslations == rhs.idBasedTranslations &&
+ lhs.connectSlotsByName == rhs.connectSlotsByName;
}
void FormWindowData::fromFormWindow(FormWindowBase* fw)
@@ -166,7 +143,7 @@ void FormWindowData::applyToFormWindow(FormWindowBase* fw) const
FormWindowSettings::FormWindowSettings(QDesignerFormWindowInterface *parent) :
QDialog(parent),
- m_ui(new ::Ui::FormWindowSettings),
+ m_ui(new QT_PREPEND_NAMESPACE(Ui)::FormWindowSettings),
m_formWindow(qobject_cast<FormWindowBase*>(parent)),
m_oldData(new FormWindowData)
{
@@ -176,8 +153,6 @@ FormWindowSettings::FormWindowSettings(QDesignerFormWindowInterface *parent) :
m_ui->gridPanel->setCheckable(true);
m_ui->gridPanel->setResetButtonVisible(false);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
-
QString deviceProfileName = m_formWindow->deviceProfileName();
if (deviceProfileName.isEmpty())
deviceProfileName = tr("None");
@@ -214,9 +189,9 @@ FormWindowData FormWindowSettings::data() const
const QString hints = m_ui->includeHintsTextEdit->toPlainText();
if (!hints.isEmpty()) {
- rc.includeHints = hints.split(QLatin1Char('\n'));
+ rc.includeHints = hints.split(u'\n');
// Purge out any lines consisting of blanks only
- const QRegularExpression blankLine(QStringLiteral("^\\s*$"));
+ const QRegularExpression blankLine(u"^\\s*$"_s);
Q_ASSERT(blankLine.isValid());
rc.includeHints.erase(std::remove_if(rc.includeHints.begin(), rc.includeHints.end(),
[blankLine](const QString &hint){ return blankLine.match(hint).hasMatch(); }),
@@ -248,7 +223,7 @@ void FormWindowSettings::setData(const FormWindowData &data)
if (data.includeHints.isEmpty()) {
m_ui->includeHintsTextEdit->clear();
} else {
- m_ui->includeHintsTextEdit->setText(data.includeHints.join(QLatin1Char('\n')));
+ m_ui->includeHintsTextEdit->setText(data.includeHints.join(u'\n'));
}
m_ui->gridPanel->setChecked(data.hasFormGrid);
diff --git a/src/designer/src/components/formeditor/formwindowsettings.h b/src/designer/src/components/formeditor/formwindowsettings.h
index 8d06097a6..37e5101c7 100644
--- a/src/designer/src/components/formeditor/formwindowsettings.h
+++ b/src/designer/src/components/formeditor/formwindowsettings.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef FORMWINDOWSETTINGS_H
#define FORMWINDOWSETTINGS_H
@@ -61,7 +36,7 @@ private:
FormWindowData data() const;
void setData(const FormWindowData&);
- Ui::FormWindowSettings *m_ui;
+ QT_PREPEND_NAMESPACE(Ui)::FormWindowSettings *m_ui;
FormWindowBase *m_formWindow;
FormWindowData *m_oldData;
};
diff --git a/src/designer/src/components/formeditor/formwindowsettings.ui b/src/designer/src/components/formeditor/formwindowsettings.ui
index a71ae3542..1fd1e35b7 100644
--- a/src/designer/src/components/formeditor/formwindowsettings.ui
+++ b/src/designer/src/components/formeditor/formwindowsettings.ui
@@ -1,32 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <comment>*********************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-*********************************************************************</comment>
+<comment>
+* Copyright (C) 2016 The Qt Company Ltd.
+* SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+</comment>
<class>FormWindowSettings</class>
<widget class="QDialog" name="FormWindowSettings">
<property name="geometry">
diff --git a/src/designer/src/components/formeditor/images/cleartext.png b/src/designer/src/components/formeditor/images/cleartext.png
deleted file mode 100644
index 4c7bb13f3..000000000
--- a/src/designer/src/components/formeditor/images/cleartext.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/cursors/arrow.png b/src/designer/src/components/formeditor/images/cursors/arrow.png
deleted file mode 100644
index a69ef4eb6..000000000
--- a/src/designer/src/components/formeditor/images/cursors/arrow.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/cursors/busy.png b/src/designer/src/components/formeditor/images/cursors/busy.png
deleted file mode 100644
index 53717e499..000000000
--- a/src/designer/src/components/formeditor/images/cursors/busy.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/cursors/closedhand.png b/src/designer/src/components/formeditor/images/cursors/closedhand.png
deleted file mode 100644
index b78dd1dac..000000000
--- a/src/designer/src/components/formeditor/images/cursors/closedhand.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/cursors/cross.png b/src/designer/src/components/formeditor/images/cursors/cross.png
deleted file mode 100644
index fe38e7448..000000000
--- a/src/designer/src/components/formeditor/images/cursors/cross.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/cursors/hand.png b/src/designer/src/components/formeditor/images/cursors/hand.png
deleted file mode 100644
index d2004aefa..000000000
--- a/src/designer/src/components/formeditor/images/cursors/hand.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/cursors/hsplit.png b/src/designer/src/components/formeditor/images/cursors/hsplit.png
deleted file mode 100644
index a5667e3ff..000000000
--- a/src/designer/src/components/formeditor/images/cursors/hsplit.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/cursors/ibeam.png b/src/designer/src/components/formeditor/images/cursors/ibeam.png
deleted file mode 100644
index 097fc5fa7..000000000
--- a/src/designer/src/components/formeditor/images/cursors/ibeam.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/cursors/no.png b/src/designer/src/components/formeditor/images/cursors/no.png
deleted file mode 100644
index 2b08c4e2a..000000000
--- a/src/designer/src/components/formeditor/images/cursors/no.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/cursors/openhand.png b/src/designer/src/components/formeditor/images/cursors/openhand.png
deleted file mode 100644
index 9181c859e..000000000
--- a/src/designer/src/components/formeditor/images/cursors/openhand.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/cursors/sizeall.png b/src/designer/src/components/formeditor/images/cursors/sizeall.png
deleted file mode 100644
index 69f13eb34..000000000
--- a/src/designer/src/components/formeditor/images/cursors/sizeall.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/cursors/sizeb.png b/src/designer/src/components/formeditor/images/cursors/sizeb.png
deleted file mode 100644
index 3b127a05d..000000000
--- a/src/designer/src/components/formeditor/images/cursors/sizeb.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/cursors/sizef.png b/src/designer/src/components/formeditor/images/cursors/sizef.png
deleted file mode 100644
index f37d7b91e..000000000
--- a/src/designer/src/components/formeditor/images/cursors/sizef.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/cursors/sizeh.png b/src/designer/src/components/formeditor/images/cursors/sizeh.png
deleted file mode 100644
index a9f40cbc3..000000000
--- a/src/designer/src/components/formeditor/images/cursors/sizeh.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/cursors/sizev.png b/src/designer/src/components/formeditor/images/cursors/sizev.png
deleted file mode 100644
index 1edbab27a..000000000
--- a/src/designer/src/components/formeditor/images/cursors/sizev.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/cursors/uparrow.png b/src/designer/src/components/formeditor/images/cursors/uparrow.png
deleted file mode 100644
index d3e70ef4c..000000000
--- a/src/designer/src/components/formeditor/images/cursors/uparrow.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/cursors/vsplit.png b/src/designer/src/components/formeditor/images/cursors/vsplit.png
deleted file mode 100644
index 1beda2570..000000000
--- a/src/designer/src/components/formeditor/images/cursors/vsplit.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/cursors/wait.png b/src/designer/src/components/formeditor/images/cursors/wait.png
deleted file mode 100644
index 69056c479..000000000
--- a/src/designer/src/components/formeditor/images/cursors/wait.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/cursors/whatsthis.png b/src/designer/src/components/formeditor/images/cursors/whatsthis.png
deleted file mode 100644
index b47601c37..000000000
--- a/src/designer/src/components/formeditor/images/cursors/whatsthis.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/mac/resourceeditortool.png b/src/designer/src/components/formeditor/images/mac/resourceeditortool.png
deleted file mode 100644
index 7ef511c2b..000000000
--- a/src/designer/src/components/formeditor/images/mac/resourceeditortool.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/plus-16.png b/src/designer/src/components/formeditor/images/plus-16.png
deleted file mode 100644
index ef43788e6..000000000
--- a/src/designer/src/components/formeditor/images/plus-16.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/qt3logo.png b/src/designer/src/components/formeditor/images/qt3logo.png
deleted file mode 100644
index 720285001..000000000
--- a/src/designer/src/components/formeditor/images/qt3logo.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/qtlogo128x128.png b/src/designer/src/components/formeditor/images/qtlogo128x128.png
new file mode 100644
index 000000000..8dfeb1a02
--- /dev/null
+++ b/src/designer/src/components/formeditor/images/qtlogo128x128.png
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/qtlogo16x16.png b/src/designer/src/components/formeditor/images/qtlogo16x16.png
index 30bcb45ed..849684984 100644
--- a/src/designer/src/components/formeditor/images/qtlogo16x16.png
+++ b/src/designer/src/components/formeditor/images/qtlogo16x16.png
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/qtlogo24x24.png b/src/designer/src/components/formeditor/images/qtlogo24x24.png
index 058bf6972..4effcc4ab 100644
--- a/src/designer/src/components/formeditor/images/qtlogo24x24.png
+++ b/src/designer/src/components/formeditor/images/qtlogo24x24.png
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/qtlogo32x32.png b/src/designer/src/components/formeditor/images/qtlogo32x32.png
index d609c1e1e..d34a6a17f 100644
--- a/src/designer/src/components/formeditor/images/qtlogo32x32.png
+++ b/src/designer/src/components/formeditor/images/qtlogo32x32.png
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/qtlogo64x64.png b/src/designer/src/components/formeditor/images/qtlogo64x64.png
index 3bc03b7c7..e40b5c6fc 100644
--- a/src/designer/src/components/formeditor/images/qtlogo64x64.png
+++ b/src/designer/src/components/formeditor/images/qtlogo64x64.png
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/widgets/groupboxcollapsible.png b/src/designer/src/components/formeditor/images/widgets/groupboxcollapsible.png
deleted file mode 100644
index 62fd1ad56..000000000
--- a/src/designer/src/components/formeditor/images/widgets/groupboxcollapsible.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/widgets/hsplit.png b/src/designer/src/components/formeditor/images/widgets/hsplit.png
deleted file mode 100644
index 1ea8f2ac0..000000000
--- a/src/designer/src/components/formeditor/images/widgets/hsplit.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/widgets/tabbar.png b/src/designer/src/components/formeditor/images/widgets/tabbar.png
deleted file mode 100644
index d5d37836b..000000000
--- a/src/designer/src/components/formeditor/images/widgets/tabbar.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/widgets/wizard.png b/src/designer/src/components/formeditor/images/widgets/wizard.png
deleted file mode 100644
index 7c0e107ae..000000000
--- a/src/designer/src/components/formeditor/images/widgets/wizard.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/images/win/resourceeditortool.png b/src/designer/src/components/formeditor/images/win/resourceeditortool.png
deleted file mode 100644
index cc9cb5851..000000000
--- a/src/designer/src/components/formeditor/images/win/resourceeditortool.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/components/formeditor/itemview_propertysheet.cpp b/src/designer/src/components/formeditor/itemview_propertysheet.cpp
index 71adf7397..312427341 100644
--- a/src/designer/src/components/formeditor/itemview_propertysheet.cpp
+++ b/src/designer/src/components/formeditor/itemview_propertysheet.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "itemview_propertysheet.h"
@@ -36,6 +11,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
struct Property {
@@ -47,8 +24,6 @@ struct Property {
int m_id{-1};
};
-typedef QMap<int, Property> FakePropertyMap;
-
struct ItemViewPropertySheetPrivate {
ItemViewPropertySheetPrivate(QDesignerFormEditorInterface *core,
QHeaderView *horizontalHeader,
@@ -58,7 +33,7 @@ struct ItemViewPropertySheetPrivate {
inline QString fakePropertyName(const QString &prefix, const QString &realName);
// Maps index of fake property to index of real property in respective sheet
- FakePropertyMap m_propertyIdMap;
+ QMap<int, Property> m_propertyIdMap;
// Maps name of fake property to name of real property
QHash<QString, QString> m_propertyNameMap;
@@ -68,20 +43,16 @@ struct ItemViewPropertySheetPrivate {
};
// Name of the fake group
-static const char *headerGroup = "Header";
+static constexpr auto headerGroup = "Header"_L1;
// Name of the real properties
-static const char *visibleProperty = "visible";
-static const char *cascadingSectionResizesProperty = "cascadingSectionResizes";
-static const char *defaultSectionSizeProperty = "defaultSectionSize";
-static const char *highlightSectionsProperty = "highlightSections";
-static const char *minimumSectionSizeProperty = "minimumSectionSize";
-static const char *showSortIndicatorProperty = "showSortIndicator";
-static const char *stretchLastSectionProperty = "stretchLastSection";
-} // namespace qdesigner_internal
-
-using namespace qdesigner_internal;
-
+static constexpr auto visibleProperty = "visible"_L1;
+static constexpr auto cascadingSectionResizesProperty = "cascadingSectionResizes"_L1;
+static constexpr auto defaultSectionSizeProperty = "defaultSectionSize"_L1;
+static constexpr auto highlightSectionsProperty = "highlightSections"_L1;
+static constexpr auto minimumSectionSizeProperty = "minimumSectionSize"_L1;
+static constexpr auto showSortIndicatorProperty = "showSortIndicator"_L1;
+static constexpr auto stretchLastSectionProperty = "stretchLastSection"_L1;
/***************** ItemViewPropertySheetPrivate *********************/
@@ -102,14 +73,12 @@ ItemViewPropertySheetPrivate::ItemViewPropertySheetPrivate(QDesignerFormEditorIn
QStringList ItemViewPropertySheetPrivate::realPropertyNames()
{
if (m_realPropertyNames.isEmpty())
- m_realPropertyNames
- << QLatin1String(visibleProperty)
- << QLatin1String(cascadingSectionResizesProperty)
- << QLatin1String(defaultSectionSizeProperty)
- << QLatin1String(highlightSectionsProperty)
- << QLatin1String(minimumSectionSizeProperty)
- << QLatin1String(showSortIndicatorProperty)
- << QLatin1String(stretchLastSectionProperty);
+ m_realPropertyNames = {
+ visibleProperty, cascadingSectionResizesProperty,
+ defaultSectionSizeProperty, highlightSectionsProperty,
+ minimumSectionSizeProperty, showSortIndicatorProperty,
+ stretchLastSectionProperty
+ };
return m_realPropertyNames;
}
@@ -145,7 +114,7 @@ ItemViewPropertySheet::ItemViewPropertySheet(QTreeView *treeViewObject, QObject
: QDesignerPropertySheet(treeViewObject, parent),
d(new ItemViewPropertySheetPrivate(core(), treeViewObject->header(), nullptr))
{
- initHeaderProperties(treeViewObject->header(), QStringLiteral("header"));
+ initHeaderProperties(treeViewObject->header(), u"header"_s);
}
ItemViewPropertySheet::ItemViewPropertySheet(QTableView *tableViewObject, QObject *parent)
@@ -154,8 +123,8 @@ ItemViewPropertySheet::ItemViewPropertySheet(QTableView *tableViewObject, QObjec
tableViewObject->horizontalHeader(),
tableViewObject->verticalHeader()))
{
- initHeaderProperties(tableViewObject->horizontalHeader(), QStringLiteral("horizontalHeader"));
- initHeaderProperties(tableViewObject->verticalHeader(), QStringLiteral("verticalHeader"));
+ initHeaderProperties(tableViewObject->horizontalHeader(), u"horizontalHeader"_s);
+ initHeaderProperties(tableViewObject->verticalHeader(), u"verticalHeader"_s);
}
ItemViewPropertySheet::~ItemViewPropertySheet()
@@ -167,12 +136,12 @@ void ItemViewPropertySheet::initHeaderProperties(QHeaderView *hv, const QString
{
QDesignerPropertySheetExtension *headerSheet = d->m_propertySheet.value(hv);
Q_ASSERT(headerSheet);
- const QString headerGroupS = QLatin1String(headerGroup);
+ const QString headerGroupS = headerGroup;
const QStringList &realPropertyNames = d->realPropertyNames();
for (const QString &realPropertyName : realPropertyNames) {
const int headerIndex = headerSheet->indexOf(realPropertyName);
Q_ASSERT(headerIndex != -1);
- const QVariant defaultValue = realPropertyName == QLatin1String(visibleProperty) ?
+ const QVariant defaultValue = realPropertyName == visibleProperty ?
QVariant(true) : headerSheet->property(headerIndex);
const QString fakePropertyName = d->fakePropertyName(prefix, realPropertyName);
const int fakeIndex = createFakeProperty(fakePropertyName, defaultValue);
@@ -192,7 +161,7 @@ QHash<QString,QString> ItemViewPropertySheet::propertyNameMap() const
QVariant ItemViewPropertySheet::property(int index) const
{
- const FakePropertyMap::const_iterator it = d->m_propertyIdMap.constFind(index);
+ const auto it = d->m_propertyIdMap.constFind(index);
if (it != d->m_propertyIdMap.constEnd())
return it.value().m_sheet->property(it.value().m_id);
return QDesignerPropertySheet::property(index);
@@ -200,7 +169,7 @@ QVariant ItemViewPropertySheet::property(int index) const
void ItemViewPropertySheet::setProperty(int index, const QVariant &value)
{
- const FakePropertyMap::iterator it = d->m_propertyIdMap.find(index);
+ const auto it = d->m_propertyIdMap.find(index);
if (it != d->m_propertyIdMap.end()) {
it.value().m_sheet->setProperty(it.value().m_id, value);
} else {
@@ -210,7 +179,7 @@ void ItemViewPropertySheet::setProperty(int index, const QVariant &value)
void ItemViewPropertySheet::setChanged(int index, bool changed)
{
- const FakePropertyMap::iterator it = d->m_propertyIdMap.find(index);
+ const auto it = d->m_propertyIdMap.find(index);
if (it != d->m_propertyIdMap.end()) {
it.value().m_sheet->setChanged(it.value().m_id, changed);
} else {
@@ -220,7 +189,7 @@ void ItemViewPropertySheet::setChanged(int index, bool changed)
bool ItemViewPropertySheet::isChanged(int index) const
{
- const FakePropertyMap::const_iterator it = d->m_propertyIdMap.constFind(index);
+ const auto it = d->m_propertyIdMap.constFind(index);
if (it != d->m_propertyIdMap.constEnd())
return it.value().m_sheet->isChanged(it.value().m_id);
return QDesignerPropertySheet::isChanged(index);
@@ -228,7 +197,7 @@ bool ItemViewPropertySheet::isChanged(int index) const
bool ItemViewPropertySheet::hasReset(int index) const
{
- const FakePropertyMap::const_iterator it = d->m_propertyIdMap.constFind(index);
+ const auto it = d->m_propertyIdMap.constFind(index);
if (it != d->m_propertyIdMap.constEnd())
return it.value().m_sheet->hasReset(it.value().m_id);
return QDesignerPropertySheet::hasReset(index);
@@ -236,7 +205,7 @@ bool ItemViewPropertySheet::hasReset(int index) const
bool ItemViewPropertySheet::reset(int index)
{
- const FakePropertyMap::iterator it = d->m_propertyIdMap.find(index);
+ const auto it = d->m_propertyIdMap.find(index);
if (it != d->m_propertyIdMap.end()) {
QDesignerPropertySheetExtension *headerSheet = it.value().m_sheet;
const int headerIndex = it.value().m_id;
@@ -244,7 +213,7 @@ bool ItemViewPropertySheet::reset(int index)
// Resetting for "visible" might fail and the stored default
// of the Widget database is "false" due to the widget not being
// visible at the time it was determined. Reset to "true" manually.
- if (!resetRC && headerSheet->propertyName(headerIndex) == QLatin1String(visibleProperty)) {
+ if (!resetRC && headerSheet->propertyName(headerIndex) == visibleProperty) {
headerSheet->setProperty(headerIndex, QVariant(true));
headerSheet->setChanged(headerIndex, false);
return true;
@@ -254,4 +223,6 @@ bool ItemViewPropertySheet::reset(int index)
return QDesignerPropertySheet::reset(index);
}
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
diff --git a/src/designer/src/components/formeditor/itemview_propertysheet.h b/src/designer/src/components/formeditor/itemview_propertysheet.h
index 5a72095d2..5ef061978 100644
--- a/src/designer/src/components/formeditor/itemview_propertysheet.h
+++ b/src/designer/src/components/formeditor/itemview_propertysheet.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ITEMVIEW_PROPERTYSHEET_H
#define ITEMVIEW_PROPERTYSHEET_H
diff --git a/src/designer/src/components/formeditor/layout_propertysheet.cpp b/src/designer/src/components/formeditor/layout_propertysheet.cpp
index d9d29a11d..8447f3fd5 100644
--- a/src/designer/src/components/formeditor/layout_propertysheet.cpp
+++ b/src/designer/src/components/formeditor/layout_propertysheet.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "layout_propertysheet.h"
@@ -48,21 +23,23 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
#define USE_LAYOUT_SIZE_CONSTRAINT
-static const char *leftMargin = "leftMargin";
-static const char *topMargin = "topMargin";
-static const char *rightMargin = "rightMargin";
-static const char *bottomMargin = "bottomMargin";
-static const char *horizontalSpacing = "horizontalSpacing";
-static const char *verticalSpacing = "verticalSpacing";
-static const char *spacing = "spacing";
-static const char *sizeConstraint = "sizeConstraint";
-static const char *boxStretchPropertyC = "stretch";
-static const char *gridRowStretchPropertyC = "rowStretch";
-static const char *gridColumnStretchPropertyC = "columnStretch";
-static const char *gridRowMinimumHeightPropertyC = "rowMinimumHeight";
-static const char *gridColumnMinimumWidthPropertyC = "columnMinimumWidth";
+static constexpr auto leftMargin = "leftMargin"_L1;
+static constexpr auto topMargin = "topMargin"_L1;
+static constexpr auto rightMargin = "rightMargin"_L1;
+static constexpr auto bottomMargin = "bottomMargin"_L1;
+static constexpr auto horizontalSpacing = "horizontalSpacing"_L1;
+static constexpr auto verticalSpacing = "verticalSpacing"_L1;
+static constexpr auto spacing = "spacing"_L1;
+static constexpr auto sizeConstraint = "sizeConstraint"_L1;
+static constexpr auto boxStretchPropertyC = "stretch"_L1;
+static constexpr auto gridRowStretchPropertyC = "rowStretch"_L1;
+static constexpr auto gridColumnStretchPropertyC = "columnStretch"_L1;
+static constexpr auto gridRowMinimumHeightPropertyC = "rowMinimumHeight"_L1;
+static constexpr auto gridColumnMinimumWidthPropertyC = "columnMinimumWidth"_L1;
namespace {
enum LayoutPropertyType {
@@ -92,7 +69,7 @@ namespace {
static bool isIntegerList(const QString &s)
{
// Check for empty string or comma-separated list of integers
- static const QRegularExpression re(QStringLiteral("^[0-9]+(,[0-9]+)+$"));
+ static const QRegularExpression re(u"^[0-9]+(,[0-9]+)+$"_s);
Q_ASSERT(re.isValid());
return s.isEmpty() || re.match(s).hasMatch();
}
@@ -101,19 +78,19 @@ static bool isIntegerList(const QString &s)
static LayoutPropertyType layoutPropertyType(const QString &name)
{
static const QHash<QString, LayoutPropertyType> namePropertyMap = {
- {QLatin1String(leftMargin), LayoutPropertyLeftMargin},
- {QLatin1String(topMargin), LayoutPropertyTopMargin},
- {QLatin1String(rightMargin), LayoutPropertyRightMargin},
- {QLatin1String(bottomMargin), LayoutPropertyBottomMargin},
- {QLatin1String(horizontalSpacing), LayoutPropertyHorizontalSpacing},
- {QLatin1String(verticalSpacing), LayoutPropertyVerticalSpacing},
- {QLatin1String(spacing), LayoutPropertySpacing},
- {QLatin1String(sizeConstraint), LayoutPropertySizeConstraint},
- {QLatin1String(boxStretchPropertyC ), LayoutPropertyBoxStretch},
- {QLatin1String(gridRowStretchPropertyC), LayoutPropertyGridRowStretch},
- {QLatin1String(gridColumnStretchPropertyC), LayoutPropertyGridColumnStretch},
- {QLatin1String(gridRowMinimumHeightPropertyC), LayoutPropertyGridRowMinimumHeight},
- {QLatin1String(gridColumnMinimumWidthPropertyC), LayoutPropertyGridColumnMinimumWidth}
+ {leftMargin, LayoutPropertyLeftMargin},
+ {topMargin, LayoutPropertyTopMargin},
+ {rightMargin, LayoutPropertyRightMargin},
+ {bottomMargin, LayoutPropertyBottomMargin},
+ {horizontalSpacing, LayoutPropertyHorizontalSpacing},
+ {verticalSpacing, LayoutPropertyVerticalSpacing},
+ {spacing, LayoutPropertySpacing},
+ {sizeConstraint, LayoutPropertySizeConstraint},
+ {boxStretchPropertyC, LayoutPropertyBoxStretch},
+ {gridRowStretchPropertyC, LayoutPropertyGridRowStretch},
+ {gridColumnStretchPropertyC, LayoutPropertyGridColumnStretch},
+ {gridRowMinimumHeightPropertyC, LayoutPropertyGridRowMinimumHeight},
+ {gridColumnMinimumWidthPropertyC, LayoutPropertyGridColumnMinimumWidth}
};
return namePropertyMap.value(name, LayoutPropertyNone);
}
@@ -175,49 +152,49 @@ namespace qdesigner_internal {
LayoutPropertySheet::LayoutPropertySheet(QLayout *l, QObject *parent)
: QDesignerPropertySheet(l, parent), m_layout(l)
{
- const QString layoutGroup = QStringLiteral("Layout");
- int pindex = createFakeProperty(QLatin1String(leftMargin), 0);
+ const QString layoutGroup = u"Layout"_s;
+ int pindex = createFakeProperty(leftMargin, 0);
setPropertyGroup(pindex, layoutGroup);
- pindex = createFakeProperty(QLatin1String(topMargin), 0);
+ pindex = createFakeProperty(topMargin, 0);
setPropertyGroup(pindex, layoutGroup);
- pindex = createFakeProperty(QLatin1String(rightMargin), 0);
+ pindex = createFakeProperty(rightMargin, 0);
setPropertyGroup(pindex, layoutGroup);
- pindex = createFakeProperty(QLatin1String(bottomMargin), 0);
+ pindex = createFakeProperty(bottomMargin, 0);
setPropertyGroup(pindex, layoutGroup);
const int visibleMask = LayoutProperties::visibleProperties(m_layout);
if (visibleMask & LayoutProperties::HorizSpacingProperty) {
- pindex = createFakeProperty(QLatin1String(horizontalSpacing), 0);
+ pindex = createFakeProperty(horizontalSpacing, 0);
setPropertyGroup(pindex, layoutGroup);
- pindex = createFakeProperty(QLatin1String(verticalSpacing), 0);
+ pindex = createFakeProperty(verticalSpacing, 0);
setPropertyGroup(pindex, layoutGroup);
- setAttribute(indexOf(QLatin1String(spacing)), true);
+ setAttribute(indexOf(spacing), true);
}
// Stretch
if (visibleMask & LayoutProperties::BoxStretchProperty) {
- pindex = createFakeProperty(QLatin1String(boxStretchPropertyC), QByteArray());
+ pindex = createFakeProperty(boxStretchPropertyC, QByteArray());
setPropertyGroup(pindex, layoutGroup);
setAttribute(pindex, true);
} else {
// Add the grid per-row/column stretch and size limits
if (visibleMask & LayoutProperties::GridColumnStretchProperty) {
const QByteArray empty;
- pindex = createFakeProperty(QLatin1String(gridRowStretchPropertyC), empty);
+ pindex = createFakeProperty(gridRowStretchPropertyC, empty);
setPropertyGroup(pindex, layoutGroup);
setAttribute(pindex, true);
- pindex = createFakeProperty(QLatin1String(gridColumnStretchPropertyC), empty);
+ pindex = createFakeProperty(gridColumnStretchPropertyC, empty);
setPropertyGroup(pindex, layoutGroup);
setAttribute(pindex, true);
- pindex = createFakeProperty(QLatin1String(gridRowMinimumHeightPropertyC), empty);
+ pindex = createFakeProperty(gridRowMinimumHeightPropertyC, empty);
setPropertyGroup(pindex, layoutGroup);
setAttribute(pindex, true);
- pindex = createFakeProperty(QLatin1String(gridColumnMinimumWidthPropertyC), empty);
+ pindex = createFakeProperty(gridColumnMinimumWidthPropertyC, empty);
setPropertyGroup(pindex, layoutGroup);
setAttribute(pindex, true);
}
@@ -227,7 +204,7 @@ LayoutPropertySheet::LayoutPropertySheet(QLayout *l, QObject *parent)
// as it affects the layout parent widget and thus
// conflicts with Designer's special layout widget.
// It will take effect on the preview only.
- pindex = createFakeProperty(QLatin1String(sizeConstraint));
+ pindex = createFakeProperty(sizeConstraint);
setPropertyGroup(pindex, layoutGroup);
#endif
}
@@ -438,8 +415,8 @@ void LayoutPropertySheet::setChanged(int index, bool changed)
switch (type) {
case LayoutPropertySpacing:
if (LayoutProperties::visibleProperties(m_layout) & LayoutProperties::HorizSpacingProperty) {
- setChanged(indexOf(QLatin1String(horizontalSpacing)), changed);
- setChanged(indexOf(QLatin1String(verticalSpacing)), changed);
+ setChanged(indexOf(horizontalSpacing), changed);
+ setChanged(indexOf(verticalSpacing), changed);
}
break;
default:
@@ -460,31 +437,31 @@ void LayoutPropertySheet::stretchAttributesToDom(QDesignerFormEditorInterface *c
// Stretch
if (visibleMask & LayoutProperties::BoxStretchProperty) {
- const int index = sheet->indexOf(QLatin1String(boxStretchPropertyC));
+ const int index = sheet->indexOf(boxStretchPropertyC);
Q_ASSERT(index != -1);
if (sheet->isChanged(index))
domLayout->setAttributeStretch(sheet->property(index).toString());
}
if (visibleMask & LayoutProperties::GridColumnStretchProperty) {
- const int index = sheet->indexOf(QLatin1String(gridColumnStretchPropertyC));
+ const int index = sheet->indexOf(gridColumnStretchPropertyC);
Q_ASSERT(index != -1);
if (sheet->isChanged(index))
domLayout->setAttributeColumnStretch(sheet->property(index).toString());
}
if (visibleMask & LayoutProperties::GridRowStretchProperty) {
- const int index = sheet->indexOf(QLatin1String(gridRowStretchPropertyC));
+ const int index = sheet->indexOf(gridRowStretchPropertyC);
Q_ASSERT(index != -1);
if (sheet->isChanged(index))
domLayout->setAttributeRowStretch(sheet->property(index).toString());
}
if (visibleMask & LayoutProperties::GridRowMinimumHeightProperty) {
- const int index = sheet->indexOf(QLatin1String(gridRowMinimumHeightPropertyC));
+ const int index = sheet->indexOf(gridRowMinimumHeightPropertyC);
Q_ASSERT(index != -1);
if (sheet->isChanged(index))
domLayout->setAttributeRowMinimumHeight(sheet->property(index).toString());
}
if (visibleMask & LayoutProperties::GridColumnMinimumWidthProperty) {
- const int index = sheet->indexOf(QLatin1String(gridColumnMinimumWidthPropertyC));
+ const int index = sheet->indexOf(gridColumnMinimumWidthPropertyC);
Q_ASSERT(index != -1);
if (sheet->isChanged(index))
domLayout->setAttributeColumnMinimumWidth(sheet->property(index).toString());
@@ -498,15 +475,15 @@ void LayoutPropertySheet::markChangedStretchProperties(QDesignerFormEditorInterf
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), lt);
Q_ASSERT(sheet);
if (!domLayout->attributeStretch().isEmpty())
- sheet->setChanged(sheet->indexOf(QLatin1String(boxStretchPropertyC)), true);
+ sheet->setChanged(sheet->indexOf(boxStretchPropertyC), true);
if (!domLayout->attributeRowStretch().isEmpty())
- sheet->setChanged(sheet->indexOf(QLatin1String(gridRowStretchPropertyC)), true);
+ sheet->setChanged(sheet->indexOf(gridRowStretchPropertyC), true);
if (!domLayout->attributeColumnStretch().isEmpty())
- sheet->setChanged(sheet->indexOf(QLatin1String(gridColumnStretchPropertyC)), true);
+ sheet->setChanged(sheet->indexOf(gridColumnStretchPropertyC), true);
if (!domLayout->attributeColumnMinimumWidth().isEmpty())
- sheet->setChanged(sheet->indexOf(QLatin1String(gridColumnMinimumWidthPropertyC)), true);
+ sheet->setChanged(sheet->indexOf(gridColumnMinimumWidthPropertyC), true);
if (!domLayout->attributeRowMinimumHeight().isEmpty())
- sheet->setChanged(sheet->indexOf(QLatin1String(gridRowMinimumHeightPropertyC)), true);
+ sheet->setChanged(sheet->indexOf(gridRowMinimumHeightPropertyC), true);
}
}
diff --git a/src/designer/src/components/formeditor/layout_propertysheet.h b/src/designer/src/components/formeditor/layout_propertysheet.h
index 559f09d4a..5d59071de 100644
--- a/src/designer/src/components/formeditor/layout_propertysheet.h
+++ b/src/designer/src/components/formeditor/layout_propertysheet.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef LAYOUT_PROPERTYSHEET_H
#define LAYOUT_PROPERTYSHEET_H
@@ -61,7 +36,7 @@ private:
QLayout *m_layout;
};
-typedef QDesignerPropertySheetFactory<QLayout, LayoutPropertySheet> LayoutPropertySheetFactory;
+using LayoutPropertySheetFactory = QDesignerPropertySheetFactory<QLayout, LayoutPropertySheet>;
} // namespace qdesigner_internal
QT_END_NAMESPACE
diff --git a/src/designer/src/components/formeditor/line_propertysheet.cpp b/src/designer/src/components/formeditor/line_propertysheet.cpp
index 3ad332015..b155e78db 100644
--- a/src/designer/src/components/formeditor/line_propertysheet.cpp
+++ b/src/designer/src/components/formeditor/line_propertysheet.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "line_propertysheet.h"
#include "formwindow.h"
@@ -38,7 +13,9 @@
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+using namespace Qt::StringLiterals;
+
+namespace qdesigner_internal {
LinePropertySheet::LinePropertySheet(Line *object, QObject *parent)
: QDesignerPropertySheet(object, parent)
@@ -52,7 +29,7 @@ bool LinePropertySheet::isVisible(int index) const
{
const QString name = propertyName(index);
- if (name == QStringLiteral("frameShape"))
+ if (name == "frameShape"_L1)
return false;
return QDesignerPropertySheet::isVisible(index);
}
@@ -67,4 +44,6 @@ QString LinePropertySheet::propertyGroup(int index) const
return QDesignerPropertySheet::propertyGroup(index);
}
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
diff --git a/src/designer/src/components/formeditor/line_propertysheet.h b/src/designer/src/components/formeditor/line_propertysheet.h
index 6d0ef613a..ba1dbe5a7 100644
--- a/src/designer/src/components/formeditor/line_propertysheet.h
+++ b/src/designer/src/components/formeditor/line_propertysheet.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef LINE_PROPERTYSHEET_H
#define LINE_PROPERTYSHEET_H
diff --git a/src/designer/src/components/formeditor/previewactiongroup.cpp b/src/designer/src/components/formeditor/previewactiongroup.cpp
index ea388da33..abcf0b8bd 100644
--- a/src/designer/src/components/formeditor/previewactiongroup.cpp
+++ b/src/designer/src/components/formeditor/previewactiongroup.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "previewactiongroup.h"
@@ -36,6 +11,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
enum { MaxDeviceActions = 20 };
namespace qdesigner_internal {
@@ -50,22 +27,17 @@ PreviewActionGroup::PreviewActionGroup(QDesignerFormEditorInterface *core, QObje
connect(this, &PreviewActionGroup::triggered, this, &PreviewActionGroup::slotTriggered);
setExclusive(true);
- const QString objNamePostfix = QStringLiteral("_action");
// Create invisible actions for devices. Set index as action data.
- QString objNamePrefix = QStringLiteral("__qt_designer_device_");
for (int i = 0; i < MaxDeviceActions; i++) {
QAction *a = new QAction(this);
- QString objName = objNamePrefix;
- objName += QString::number(i);
- objName += objNamePostfix;
- a->setObjectName(objName);
+ a->setObjectName(QString::asprintf("__qt_designer_device_%d_action", i));
a->setVisible(false);
a->setData(i);
addAction(a);
}
// Create separator at index MaxDeviceActions
QAction *sep = new QAction(this);
- sep->setObjectName(QStringLiteral("__qt_designer_deviceseparator"));
+ sep->setObjectName(u"__qt_designer_deviceseparator"_s);
sep->setSeparator(true);
sep->setVisible(false);
addAction(sep);
@@ -74,17 +46,12 @@ PreviewActionGroup::PreviewActionGroup(QDesignerFormEditorInterface *core, QObje
// Add style actions
const QStringList styles = QStyleFactory::keys();
- const QStringList::const_iterator cend = styles.constEnd();
// Make sure ObjectName is unique in case toolbar solution is used.
- objNamePrefix = QStringLiteral("__qt_designer_style_");
// Create styles. Set style name string as action data.
- for (QStringList::const_iterator it = styles.constBegin(); it != cend ;++it) {
- QAction *a = new QAction(tr("%1 Style").arg(*it), this);
- QString objName = objNamePrefix;
- objName += *it;
- objName += objNamePostfix;
- a->setObjectName(objName);
- a->setData(*it);
+ for (const auto &s : styles) {
+ QAction *a = new QAction(tr("%1 Style").arg(s), this);
+ a->setObjectName("__qt_designer_style_"_L1 + s + "_action"_L1);
+ a->setData(s);
addAction(a);
}
}
diff --git a/src/designer/src/components/formeditor/previewactiongroup.h b/src/designer/src/components/formeditor/previewactiongroup.h
index dae1abbe1..cb0ee0a19 100644
--- a/src/designer/src/components/formeditor/previewactiongroup.h
+++ b/src/designer/src/components/formeditor/previewactiongroup.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/components/formeditor/qdesigner_resource.cpp b/src/designer/src/components/formeditor/qdesigner_resource.cpp
index e46a01bfa..1dc7aa735 100644
--- a/src/designer/src/components/formeditor/qdesigner_resource.cpp
+++ b/src/designer/src/components/formeditor/qdesigner_resource.cpp
@@ -1,35 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_resource.h"
#include "formwindow.h"
#include "dynamicpropertysheet.h"
#include "qdesigner_tabwidget_p.h"
+#include "iconloader_p.h"
#include "qdesigner_toolbox_p.h"
#include "qdesigner_stackedbox_p.h"
#include "qdesigner_toolbar_p.h"
@@ -108,12 +84,16 @@ Q_DECLARE_METATYPE(QWidgetList)
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
+using QFBE = QFormBuilderExtra;
+
namespace {
using DomPropertyList = QList<DomProperty *>;
}
-static const char *currentUiVersion = "4.0";
-static const char *clipboardObjectName = "__qt_fake_top_level";
+static constexpr auto currentUiVersion = "4.0"_L1;
+static constexpr auto clipboardObjectName = "__qt_fake_top_level"_L1;
#define OLD_RESOURCE_FORMAT // Support pre 4.4 format.
@@ -193,7 +173,16 @@ QVariant QDesignerResourceBuilder::loadResource(const QDir &workingDirectory, co
case DomProperty::IconSet: {
PropertySheetIconValue icon;
DomResourceIcon *di = property->elementIconSet();
- icon.setTheme(di->attributeTheme());
+ const bool hasTheme = di->hasAttributeTheme();
+ if (hasTheme) {
+ const QString &theme = di->attributeTheme();
+ const qsizetype themeEnum = theme.startsWith("QIcon::"_L1)
+ ? QDesignerResourceBuilder::themeIconIndex(theme) : -1;
+ if (themeEnum != -1)
+ icon.setThemeEnum(themeEnum);
+ else
+ icon.setTheme(theme);
+ }
if (const int flags = iconStateFlags(di)) { // new, post 4.4 format
if (flags & NormalOff)
setIconPixmap(QIcon::Normal, QIcon::Off, workingDirectory, di->elementNormalOff()->text(), icon, m_lang);
@@ -211,7 +200,7 @@ QVariant QDesignerResourceBuilder::loadResource(const QDir &workingDirectory, co
setIconPixmap(QIcon::Selected, QIcon::Off, workingDirectory, di->elementSelectedOff()->text(), icon, m_lang);
if (flags & SelectedOn)
setIconPixmap(QIcon::Selected, QIcon::On, workingDirectory, di->elementSelectedOn()->text(), icon, m_lang);
- } else {
+ } else if (!hasTheme) {
#ifdef OLD_RESOURCE_FORMAT
setIconPixmap(QIcon::Normal, QIcon::Off, workingDirectory, di->text(), icon, m_lang);
if (di->hasAttributeResource())
@@ -269,8 +258,10 @@ DomProperty *QDesignerResourceBuilder::saveResource(const QDir &workingDirectory
}
if (value.canConvert<PropertySheetIconValue>()) {
const PropertySheetIconValue icon = qvariant_cast<PropertySheetIconValue>(value);
- const QMap<QPair<QIcon::Mode, QIcon::State>, PropertySheetPixmapValue> pixmaps = icon.paths();
- const QString theme = icon.theme();
+ const auto &pixmaps = icon.paths();
+ const int themeEnum = icon.themeEnum();
+ const QString theme = themeEnum != -1
+ ? QDesignerResourceBuilder::fullyQualifiedThemeIconName(themeEnum) : icon.theme();
if (!pixmaps.isEmpty() || !theme.isEmpty()) {
DomResourceIcon *ri = new DomResourceIcon;
if (!theme.isEmpty())
@@ -343,7 +334,7 @@ inline void translationParametersToDom(const PropertySheetTranslatableData &data
if (!id.isEmpty())
e->setAttributeId(id);
if (!data.translatable())
- e->setAttributeNotr(QStringLiteral("true"));
+ e->setAttributeNotr(u"true"_s);
}
template <class DomElement> // for DomString, potentially DomStringList
@@ -357,7 +348,7 @@ inline void translationParametersFromDom(const DomElement *e, PropertySheetTrans
data->setId(e->attributeId());
if (e->hasAttributeNotr()) {
const QString notr = e->attributeNotr();
- const bool translatable = !(notr == QStringLiteral("true") || notr == QStringLiteral("yes"));
+ const bool translatable = !(notr == "true"_L1 || notr == "yes"_L1);
data->setTranslatable(translatable);
}
}
@@ -439,19 +430,18 @@ QDesignerResource::QDesignerResource(FormWindow *formWindow) :
setTextBuilder(new QDesignerTextBuilder());
// ### generalise
- const QString designerWidget = QStringLiteral("QDesignerWidget");
- const QString layoutWidget = QStringLiteral("QLayoutWidget");
- const QString widget = QStringLiteral("QWidget");
+ const QString designerWidget = u"QDesignerWidget"_s;
+ const QString layoutWidget = u"QLayoutWidget"_s;
+ const QString widget = u"QWidget"_s;
m_internal_to_qt.insert(layoutWidget, widget);
m_internal_to_qt.insert(designerWidget, widget);
- m_internal_to_qt.insert(QStringLiteral("QDesignerDialog"), QStringLiteral("QDialog"));
- m_internal_to_qt.insert(QStringLiteral("QDesignerMenuBar"), QStringLiteral("QMenuBar"));
- m_internal_to_qt.insert(QStringLiteral("QDesignerMenu"), QStringLiteral("QMenu"));
- m_internal_to_qt.insert(QStringLiteral("QDesignerDockWidget"), QStringLiteral("QDockWidget"));
+ m_internal_to_qt.insert(u"QDesignerDialog"_s, u"QDialog"_s);
+ m_internal_to_qt.insert(u"QDesignerMenuBar"_s, u"QMenuBar"_s);
+ m_internal_to_qt.insert(u"QDesignerMenu"_s, u"QMenu"_s);
+ m_internal_to_qt.insert(u"QDesignerDockWidget"_s, u"QDockWidget"_s);
// invert
- QHash<QString, QString>::const_iterator cend = m_internal_to_qt.constEnd();
- for (QHash<QString, QString>::const_iterator it = m_internal_to_qt.constBegin();it != cend; ++it ) {
+ for (auto it = m_internal_to_qt.cbegin(), cend = m_internal_to_qt.cend(); it != cend; ++it ) {
if (it.value() != designerWidget && it.value() != layoutWidget)
m_qt_to_internal.insert(it.value(), it.key());
@@ -467,7 +457,7 @@ DomUI *QDesignerResource::readUi(QIODevice *dev)
static inline QString messageBoxTitle()
{
- return QApplication::translate("Designer", "Qt Designer");
+ return QApplication::translate("Designer", "Qt Widgets Designer");
}
void QDesignerResource::save(QIODevice *dev, QWidget *widget)
@@ -482,7 +472,7 @@ void QDesignerResource::saveDom(DomUI *ui, QWidget *widget)
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), widget);
Q_ASSERT(sheet != nullptr);
- const QVariant classVar = sheet->property(sheet->indexOf(QStringLiteral("objectName")));
+ const QVariant classVar = sheet->property(sheet->indexOf(u"objectName"_s));
QString classStr;
if (classVar.canConvert<QString>())
classStr = classVar.toString();
@@ -519,8 +509,7 @@ void QDesignerResource::saveDom(DomUI *ui, QWidget *widget)
const QVariantMap designerFormData = m_formWindow->formData();
if (!designerFormData.isEmpty()) {
DomPropertyList domPropertyList;
- const QVariantMap::const_iterator cend = designerFormData.constEnd();
- for (QVariantMap::const_iterator it = designerFormData.constBegin(); it != cend; ++it) {
+ for (auto it = designerFormData.cbegin(), cend = designerFormData.cend(); it != cend; ++it) {
if (DomProperty *prop = variantToDomProperty(this, widget->metaObject(), it.key(), it.value()))
domPropertyList += prop;
}
@@ -532,8 +521,8 @@ void QDesignerResource::saveDom(DomUI *ui, QWidget *widget)
}
if (!m_formWindow->includeHints().isEmpty()) {
- const QString local = QStringLiteral("local");
- const QString global = QStringLiteral("global");
+ const QString local = u"local"_s;
+ const QString global = u"global"_s;
QList<DomInclude *> ui_includes;
const QStringList &includeHints = m_formWindow->includeHints();
ui_includes.reserve(includeHints.size());
@@ -541,10 +530,10 @@ void QDesignerResource::saveDom(DomUI *ui, QWidget *widget)
if (includeHint.isEmpty())
continue;
DomInclude *incl = new DomInclude;
- const QString location = includeHint.at(0) == QLatin1Char('<') ? global : local;
- includeHint.remove(QLatin1Char('"'));
- includeHint.remove(QLatin1Char('<'));
- includeHint.remove(QLatin1Char('>'));
+ const QString location = includeHint.at(0) == u'<' ? global : local;
+ includeHint.remove(u'"');
+ includeHint.remove(u'<');
+ includeHint.remove(u'>');
incl->setAttributeLocation(location);
incl->setText(includeHint);
ui_includes.append(incl);
@@ -665,11 +654,10 @@ QWidget *QDesignerResource::create(DomUI *ui, QWidget *parentWidget)
QVariantMap designerFormData;
if (ui->hasElementDesignerdata()) {
const DomPropertyList domPropertyList = ui->elementDesignerdata()->elementProperty();
- const DomPropertyList::const_iterator cend = domPropertyList.constEnd();
- for (DomPropertyList::const_iterator it = domPropertyList.constBegin(); it != cend; ++it) {
- const QVariant vprop = domPropertyToVariant(this, mainWidget->metaObject(), *it);
+ for (auto *prop : domPropertyList) {
+ const QVariant vprop = domPropertyToVariant(this, mainWidget->metaObject(), prop);
if (vprop.metaType().id() != QMetaType::UnknownType)
- designerFormData.insert((*it)->attributeName(), vprop);
+ designerFormData.insert(prop->attributeName(), vprop);
}
}
m_formWindow->setFormData(designerFormData);
@@ -685,7 +673,7 @@ QWidget *QDesignerResource::create(DomUI *ui, QWidget *parentWidget)
}
if (DomIncludes *includes = ui->elementIncludes()) {
- const QString global = QStringLiteral("global");
+ const auto global = "global"_L1;
QStringList includeHints;
const auto &elementInclude = includes->elementInclude();
for (DomInclude *incl : elementInclude) {
@@ -695,9 +683,11 @@ QWidget *QDesignerResource::create(DomUI *ui, QWidget *parentWidget)
continue;
if (incl->hasAttributeLocation() && incl->attributeLocation() == global ) {
- text = text.prepend(QLatin1Char('<')).append(QLatin1Char('>'));
+ text.prepend(u'<');
+ text.append(u'>');
} else {
- text = text.prepend(QLatin1Char('"')).append(QLatin1Char('"'));
+ text.prepend(u'"');
+ text.append(u'"');
}
includeHints.append(text);
@@ -708,13 +698,10 @@ QWidget *QDesignerResource::create(DomUI *ui, QWidget *parentWidget)
// Register all button groups the form builder adds as children of the main container for them to be found
// in the signal slot editor
- const QObjectList mchildren = mainWidget->children();
- if (!mchildren.isEmpty()) {
- QDesignerMetaDataBaseInterface *mdb = core()->metaDataBase();
- const QObjectList::const_iterator cend = mchildren.constEnd();
- for (QObjectList::const_iterator it = mchildren.constBegin(); it != cend; ++it)
- if (QButtonGroup *bg = qobject_cast<QButtonGroup*>(*it))
- mdb->add(bg);
+ auto *mdb = core()->metaDataBase();
+ for (auto *child : mainWidget->children()) {
+ if (QButtonGroup *bg = qobject_cast<QButtonGroup*>(child))
+ mdb->add(bg);
}
// Load tools
for (int index = 0; index < m_formWindow->toolCount(); ++index) {
@@ -742,9 +729,8 @@ QWidget *QDesignerResource::create(DomUI *ui, QWidget *parentWidget)
bool hasExplicitGeometry = false;
const auto &properties = ui->elementWidget()->elementProperty();
if (!properties.isEmpty()) {
- const QString geometry = QStringLiteral("geometry");
for (const DomProperty *p : properties) {
- if (p->attributeName() == geometry) {
+ if (p->attributeName() == "geometry"_L1) {
hasExplicitGeometry = true;
break;
}
@@ -786,7 +772,7 @@ QWidget *QDesignerResource::create(DomUI *ui, QWidget *parentWidget)
QWidget *QDesignerResource::create(DomWidget *ui_widget, QWidget *parentWidget)
{
const QString className = ui_widget->attributeClass();
- if (!m_isMainWidget && className == QStringLiteral("QWidget")
+ if (!m_isMainWidget && className == "QWidget"_L1
&& !ui_widget->elementLayout().isEmpty()
&& !ui_widget->hasAttributeNative()) {
// ### check if elementLayout.size() == 1
@@ -795,7 +781,7 @@ QWidget *QDesignerResource::create(DomWidget *ui_widget, QWidget *parentWidget)
if (container == nullptr) {
// generate a QLayoutWidget iff the parent is not an QDesignerContainerExtension.
- ui_widget->setAttributeClass(QStringLiteral("QLayoutWidget"));
+ ui_widget->setAttributeClass(u"QLayoutWidget"_s);
}
}
@@ -820,7 +806,7 @@ QWidget *QDesignerResource::create(DomWidget *ui_widget, QWidget *parentWidget)
for (DomActionRef *ui_action_ref : actionRefs) {
const QString name = ui_action_ref->attributeName();
- if (name == QStringLiteral("separator")) {
+ if (name == "separator"_L1) {
QAction *sep = new QAction(w);
sep->setSeparator(true);
w->addAction(sep);
@@ -866,7 +852,7 @@ QLayoutItem *QDesignerResource::create(DomLayoutItem *ui_layoutItem, QLayout *la
{
if (ui_layoutItem->kind() == DomLayoutItem::Spacer) {
const DomSpacer *domSpacer = ui_layoutItem->elementSpacer();
- Spacer *spacer = static_cast<Spacer*>(core()->widgetFactory()->createWidget(QStringLiteral("Spacer"), parentWidget));
+ Spacer *spacer = static_cast<Spacer*>(core()->widgetFactory()->createWidget(u"Spacer"_s, parentWidget));
if (domSpacer->hasAttributeName())
changeObjectName(spacer, domSpacer->attributeName());
core()->metaDataBase()->add(spacer);
@@ -878,7 +864,7 @@ QLayoutItem *QDesignerResource::create(DomLayoutItem *ui_layoutItem, QLayout *la
if (m_formWindow) {
m_formWindow->manageWidget(spacer);
if (QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), spacer))
- sheet->setChanged(sheet->indexOf(QStringLiteral("orientation")), true);
+ sheet->setChanged(sheet->indexOf(u"orientation"_s), true);
}
return new QWidgetItem(spacer);
@@ -975,13 +961,12 @@ void QDesignerResource::applyProperties(QObject *o, const QList<DomProperty*> &p
QDesignerDynamicPropertySheetExtension *dynamicSheet = qt_extension<QDesignerDynamicPropertySheetExtension*>(core()->extensionManager(), o);
const bool dynamicPropertiesAllowed = dynamicSheet && dynamicSheet->dynamicPropertiesAllowed();
- const QString objectNameProperty = QStringLiteral("objectName");
for (DomProperty *p : properties) {
if (isDeprecatedQt5Property(o, p)) // ### fixme Qt 7 remove this
continue; // ### fixme Qt 7 remove this: Exclude deprecated value of Qt 5.
QString propertyName = p->attributeName();
- if (propertyName == QLatin1String("numDigits") && o->inherits("QLCDNumber")) // Deprecated in Qt 4, removed in Qt 5.
- propertyName = QLatin1String("digitCount");
+ if (propertyName == "numDigits"_L1 && o->inherits("QLCDNumber")) // Deprecated in Qt 4, removed in Qt 5.
+ propertyName = u"digitCount"_s;
const int index = sheet->indexOf(propertyName);
QVariant v;
if (!readDomEnumerationValue(p, sheet, index, v))
@@ -1044,7 +1029,7 @@ void QDesignerResource::applyProperties(QObject *o, const QList<DomProperty*> &p
}
}
- if (propertyName == objectNameProperty)
+ if (propertyName == "objectName"_L1)
changeObjectName(o, o->objectName());
}
}
@@ -1161,9 +1146,8 @@ DomWidget *QDesignerResource::createDom(QWidget *widget, DomWidget *ui_parentWid
Q_ASSERT( w != nullptr );
- if (!qobject_cast<QLayoutWidget*>(widget) && w->attributeClass() == QStringLiteral("QWidget")) {
+ if (!qobject_cast<QLayoutWidget*>(widget) && w->attributeClass() == "QWidget"_L1)
w->setAttributeNative(true);
- }
const QString className = w->attributeClass();
if (m_internal_to_qt.contains(className))
@@ -1176,7 +1160,7 @@ DomWidget *QDesignerResource::createDom(QWidget *widget, DomWidget *ui_parentWid
const auto &prop_list = w->elementProperty();
for (DomProperty *prop : prop_list) {
- if (prop->attributeName() == QStringLiteral("geometry")) {
+ if (prop->attributeName() == "geometry"_L1) {
if (DomRect *rect = prop->elementRect()) {
rect->setElementX(widget->x());
rect->setElementY(widget->y());
@@ -1273,7 +1257,7 @@ DomTabStops *QDesignerResource::saveTabStops()
tabStops.append(widget->objectName());
}
- if (tabStops.count()) {
+ if (!tabStops.isEmpty()) {
DomTabStops *dom = new DomTabStops;
dom->setElementTabStop(tabStops);
return dom;
@@ -1366,13 +1350,13 @@ DomWidget *QDesignerResource::saveWidget(QToolBar *toolBar, DomWidget *ui_parent
auto attributes = ui_widget->elementAttribute();
DomProperty *attr = new DomProperty();
- attr->setAttributeName(QStringLiteral("toolBarArea"));
- attr->setElementEnum(QLatin1String(toolBarAreaMetaEnum().valueToKey(area)));
+ attr->setAttributeName(u"toolBarArea"_s);
+ attr->setElementEnum(QLatin1StringView(toolBarAreaMetaEnum().valueToKey(area)));
attributes << attr;
attr = new DomProperty();
- attr->setAttributeName(QStringLiteral("toolBarBreak"));
- attr->setElementBool(toolBarBreak ? QLatin1String("true") : QLatin1String("false"));
+ attr->setAttributeName(u"toolBarBreak"_s);
+ attr->setElementBool(toolBarBreak ? u"true"_s : u"false"_s);
attributes << attr;
ui_widget->setElementAttribute(attributes);
}
@@ -1386,7 +1370,7 @@ DomWidget *QDesignerResource::saveWidget(QDesignerDockWidget *dockWidget, DomWid
if (QMainWindow *mainWindow = qobject_cast<QMainWindow*>(dockWidget->parentWidget())) {
const Qt::DockWidgetArea area = mainWindow->dockWidgetArea(dockWidget);
DomProperty *attr = new DomProperty();
- attr->setAttributeName(QStringLiteral("dockWidgetArea"));
+ attr->setAttributeName(u"dockWidgetArea"_s);
attr->setElementNumber(int(area));
ui_widget->setElementAttribute(ui_widget->elementAttribute() << attr);
}
@@ -1412,39 +1396,38 @@ DomWidget *QDesignerResource::saveWidget(QTabWidget *widget, DomWidget *ui_paren
}
QList<DomProperty*> ui_attribute_list;
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
// attribute `icon'
widget->setCurrentIndex(i);
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), widget);
- PropertySheetIconValue icon = qvariant_cast<PropertySheetIconValue>(sheet->property(sheet->indexOf(QStringLiteral("currentTabIcon"))));
+ PropertySheetIconValue icon = qvariant_cast<PropertySheetIconValue>(sheet->property(sheet->indexOf(u"currentTabIcon"_s)));
DomProperty *p = resourceBuilder()->saveResource(workingDirectory(), QVariant::fromValue(icon));
if (p) {
- p->setAttributeName(strings.iconAttribute);
+ p->setAttributeName(QFormBuilderStrings::iconAttribute);
ui_attribute_list.append(p);
}
// attribute `title'
- p = textBuilder()->saveText(sheet->property(sheet->indexOf(QStringLiteral("currentTabText"))));
+ p = textBuilder()->saveText(sheet->property(sheet->indexOf(u"currentTabText"_s)));
if (p) {
- p->setAttributeName(strings.titleAttribute);
+ p->setAttributeName(QFormBuilderStrings::titleAttribute);
ui_attribute_list.append(p);
}
// attribute `toolTip'
- QVariant v = sheet->property(sheet->indexOf(QStringLiteral("currentTabToolTip")));
+ QVariant v = sheet->property(sheet->indexOf(u"currentTabToolTip"_s));
if (!qvariant_cast<PropertySheetStringValue>(v).value().isEmpty()) {
p = textBuilder()->saveText(v);
if (p) {
- p->setAttributeName(strings.toolTipAttribute);
+ p->setAttributeName(QFormBuilderStrings::toolTipAttribute);
ui_attribute_list.append(p);
}
}
// attribute `whatsThis'
- v = sheet->property(sheet->indexOf(QStringLiteral("currentTabWhatsThis")));
+ v = sheet->property(sheet->indexOf(u"currentTabWhatsThis"_s));
if (!qvariant_cast<PropertySheetStringValue>(v).value().isEmpty()) {
p = textBuilder()->saveText(v);
if (p) {
- p->setAttributeName(strings.whatsThisAttribute);
+ p->setAttributeName(QFormBuilderStrings::whatsThisAttribute);
ui_attribute_list.append(p);
}
}
@@ -1481,29 +1464,27 @@ DomWidget *QDesignerResource::saveWidget(QToolBox *widget, DomWidget *ui_parentW
// attribute `label'
QList<DomProperty*> ui_attribute_list;
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
-
// attribute `icon'
widget->setCurrentIndex(i);
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), widget);
- PropertySheetIconValue icon = qvariant_cast<PropertySheetIconValue>(sheet->property(sheet->indexOf(QStringLiteral("currentItemIcon"))));
+ PropertySheetIconValue icon = qvariant_cast<PropertySheetIconValue>(sheet->property(sheet->indexOf(u"currentItemIcon"_s)));
DomProperty *p = resourceBuilder()->saveResource(workingDirectory(), QVariant::fromValue(icon));
if (p) {
- p->setAttributeName(strings.iconAttribute);
+ p->setAttributeName(QFormBuilderStrings::iconAttribute);
ui_attribute_list.append(p);
}
- p = textBuilder()->saveText(sheet->property(sheet->indexOf(QStringLiteral("currentItemText"))));
+ p = textBuilder()->saveText(sheet->property(sheet->indexOf(u"currentItemText"_s)));
if (p) {
- p->setAttributeName(strings.labelAttribute);
+ p->setAttributeName(QFormBuilderStrings::labelAttribute);
ui_attribute_list.append(p);
}
// attribute `toolTip'
- QVariant v = sheet->property(sheet->indexOf(QStringLiteral("currentItemToolTip")));
+ QVariant v = sheet->property(sheet->indexOf(u"currentItemToolTip"_s));
if (!qvariant_cast<PropertySheetStringValue>(v).value().isEmpty()) {
p = textBuilder()->saveText(v);
if (p) {
- p->setAttributeName(strings.toolTipAttribute);
+ p->setAttributeName(QFormBuilderStrings::toolTipAttribute);
ui_attribute_list.append(p);
}
}
@@ -1525,12 +1506,12 @@ DomWidget *QDesignerResource::saveWidget(QWizardPage *wizardPage, DomWidget *ui_
DomWidget *ui_widget = QAbstractFormBuilder::createDom(wizardPage, ui_parentWidget, true);
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), wizardPage);
// Save the page id (string) attribute, append to existing attributes
- const QString pageIdPropertyName = QLatin1String(QWizardPagePropertySheet::pageIdProperty);
+ const QString pageIdPropertyName = QLatin1StringView(QWizardPagePropertySheet::pageIdProperty);
const int pageIdIndex = sheet->indexOf(pageIdPropertyName);
if (pageIdIndex != -1 && sheet->isChanged(pageIdIndex)) {
DomProperty *property = variantToDomProperty(this, wizardPage->metaObject(), pageIdPropertyName, sheet->property(pageIdIndex));
Q_ASSERT(property);
- property->elementString()->setAttributeNotr(QStringLiteral("true"));
+ property->elementString()->setAttributeNotr(u"true"_s);
DomPropertyList attributes = ui_widget->elementAttribute();
attributes.push_back(property);
ui_widget->setElementAttribute(attributes);
@@ -1560,14 +1541,14 @@ bool QDesignerResource::checkProperty(QObject *obj, const QString &prop) const
if (pindex != -1 && !meta->property(pindex)->attributes().testFlag(QDesignerMetaPropertyInterface::StoredAttribute))
return false;
- if (prop == QStringLiteral("objectName") || prop == QStringLiteral("spacerName")) // ### don't store the property objectName
+ if (prop == "objectName"_L1 || prop == "spacerName"_L1) // ### don't store the property objectName
return false;
QWidget *check_widget = nullptr;
if (obj->isWidgetType())
check_widget = static_cast<QWidget*>(obj);
- if (check_widget && prop == QStringLiteral("geometry")) {
+ if (check_widget && prop == "geometry"_L1) {
if (check_widget == m_formWindow->mainContainer())
return true; // Save although maincontainer is technically laid-out by embedding container
if (m_selected && m_selected == check_widget)
@@ -1633,25 +1614,23 @@ bool QDesignerResource::addItem(DomWidget *ui_widget, QWidget *widget, QWidget *
tabWidget->setCurrentIndex(tabIndex);
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
-
- const DomPropertyHash attributes = propertyMap(ui_widget->elementAttribute());
+ const auto &attributes = ui_widget->elementAttribute();
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), parentWidget);
- if (DomProperty *picon = attributes.value(strings.iconAttribute)) {
+ if (auto *picon = QFBE::propertyByName(attributes, QFormBuilderStrings::iconAttribute)) {
QVariant v = resourceBuilder()->loadResource(workingDirectory(), picon);
- sheet->setProperty(sheet->indexOf(QStringLiteral("currentTabIcon")), v);
+ sheet->setProperty(sheet->indexOf(u"currentTabIcon"_s), v);
}
- if (DomProperty *ptext = attributes.value(strings.titleAttribute)) {
+ if (auto *ptext = QFBE::propertyByName(attributes, QFormBuilderStrings::titleAttribute)) {
QVariant v = textBuilder()->loadText(ptext);
- sheet->setProperty(sheet->indexOf(QStringLiteral("currentTabText")), v);
+ sheet->setProperty(sheet->indexOf(u"currentTabText"_s), v);
}
- if (DomProperty *ptext = attributes.value(strings.toolTipAttribute)) {
+ if (auto *ptext = QFBE::propertyByName(attributes, QFormBuilderStrings::toolTipAttribute)) {
QVariant v = textBuilder()->loadText(ptext);
- sheet->setProperty(sheet->indexOf(QStringLiteral("currentTabToolTip")), v);
+ sheet->setProperty(sheet->indexOf(u"currentTabToolTip"_s), v);
}
- if (DomProperty *ptext = attributes.value(strings.whatsThisAttribute)) {
+ if (auto *ptext = QFBE::propertyByName(attributes, QFormBuilderStrings::whatsThisAttribute)) {
QVariant v = textBuilder()->loadText(ptext);
- sheet->setProperty(sheet->indexOf(QStringLiteral("currentTabWhatsThis")), v);
+ sheet->setProperty(sheet->indexOf(u"currentTabWhatsThis"_s), v);
}
tabWidget->setCurrentIndex(current);
} else if (QToolBox *toolBox = qobject_cast<QToolBox*>(parentWidget)) {
@@ -1660,21 +1639,19 @@ bool QDesignerResource::addItem(DomWidget *ui_widget, QWidget *widget, QWidget *
toolBox->setCurrentIndex(itemIndex);
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
-
- const DomPropertyHash attributes = propertyMap(ui_widget->elementAttribute());
+ const auto &attributes = ui_widget->elementAttribute();
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), parentWidget);
- if (DomProperty *picon = attributes.value(strings.iconAttribute)) {
+ if (auto *picon = QFBE::propertyByName(attributes, QFormBuilderStrings::iconAttribute)) {
QVariant v = resourceBuilder()->loadResource(workingDirectory(), picon);
- sheet->setProperty(sheet->indexOf(QStringLiteral("currentItemIcon")), v);
+ sheet->setProperty(sheet->indexOf(u"currentItemIcon"_s), v);
}
- if (DomProperty *ptext = attributes.value(strings.labelAttribute)) {
+ if (auto *ptext = QFBE::propertyByName(attributes, QFormBuilderStrings::labelAttribute)) {
QVariant v = textBuilder()->loadText(ptext);
- sheet->setProperty(sheet->indexOf(QStringLiteral("currentItemText")), v);
+ sheet->setProperty(sheet->indexOf(u"currentItemText"_s), v);
}
- if (DomProperty *ptext = attributes.value(strings.toolTipAttribute)) {
+ if (auto *ptext = QFBE::propertyByName(attributes, QFormBuilderStrings::toolTipAttribute)) {
QVariant v = textBuilder()->loadText(ptext);
- sheet->setProperty(sheet->indexOf(QStringLiteral("currentItemToolTip")), v);
+ sheet->setProperty(sheet->indexOf(u"currentItemToolTip"_s), v);
}
toolBox->setCurrentIndex(current);
}
@@ -1712,14 +1689,12 @@ DomUI *QDesignerResource::copy(const FormBuilderClipboard &selection)
m_copyWidget = true;
DomWidget *ui_widget = new DomWidget();
- ui_widget->setAttributeName(QLatin1String(clipboardObjectName));
+ ui_widget->setAttributeName(clipboardObjectName);
bool hasItems = false;
// Widgets
if (!selection.m_widgets.isEmpty()) {
QList<DomWidget *> ui_widget_list;
- const int size = selection.m_widgets.size();
- for (int i=0; i< size; ++i) {
- QWidget *w = selection.m_widgets.at(i);
+ for (auto *w : selection.m_widgets) {
m_selected = w;
DomWidget *ui_child = createDom(w, ui_widget);
m_selected = nullptr;
@@ -1734,7 +1709,7 @@ DomUI *QDesignerResource::copy(const FormBuilderClipboard &selection)
// actions
if (!selection.m_actions.isEmpty()) {
QList<DomAction *> domActions;
- for (QAction* action : qAsConst(selection.m_actions)) {
+ for (QAction* action : std::as_const(selection.m_actions)) {
if (DomAction *domAction = createDom(action))
domActions += domAction;
}
@@ -1753,7 +1728,7 @@ DomUI *QDesignerResource::copy(const FormBuilderClipboard &selection)
}
// UI
DomUI *ui = new DomUI();
- ui->setAttributeVersion(QLatin1String(currentUiVersion));
+ ui->setAttributeVersion(currentUiVersion);
ui->setElementWidget(ui_widget);
ui->setElementResources(saveResources(m_resourceBuilder->usedQrcFiles()));
if (DomCustomWidgets *cws = saveCustomWidgets())
@@ -1805,10 +1780,9 @@ FormBuilderClipboard QDesignerResource::paste(QIODevice *dev, QWidget *widgetPar
QXmlStreamReader reader(dev);
bool uiInitialized = false;
- const QString uiElement = QStringLiteral("ui");
while (!reader.atEnd()) {
if (reader.readNext() == QXmlStreamReader::StartElement) {
- if (reader.name().compare(uiElement, Qt::CaseInsensitive)) {
+ if (reader.name().compare("ui"_L1, Qt::CaseInsensitive)) {
ui.read(reader);
uiInitialized = true;
} else {
@@ -1851,10 +1825,7 @@ DomCustomWidgets *QDesignerResource::saveCustomWidgets()
QDesignerFormEditorInterface *core = m_formWindow->core();
QDesignerWidgetDataBaseInterface *db = core->widgetDataBase();
const bool isInternalWidgetDataBase = qobject_cast<const WidgetDataBase *>(db);
- typedef QMap<int,DomCustomWidget*> OrderedDBIndexDomCustomWidgetMap;
- OrderedDBIndexDomCustomWidgetMap orderedMap;
-
- const QString global = QStringLiteral("global");
+ QMap<int, DomCustomWidget *> orderedMap;
for (auto it = m_usedCustomWidgets.cbegin(), end = m_usedCustomWidgets.cend(); it != end; ++it) {
QDesignerWidgetDataBaseItemInterface *item = it.key();
@@ -1870,7 +1841,7 @@ DomCustomWidgets *QDesignerResource::saveCustomWidgets()
const IncludeSpecification spec = includeSpecification(item->includeFile());
header->setText(spec.first);
if (spec.second == IncludeGlobal) {
- header->setAttributeLocation(global);
+ header->setAttributeLocation(u"global"_s);
}
custom_widget->setElementHeader(header);
custom_widget->setElementExtends(item->extends());
@@ -1903,8 +1874,8 @@ bool QDesignerResource::canCompressSpacings(QObject *object) const
{
if (QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), object)) {
if (qobject_cast<QGridLayout *>(object)) {
- const int h = sheet->property(sheet->indexOf(QStringLiteral("horizontalSpacing"))).toInt();
- const int v = sheet->property(sheet->indexOf(QStringLiteral("verticalSpacing"))).toInt();
+ const int h = sheet->property(sheet->indexOf(u"horizontalSpacing"_s)).toInt();
+ const int v = sheet->property(sheet->indexOf(u"verticalSpacing"_s)).toInt();
if (h == v)
return true;
}
@@ -1926,13 +1897,13 @@ QList<DomProperty*> QDesignerResource::computeProperties(QObject *object)
const QString propertyName = sheet->propertyName(index);
// Suppress windowModality in legacy forms that have it set on child widgets
- if (propertyName == QStringLiteral("windowModality") && !sheet->isVisible(index))
+ if (propertyName == "windowModality"_L1 && !sheet->isVisible(index))
continue;
const QVariant value = sheet->property(index);
if (DomProperty *p = createProperty(object, propertyName, value)) {
- if (compressSpacings && (propertyName == QStringLiteral("horizontalSpacing")
- || propertyName == QStringLiteral("verticalSpacing"))) {
+ if (compressSpacings && (propertyName == "horizontalSpacing"_L1
+ || propertyName == "verticalSpacing"_L1)) {
spacingProperties.append(p);
} else {
properties.append(p);
@@ -1940,9 +1911,9 @@ QList<DomProperty*> QDesignerResource::computeProperties(QObject *object)
}
}
if (compressSpacings) {
- if (spacingProperties.count() == 2) {
+ if (spacingProperties.size() == 2) {
DomProperty *spacingProperty = spacingProperties.at(0);
- spacingProperty->setAttributeName(QStringLiteral("spacing"));
+ spacingProperty->setAttributeName(u"spacing"_s);
properties.append(spacingProperty);
delete spacingProperties.at(1);
} else {
@@ -2147,7 +2118,8 @@ DomResources *QDesignerResource::saveResources(const QStringList &qrcPaths)
QString conv_path = path;
if (m_resourceBuilder->isSaveRelative())
conv_path = m_formWindow->absoluteDir().relativeFilePath(path);
- dom_res->setAttributeLocation(conv_path.replace(QDir::separator(), QLatin1Char('/')));
+ conv_path.replace(QDir::separator(), u'/');
+ dom_res->setAttributeLocation(conv_path);
dom_include.append(dom_res);
}
}
@@ -2238,15 +2210,14 @@ void QDesignerResource::applyAttributesToPropertySheet(const DomWidget *ui_widge
if (attributes.isEmpty())
return;
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(m_formWindow->core()->extensionManager(), widget);
- const DomPropertyList::const_iterator acend = attributes.constEnd();
- for (DomPropertyList::const_iterator it = attributes.constBegin(); it != acend; ++it) {
- const QString name = (*it)->attributeName();
+ for (auto *prop : attributes) {
+ const QString name = prop->attributeName();
const int index = sheet->indexOf(name);
if (index == -1) {
- const QString msg = QString::fromUtf8("Unable to apply attributive property '%1' to '%2'. It does not exist.").arg(name, widget->objectName());
+ const QString msg = "Unable to apply attributive property '%1' to '%2'. It does not exist."_L1.arg(name, widget->objectName());
designerWarning(msg);
} else {
- sheet->setProperty(index, domPropertyToVariant(this, widget->metaObject(), *it));
+ sheet->setProperty(index, domPropertyToVariant(this, widget->metaObject(), prop));
sheet->setChanged(index, true);
}
}
diff --git a/src/designer/src/components/formeditor/qdesigner_resource.h b/src/designer/src/components/formeditor/qdesigner_resource.h
index d667f1372..7466744ca 100644
--- a/src/designer/src/components/formeditor/qdesigner_resource.h
+++ b/src/designer/src/components/formeditor/qdesigner_resource.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QDESIGNER_RESOURCE_H
#define QDESIGNER_RESOURCE_H
diff --git a/src/designer/src/components/formeditor/qlayoutwidget_propertysheet.cpp b/src/designer/src/components/formeditor/qlayoutwidget_propertysheet.cpp
index 517bec0cf..78fc443a2 100644
--- a/src/designer/src/components/formeditor/qlayoutwidget_propertysheet.cpp
+++ b/src/designer/src/components/formeditor/qlayoutwidget_propertysheet.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qlayoutwidget_propertysheet.h"
#include "qlayout_widget_p.h"
@@ -37,7 +12,9 @@
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+using namespace Qt::StringLiterals;
+
+namespace qdesigner_internal {
QLayoutWidgetPropertySheet::QLayoutWidgetPropertySheet(QLayoutWidget *object, QObject *parent)
: QDesignerPropertySheet(object, parent)
@@ -49,8 +26,7 @@ QLayoutWidgetPropertySheet::~QLayoutWidgetPropertySheet() = default;
bool QLayoutWidgetPropertySheet::isVisible(int index) const
{
- static const QString layoutPropertyGroup = QStringLiteral("Layout");
- if (propertyGroup(index) == layoutPropertyGroup)
+ if (propertyGroup(index) == "Layout"_L1)
return QDesignerPropertySheet::isVisible(index);
return false;
}
@@ -65,4 +41,6 @@ bool QLayoutWidgetPropertySheet::dynamicPropertiesAllowed() const
return false;
}
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
diff --git a/src/designer/src/components/formeditor/qlayoutwidget_propertysheet.h b/src/designer/src/components/formeditor/qlayoutwidget_propertysheet.h
index f0a66787e..b01a9b148 100644
--- a/src/designer/src/components/formeditor/qlayoutwidget_propertysheet.h
+++ b/src/designer/src/components/formeditor/qlayoutwidget_propertysheet.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QLAYOUTWIDGET_PROPERTYSHEET_H
#define QLAYOUTWIDGET_PROPERTYSHEET_H
diff --git a/src/designer/src/components/formeditor/qmainwindow_container.cpp b/src/designer/src/components/formeditor/qmainwindow_container.cpp
index 8bed2911b..d4c85bc75 100644
--- a/src/designer/src/components/formeditor/qmainwindow_container.cpp
+++ b/src/designer/src/components/formeditor/qmainwindow_container.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qmainwindow_container.h"
#include "qdesigner_toolbar_p.h"
@@ -40,7 +15,7 @@
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+namespace qdesigner_internal {
QMainWindowContainer::QMainWindowContainer(QMainWindow *widget, QObject *parent)
: QObject(parent),
@@ -50,20 +25,19 @@ QMainWindowContainer::QMainWindowContainer(QMainWindow *widget, QObject *parent)
int QMainWindowContainer::count() const
{
- return m_widgets.count();
+ return m_widgets.size();
}
QWidget *QMainWindowContainer::widget(int index) const
{
- if (index == -1)
- return nullptr;
-
- return m_widgets.at(index);
+ return m_widgets.value(index, nullptr);
}
int QMainWindowContainer::currentIndex() const
{
- return m_mainWindow->centralWidget() ? 0 : -1;
+ // QTBUG-111603, handle plugins with unmanaged central widgets
+ auto *cw = m_mainWindow->centralWidget();
+ return cw != nullptr && m_widgets.contains(cw) ? 0 : -1;
}
void QMainWindowContainer::setCurrentIndex(int index)
@@ -74,7 +48,7 @@ void QMainWindowContainer::setCurrentIndex(int index)
namespace {
// Pair of <area,break_before>
- using ToolBarData = QPair<Qt::ToolBarArea,bool> ;
+ using ToolBarData = std::pair<Qt::ToolBarArea, bool>;
ToolBarData toolBarData(QToolBar *me) {
const QMainWindow *mw = qobject_cast<const QMainWindow*>(me->parentWidget());
@@ -97,7 +71,7 @@ Qt::DockWidgetArea dockWidgetArea(QDockWidget *me)
candidates.append(mw->layout());
candidates += mw->layout()->findChildren<QLayout*>();
}
- for (QLayout *l : qAsConst(candidates)) {
+ for (QLayout *l : std::as_const(candidates)) {
if (l->indexOf(me) != -1)
return mw->dockWidgetArea(me);
}
@@ -202,4 +176,6 @@ void QMainWindowContainer::remove(int index)
m_widgets.removeAt(index);
}
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
diff --git a/src/designer/src/components/formeditor/qmainwindow_container.h b/src/designer/src/components/formeditor/qmainwindow_container.h
index bdd0a3a87..4473cab8f 100644
--- a/src/designer/src/components/formeditor/qmainwindow_container.h
+++ b/src/designer/src/components/formeditor/qmainwindow_container.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QMAINWINDOW_CONTAINER_H
#define QMAINWINDOW_CONTAINER_H
diff --git a/src/designer/src/components/formeditor/qmdiarea_container.cpp b/src/designer/src/components/formeditor/qmdiarea_container.cpp
index 03fe667a3..137bd9618 100644
--- a/src/designer/src/components/formeditor/qmdiarea_container.cpp
+++ b/src/designer/src/components/formeditor/qmdiarea_container.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qmdiarea_container.h"
@@ -39,6 +14,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
QMdiAreaContainer::QMdiAreaContainer(QMdiArea *widget, QObject *parent)
@@ -49,7 +26,7 @@ QMdiAreaContainer::QMdiAreaContainer(QMdiArea *widget, QObject *parent)
int QMdiAreaContainer::count() const
{
- return m_mdiArea->subWindowList(QMdiArea::CreationOrder).count();
+ return m_mdiArea->subWindowList(QMdiArea::CreationOrder).size();
}
QWidget *QMdiAreaContainer::widget(int index) const
@@ -129,26 +106,24 @@ void QMdiAreaContainer::remove(int index)
// 1) window name (object name of child)
// 2) title (windowTitle of child).
-static const char *subWindowTitleC = "activeSubWindowTitle";
-static const char *subWindowNameC = "activeSubWindowName";
+static constexpr auto subWindowTitleC = "activeSubWindowTitle"_L1;
+static constexpr auto subWindowNameC = "activeSubWindowName"_L1;
QMdiAreaPropertySheet::QMdiAreaPropertySheet(QWidget *mdiArea, QObject *parent) :
QDesignerPropertySheet(mdiArea, parent),
- m_windowTitleProperty(QStringLiteral("windowTitle"))
+ m_windowTitleProperty(u"windowTitle"_s)
{
- createFakeProperty(QLatin1String(subWindowNameC), QString());
- createFakeProperty(QLatin1String(subWindowTitleC), QString());
+ createFakeProperty(subWindowNameC, QString());
+ createFakeProperty(subWindowTitleC, QString());
}
QMdiAreaPropertySheet::MdiAreaProperty QMdiAreaPropertySheet::mdiAreaProperty(const QString &name)
{
- using MdiAreaPropertyHash = QHash<QString, MdiAreaProperty>;
- static MdiAreaPropertyHash mdiAreaPropertyHash;
- if (mdiAreaPropertyHash.isEmpty()) {
- mdiAreaPropertyHash.insert(QLatin1String(subWindowNameC), MdiAreaSubWindowName);
- mdiAreaPropertyHash.insert(QLatin1String(subWindowTitleC), MdiAreaSubWindowTitle);
- }
- return mdiAreaPropertyHash.value(name,MdiAreaNone);
+ static const QHash<QString, MdiAreaProperty> mdiAreaPropertyHash = {
+ {subWindowNameC, MdiAreaSubWindowName},
+ {subWindowTitleC, MdiAreaSubWindowTitle}
+ };
+ return mdiAreaPropertyHash.value(name, MdiAreaNone);
}
void QMdiAreaPropertySheet::setProperty(int index, const QVariant &value)
diff --git a/src/designer/src/components/formeditor/qmdiarea_container.h b/src/designer/src/components/formeditor/qmdiarea_container.h
index 5134757d7..aebd3f2c3 100644
--- a/src/designer/src/components/formeditor/qmdiarea_container.h
+++ b/src/designer/src/components/formeditor/qmdiarea_container.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QMDIAREA_CONTAINER_H
#define QMDIAREA_CONTAINER_H
diff --git a/src/designer/src/components/formeditor/qwizard_container.cpp b/src/designer/src/components/formeditor/qwizard_container.cpp
index c2b8408d3..99254a4fb 100644
--- a/src/designer/src/components/formeditor/qwizard_container.cpp
+++ b/src/designer/src/components/formeditor/qwizard_container.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qwizard_container.h"
@@ -37,6 +12,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
using WizardPageList = QList<QWizardPage *>;
namespace qdesigner_internal {
@@ -93,7 +70,7 @@ void QWizardContainer::setCurrentIndex(int index)
}
}
-static const char *msgWrongType = "** WARNING Attempt to add oject that is not of class WizardPage to a QWizard";
+static const char msgWrongType[] = "** WARNING Attempt to add oject that is not of class WizardPage to a QWizard";
void QWizardContainer::addWidget(QWidget *widget)
{
@@ -118,7 +95,7 @@ void QWizardContainer::insertWidget(int index, QWidget *widget)
}
const auto idList = m_wizard->pageIds();
- const int pageCount = idList.size();
+ const auto pageCount = idList.size();
if (index >= pageCount) {
addWidget(widget);
return;
@@ -134,12 +111,12 @@ void QWizardContainer::insertWidget(int index, QWidget *widget)
// Create a gap by shuffling pages
WizardPageList pageList;
pageList.push_back(newPage);
- for (int i = index; i < pageCount; i++) {
+ for (qsizetype i = index; i < pageCount; ++i) {
pageList.push_back(m_wizard->page(idList.at(i)));
m_wizard->removePage(idList.at(i));
}
int newId = idBefore + delta;
- for (QWizardPage *page : qAsConst(pageList)) {
+ for (QWizardPage *page : std::as_const(pageList)) {
m_wizard->setPage(newId, page);
newId += delta;
}
@@ -176,7 +153,7 @@ const char *QWizardPagePropertySheet::pageIdProperty = "pageId";
QWizardPagePropertySheet::QWizardPagePropertySheet(QWizardPage *object, QObject *parent) :
QDesignerPropertySheet(object, parent),
- m_pageIdIndex(createFakeProperty(QLatin1String(pageIdProperty), QString()))
+ m_pageIdIndex(createFakeProperty(QLatin1StringView(pageIdProperty), QString()))
{
setAttribute(m_pageIdIndex, true);
}
@@ -193,7 +170,7 @@ bool QWizardPagePropertySheet::reset(int index)
// ---------------- QWizardPropertySheet
QWizardPropertySheet::QWizardPropertySheet(QWizard *object, QObject *parent) :
QDesignerPropertySheet(object, parent),
- m_startId(QStringLiteral("startId"))
+ m_startId(u"startId"_s)
{
}
diff --git a/src/designer/src/components/formeditor/qwizard_container.h b/src/designer/src/components/formeditor/qwizard_container.h
index 23dc63b4f..5c6533f66 100644
--- a/src/designer/src/components/formeditor/qwizard_container.h
+++ b/src/designer/src/components/formeditor/qwizard_container.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QWIZARD_CONTAINER_H
#define QWIZARD_CONTAINER_H
diff --git a/src/designer/src/components/formeditor/spacer_propertysheet.cpp b/src/designer/src/components/formeditor/spacer_propertysheet.cpp
index eed26383a..9c3da1303 100644
--- a/src/designer/src/components/formeditor/spacer_propertysheet.cpp
+++ b/src/designer/src/components/formeditor/spacer_propertysheet.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "spacer_propertysheet.h"
#include "qdesigner_widget_p.h"
@@ -37,6 +12,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal
{
SpacerPropertySheet::SpacerPropertySheet(Spacer *object, QObject *parent)
@@ -49,8 +26,7 @@ SpacerPropertySheet::~SpacerPropertySheet() = default;
bool SpacerPropertySheet::isVisible(int index) const
{
- static const QString spacerGroup = QStringLiteral("Spacer");
- return propertyGroup(index) == spacerGroup;
+ return propertyGroup(index) == "Spacer"_L1;
}
void SpacerPropertySheet::setProperty(int index, const QVariant &value)
diff --git a/src/designer/src/components/formeditor/spacer_propertysheet.h b/src/designer/src/components/formeditor/spacer_propertysheet.h
index a2b00dbdb..c2525d84d 100644
--- a/src/designer/src/components/formeditor/spacer_propertysheet.h
+++ b/src/designer/src/components/formeditor/spacer_propertysheet.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef SPACER_PROPERTYSHEET_H
#define SPACER_PROPERTYSHEET_H
diff --git a/src/designer/src/components/formeditor/templateoptionspage.cpp b/src/designer/src/components/formeditor/templateoptionspage.cpp
index 4e638c913..2063972d9 100644
--- a/src/designer/src/components/formeditor/templateoptionspage.cpp
+++ b/src/designer/src/components/formeditor/templateoptionspage.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "templateoptionspage.h"
#include "ui_templateoptionspage.h"
@@ -37,20 +12,22 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
// ----------------- TemplateOptionsWidget
TemplateOptionsWidget::TemplateOptionsWidget(QDesignerFormEditorInterface *core, QWidget *parent) :
QWidget(parent),
m_core(core),
- m_ui(new Ui::TemplateOptionsWidget)
+ m_ui(new QT_PREPEND_NAMESPACE(qdesigner_internal)::Ui::TemplateOptionsWidget)
{
m_ui->setupUi(this);
m_ui->m_addTemplatePathButton->setIcon(
- qdesigner_internal::createIconSet(QString::fromUtf8("plus.png")));
+ qdesigner_internal::createIconSet("plus.png"_L1));
m_ui->m_removeTemplatePathButton->setIcon(
- qdesigner_internal::createIconSet(QString::fromUtf8("minus.png")));
+ qdesigner_internal::createIconSet("minus.png"_L1));
connect(m_ui->m_templatePathListWidget, &QListWidget::itemSelectionChanged,
this, &TemplateOptionsWidget::templatePathSelectionChanged);
@@ -83,9 +60,8 @@ void TemplateOptionsWidget::setTemplatePaths(const QStringList &l)
// disable button
templatePathSelectionChanged();
} else {
- const QStringList::const_iterator cend = l.constEnd();
- for (QStringList::const_iterator it = l.constBegin(); it != cend; ++it)
- m_ui->m_templatePathListWidget->addItem(*it);
+ for (const auto &s : l)
+ m_ui->m_templatePathListWidget->addItem(s);
m_ui->m_templatePathListWidget->setCurrentItem(m_ui->m_templatePathListWidget->item(0));
}
}
diff --git a/src/designer/src/components/formeditor/templateoptionspage.h b/src/designer/src/components/formeditor/templateoptionspage.h
index 374713fed..9ce8c45cf 100644
--- a/src/designer/src/components/formeditor/templateoptionspage.h
+++ b/src/designer/src/components/formeditor/templateoptionspage.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QDESIGNER_TEMPLATEOPTIONS_H
#define QDESIGNER_TEMPLATEOPTIONS_H
diff --git a/src/designer/src/components/formeditor/tool_widgeteditor.cpp b/src/designer/src/components/formeditor/tool_widgeteditor.cpp
index 8b27d54aa..fd019b75c 100644
--- a/src/designer/src/components/formeditor/tool_widgeteditor.cpp
+++ b/src/designer/src/components/formeditor/tool_widgeteditor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "tool_widgeteditor.h"
#include "formwindow.h"
@@ -48,7 +23,7 @@
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+namespace qdesigner_internal {
WidgetEditorTool::WidgetEditorTool(FormWindow *formWindow)
: QDesignerFormWindowToolInterface(formWindow),
@@ -75,6 +50,7 @@ QDesignerFormWindowInterface *WidgetEditorTool::formWindow() const
return m_formWindow;
}
+// separators in QMainWindow are no longer widgets
bool WidgetEditorTool::mainWindowSeparatorEvent(QWidget *widget, QEvent *event)
{
QMainWindow *mw = qobject_cast<QMainWindow*>(widget);
@@ -109,11 +85,14 @@ bool WidgetEditorTool::mainWindowSeparatorEvent(QWidget *widget, QEvent *event)
return false;
}
+bool WidgetEditorTool::isPassiveInteractor(QWidget *widget, QEvent *event)
+{
+ auto *widgetFactory = core()->widgetFactory();
+ return widgetFactory->isPassiveInteractor(widget) || mainWindowSeparatorEvent(widget, event);
+}
+
bool WidgetEditorTool::handleEvent(QWidget *widget, QWidget *managedWidget, QEvent *event)
{
- const bool passive = core()->widgetFactory()->isPassiveInteractor(widget) != 0
- || mainWindowSeparatorEvent(widget, event); // separators in QMainWindow
- // are no longer widgets
switch (event->type()) {
case QEvent::Resize:
case QEvent::Move:
@@ -122,40 +101,48 @@ bool WidgetEditorTool::handleEvent(QWidget *widget, QWidget *managedWidget, QEve
case QEvent::FocusOut:
case QEvent::FocusIn: // Popup cancelled over a form widget: Reset its focus frame
- return !(passive || widget == m_formWindow || widget == m_formWindow->mainContainer());
+ return widget != m_formWindow && widget != m_formWindow->mainContainer()
+ && !isPassiveInteractor(widget, event);
case QEvent::Wheel: // Prevent spinboxes and combos from reacting
if (widget == m_formWindow->formContainer() || widget == m_formWindow
|| widget == m_formWindow->mainContainer()) { // Allow scrolling the form with wheel.
return false;
}
- return !passive;
+ return !isPassiveInteractor(widget, event);
case QEvent::KeyPress:
- return !passive && handleKeyPressEvent(widget, managedWidget, static_cast<QKeyEvent*>(event));
+ return !isPassiveInteractor(widget, event)
+ && handleKeyPressEvent(widget, managedWidget, static_cast<QKeyEvent*>(event));
case QEvent::KeyRelease:
- return !passive && handleKeyReleaseEvent(widget, managedWidget, static_cast<QKeyEvent*>(event));
+ return !isPassiveInteractor(widget, event)
+ && handleKeyReleaseEvent(widget, managedWidget, static_cast<QKeyEvent*>(event));
case QEvent::MouseMove:
- return !passive && handleMouseMoveEvent(widget, managedWidget, static_cast<QMouseEvent*>(event));
+ return !isPassiveInteractor(widget, event)
+ && handleMouseMoveEvent(widget, managedWidget, static_cast<QMouseEvent*>(event));
case QEvent::MouseButtonPress:
- return !passive && handleMousePressEvent(widget, managedWidget, static_cast<QMouseEvent*>(event));
+ return !isPassiveInteractor(widget, event)
+ && handleMousePressEvent(widget, managedWidget, static_cast<QMouseEvent*>(event));
case QEvent::MouseButtonRelease:
- return !passive && handleMouseReleaseEvent(widget, managedWidget, static_cast<QMouseEvent*>(event));
+ return !isPassiveInteractor(widget, event)
+ && handleMouseReleaseEvent(widget, managedWidget, static_cast<QMouseEvent*>(event));
case QEvent::MouseButtonDblClick:
- return !passive && handleMouseButtonDblClickEvent(widget, managedWidget, static_cast<QMouseEvent*>(event));
+ return !isPassiveInteractor(widget, event)
+ && handleMouseButtonDblClickEvent(widget, managedWidget, static_cast<QMouseEvent*>(event));
case QEvent::ContextMenu:
- return !passive && handleContextMenu(widget, managedWidget, static_cast<QContextMenuEvent*>(event));
+ return !isPassiveInteractor(widget, event)
+ && handleContextMenu(widget, managedWidget, static_cast<QContextMenuEvent*>(event));
case QEvent::DragEnter:
return handleDragEnterMoveEvent(widget, managedWidget, static_cast<QDragEnterEvent *>(event), true);
case QEvent::DragMove:
- return handleDragEnterMoveEvent(widget, managedWidget, static_cast<QDragEnterEvent *>(event), false);
+ return handleDragEnterMoveEvent(widget, managedWidget, static_cast<QDragMoveEvent *>(event), false);
case QEvent::DragLeave:
return handleDragLeaveEvent(widget, managedWidget, static_cast<QDragLeaveEvent *>(event));
case QEvent::Drop:
@@ -351,4 +338,6 @@ void WidgetEditorTool::deactivated()
m_formWindow->clearSelection();
}
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
diff --git a/src/designer/src/components/formeditor/tool_widgeteditor.h b/src/designer/src/components/formeditor/tool_widgeteditor.h
index d2b3a1df4..5e22224be 100644
--- a/src/designer/src/components/formeditor/tool_widgeteditor.h
+++ b/src/designer/src/components/formeditor/tool_widgeteditor.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef TOOL_WIDGETEDITOR_H
#define TOOL_WIDGETEDITOR_H
@@ -82,6 +57,7 @@ private:
QAction *m_action;
bool mainWindowSeparatorEvent(QWidget *widget, QEvent *event);
+ bool isPassiveInteractor(QWidget *widget, QEvent *event);
QPointer<QMainWindow> m_separator_drag_mw;
QPointer<QWidget> m_lastDropTarget;
bool m_specialDockDrag;
diff --git a/src/designer/src/components/formeditor/widgetselection.cpp b/src/designer/src/components/formeditor/widgetselection.cpp
index 36f9eec1f..75d8a5fb7 100644
--- a/src/designer/src/components/formeditor/widgetselection.cpp
+++ b/src/designer/src/components/formeditor/widgetselection.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "widgetselection.h"
#include "formwindow.h"
@@ -58,6 +33,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
enum { debugWidgetSelection = 0 };
@@ -351,7 +328,7 @@ void WidgetHandle::mouseReleaseEvent(QMouseEvent *e)
case WidgetSelection::UnlaidOut:
if (m_geom != m_widget->geometry()) {
SetPropertyCommand *cmd = new SetPropertyCommand(m_formWindow);
- cmd->init(m_widget, QStringLiteral("geometry"), m_widget->geometry());
+ cmd->init(m_widget, u"geometry"_s, m_widget->geometry());
cmd->setOldValue(m_origGeom);
m_formWindow->commandHistory()->push(cmd);
m_formWindow->emitSelectionChanged();
diff --git a/src/designer/src/components/formeditor/widgetselection.h b/src/designer/src/components/formeditor/widgetselection.h
index eef2593b3..b5a6ae20c 100644
--- a/src/designer/src/components/formeditor/widgetselection.h
+++ b/src/designer/src/components/formeditor/widgetselection.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef WIDGETSELECTION_H
#define WIDGETSELECTION_H
diff --git a/src/designer/src/components/lib/CMakeLists.txt b/src/designer/src/components/lib/CMakeLists.txt
index 2044ce31e..1d08b785f 100644
--- a/src/designer/src/components/lib/CMakeLists.txt
+++ b/src/designer/src/components/lib/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from lib.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## DesignerComponentsPrivate Module:
@@ -7,6 +8,7 @@
qt_internal_add_module(DesignerComponentsPrivate
INTERNAL_MODULE
SOURCES
+ lib_pch.h
../buddyeditor/buddyeditor.cpp ../buddyeditor/buddyeditor.h
../buddyeditor/buddyeditor_global.h
../buddyeditor/buddyeditor_plugin.cpp ../buddyeditor/buddyeditor_plugin.h
@@ -48,6 +50,7 @@ qt_internal_add_module(DesignerComponentsPrivate
../propertyeditor/newdynamicpropertydialog.cpp ../propertyeditor/newdynamicpropertydialog.h
../propertyeditor/paletteeditor.cpp ../propertyeditor/paletteeditor.h
../propertyeditor/paletteeditorbutton.cpp ../propertyeditor/paletteeditorbutton.h
+ ../propertyeditor/pixmapeditor.cpp ../propertyeditor/pixmapeditor.h
../propertyeditor/previewframe.cpp ../propertyeditor/previewframe.h
../propertyeditor/previewwidget.cpp ../propertyeditor/previewwidget.h
../propertyeditor/propertyeditor.cpp ../propertyeditor/propertyeditor.h
@@ -92,6 +95,9 @@ qt_internal_add_module(DesignerComponentsPrivate
../widgetbox/widgetboxcategorylistview.cpp ../widgetbox/widgetboxcategorylistview.h
../widgetbox/widgetboxtreewidget.cpp ../widgetbox/widgetboxtreewidget.h
qdesigner_components.cpp
+ NO_UNITY_BUILD_SOURCES
+ ../tabordereditor/tabordereditor.cpp # redefinition of 'QMetaTypeId<QList<QWidget *>>' (from qdesigner_resource.cpp)
+ ../formeditor/formwindow.cpp # explicit specialization of 'QMetaTypeId<QWidget *>' after instantiation
DEFINES
QDESIGNER_COMPONENTS_LIBRARY
QT_STATICPLUGIN
@@ -123,6 +129,7 @@ qt_internal_add_module(DesignerComponentsPrivate
uic
PRECOMPILED_HEADER
"lib_pch.h"
+ NO_GENERATE_CPP_EXPORTS
)
set(ui_sources
@@ -161,27 +168,8 @@ qt_internal_add_resource(DesignerComponentsPrivate "propertyeditor"
${propertyeditor_resource_files}
)
set(formeditor_resource_files
- "../formeditor/images/cleartext.png"
"../formeditor/images/color.png"
"../formeditor/images/configure.png"
- "../formeditor/images/cursors/arrow.png"
- "../formeditor/images/cursors/busy.png"
- "../formeditor/images/cursors/closedhand.png"
- "../formeditor/images/cursors/cross.png"
- "../formeditor/images/cursors/hand.png"
- "../formeditor/images/cursors/hsplit.png"
- "../formeditor/images/cursors/ibeam.png"
- "../formeditor/images/cursors/no.png"
- "../formeditor/images/cursors/openhand.png"
- "../formeditor/images/cursors/sizeall.png"
- "../formeditor/images/cursors/sizeb.png"
- "../formeditor/images/cursors/sizef.png"
- "../formeditor/images/cursors/sizeh.png"
- "../formeditor/images/cursors/sizev.png"
- "../formeditor/images/cursors/uparrow.png"
- "../formeditor/images/cursors/vsplit.png"
- "../formeditor/images/cursors/wait.png"
- "../formeditor/images/cursors/whatsthis.png"
"../formeditor/images/downplus.png"
"../formeditor/images/dropdownbutton.png"
"../formeditor/images/edit.png"
@@ -216,7 +204,6 @@ set(formeditor_resource_files
"../formeditor/images/mac/minus.png"
"../formeditor/images/mac/plus.png"
"../formeditor/images/mac/redo.png"
- "../formeditor/images/mac/resourceeditortool.png"
"../formeditor/images/mac/signalslottool.png"
"../formeditor/images/mac/simplifyrichtext.png"
"../formeditor/images/mac/tabordertool.png"
@@ -234,9 +221,8 @@ set(formeditor_resource_files
"../formeditor/images/mac/up.png"
"../formeditor/images/mac/widgettool.png"
"../formeditor/images/minus-16.png"
- "../formeditor/images/plus-16.png"
"../formeditor/images/prefix-add.png"
- "../formeditor/images/qt3logo.png"
+ "../formeditor/images/qtlogo128x128.png"
"../formeditor/images/qtlogo16x16.png"
"../formeditor/images/qtlogo24x24.png"
"../formeditor/images/qtlogo32x32.png"
@@ -263,7 +249,6 @@ set(formeditor_resource_files
"../formeditor/images/widgets/groupbox.png"
"../formeditor/images/widgets/hscrollbar.png"
"../formeditor/images/widgets/hslider.png"
- "../formeditor/images/widgets/hsplit.png"
"../formeditor/images/widgets/label.png"
"../formeditor/images/widgets/lcdnumber.png"
"../formeditor/images/widgets/line.png"
@@ -290,7 +275,6 @@ set(formeditor_resource_files
"../formeditor/images/widgets/vspacer.png"
"../formeditor/images/widgets/widget.png"
"../formeditor/images/widgets/widgetstack.png"
- "../formeditor/images/widgets/wizard.png"
"../formeditor/images/win/adjustsize.png"
"../formeditor/images/win/back.png"
"../formeditor/images/win/buddytool.png"
@@ -316,7 +300,6 @@ set(formeditor_resource_files
"../formeditor/images/win/minus.png"
"../formeditor/images/win/plus.png"
"../formeditor/images/win/redo.png"
- "../formeditor/images/win/resourceeditortool.png"
"../formeditor/images/win/signalslottool.png"
"../formeditor/images/win/simplifyrichtext.png"
"../formeditor/images/win/tabordertool.png"
@@ -368,10 +351,6 @@ qt_internal_add_resource(DesignerComponentsPrivate "widgetbox"
${widgetbox_resource_files}
)
-
-#### Keys ignored in scope 1:.:.:lib.pro:<TRUE>:
-# MODULE = "DesignerComponentsPrivate"
-
## Scopes:
#####################################################################
diff --git a/src/designer/src/components/lib/lib_pch.h b/src/designer/src/components/lib/lib_pch.h
index 1c7a758ee..6befeb751 100644
--- a/src/designer/src/components/lib/lib_pch.h
+++ b/src/designer/src/components/lib/lib_pch.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#if defined __cplusplus
#include <QtDesigner/QtDesigner>
diff --git a/src/designer/src/components/lib/qdesigner_components.cpp b/src/designer/src/components/lib/qdesigner_components.cpp
index 29226f95a..02e38a24b 100644
--- a/src/designer/src/components/lib/qdesigner_components.cpp
+++ b/src/designer/src/components/lib/qdesigner_components.cpp
@@ -1,34 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtDesigner/QDesignerComponents>
#include <actioneditor_p.h>
+#include <pluginmanager_p.h>
#include <widgetdatabase_p.h>
#include <widgetfactory_p.h>
@@ -89,6 +65,8 @@ static void initInstances()
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
/*!
\class QDesignerComponents
\brief The QDesignerComponents class provides a central resource for the various components
@@ -119,12 +97,25 @@ void QDesignerComponents::initializePlugins(QDesignerFormEditorInterface *core)
QDesignerIntegration::initializePlugins(core);
}
+// ### fixme Qt 7 createFormEditorWithPluginPaths->createFormEditor
+
/*!
Constructs a form editor interface with the given \a parent.*/
QDesignerFormEditorInterface *QDesignerComponents::createFormEditor(QObject *parent)
{
+ return createFormEditorWithPluginPaths({}, parent);
+}
+
+/*!
+ Constructs a form editor interface with the given \a pluginPaths and the \a parent.
+ \since 6.7
+*/
+QDesignerFormEditorInterface *
+ QDesignerComponents::createFormEditorWithPluginPaths(const QStringList &pluginPaths,
+ QObject *parent)
+{
initInstances();
- return new qdesigner_internal::FormEditor(parent);
+ return new qdesigner_internal::FormEditor(pluginPaths, parent);
}
/*!
@@ -146,18 +137,17 @@ static inline void setMinorVersion(int minorVersion, int *qtVersion)
static inline QString widgetBoxFileName(int qtVersion, const QDesignerLanguageExtension *lang = nullptr)
{
QString rc; {
- const QChar dot = QLatin1Char('.');
QTextStream str(&rc);
- str << QDir::homePath() << QDir::separator() << QStringLiteral(".designer") << QDir::separator()
- << QStringLiteral("widgetbox");
+ str << QDir::homePath() << QDir::separator() << ".designer" << QDir::separator()
+ << "widgetbox";
// The naming convention using the version was introduced with 4.4
const int major = qtMajorVersion(qtVersion);
const int minor = qtMinorVersion(qtVersion);
if (major >= 4 && minor >= 4)
- str << major << dot << minor;
+ str << major << '.' << minor;
if (lang)
- str << dot << lang->uiExtension();
- str << QStringLiteral(".xml");
+ str << '.' << lang->uiExtension();
+ str << ".xml";
}
return rc;
}
@@ -179,7 +169,7 @@ QDesignerWidgetBoxInterface *QDesignerComponents::createWidgetBox(QDesignerFormE
}
}
- widgetBox->setFileName(QStringLiteral(":/qt-project.org/widgetbox/widgetbox.xml"));
+ widgetBox->setFileName(u":/qt-project.org/widgetbox/widgetbox.xml"_s);
widgetBox->load();
} while (false);
@@ -234,7 +224,7 @@ QWidget *QDesignerComponents::createResourceEditor(QDesignerFormEditorInterface
}
QtResourceView *resourceView = new QtResourceView(core, parent);
resourceView->setResourceModel(core->resourceModel());
- resourceView->setSettingsKey(QStringLiteral("ResourceBrowser"));
+ resourceView->setSettingsKey(u"ResourceBrowser"_s);
// Note for integrators: make sure you call createResourceEditor() after you instantiated your subclass of designer integration
// (designer doesn't do that since by default editing resources is enabled)
const QDesignerIntegrationInterface *integration = core->integration();
@@ -250,5 +240,16 @@ QWidget *QDesignerComponents::createSignalSlotEditor(QDesignerFormEditorInterfac
return new qdesigner_internal::SignalSlotEditorWindow(core, parent);
}
+/*!
+ Returns the default plugin paths of Qt Widgets Designer's plugin manager.
+
+ \return Plugin paths
+ \since 6.7
+*/
+QStringList QDesignerComponents::defaultPluginPaths()
+{
+ return QDesignerPluginManager::defaultPluginPaths();
+}
+
QT_END_NAMESPACE
diff --git a/src/designer/src/components/objectinspector/objectinspector.cpp b/src/designer/src/components/objectinspector/objectinspector.cpp
index c34df34f9..18096065b 100644
--- a/src/designer/src/components/objectinspector/objectinspector.cpp
+++ b/src/designer/src/components/objectinspector/objectinspector.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "objectinspector.h"
#include "objectinspectormodel_p.h"
@@ -63,6 +38,7 @@
#include <QtCore/qdebug.h>
#include <QtCore/qlist.h>
+#include <QtCore/qpointer.h>
#include <QtCore/qsortfilterproxymodel.h>
QT_BEGIN_NAMESPACE
@@ -89,8 +65,6 @@ namespace {
UnmanagedWidgetSelection,
// A widget managed by the form window cursor
ManagedWidgetSelection };
-
- using QObjectVector = QList<QObject *>;
}
static inline SelectionType selectionType(const QDesignerFormWindowInterface *fw, QObject *o)
@@ -208,7 +182,7 @@ public:
QModelIndexList indexesOf(QObject *o) const;
QObject *objectAt(const QModelIndex &index) const;
- QObjectVector indexesToObjects(const QModelIndexList &indexes) const;
+ QObjectList indexesToObjects(const QModelIndexList &indexes) const;
void slotHeaderDoubleClicked(int column) { m_treeView->resizeColumnToContents(column); }
void slotPopupContextMenu(QWidget *parent, const QPoint &pos);
@@ -255,6 +229,8 @@ ObjectInspector::ObjectInspectorPrivate::ObjectInspectorPrivate(QDesignerFormEdi
m_filterModel->setSourceModel(m_model);
m_filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
m_treeView->setModel(m_filterModel);
+ m_treeView->setSortingEnabled(true);
+ m_treeView->sortByColumn(0, Qt::AscendingOrder);
m_treeView->setItemDelegate(new ObjectInspectorDelegate);
m_treeView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
m_treeView->header()->setSectionResizeMode(1, QHeaderView::Stretch);
@@ -454,12 +430,12 @@ void ObjectInspector::ObjectInspectorPrivate::selectIndexRange(const QModelIndex
selectFlags |= QItemSelectionModel::Current;
QItemSelectionModel *selectionModel = m_treeView->selectionModel();
- const QModelIndexList::const_iterator cend = indexes.constEnd();
- for (QModelIndexList::const_iterator it = indexes.constBegin(); it != cend; ++it)
- if (it->column() == 0) {
- selectionModel->select(*it, selectFlags);
+ for (const auto &mi : indexes) {
+ if (mi.column() == 0) {
+ selectionModel->select(mi, selectFlags);
selectFlags &= ~(QItemSelectionModel::Clear|QItemSelectionModel::Current);
}
+ }
if (flags & MakeCurrent)
m_treeView->scrollTo(indexes.constFirst(), QAbstractItemView::EnsureVisible);
}
@@ -566,16 +542,16 @@ void ObjectInspector::ObjectInspectorPrivate::applyCursorSelection()
}
// Synchronize managed widget in the form (select in cursor). Block updates
-static int selectInCursor(FormWindowBase *fw, const QObjectVector &objects, bool value)
+static int selectInCursor(FormWindowBase *fw, const QObjectList &objects, bool value)
{
int rc = 0;
const bool blocked = fw->blockSelectionChanged(true);
- const QObjectVector::const_iterator ocend = objects.constEnd();
- for (QObjectVector::const_iterator it = objects.constBegin(); it != ocend; ++it)
- if (selectionType(fw, *it) == ManagedWidgetSelection) {
- fw->selectWidget(static_cast<QWidget *>(*it), value);
+ for (auto *o : objects) {
+ if (selectionType(fw, o) == ManagedWidgetSelection) {
+ fw->selectWidget(static_cast<QWidget *>(o), value);
rc++;
}
+ }
fw->blockSelectionChanged(blocked);
return rc;
}
@@ -590,16 +566,16 @@ void ObjectInspector::ObjectInspectorPrivate::slotSelectionChanged(const QItemSe
// Convert indexes to object vectors taking into account that
// some index lists are multicolumn ranges
-QObjectVector ObjectInspector::ObjectInspectorPrivate::indexesToObjects(const QModelIndexList &indexes) const
+QObjectList ObjectInspector::ObjectInspectorPrivate::indexesToObjects(const QModelIndexList &indexes) const
{
+ QObjectList rc;
if (indexes.isEmpty())
- return QObjectVector();
- QObjectVector rc;
+ return rc;
rc.reserve(indexes.size());
- const QModelIndexList::const_iterator icend = indexes.constEnd();
- for (QModelIndexList::const_iterator it = indexes.constBegin(); it != icend; ++it)
- if (it->column() == 0)
- rc.append(objectAt(*it));
+ for (const auto &mi : indexes) {
+ if (mi.column() == 0)
+ rc.append(objectAt(mi));
+ }
return rc;
}
@@ -609,9 +585,8 @@ bool ObjectInspector::ObjectInspectorPrivate::checkManagedWidgetSelection(const
{
bool isManagedWidgetSelection = false;
QItemSelectionModel *selectionModel = m_treeView->selectionModel();
- const QModelIndexList::const_iterator cscend = rowSelection.constEnd();
- for (QModelIndexList::const_iterator it = rowSelection.constBegin(); it != cscend; ++it) {
- QObject *object = objectAt(*it);
+ for (const auto &mi : rowSelection) {
+ QObject *object = objectAt(mi);
if (selectionType(m_formWindow, object) == ManagedWidgetSelection) {
isManagedWidgetSelection = true;
break;
@@ -622,10 +597,10 @@ bool ObjectInspector::ObjectInspectorPrivate::checkManagedWidgetSelection(const
return false;
// Need to unselect unmanaged ones
const bool blocked = selectionModel->blockSignals(true);
- for (QModelIndexList::const_iterator it = rowSelection.constBegin(); it != cscend; ++it) {
- QObject *object = objectAt(*it);
+ for (const auto &mi : rowSelection) {
+ QObject *object = objectAt(mi);
if (selectionType(m_formWindow, object) != ManagedWidgetSelection)
- selectionModel->select(*it, QItemSelectionModel::Deselect|QItemSelectionModel::Rows);
+ selectionModel->select(mi, QItemSelectionModel::Deselect|QItemSelectionModel::Rows);
}
selectionModel->blockSignals(blocked);
return true;
@@ -634,8 +609,8 @@ bool ObjectInspector::ObjectInspectorPrivate::checkManagedWidgetSelection(const
void ObjectInspector::ObjectInspectorPrivate::synchronizeSelection(const QItemSelection & selectedSelection, const QItemSelection &deselectedSelection)
{
// Synchronize form window cursor.
- const QObjectVector deselected = indexesToObjects(deselectedSelection.indexes());
- const QObjectVector newlySelected = indexesToObjects(selectedSelection.indexes());
+ const QObjectList deselected = indexesToObjects(deselectedSelection.indexes());
+ const QObjectList newlySelected = indexesToObjects(selectedSelection.indexes());
const QModelIndexList currentSelectedIndexes = m_treeView->selectionModel()->selectedRows(0);
diff --git a/src/designer/src/components/objectinspector/objectinspector.h b/src/designer/src/components/objectinspector/objectinspector.h
index 2aa53cdb9..c856d7d91 100644
--- a/src/designer/src/components/objectinspector/objectinspector.h
+++ b/src/designer/src/components/objectinspector/objectinspector.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef OBJECTINSPECTOR_H
#define OBJECTINSPECTOR_H
@@ -77,6 +52,6 @@ private:
} // namespace qdesigner_internal
-#endif // OBJECTINSPECTOR_H
-
QT_END_NAMESPACE
+
+#endif // OBJECTINSPECTOR_H
diff --git a/src/designer/src/components/objectinspector/objectinspector_global.h b/src/designer/src/components/objectinspector/objectinspector_global.h
index 9c7162fdf..6a1185564 100644
--- a/src/designer/src/components/objectinspector/objectinspector_global.h
+++ b/src/designer/src/components/objectinspector/objectinspector_global.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef OBJECTINSPECTOR_GLOBAL_H
#define OBJECTINSPECTOR_GLOBAL_H
@@ -43,6 +18,6 @@ QT_BEGIN_NAMESPACE
#define QT_OBJECTINSPECTOR_EXPORT
#endif
-#endif // OBJECTINSPECTOR_GLOBAL_H
-
QT_END_NAMESPACE
+
+#endif // OBJECTINSPECTOR_GLOBAL_H
diff --git a/src/designer/src/components/objectinspector/objectinspectormodel.cpp b/src/designer/src/components/objectinspector/objectinspectormodel.cpp
index 3f8c6a665..5168d4ff8 100644
--- a/src/designer/src/components/objectinspector/objectinspectormodel.cpp
+++ b/src/designer/src/components/objectinspector/objectinspectormodel.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "objectinspectormodel_p.h"
@@ -55,6 +30,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace {
enum { DataRole = 1000 };
}
@@ -63,11 +40,6 @@ static inline QObject *objectOfItem(const QStandardItem *item) {
return qvariant_cast<QObject *>(item->data(DataRole));
}
-static bool sortEntry(const QObject *a, const QObject *b)
-{
- return a->objectName() < b->objectName();
-}
-
static bool sameIcon(const QIcon &i1, const QIcon &i2)
{
if (i1.isNull() && i2.isNull())
@@ -77,8 +49,10 @@ static bool sameIcon(const QIcon &i1, const QIcon &i2)
return i1.cacheKey() == i2.cacheKey();
}
-static inline bool isNameColumnEditable(const QObject *)
+static inline bool isNameColumnEditable(const QObject *o)
{
+ if (auto *action = qobject_cast<const QAction *>(o))
+ return !action->isSeparator();
return true;
}
@@ -117,7 +91,7 @@ namespace qdesigner_internal {
};
ModelRecursionContext::ModelRecursionContext(QDesignerFormEditorInterface *c, const QString &sepName) :
- designerPrefix(QStringLiteral("QDesigner")),
+ designerPrefix(u"QDesigner"_s),
separator(sepName),
core(c),
db(c->widgetDataBase()),
@@ -141,7 +115,7 @@ namespace qdesigner_internal {
ObjectData::ObjectData(QObject *parent, QObject *object, const ModelRecursionContext &ctx) :
m_parent(parent),
m_object(object),
- m_className(QLatin1String(object->metaObject()->className())),
+ m_className(QLatin1StringView(object->metaObject()->className())),
m_objectName(object->objectName())
{
@@ -187,7 +161,7 @@ namespace qdesigner_internal {
if (const QLayout *layout = w->layout()) {
m_type = LayoutWidget;
m_managedLayoutType = LayoutInfo::layoutType(ctx.core, layout);
- m_className = QLatin1String(layout->metaObject()->className());
+ m_className = QLatin1StringView(layout->metaObject()->className());
m_objectName = layout->objectName();
}
return;
@@ -289,9 +263,7 @@ namespace qdesigner_internal {
if (!object->children().isEmpty()) {
ButtonGroupList buttonGroups;
- QObjectList children = object->children();
- std::sort(children.begin(), children.end(), sortEntry);
- for (QObject *childObject : qAsConst(children)) {
+ for (QObject *childObject : object->children()) {
// Managed child widgets unless we had a container extension
if (childObject->isWidgetType()) {
if (!containerExtension) {
@@ -308,7 +280,7 @@ namespace qdesigner_internal {
}
// Add button groups
if (!buttonGroups.isEmpty()) {
- for (QButtonGroup *group : qAsConst(buttonGroups))
+ for (QButtonGroup *group : std::as_const(buttonGroups))
createModelRecursion(fwi, object, group, model, ctx);
}
} // has children
@@ -337,13 +309,13 @@ namespace qdesigner_internal {
setColumnCount(NumColumns);
setHorizontalHeaderLabels(headers);
// Icons
- m_icons.layoutIcons[LayoutInfo::NoLayout] = createIconSet(QStringLiteral("editbreaklayout.png"));
- m_icons.layoutIcons[LayoutInfo::HSplitter] = createIconSet(QStringLiteral("edithlayoutsplit.png"));
- m_icons.layoutIcons[LayoutInfo::VSplitter] = createIconSet(QStringLiteral("editvlayoutsplit.png"));
- m_icons.layoutIcons[LayoutInfo::HBox] = createIconSet(QStringLiteral("edithlayout.png"));
- m_icons.layoutIcons[LayoutInfo::VBox] = createIconSet(QStringLiteral("editvlayout.png"));
- m_icons.layoutIcons[LayoutInfo::Grid] = createIconSet(QStringLiteral("editgrid.png"));
- m_icons.layoutIcons[LayoutInfo::Form] = createIconSet(QStringLiteral("editform.png"));
+ m_icons.layoutIcons[LayoutInfo::NoLayout] = createIconSet("editbreaklayout.png"_L1);
+ m_icons.layoutIcons[LayoutInfo::HSplitter] = createIconSet("edithlayoutsplit.png"_L1);
+ m_icons.layoutIcons[LayoutInfo::VSplitter] = createIconSet("editvlayoutsplit.png"_L1);
+ m_icons.layoutIcons[LayoutInfo::HBox] = createIconSet("edithlayout.png"_L1);
+ m_icons.layoutIcons[LayoutInfo::VBox] = createIconSet("editvlayout.png"_L1);
+ m_icons.layoutIcons[LayoutInfo::Grid] = createIconSet("editgrid.png"_L1);
+ m_icons.layoutIcons[LayoutInfo::Form] = createIconSet("editform.png"_L1);
}
void ObjectInspectorModel::clearItems()
@@ -411,8 +383,8 @@ namespace qdesigner_internal {
if (newModel.isEmpty())
return;
- const ObjectModel::const_iterator mcend = newModel.constEnd();
- ObjectModel::const_iterator it = newModel.constBegin();
+ const auto mcend = newModel.cend();
+ auto it = newModel.cbegin();
// Set up root element
StandardItemList rootRow = createModelRow(it->object());
it->setItems(rootRow, m_icons);
@@ -439,10 +411,10 @@ namespace qdesigner_internal {
QObjectSet changedObjects;
- const int size = newModel.size();
+ const auto size = newModel.size();
Q_ASSERT(oldModel.size() == size);
- for (int i = 0; i < size; i++) {
- const ObjectData &newEntry = newModel[i];
+ for (qsizetype i = 0; i < size; ++i) {
+ const ObjectData &newEntry = newModel.at(i);
ObjectData &entry = oldModel[i];
// Has some data changed?
if (const unsigned changedMask = entry.compare(newEntry)) {
@@ -482,7 +454,7 @@ namespace qdesigner_internal {
if (!object)
return false;
// Is this a layout widget?
- const QString nameProperty = isQLayoutWidget(object) ? QStringLiteral("layoutName") : QStringLiteral("objectName");
+ const QString nameProperty = isQLayoutWidget(object) ? u"layoutName"_s : u"objectName"_s;
m_formWindow->commandHistory()->push(createTextPropertyCommand(nameProperty, value.toString(), object, m_formWindow));
return true;
}
diff --git a/src/designer/src/components/objectinspector/objectinspectormodel_p.h b/src/designer/src/components/objectinspector/objectinspectormodel_p.h
index f138253a5..5ba4b83d3 100644
--- a/src/designer/src/components/objectinspector/objectinspectormodel_p.h
+++ b/src/designer/src/components/objectinspector/objectinspectormodel_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -44,6 +19,7 @@
#include <QtGui/qstandarditemmodel.h>
#include <QtGui/qicon.h>
+#include <QtCore/qcompare.h>
#include <QtCore/qstring.h>
#include <QtCore/qlist.h>
#include <QtCore/qmap.h>
@@ -99,6 +75,12 @@ namespace qdesigner_internal {
void setItemsDisplayData(const StandardItemList &row, const ObjectInspectorIcons &icons, unsigned mask) const;
private:
+ friend bool comparesEqual(const ObjectData &lhs, const ObjectData &rhs) noexcept
+ {
+ return lhs.m_parent == rhs.m_parent && lhs.m_object == rhs.m_object;
+ }
+ Q_DECLARE_EQUALITY_COMPARABLE(ObjectData)
+
void initObject(const ModelRecursionContext &ctx);
void initWidget(QWidget *w, const ModelRecursionContext &ctx);
@@ -111,9 +93,6 @@ namespace qdesigner_internal {
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); }
-
using ObjectModel = QList<ObjectData>;
// QStandardItemModel for ObjectInspector. Uses ObjectData/ObjectModel
@@ -135,20 +114,18 @@ namespace qdesigner_internal {
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
private:
- typedef QMultiMap<QObject *,QModelIndex> ObjectIndexMultiMap;
-
void rebuild(const ObjectModel &newModel);
void updateItemContents(ObjectModel &oldModel, const ObjectModel &newModel);
void clearItems();
StandardItemList rowAt(QModelIndex index) const;
ObjectInspectorIcons m_icons;
- ObjectIndexMultiMap m_objectIndexMultiMap;
+ QMultiMap<QObject *, QModelIndex> m_objectIndexMultiMap;
ObjectModel m_model;
QPointer<QDesignerFormWindowInterface> m_formWindow;
};
} // namespace qdesigner_internal
-#endif // OBJECTINSPECTORMODEL_H
-
QT_END_NAMESPACE
+
+#endif // OBJECTINSPECTORMODEL_H
diff --git a/src/designer/src/components/propertyeditor/brushpropertymanager.cpp b/src/designer/src/components/propertyeditor/brushpropertymanager.cpp
index aa94e17f3..2356e3843 100644
--- a/src/designer/src/components/propertyeditor/brushpropertymanager.cpp
+++ b/src/designer/src/components/propertyeditor/brushpropertymanager.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "brushpropertymanager.h"
#include "qtpropertymanager.h"
@@ -55,6 +30,8 @@ QT_TRANSLATE_NOOP("BrushPropertyManager", "Crossing diagonal"),
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
BrushPropertyManager::BrushPropertyManager() = default;
@@ -124,7 +101,7 @@ static void clearBrushIcons()
brushIcons()->clear();
}
-const BrushPropertyManager::EnumIndexIconMap &BrushPropertyManager::brushStyleIcons()
+const QMap<int, QIcon> &BrushPropertyManager::brushStyleIcons()
{
// Create a map of icons for the brush style editor
if (brushIcons()->empty()) {
@@ -145,6 +122,8 @@ QString BrushPropertyManager::brushStyleIndexToString(int brushStyleIndex)
return brushStyleIndex < brushStyleCount ? QCoreApplication::translate("BrushPropertyManager", brushStyles[brushStyleIndex]) : QString();
}
+BrushPropertyManager::~BrushPropertyManager() = default;
+
void BrushPropertyManager::initializeProperty(QtVariantPropertyManager *vm, QtProperty *property, int enumTypeId)
{
m_brushValues.insert(property, QBrush());
@@ -154,8 +133,8 @@ void BrushPropertyManager::initializeProperty(QtVariantPropertyManager *vm, QtPr
QStringList styles;
for (const char *brushStyle : brushStyles)
styles.push_back(QCoreApplication::translate("BrushPropertyManager", brushStyle));
- styleSubProperty->setAttribute(QStringLiteral("enumNames"), styles);
- styleSubProperty->setAttribute(QStringLiteral("enumIcons"), QVariant::fromValue(brushStyleIcons()));
+ styleSubProperty->setAttribute(u"enumNames"_s, styles);
+ styleSubProperty->setAttribute(u"enumIcons"_s, QVariant::fromValue(brushStyleIcons()));
m_brushPropertyToStyleSubProperty.insert(property, styleSubProperty);
m_brushStyleSubPropertyToProperty.insert(styleSubProperty, property);
// color
@@ -168,24 +147,24 @@ void BrushPropertyManager::initializeProperty(QtVariantPropertyManager *vm, QtPr
bool BrushPropertyManager::uninitializeProperty(QtProperty *property)
{
- const PropertyBrushMap::iterator brit = m_brushValues.find(property); // Brushes
+ const auto brit = m_brushValues.find(property); // Brushes
if (brit == m_brushValues.end())
return false;
m_brushValues.erase(brit);
// style
- PropertyToPropertyMap::iterator subit = m_brushPropertyToStyleSubProperty.find(property);
- if (subit != m_brushPropertyToStyleSubProperty.end()) {
- QtProperty *styleProp = subit.value();
+ const auto styleIt = m_brushPropertyToStyleSubProperty.find(property);
+ if (styleIt != m_brushPropertyToStyleSubProperty.end()) {
+ QtProperty *styleProp = styleIt .value();
m_brushStyleSubPropertyToProperty.remove(styleProp);
- m_brushPropertyToStyleSubProperty.erase(subit);
+ m_brushPropertyToStyleSubProperty.erase(styleIt );
delete styleProp;
}
// color
- subit = m_brushPropertyToColorSubProperty.find(property);
- if (subit != m_brushPropertyToColorSubProperty.end()) {
- QtProperty *colorProp = subit.value();
+ const auto colorIt = m_brushPropertyToColorSubProperty.find(property);
+ if (colorIt != m_brushPropertyToColorSubProperty.end()) {
+ QtProperty *colorProp = colorIt .value();
m_brushColorSubPropertyToProperty.remove(colorProp);
- m_brushPropertyToColorSubProperty.erase(subit);
+ m_brushPropertyToColorSubProperty.erase(colorIt );
delete colorProp;
}
return true;
@@ -193,7 +172,7 @@ bool BrushPropertyManager::uninitializeProperty(QtProperty *property)
void BrushPropertyManager::slotPropertyDestroyed(QtProperty *property)
{
- PropertyToPropertyMap::iterator subit = m_brushStyleSubPropertyToProperty.find(property);
+ auto subit = m_brushStyleSubPropertyToProperty.find(property);
if (subit != m_brushStyleSubPropertyToProperty.end()) {
m_brushPropertyToStyleSubProperty[subit.value()] = 0;
m_brushStyleSubPropertyToProperty.erase(subit);
@@ -242,7 +221,7 @@ int BrushPropertyManager::setValue(QtVariantPropertyManager *vm, QtProperty *pro
{
if (value.metaType().id() != QMetaType::QBrush)
return DesignerPropertyManager::NoMatch;
- const PropertyBrushMap::iterator brit = m_brushValues.find(property);
+ const auto brit = m_brushValues.find(property);
if (brit == m_brushValues.end())
return DesignerPropertyManager::NoMatch;
@@ -260,7 +239,7 @@ int BrushPropertyManager::setValue(QtVariantPropertyManager *vm, QtProperty *pro
bool BrushPropertyManager::valueText(const QtProperty *property, QString *text) const
{
- const PropertyBrushMap::const_iterator brit = m_brushValues.constFind(const_cast<QtProperty *>(property));
+ const auto brit = m_brushValues.constFind(property);
if (brit == m_brushValues.constEnd())
return false;
const QBrush &brush = brit.value();
@@ -272,7 +251,7 @@ bool BrushPropertyManager::valueText(const QtProperty *property, QString *text)
bool BrushPropertyManager::valueIcon(const QtProperty *property, QIcon *icon) const
{
- const PropertyBrushMap::const_iterator brit = m_brushValues.constFind(const_cast<QtProperty *>(property));
+ const auto brit = m_brushValues.constFind(property);
if (brit == m_brushValues.constEnd())
return false;
*icon = QtPropertyBrowserUtils::brushValueIcon(brit.value());
@@ -281,7 +260,7 @@ bool BrushPropertyManager::valueIcon(const QtProperty *property, QIcon *icon) co
bool BrushPropertyManager::value(const QtProperty *property, QVariant *v) const
{
- const PropertyBrushMap::const_iterator brit = m_brushValues.constFind(const_cast<QtProperty *>(property));
+ const auto brit = m_brushValues.constFind(property);
if (brit == m_brushValues.constEnd())
return false;
v->setValue(brit.value());
diff --git a/src/designer/src/components/propertyeditor/brushpropertymanager.h b/src/designer/src/components/propertyeditor/brushpropertymanager.h
index 5f2a81a00..8bfe7f5c6 100644
--- a/src/designer/src/components/propertyeditor/brushpropertymanager.h
+++ b/src/designer/src/components/propertyeditor/brushpropertymanager.h
@@ -1,35 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef BRUSHPROPERTYMANAGER_H
#define BRUSHPROPERTYMANAGER_H
-#include <QtCore/qmap.h>
+#include <QtCore/qhash.h>
#include <QtGui/qbrush.h>
#include <QtGui/qicon.h>
@@ -46,11 +21,11 @@ namespace qdesigner_internal {
// BrushPropertyManager: A mixin for DesignerPropertyManager that manages brush properties.
class BrushPropertyManager {
- BrushPropertyManager(const BrushPropertyManager&);
- BrushPropertyManager &operator=(const BrushPropertyManager&);
-
public:
+ Q_DISABLE_COPY_MOVE(BrushPropertyManager);
+
BrushPropertyManager();
+ ~BrushPropertyManager();
void initializeProperty(QtVariantPropertyManager *vm, QtProperty *property, int enumTypeId);
bool uninitializeProperty(QtProperty *property);
@@ -71,17 +46,15 @@ private:
static Qt::BrushStyle brushStyleIndexToStyle(int brushStyleIndex);
static QString brushStyleIndexToString(int brushStyleIndex);
- typedef QMap<int, QIcon> EnumIndexIconMap;
- static const EnumIndexIconMap &brushStyleIcons();
+ static const QMap<int, QIcon> &brushStyleIcons();
- typedef QMap<QtProperty *, QtProperty *> PropertyToPropertyMap;
+ using PropertyToPropertyMap = QHash<const QtProperty *, QtProperty *>;
PropertyToPropertyMap m_brushPropertyToStyleSubProperty;
PropertyToPropertyMap m_brushPropertyToColorSubProperty;
PropertyToPropertyMap m_brushStyleSubPropertyToProperty;
PropertyToPropertyMap m_brushColorSubPropertyToProperty;
- typedef QMap<QtProperty *, QBrush> PropertyBrushMap;
- PropertyBrushMap m_brushValues;
+ QHash<const QtProperty *, QBrush> m_brushValues;
};
}
diff --git a/src/designer/src/components/propertyeditor/designerpropertymanager.cpp b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp
index d65d5deeb..a880cc512 100644
--- a/src/designer/src/components/propertyeditor/designerpropertymanager.cpp
+++ b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp
@@ -1,34 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "designerpropertymanager.h"
#include "qtpropertymanager.h"
#include "paletteeditorbutton.h"
+#include "pixmapeditor.h"
#include "qlonglongvalidator.h"
#include "stringlisteditorbutton.h"
#include "qtresourceview_p.h"
@@ -49,6 +25,7 @@
#include <abstractdialoggui_p.h>
#include <QtWidgets/qapplication.h>
+#include <QtWidgets/qcombobox.h>
#include <QtWidgets/qlabel.h>
#include <QtWidgets/qtoolbutton.h>
#include <QtWidgets/qboxlayout.h>
@@ -60,9 +37,6 @@
#include <QtWidgets/qkeysequenceedit.h>
#include <QtGui/qaction.h>
-#if QT_CONFIG(clipboard)
-#include <QtGui/qclipboard.h>
-#endif
#include <QtGui/qevent.h>
#include <QtCore/qdebug.h>
@@ -71,13 +45,16 @@
QT_BEGIN_NAMESPACE
-static const char *resettableAttributeC = "resettable";
-static const char *flagsAttributeC = "flags";
-static const char *validationModesAttributeC = "validationMode";
-static const char *superPaletteAttributeC = "superPalette";
-static const char *defaultResourceAttributeC = "defaultResource";
-static const char *fontAttributeC = "font";
-static const char *themeAttributeC = "theme";
+using namespace Qt::StringLiterals;
+
+static constexpr auto resettableAttributeC = "resettable"_L1;
+static constexpr auto flagsAttributeC = "flags"_L1;
+static constexpr auto validationModesAttributeC = "validationMode"_L1;
+static constexpr auto superPaletteAttributeC = "superPalette"_L1;
+static constexpr auto defaultResourceAttributeC = "defaultResource"_L1;
+static constexpr auto fontAttributeC = "font"_L1;
+static constexpr auto themeAttributeC = "theme"_L1;
+static constexpr auto themeEnumAttributeC = "themeEnum"_L1;
class DesignerFlagPropertyType
{
@@ -271,7 +248,7 @@ int TranslatablePropertyManager<PropertySheetValue>::setValue(QtVariantPropertyM
template <class PropertySheetValue>
bool TranslatablePropertyManager<PropertySheetValue>::value(const QtProperty *property, QVariant *rc) const
{
- const auto it = m_values.constFind(const_cast<QtProperty *>(property));
+ const auto it = m_values.constFind(property);
if (it == m_values.constEnd())
return false;
*rc = QVariant::fromValue(it.value());
@@ -440,7 +417,7 @@ void TextEditor::buttonClicked()
}
break;
case ValidationURL:
- if (oldText.isEmpty() || oldText.startsWith(QStringLiteral("qrc:")))
+ if (oldText.isEmpty() || oldText.startsWith("qrc:"_L1))
resourceActionActivated();
else
fileActionActivated();
@@ -457,15 +434,15 @@ void TextEditor::buttonClicked()
void TextEditor::resourceActionActivated()
{
QString oldPath = m_editor->text();
- if (oldPath.startsWith(QStringLiteral("qrc:")))
+ if (oldPath.startsWith("qrc:"_L1))
oldPath.remove(0, 4);
// returns ':/file'
QString newPath = IconSelector::choosePixmapResource(m_core, m_core->resourceModel(), oldPath, this);
- if (newPath.startsWith(QLatin1Char(':')))
+ if (newPath.startsWith(u':'))
newPath.remove(0, 1);
if (newPath.isEmpty() || newPath == oldPath)
return;
- const QString newText = QStringLiteral("qrc:") + newPath;
+ const QString newText = "qrc:"_L1 + newPath;
m_editor->setText(newText);
emit textChanged(newText);
}
@@ -473,7 +450,7 @@ void TextEditor::resourceActionActivated()
void TextEditor::fileActionActivated()
{
QString oldPath = m_editor->text();
- if (oldPath.startsWith(QStringLiteral("file:")))
+ if (oldPath.startsWith("file:"_L1))
oldPath = oldPath.mid(5);
const QString newPath = m_core->dialogGui()->getOpenFileName(this, tr("Choose a File"), oldPath);
if (newPath.isEmpty() || newPath == oldPath)
@@ -483,314 +460,6 @@ void TextEditor::fileActionActivated()
emit textChanged(newText);
}
-// ------------ ThemeInputDialog
-
-class IconThemeDialog : public QDialog
-{
- Q_OBJECT
-public:
- static QString getTheme(QWidget *parent, const QString &theme, bool *ok);
-private:
- IconThemeDialog(QWidget *parent);
- IconThemeEditor *m_editor;
-};
-
-IconThemeDialog::IconThemeDialog(QWidget *parent)
- : QDialog(parent)
-{
- setWindowTitle(tr("Set Icon From Theme"));
-
- QVBoxLayout *layout = new QVBoxLayout(this);
- QLabel *label = new QLabel(tr("Input icon name from the current theme:"), this);
- m_editor = new IconThemeEditor(this);
- QDialogButtonBox *buttons = new QDialogButtonBox(this);
- buttons->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
-
- layout->addWidget(label);
- layout->addWidget(m_editor);
- layout->addWidget(buttons);
-
- connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept);
- connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject);
-}
-
-QString IconThemeDialog::getTheme(QWidget *parent, const QString &theme, bool *ok)
-{
- IconThemeDialog dlg(parent);
- dlg.m_editor->setTheme(theme);
- if (dlg.exec() == QDialog::Accepted) {
- *ok = true;
- return dlg.m_editor->theme();
- }
- *ok = false;
- return QString();
-}
-
-// ------------ PixmapEditor
-class PixmapEditor : public QWidget
-{
- Q_OBJECT
-public:
- PixmapEditor(QDesignerFormEditorInterface *core, QWidget *parent);
-
- void setSpacing(int spacing);
- void setPixmapCache(DesignerPixmapCache *cache);
- void setIconThemeModeEnabled(bool enabled);
-public slots:
- void setPath(const QString &path);
- void setTheme(const QString &theme);
- void setDefaultPixmap(const QPixmap &pixmap);
-
-signals:
- void pathChanged(const QString &path);
- void themeChanged(const QString &theme);
-
-protected:
- void contextMenuEvent(QContextMenuEvent *event) override;
-
-private slots:
- void defaultActionActivated();
- void resourceActionActivated();
- void fileActionActivated();
- void themeActionActivated();
-#if QT_CONFIG(clipboard)
- void copyActionActivated();
- void pasteActionActivated();
- void clipboardDataChanged();
-#endif
-private:
- void updateLabels();
- bool m_iconThemeModeEnabled;
- QDesignerFormEditorInterface *m_core;
- QLabel *m_pixmapLabel;
- QLabel *m_pathLabel;
- QToolButton *m_button;
- QAction *m_resourceAction;
- QAction *m_fileAction;
- QAction *m_themeAction;
- QAction *m_copyAction;
- QAction *m_pasteAction;
- QHBoxLayout *m_layout;
- QPixmap m_defaultPixmap;
- QString m_path;
- QString m_theme;
- DesignerPixmapCache *m_pixmapCache;
-};
-
-PixmapEditor::PixmapEditor(QDesignerFormEditorInterface *core, QWidget *parent) :
- QWidget(parent),
- m_iconThemeModeEnabled(false),
- m_core(core),
- m_pixmapLabel(new QLabel(this)),
- m_pathLabel(new QLabel(this)),
- m_button(new QToolButton(this)),
- m_resourceAction(new QAction(tr("Choose Resource..."), this)),
- m_fileAction(new QAction(tr("Choose File..."), this)),
- m_themeAction(new QAction(tr("Set Icon From Theme..."), this)),
- 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(nullptr)
-{
- m_layout->addWidget(m_pixmapLabel);
- m_layout->addWidget(m_pathLabel);
- m_button->setText(tr("..."));
- m_button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored);
- m_button->setFixedWidth(30);
- m_button->setPopupMode(QToolButton::MenuButtonPopup);
- m_layout->addWidget(m_button);
- m_layout->setContentsMargins(QMargins());
- m_layout->setSpacing(0);
- m_pixmapLabel->setFixedWidth(16);
- m_pixmapLabel->setAlignment(Qt::AlignCenter);
- m_pathLabel->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed));
- m_themeAction->setVisible(false);
-
- QMenu *menu = new QMenu(this);
- menu->addAction(m_resourceAction);
- menu->addAction(m_fileAction);
- menu->addAction(m_themeAction);
-
- m_button->setMenu(menu);
- m_button->setText(tr("..."));
-
- connect(m_button, &QAbstractButton::clicked, this, &PixmapEditor::defaultActionActivated);
- connect(m_resourceAction, &QAction::triggered, this, &PixmapEditor::resourceActionActivated);
- connect(m_fileAction, &QAction::triggered, this, &PixmapEditor::fileActionActivated);
- connect(m_themeAction, &QAction::triggered, this, &PixmapEditor::themeActionActivated);
-#if QT_CONFIG(clipboard)
- connect(m_copyAction, &QAction::triggered, this, &PixmapEditor::copyActionActivated);
- connect(m_pasteAction, &QAction::triggered, this, &PixmapEditor::pasteActionActivated);
-#endif
- setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored));
- setFocusProxy(m_button);
-
-#if QT_CONFIG(clipboard)
- connect(QApplication::clipboard(), &QClipboard::dataChanged,
- this, &PixmapEditor::clipboardDataChanged);
- clipboardDataChanged();
-#endif
-}
-
-void PixmapEditor::setPixmapCache(DesignerPixmapCache *cache)
-{
- m_pixmapCache = cache;
-}
-
-void PixmapEditor::setIconThemeModeEnabled(bool enabled)
-{
- if (m_iconThemeModeEnabled == enabled)
- return;
- m_iconThemeModeEnabled = enabled;
- m_themeAction->setVisible(enabled);
-}
-
-void PixmapEditor::setSpacing(int spacing)
-{
- m_layout->setSpacing(spacing);
-}
-
-void PixmapEditor::setPath(const QString &path)
-{
- m_path = path;
- updateLabels();
-}
-
-void PixmapEditor::setTheme(const QString &theme)
-{
- m_theme = theme;
- updateLabels();
-}
-
-void PixmapEditor::updateLabels()
-{
- if (m_iconThemeModeEnabled && QIcon::hasThemeIcon(m_theme)) {
- m_pixmapLabel->setPixmap(QIcon::fromTheme(m_theme).pixmap(16, 16));
- m_pathLabel->setText(tr("[Theme] %1").arg(m_theme));
- m_copyAction->setEnabled(true);
- } else {
- if (m_path.isEmpty()) {
- m_pathLabel->setText(m_path);
- m_pixmapLabel->setPixmap(m_defaultPixmap);
- m_copyAction->setEnabled(false);
- } else {
- m_pathLabel->setText(QFileInfo(m_path).fileName());
- if (m_pixmapCache)
- m_pixmapLabel->setPixmap(QIcon(m_pixmapCache->pixmap(PropertySheetPixmapValue(m_path))).pixmap(16, 16));
- m_copyAction->setEnabled(true);
- }
- }
-}
-
-void PixmapEditor::setDefaultPixmap(const QPixmap &pixmap)
-{
- m_defaultPixmap = QIcon(pixmap).pixmap(16, 16);
- const bool hasThemeIcon = m_iconThemeModeEnabled && QIcon::hasThemeIcon(m_theme);
- if (!hasThemeIcon && m_path.isEmpty())
- m_pixmapLabel->setPixmap(m_defaultPixmap);
-}
-
-void PixmapEditor::contextMenuEvent(QContextMenuEvent *event)
-{
- QMenu menu(this);
- menu.addAction(m_copyAction);
- menu.addAction(m_pasteAction);
- menu.exec(event->globalPos());
- event->accept();
-}
-
-void PixmapEditor::defaultActionActivated()
-{
- if (m_iconThemeModeEnabled && QIcon::hasThemeIcon(m_theme)) {
- themeActionActivated();
- return;
- }
- // Default to resource
- const PropertySheetPixmapValue::PixmapSource ps = m_path.isEmpty() ? PropertySheetPixmapValue::ResourcePixmap : PropertySheetPixmapValue::getPixmapSource(m_core, m_path);
- switch (ps) {
- case PropertySheetPixmapValue::LanguageResourcePixmap:
- case PropertySheetPixmapValue::ResourcePixmap:
- resourceActionActivated();
- break;
- case PropertySheetPixmapValue::FilePixmap:
- fileActionActivated();
- break;
- }
-}
-
-void PixmapEditor::resourceActionActivated()
-{
- const QString oldPath = m_path;
- const QString newPath = IconSelector::choosePixmapResource(m_core, m_core->resourceModel(), oldPath, this);
- if (!newPath.isEmpty() && newPath != oldPath) {
- setTheme(QString());
- setPath(newPath);
- emit pathChanged(newPath);
- }
-}
-
-void PixmapEditor::fileActionActivated()
-{
- const QString newPath = IconSelector::choosePixmapFile(m_path, m_core->dialogGui(), this);
- if (!newPath.isEmpty() && newPath != m_path) {
- setTheme(QString());
- setPath(newPath);
- emit pathChanged(newPath);
- }
-}
-
-void PixmapEditor::themeActionActivated()
-{
- bool ok;
- const QString newTheme = IconThemeDialog::getTheme(this, m_theme, &ok);
- if (ok && newTheme != m_theme) {
- setTheme(newTheme);
- setPath(QString());
- emit themeChanged(newTheme);
- }
-}
-
-#if QT_CONFIG(clipboard)
-void PixmapEditor::copyActionActivated()
-{
- QClipboard *clipboard = QApplication::clipboard();
- if (m_iconThemeModeEnabled && QIcon::hasThemeIcon(m_theme))
- clipboard->setText(m_theme);
- else
- clipboard->setText(m_path);
-}
-
-void PixmapEditor::pasteActionActivated()
-{
- QClipboard *clipboard = QApplication::clipboard();
- QString subtype = QStringLiteral("plain");
- QString text = clipboard->text(subtype);
- if (!text.isNull()) {
- QStringList list = text.split(QLatin1Char('\n'));
- if (!list.isEmpty()) {
- text = list.at(0);
- if (m_iconThemeModeEnabled && QIcon::hasThemeIcon(text)) {
- setTheme(text);
- setPath(QString());
- emit themeChanged(text);
- } else {
- setPath(text);
- setTheme(QString());
- emit pathChanged(text);
- }
- }
- }
-}
-
-void PixmapEditor::clipboardDataChanged()
-{
- QClipboard *clipboard = QApplication::clipboard();
- QString subtype = QStringLiteral("plain");
- const QString text = clipboard->text(subtype);
- m_pasteAction->setEnabled(!text.isNull());
-}
-#endif
-
// --------------- ResetWidget
class ResetWidget : public QWidget
{
@@ -826,7 +495,7 @@ ResetWidget::ResetWidget(QtProperty *property, QWidget *parent) :
m_textLabel->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed));
m_iconLabel->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
m_button->setToolButtonStyle(Qt::ToolButtonIconOnly);
- m_button->setIcon(createIconSet(QStringLiteral("resetproperty.png")));
+ m_button->setIcon(createIconSet("resetproperty.png"_L1));
m_button->setIconSize(QSize(8,8));
m_button->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding));
connect(m_button, &QAbstractButton::clicked, this, &ResetWidget::slotClicked);
@@ -913,7 +582,8 @@ DesignerPropertyManager::~DesignerPropertyManager()
bool DesignerPropertyManager::m_IdBasedTranslations = false;
-int DesignerPropertyManager::bitCount(int mask) const
+template <class IntT>
+static int bitCount(IntT mask)
{
int count = 0;
for (; mask; count++)
@@ -1015,10 +685,10 @@ void DesignerPropertyManager::slotValueChanged(QtProperty *property, const QVari
if (QtProperty *flagProperty = m_flagToProperty.value(property, 0)) {
const auto subFlags = m_propertyToFlags.value(flagProperty);
- const int subFlagCount = subFlags.count();
+ const qsizetype subFlagCount = subFlags.size();
// flag changed
const bool subValue = variantProperty(property)->value().toBool();
- const int subIndex = subFlags.indexOf(property);
+ const qsizetype subIndex = subFlags.indexOf(property);
if (subIndex < 0)
return;
@@ -1030,21 +700,21 @@ void DesignerPropertyManager::slotValueChanged(QtProperty *property, const QVari
const auto values = data.values;
// Compute new value, without including (additional) supermasks
if (values.at(subIndex) == 0) {
- for (int i = 0; i < subFlagCount; ++i) {
+ for (qsizetype i = 0; i < subFlagCount; ++i) {
QtVariantProperty *subFlag = variantProperty(subFlags.at(i));
subFlag->setValue(i == subIndex);
}
} else {
if (subValue)
newValue = values.at(subIndex); // value mask of subValue
- for (int i = 0; i < subFlagCount; ++i) {
+ for (qsizetype i = 0; i < subFlagCount; ++i) {
QtVariantProperty *subFlag = variantProperty(subFlags.at(i));
if (subFlag->value().toBool() && bitCount(values.at(i)) == 1)
newValue |= values.at(i);
}
if (newValue == 0) {
// Uncheck all items except 0-mask
- for (int i = 0; i < subFlagCount; ++i) {
+ for (qsizetype i = 0; i < subFlagCount; ++i) {
QtVariantProperty *subFlag = variantProperty(subFlags.at(i));
subFlag->setValue(values.at(i) == 0);
}
@@ -1055,7 +725,7 @@ void DesignerPropertyManager::slotValueChanged(QtProperty *property, const QVari
}
} else {
// Make sure 0-mask is not selected
- for (int i = 0; i < subFlagCount; ++i) {
+ for (qsizetype i = 0; i < subFlagCount; ++i) {
QtVariantProperty *subFlag = variantProperty(subFlags.at(i));
if (values.at(i) == 0)
subFlag->setValue(false);
@@ -1063,7 +733,7 @@ void DesignerPropertyManager::slotValueChanged(QtProperty *property, const QVari
// Check/uncheck proper masks
if (subValue) {
// Make sure submasks and supermasks are selected
- for (int i = 0; i < subFlagCount; ++i) {
+ for (qsizetype i = 0; i < subFlagCount; ++i) {
QtVariantProperty *subFlag = variantProperty(subFlags.at(i));
const uint vi = values.at(i);
if ((vi != 0) && ((vi & newValue) == vi) && !subFlag->value().toBool())
@@ -1071,7 +741,7 @@ void DesignerPropertyManager::slotValueChanged(QtProperty *property, const QVari
}
} else {
// Make sure supermasks are not selected if they're no longer valid
- for (int i = 0; i < subFlagCount; ++i) {
+ for (qsizetype i = 0; i < subFlagCount; ++i) {
QtVariantProperty *subFlag = variantProperty(subFlags.at(i));
const uint vi = values.at(i);
if (subFlag->value().toBool() && ((vi & newValue) != vi))
@@ -1102,10 +772,12 @@ void DesignerPropertyManager::slotValueChanged(QtProperty *property, const QVari
} else if (QtProperty *iProperty = m_iconSubPropertyToProperty.value(property, 0)) {
QtVariantProperty *iconProperty = variantProperty(iProperty);
PropertySheetIconValue icon = qvariant_cast<PropertySheetIconValue>(iconProperty->value());
- QMap<QtProperty *, QPair<QIcon::Mode, QIcon::State> >::ConstIterator itState = m_iconSubPropertyToState.constFind(property);
+ const auto itState = m_iconSubPropertyToState.constFind(property);
if (itState != m_iconSubPropertyToState.constEnd()) {
- QPair<QIcon::Mode, QIcon::State> pair = m_iconSubPropertyToState.value(property);
+ const auto pair = m_iconSubPropertyToState.value(property);
icon.setPixmap(pair.first, pair.second, qvariant_cast<PropertySheetPixmapValue>(value));
+ } else if (attributeValue(property, themeEnumAttributeC).toBool()) {
+ icon.setThemeEnum(value.toInt());
} else { // must be theme property
icon.setTheme(value.toString());
}
@@ -1124,7 +796,7 @@ void DesignerPropertyManager::slotValueChanged(QtProperty *property, const QVari
void DesignerPropertyManager::slotPropertyDestroyed(QtProperty *property)
{
if (QtProperty *flagProperty = m_flagToProperty.value(property, 0)) {
- PropertyToPropertyListMap::iterator it = m_propertyToFlags.find(flagProperty);
+ const auto it = m_propertyToFlags.find(flagProperty);
auto &propertyList = it.value();
propertyList.replace(propertyList.indexOf(property), 0);
m_flagToProperty.remove(property);
@@ -1140,11 +812,12 @@ void DesignerPropertyManager::slotPropertyDestroyed(QtProperty *property)
} else if (QtProperty *iconProperty = m_iconSubPropertyToProperty.value(property, 0)) {
if (m_propertyToTheme.value(iconProperty) == property) {
m_propertyToTheme.remove(iconProperty);
+ } else if (m_propertyToThemeEnum.value(iconProperty) == property) {
+ m_propertyToThemeEnum.remove(iconProperty);
} else {
- QMap<QtProperty *, QMap<QPair<QIcon::Mode, QIcon::State>, QtProperty *> >::iterator it =
- m_propertyToIconSubProperties.find(iconProperty);
- QPair<QIcon::Mode, QIcon::State> state = m_iconSubPropertyToState.value(property);
- QMap<QPair<QIcon::Mode, QIcon::State>, QtProperty *> &propertyList = it.value();
+ const auto it = m_propertyToIconSubProperties.find(iconProperty);
+ const auto state = m_iconSubPropertyToState.value(property);
+ auto &propertyList = it.value();
propertyList.remove(state);
m_iconSubPropertyToState.remove(property);
}
@@ -1163,19 +836,21 @@ QStringList DesignerPropertyManager::attributes(int propertyType) const
QStringList list = QtVariantPropertyManager::attributes(propertyType);
if (propertyType == designerFlagTypeId()) {
- list.append(QLatin1String(flagsAttributeC));
+ list.append(flagsAttributeC);
} else if (propertyType == designerPixmapTypeId()) {
- list.append(QLatin1String(defaultResourceAttributeC));
+ list.append(defaultResourceAttributeC);
} else if (propertyType == designerIconTypeId()) {
- list.append(QLatin1String(defaultResourceAttributeC));
+ list.append(defaultResourceAttributeC);
} else if (propertyType == designerStringTypeId() || propertyType == QMetaType::QString) {
- list.append(QLatin1String(validationModesAttributeC));
- list.append(QLatin1String(fontAttributeC));
- list.append(QLatin1String(themeAttributeC));
+ list.append(validationModesAttributeC);
+ list.append(fontAttributeC);
+ list.append(themeAttributeC);
} else if (propertyType == QMetaType::QPalette) {
- list.append(QLatin1String(superPaletteAttributeC));
+ list.append(superPaletteAttributeC);
+ } else if (propertyType == QMetaType::Int) {
+ list.append(themeEnumAttributeC);
}
- list.append(QLatin1String(resettableAttributeC));
+ list.append(resettableAttributeC);
return list;
}
@@ -1184,23 +859,23 @@ int DesignerPropertyManager::attributeType(int propertyType, const QString &attr
if (!isPropertyTypeSupported(propertyType))
return 0;
- if (propertyType == designerFlagTypeId() && attribute == QLatin1String(flagsAttributeC))
+ if (propertyType == designerFlagTypeId() && attribute == flagsAttributeC)
return designerFlagListTypeId();
- if (propertyType == designerPixmapTypeId() && attribute == QLatin1String(defaultResourceAttributeC))
+ if (propertyType == designerPixmapTypeId() && attribute == defaultResourceAttributeC)
return QMetaType::QPixmap;
- if (propertyType == designerIconTypeId() && attribute == QLatin1String(defaultResourceAttributeC))
+ if (propertyType == designerIconTypeId() && attribute == defaultResourceAttributeC)
return QMetaType::QIcon;
- if (attribute == QLatin1String(resettableAttributeC))
+ if (attribute == resettableAttributeC)
return QMetaType::Bool;
if (propertyType == designerStringTypeId() || propertyType == QMetaType::QString) {
- if (attribute == QLatin1String(validationModesAttributeC))
+ if (attribute == validationModesAttributeC)
return QMetaType::Int;
- if (attribute == QLatin1String(fontAttributeC))
+ if (attribute == fontAttributeC)
return QMetaType::QFont;
- if (attribute == QLatin1String(themeAttributeC))
+ if (attribute == themeAttributeC)
return QMetaType::Bool;
}
- if (propertyType == QMetaType::QPalette && attribute == QLatin1String(superPaletteAttributeC))
+ if (propertyType == QMetaType::QPalette && attribute == superPaletteAttributeC)
return QMetaType::QPalette;
return QtVariantPropertyManager::attributeType(propertyType, attribute);
@@ -1208,52 +883,56 @@ int DesignerPropertyManager::attributeType(int propertyType, const QString &attr
QVariant DesignerPropertyManager::attributeValue(const QtProperty *property, const QString &attribute) const
{
- QtProperty *prop = const_cast<QtProperty *>(property);
-
- if (attribute == QLatin1String(resettableAttributeC)) {
- const PropertyBoolMap::const_iterator it = m_resetMap.constFind(prop);
+ if (attribute == resettableAttributeC) {
+ const auto it = m_resetMap.constFind(property);
if (it != m_resetMap.constEnd())
return it.value();
}
- if (attribute == QLatin1String(flagsAttributeC)) {
- PropertyFlagDataMap::const_iterator it = m_flagValues.constFind(prop);
+ if (attribute == flagsAttributeC) {
+ const auto it = m_flagValues.constFind(property);
if (it != m_flagValues.constEnd()) {
QVariant v;
v.setValue(it.value().flags);
return v;
}
}
- if (attribute == QLatin1String(validationModesAttributeC)) {
- const PropertyIntMap::const_iterator it = m_stringAttributes.constFind(prop);
+ if (attribute == validationModesAttributeC) {
+ const auto it = m_stringAttributes.constFind(property);
if (it != m_stringAttributes.constEnd())
return it.value();
}
- if (attribute == QLatin1String(fontAttributeC)) {
- const PropertyFontMap::const_iterator it = m_stringFontAttributes.constFind(prop);
+ if (attribute == fontAttributeC) {
+ const auto it = m_stringFontAttributes.constFind(property);
if (it != m_stringFontAttributes.constEnd())
return it.value();
}
- if (attribute == QLatin1String(themeAttributeC)) {
- const PropertyBoolMap::const_iterator it = m_stringThemeAttributes.constFind(prop);
+ if (attribute == themeAttributeC) {
+ const auto it = m_stringThemeAttributes.constFind(property);
if (it != m_stringThemeAttributes.constEnd())
return it.value();
}
- if (attribute == QLatin1String(superPaletteAttributeC)) {
- PropertyPaletteDataMap::const_iterator it = m_paletteValues.constFind(prop);
- if (it != m_paletteValues.constEnd())
+ if (attribute == themeEnumAttributeC) {
+ const auto it = m_intThemeEnumAttributes.constFind(property);
+ if (it != m_intThemeEnumAttributes.constEnd())
+ return it.value();
+ }
+
+ if (attribute == superPaletteAttributeC) {
+ const auto it = m_paletteValues.constFind(property);
+ if (it != m_paletteValues.cend())
return it.value().superPalette;
}
- if (attribute == QLatin1String(defaultResourceAttributeC)) {
- QMap<QtProperty *, QPixmap>::const_iterator itPix = m_defaultPixmaps.constFind(prop);
+ if (attribute == defaultResourceAttributeC) {
+ const auto itPix = m_defaultPixmaps.constFind(property);
if (itPix != m_defaultPixmaps.constEnd())
return itPix.value();
- QMap<QtProperty *, QIcon>::const_iterator itIcon = m_defaultIcons.constFind(prop);
+ const auto itIcon = m_defaultIcons.constFind(property);
if (itIcon != m_defaultIcons.constEnd())
return itIcon.value();
}
@@ -1270,29 +949,29 @@ QVariant DesignerPropertyManager::attributeValue(const QtProperty *property, con
void DesignerPropertyManager::setAttribute(QtProperty *property,
const QString &attribute, const QVariant &value)
{
- if (attribute == QLatin1String(resettableAttributeC) && m_resetMap.contains(property)) {
+ if (attribute == resettableAttributeC && m_resetMap.contains(property)) {
if (value.userType() != QMetaType::Bool)
return;
const bool val = value.toBool();
- const PropertyBoolMap::iterator it = m_resetMap.find(property);
+ const auto it = m_resetMap.find(property);
if (it.value() == val)
return;
it.value() = val;
emit attributeChanged(variantProperty(property), attribute, value);
return;
}
- if (attribute == QLatin1String(flagsAttributeC) && m_flagValues.contains(property)) {
+ if (attribute == flagsAttributeC && m_flagValues.contains(property)) {
if (value.userType() != designerFlagListTypeId())
return;
const DesignerFlagList flags = qvariant_cast<DesignerFlagList>(value);
- PropertyFlagDataMap::iterator fit = m_flagValues.find(property);
+ const auto fit = m_flagValues.find(property);
FlagData data = fit.value();
if (data.flags == flags)
return;
- PropertyToPropertyListMap::iterator pfit = m_propertyToFlags.find(property);
- for (QtProperty *prop : qAsConst(pfit.value())) {
+ const auto pfit = m_propertyToFlags.find(property);
+ for (QtProperty *prop : std::as_const(pfit.value())) {
if (prop) {
delete prop;
m_flagToProperty.remove(prop);
@@ -1302,7 +981,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
QList<uint> values;
- for (const QPair<QString, uint> &pair : flags) {
+ for (const auto &pair : flags) {
const QString flagName = pair.first;
QtProperty *prop = addProperty(QMetaType::Bool);
prop->setPropertyName(flagName);
@@ -1324,11 +1003,11 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
emit propertyChanged(property);
emit QtVariantPropertyManager::valueChanged(property, data.val);
- } else if (attribute == QLatin1String(validationModesAttributeC) && m_stringAttributes.contains(property)) {
+ } else if (attribute == validationModesAttributeC && m_stringAttributes.contains(property)) {
if (value.userType() != QMetaType::Int)
return;
- const PropertyIntMap::iterator it = m_stringAttributes.find(property);
+ const auto it = m_stringAttributes.find(property);
const int oldValue = it.value();
const int newValue = value.toInt();
@@ -1339,11 +1018,11 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
it.value() = newValue;
emit attributeChanged(property, attribute, newValue);
- } else if (attribute == QLatin1String(fontAttributeC) && m_stringFontAttributes.contains(property)) {
+ } else if (attribute == fontAttributeC && m_stringFontAttributes.contains(property)) {
if (value.userType() != QMetaType::QFont)
return;
- const PropertyFontMap::iterator it = m_stringFontAttributes.find(property);
+ const auto it = m_stringFontAttributes.find(property);
const QFont oldValue = it.value();
const QFont newValue = qvariant_cast<QFont>(value);
@@ -1354,11 +1033,11 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
it.value() = newValue;
emit attributeChanged(property, attribute, newValue);
- } else if (attribute == QLatin1String(themeAttributeC) && m_stringThemeAttributes.contains(property)) {
+ } else if (attribute == themeAttributeC && m_stringThemeAttributes.contains(property)) {
if (value.userType() != QMetaType::Bool)
return;
- const PropertyBoolMap::iterator it = m_stringThemeAttributes.find(property);
+ const auto it = m_stringThemeAttributes.find(property);
const bool oldValue = it.value();
const bool newValue = value.toBool();
@@ -1369,20 +1048,35 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
it.value() = newValue;
emit attributeChanged(property, attribute, newValue);
- } else if (attribute == QLatin1String(superPaletteAttributeC) && m_paletteValues.contains(property)) {
+ } else if (attribute == themeEnumAttributeC && m_intThemeEnumAttributes.contains(property)) {
+ if (value.userType() != QMetaType::Bool)
+ return;
+
+ const auto it = m_intThemeEnumAttributes.find(property);
+ const bool oldValue = it.value();
+
+ const bool newValue = value.toBool();
+
+ if (oldValue == newValue)
+ return;
+
+ it.value() = newValue;
+
+ emit attributeChanged(property, attribute, newValue);
+ } else if (attribute == superPaletteAttributeC && m_paletteValues.contains(property)) {
if (value.userType() != QMetaType::QPalette)
return;
QPalette superPalette = qvariant_cast<QPalette>(value);
- const PropertyPaletteDataMap::iterator it = m_paletteValues.find(property);
+ const auto it = m_paletteValues.find(property);
PaletteData data = it.value();
if (data.superPalette == superPalette)
return;
data.superPalette = superPalette;
// resolve here
- const uint mask = data.val.resolveMask();
+ const auto mask = data.val.resolveMask();
data.val = data.val.resolve(superPalette);
data.val.setResolveMask(mask);
@@ -1394,13 +1088,13 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
emit propertyChanged(property);
emit QtVariantPropertyManager::valueChanged(property, data.val); // if resolve was done, this is also for consistency
- } else if (attribute == QLatin1String(defaultResourceAttributeC) && m_defaultPixmaps.contains(property)) {
+ } else if (attribute == defaultResourceAttributeC && m_defaultPixmaps.contains(property)) {
if (value.userType() != QMetaType::QPixmap)
return;
QPixmap defaultPixmap = qvariant_cast<QPixmap>(value);
- const QMap<QtProperty *, QPixmap>::iterator it = m_defaultPixmaps.find(property);
+ const auto it = m_defaultPixmaps.find(property);
QPixmap oldDefaultPixmap = it.value();
if (defaultPixmap.cacheKey() == oldDefaultPixmap.cacheKey())
return;
@@ -1411,13 +1105,13 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
emit attributeChanged(property, attribute, v);
emit propertyChanged(property);
- } else if (attribute == QLatin1String(defaultResourceAttributeC) && m_defaultIcons.contains(property)) {
+ } else if (attribute == defaultResourceAttributeC && m_defaultIcons.contains(property)) {
if (value.userType() != QMetaType::QIcon)
return;
QIcon defaultIcon = qvariant_cast<QIcon>(value);
- const QMap<QtProperty *, QIcon>::iterator it = m_defaultIcons.find(property);
+ const auto it = m_defaultIcons.find(property);
QIcon oldDefaultIcon = it.value();
if (defaultIcon.cacheKey() == oldDefaultIcon.cacheKey())
return;
@@ -1426,11 +1120,11 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
qdesigner_internal::PropertySheetIconValue icon = m_iconValues.value(property);
if (icon.paths().isEmpty()) {
- QMap<QPair<QIcon::Mode, QIcon::State>, QtProperty *> subIconProperties = m_propertyToIconSubProperties.value(property);
+ const auto &subIconProperties = m_propertyToIconSubProperties.value(property);
for (auto itSub = subIconProperties.cbegin(), end = subIconProperties.cend(); itSub != end; ++itSub) {
- QPair<QIcon::Mode, QIcon::State> pair = itSub.key();
+ const auto pair = itSub.key();
QtProperty *subProp = itSub.value();
- setAttribute(subProp, QLatin1String(defaultResourceAttributeC),
+ setAttribute(subProp, defaultResourceAttributeC,
defaultIcon.pixmap(16, 16, pair.first, pair.second));
}
}
@@ -1490,7 +1184,7 @@ int DesignerPropertyManager::designerKeySequenceTypeId()
QString DesignerPropertyManager::alignDefaultAttribute()
{
- return QStringLiteral("alignDefault");
+ return u"alignDefault"_s;
}
uint DesignerPropertyManager::alignDefault(const QtVariantProperty *prop)
@@ -1532,79 +1226,70 @@ bool DesignerPropertyManager::isPropertyTypeSupported(int propertyType) const
QString DesignerPropertyManager::valueText(const QtProperty *property) const
{
- if (m_flagValues.contains(const_cast<QtProperty *>(property))) {
- const FlagData data = m_flagValues.value(const_cast<QtProperty *>(property));
+ if (m_flagValues.contains(property)) {
+ const FlagData data = m_flagValues.value(property);
const uint v = data.val;
- const QChar bar = QLatin1Char('|');
QString valueStr;
for (const DesignerIntPair &p : data.flags) {
const uint val = p.second;
const bool checked = (val == 0) ? (v == 0) : ((val & v) == val);
if (checked) {
if (!valueStr.isEmpty())
- valueStr += bar;
+ valueStr += u'|';
valueStr += p.first;
}
}
return valueStr;
}
- if (m_alignValues.contains(const_cast<QtProperty *>(property))) {
- const uint v = m_alignValues.value(const_cast<QtProperty *>(property));
+ if (m_alignValues.contains(property)) {
+ const uint v = m_alignValues.value(property);
return tr("%1, %2").arg(indexHToString(alignToIndexH(v)),
indexVToString(alignToIndexV(v)));
}
- if (m_paletteValues.contains(const_cast<QtProperty *>(property))) {
- const PaletteData data = m_paletteValues.value(const_cast<QtProperty *>(property));
- const uint mask = data.val.resolveMask();
+ if (m_paletteValues.contains(property)) {
+ const PaletteData data = m_paletteValues.value(property);
+ const auto mask = data.val.resolveMask();
if (mask)
return tr("Customized (%n roles)", nullptr, bitCount(mask));
static const QString inherited = tr("Inherited");
return inherited;
}
- if (m_iconValues.contains(const_cast<QtProperty *>(property))) {
- const PropertySheetIconValue icon = m_iconValues.value(const_cast<QtProperty *>(property));
- const QString theme = icon.theme();
- if (!theme.isEmpty() && QIcon::hasThemeIcon(theme))
- return tr("[Theme] %1").arg(theme);
- const auto &paths = icon.paths();
- const PropertySheetIconValue::ModeStateToPixmapMap::const_iterator it = paths.constFind(qMakePair(QIcon::Normal, QIcon::Off));
- if (it == paths.constEnd())
- return QString();
- return QFileInfo(it.value().path()).fileName();
- }
- if (m_pixmapValues.contains(const_cast<QtProperty *>(property))) {
- const QString path = m_pixmapValues.value(const_cast<QtProperty *>(property)).path();
+ if (m_iconValues.contains(property))
+ return PixmapEditor::displayText(m_iconValues.value(property));
+ if (m_pixmapValues.contains(property)) {
+ const QString path = m_pixmapValues.value(property).path();
if (path.isEmpty())
return QString();
return QFileInfo(path).fileName();
}
- if (m_uintValues.contains(const_cast<QtProperty *>(property))) {
- return QString::number(m_uintValues.value(const_cast<QtProperty *>(property)));
- }
- if (m_longLongValues.contains(const_cast<QtProperty *>(property))) {
- return QString::number(m_longLongValues.value(const_cast<QtProperty *>(property)));
- }
- if (m_uLongLongValues.contains(const_cast<QtProperty *>(property))) {
- return QString::number(m_uLongLongValues.value(const_cast<QtProperty *>(property)));
- }
- if (m_urlValues.contains(const_cast<QtProperty *>(property))) {
- return m_urlValues.value(const_cast<QtProperty *>(property)).toString();
- }
- if (m_byteArrayValues.contains(const_cast<QtProperty *>(property))) {
- return QString::fromUtf8(m_byteArrayValues.value(const_cast<QtProperty *>(property)));
- }
+ if (m_intValues.contains(property)) {
+ const auto value = m_intValues.value(property);
+ if (m_intThemeEnumAttributes.value(property))
+ return IconThemeEnumEditor::iconName(value);
+ return QString::number(value);
+ }
+ if (m_uintValues.contains(property))
+ return QString::number(m_uintValues.value(property));
+ if (m_longLongValues.contains(property))
+ return QString::number(m_longLongValues.value(property));
+ if (m_uLongLongValues.contains(property))
+ return QString::number(m_uLongLongValues.value(property));
+ if (m_urlValues.contains(property))
+ return m_urlValues.value(property).toString();
+ if (m_byteArrayValues.contains(property))
+ return QString::fromUtf8(m_byteArrayValues.value(property));
const int vType = QtVariantPropertyManager::valueType(property);
if (vType == QMetaType::QString || vType == designerStringTypeId()) {
const QString str = (QtVariantPropertyManager::valueType(property) == QMetaType::QString)
? value(property).toString() : qvariant_cast<PropertySheetStringValue>(value(property)).value();
- const int validationMode = attributeValue(property, QLatin1String(validationModesAttributeC)).toInt();
+ const int validationMode = attributeValue(property, validationModesAttributeC).toInt();
return TextPropertyEditor::stringToEditorString(str, static_cast<TextPropertyValidationMode>(validationMode));
}
if (vType == QMetaType::QStringList || vType == designerStringListTypeId()) {
QVariant v = value(property);
const QStringList list = v.metaType().id() == QMetaType::QStringList
? v.toStringList() : qvariant_cast<PropertySheetStringListValue>(v).value();
- return list.join(QLatin1String("; "));
+ return list.join("; "_L1);
}
if (vType == designerKeySequenceTypeId()) {
return qvariant_cast<PropertySheetKeySequenceValue>(value(property)).value().toString(QKeySequence::NativeText);
@@ -1623,7 +1308,7 @@ void DesignerPropertyManager::reloadResourceProperties()
{
DesignerIconCache *iconCache = nullptr;
for (auto itIcon = m_iconValues.cbegin(), end = m_iconValues.cend(); itIcon!= end; ++itIcon) {
- QtProperty *property = itIcon.key();
+ auto *property = itIcon.key();
const PropertySheetIconValue &icon = itIcon.value();
QIcon defaultIcon = m_defaultIcons.value(property);
@@ -1637,19 +1322,20 @@ void DesignerPropertyManager::reloadResourceProperties()
defaultIcon = iconCache->icon(icon);
}
- QMap<QPair<QIcon::Mode, QIcon::State>, QtProperty *> subProperties = m_propertyToIconSubProperties.value(property);
+ const auto &subProperties = m_propertyToIconSubProperties.value(property);
for (auto itSub = subProperties.cbegin(), end = subProperties.cend(); itSub != end; ++itSub) {
- const QPair<QIcon::Mode, QIcon::State> pair = itSub.key();
+ const auto pair = itSub.key();
QtVariantProperty *subProperty = variantProperty(itSub.value());
- subProperty->setAttribute(QLatin1String(defaultResourceAttributeC),
+ subProperty->setAttribute(defaultResourceAttributeC,
defaultIcon.pixmap(16, 16, pair.first, pair.second));
}
- emit propertyChanged(property);
- emit QtVariantPropertyManager::valueChanged(property, QVariant::fromValue(itIcon.value()));
+ auto *ncProperty = const_cast<QtProperty *>(property);
+ emit propertyChanged(ncProperty);
+ emit QtVariantPropertyManager::valueChanged(ncProperty, QVariant::fromValue(itIcon.value()));
}
for (auto itPix = m_pixmapValues.cbegin(), end = m_pixmapValues.cend(); itPix != end; ++itPix) {
- QtProperty *property = itPix.key();
+ auto *property = const_cast<QtProperty *>(itPix.key());
emit propertyChanged(property);
emit QtVariantPropertyManager::valueChanged(property, QVariant::fromValue(itPix.value()));
}
@@ -1657,21 +1343,21 @@ void DesignerPropertyManager::reloadResourceProperties()
QIcon DesignerPropertyManager::valueIcon(const QtProperty *property) const
{
- if (m_iconValues.contains(const_cast<QtProperty *>(property))) {
+ if (m_iconValues.contains(property)) {
if (!property->isModified())
- return m_defaultIcons.value(const_cast<QtProperty *>(property)).pixmap(16, 16);
+ return m_defaultIcons.value(property).pixmap(16, 16);
QDesignerFormWindowInterface *formWindow = QDesignerFormWindowInterface::findFormWindow(m_object);
qdesigner_internal::FormWindowBase *fwb = qobject_cast<qdesigner_internal::FormWindowBase *>(formWindow);
if (fwb)
- return fwb->iconCache()->icon(m_iconValues.value(const_cast<QtProperty *>(property))).pixmap(16, 16);
- } else if (m_pixmapValues.contains(const_cast<QtProperty *>(property))) {
+ return fwb->iconCache()->icon(m_iconValues.value(property)).pixmap(16, 16);
+ } else if (m_pixmapValues.contains(property)) {
if (!property->isModified())
- return m_defaultPixmaps.value(const_cast<QtProperty *>(property));
+ return m_defaultPixmaps.value(property);
QDesignerFormWindowInterface *formWindow = QDesignerFormWindowInterface::findFormWindow(m_object);
qdesigner_internal::FormWindowBase *fwb = qobject_cast<qdesigner_internal::FormWindowBase *>(formWindow);
if (fwb)
- return fwb->pixmapCache()->pixmap(m_pixmapValues.value(const_cast<QtProperty *>(property)));
- } else if (m_stringThemeAttributes.value(const_cast<QtProperty *>(property), false)) {
+ return fwb->pixmapCache()->pixmap(m_pixmapValues.value(property));
+ } else if (m_stringThemeAttributes.value(property, false)) {
return QIcon::fromTheme(value(property).toString());
} else {
QIcon rc;
@@ -1684,32 +1370,34 @@ QIcon DesignerPropertyManager::valueIcon(const QtProperty *property) const
QVariant DesignerPropertyManager::value(const QtProperty *property) const
{
- if (m_flagValues.contains(const_cast<QtProperty *>(property)))
- return m_flagValues.value(const_cast<QtProperty *>(property)).val;
- if (m_alignValues.contains(const_cast<QtProperty *>(property)))
- return m_alignValues.value(const_cast<QtProperty *>(property));
- if (m_paletteValues.contains(const_cast<QtProperty *>(property)))
- return m_paletteValues.value(const_cast<QtProperty *>(property)).val;
- if (m_iconValues.contains(const_cast<QtProperty *>(property)))
- return QVariant::fromValue(m_iconValues.value(const_cast<QtProperty *>(property)));
- if (m_pixmapValues.contains(const_cast<QtProperty *>(property)))
- return QVariant::fromValue(m_pixmapValues.value(const_cast<QtProperty *>(property)));
+ if (m_flagValues.contains(property))
+ return m_flagValues.value(property).val;
+ if (m_alignValues.contains(property))
+ return m_alignValues.value(property);
+ if (m_paletteValues.contains(property))
+ return m_paletteValues.value(property).val;
+ if (m_iconValues.contains(property))
+ return QVariant::fromValue(m_iconValues.value(property));
+ if (m_pixmapValues.contains(property))
+ return QVariant::fromValue(m_pixmapValues.value(property));
QVariant rc;
if (m_stringManager.value(property, &rc)
|| m_keySequenceManager.value(property, &rc)
|| m_stringListManager.value(property, &rc)
|| m_brushManager.value(property, &rc))
return rc;
- if (m_uintValues.contains(const_cast<QtProperty *>(property)))
- return m_uintValues.value(const_cast<QtProperty *>(property));
- if (m_longLongValues.contains(const_cast<QtProperty *>(property)))
- return m_longLongValues.value(const_cast<QtProperty *>(property));
- if (m_uLongLongValues.contains(const_cast<QtProperty *>(property)))
- return m_uLongLongValues.value(const_cast<QtProperty *>(property));
- if (m_urlValues.contains(const_cast<QtProperty *>(property)))
- return m_urlValues.value(const_cast<QtProperty *>(property));
- if (m_byteArrayValues.contains(const_cast<QtProperty *>(property)))
- return m_byteArrayValues.value(const_cast<QtProperty *>(property));
+ if (m_intValues.contains(property))
+ return m_intValues.value(property);
+ if (m_uintValues.contains(property))
+ return m_uintValues.value(property);
+ if (m_longLongValues.contains(property))
+ return m_longLongValues.value(property);
+ if (m_uLongLongValues.contains(property))
+ return m_uLongLongValues.value(property);
+ if (m_urlValues.contains(property))
+ return m_urlValues.value(property);
+ if (m_byteArrayValues.contains(property))
+ return m_byteArrayValues.value(property);
return QtVariantPropertyManager::value(property);
}
@@ -1761,7 +1449,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
return;
}
- const PropertyFlagDataMap::iterator fit = m_flagValues.find(property);
+ const auto fit = m_flagValues.find(property);
if (fit != m_flagValues.end()) {
if (value.metaType().id() != QMetaType::UInt && !value.canConvert<uint>())
@@ -1777,15 +1465,15 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
const auto values = data.values;
const auto subFlags = m_propertyToFlags.value(property);
- const int subFlagCount = subFlags.count();
- for (int i = 0; i < subFlagCount; ++i) {
+ const qsizetype subFlagCount = subFlags.size();
+ for (qsizetype i = 0; i < subFlagCount; ++i) {
QtVariantProperty *subFlag = variantProperty(subFlags.at(i));
const uint val = values.at(i);
const bool checked = (val == 0) ? (v == 0) : ((val & v) == val);
subFlag->setValue(checked);
}
- for (int i = 0; i < subFlagCount; ++i) {
+ for (qsizetype i = 0; i < subFlagCount; ++i) {
QtVariantProperty *subFlag = variantProperty(subFlags.at(i));
const uint val = values.at(i);
const bool checked = (val == 0) ? (v == 0) : ((val & v) == val);
@@ -1796,7 +1484,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
} else if (bitCount(val) > 1) {
// Disabled if all flags contained in the mask are checked
uint currentMask = 0;
- for (int j = 0; j < subFlagCount; ++j) {
+ for (qsizetype j = 0; j < subFlagCount; ++j) {
QtVariantProperty *subFlag = variantProperty(subFlags.at(j));
if (bitCount(values.at(j)) == 1)
currentMask |= subFlag->value().toBool() ? values.at(j) : 0;
@@ -1849,7 +1537,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
PaletteData data = m_paletteValues.value(property);
- const uint mask = p.resolveMask();
+ const auto mask = p.resolveMask();
p = p.resolve(data.superPalette);
p.setResolveMask(mask);
@@ -1886,14 +1574,14 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
const auto &iconPaths = icon.paths();
- QMap<QPair<QIcon::Mode, QIcon::State>, QtProperty *> subProperties = m_propertyToIconSubProperties.value(property);
+ const auto &subProperties = m_propertyToIconSubProperties.value(property);
for (auto itSub = subProperties.cbegin(), end = subProperties.cend(); itSub != end; ++itSub) {
- const QPair<QIcon::Mode, QIcon::State> pair = itSub.key();
+ const auto pair = itSub.key();
QtVariantProperty *subProperty = variantProperty(itSub.value());
bool hasPath = iconPaths.contains(pair);
subProperty->setModified(hasPath);
subProperty->setValue(QVariant::fromValue(iconPaths.value(pair)));
- subProperty->setAttribute(QLatin1String(defaultResourceAttributeC),
+ subProperty->setAttribute(defaultResourceAttributeC,
defaultIcon.pixmap(16, 16, pair.first, pair.second));
}
QtVariantProperty *themeSubProperty = variantProperty(m_propertyToTheme.value(property));
@@ -1902,13 +1590,18 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
themeSubProperty->setModified(!theme.isEmpty());
themeSubProperty->setValue(theme);
}
+ QtVariantProperty *themeEnumSubProperty = variantProperty(m_propertyToThemeEnum.value(property));
+ if (themeEnumSubProperty) {
+ const int themeEnum = icon.themeEnum();
+ themeEnumSubProperty->setModified(themeEnum != -1);
+ themeEnumSubProperty->setValue(QVariant(themeEnum));
+ }
emit QtVariantPropertyManager::valueChanged(property, QVariant::fromValue(icon));
emit propertyChanged(property);
QString toolTip;
- const QMap<QPair<QIcon::Mode, QIcon::State>, PropertySheetPixmapValue>::ConstIterator itNormalOff =
- iconPaths.constFind(qMakePair(QIcon::Normal, QIcon::Off));
+ const auto itNormalOff = iconPaths.constFind({QIcon::Normal, QIcon::Off});
if (itNormalOff != iconPaths.constEnd())
toolTip = itNormalOff.value().path();
// valueText() only show the file name; show full path as ToolTip.
@@ -1936,6 +1629,23 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
return;
}
+ if (m_intValues.contains(property)) {
+ if (value.metaType().id() != QMetaType::Int && !value.canConvert<int>())
+ return;
+
+ const int v = value.toInt(nullptr);
+
+ const int oldValue = m_intValues.value(property);
+ if (v == oldValue)
+ return;
+
+ m_intValues[property] = v;
+
+ emit QtVariantPropertyManager::valueChanged(property, v);
+ emit propertyChanged(property);
+
+ return;
+ }
if (m_uintValues.contains(property)) {
if (value.metaType().id() != QMetaType::UInt && !value.canConvert<uint>())
return;
@@ -2029,6 +1739,8 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
void DesignerPropertyManager::initializeProperty(QtProperty *property)
{
+ static bool creatingIconProperties = false;
+
m_resetMap[property] = false;
const int type = propertyType(property);
@@ -2042,6 +1754,12 @@ void DesignerPropertyManager::initializeProperty(QtProperty *property)
m_stringFontAttributes[property] = QApplication::font();
m_stringThemeAttributes[property] = false;
break;
+ case QMetaType::Int:
+ if (creatingIconProperties) {
+ m_intValues[property] = 0;
+ m_intThemeEnumAttributes[property] = false;
+ }
+ break;
case QMetaType::UInt:
m_uintValues[property] = 0;
break;
@@ -2071,7 +1789,7 @@ void DesignerPropertyManager::initializeProperty(QtProperty *property)
QtVariantProperty *alignH = addProperty(enumTypeId(), tr("Horizontal"));
QStringList namesH;
namesH << indexHToString(0) << indexHToString(1) << indexHToString(2) << indexHToString(3);
- alignH->setAttribute(QStringLiteral("enumNames"), namesH);
+ alignH->setAttribute(u"enumNames"_s, namesH);
alignH->setValue(alignToIndexH(align));
m_propertyToAlignH[property] = alignH;
m_alignHToProperty[alignH] = property;
@@ -2080,7 +1798,7 @@ void DesignerPropertyManager::initializeProperty(QtProperty *property)
QtVariantProperty *alignV = addProperty(enumTypeId(), tr("Vertical"));
QStringList namesV;
namesV << indexVToString(0) << indexVToString(1) << indexVToString(2);
- alignV->setAttribute(QStringLiteral("enumNames"), namesV);
+ alignV->setAttribute(u"enumNames"_s, namesV);
alignV->setValue(alignToIndexV(align));
m_propertyToAlignV[property] = alignV;
m_alignVToProperty[alignV] = property;
@@ -2089,11 +1807,20 @@ void DesignerPropertyManager::initializeProperty(QtProperty *property)
m_pixmapValues[property] = PropertySheetPixmapValue();
m_defaultPixmaps[property] = QPixmap();
} else if (type == designerIconTypeId()) {
+ creatingIconProperties = true;
m_iconValues[property] = PropertySheetIconValue();
m_defaultIcons[property] = QIcon();
- QtVariantProperty *themeProp = addProperty(QMetaType::QString, tr("Theme"));
- themeProp->setAttribute(QLatin1String(themeAttributeC), true);
+ QtVariantProperty *themeEnumProp = addProperty(QMetaType::Int, tr("Theme"));
+ m_intValues[themeEnumProp] = -1;
+ themeEnumProp->setAttribute(themeEnumAttributeC, true);
+ m_iconSubPropertyToProperty[themeEnumProp] = property;
+ m_propertyToThemeEnum[property] = themeEnumProp;
+ m_resetMap[themeEnumProp] = true;
+ property->addSubProperty(themeEnumProp);
+
+ QtVariantProperty *themeProp = addProperty(QMetaType::QString, tr("XDG Theme"));
+ themeProp->setAttribute(themeAttributeC, true);
m_iconSubPropertyToProperty[themeProp] = property;
m_propertyToTheme[property] = themeProp;
m_resetMap[themeProp] = true;
@@ -2107,6 +1834,7 @@ void DesignerPropertyManager::initializeProperty(QtProperty *property)
createIconSubProperty(property, QIcon::Active, QIcon::On, tr("Active On"));
createIconSubProperty(property, QIcon::Selected, QIcon::Off, tr("Selected Off"));
createIconSubProperty(property, QIcon::Selected, QIcon::On, tr("Selected On"));
+ creatingIconProperties = false;
} else if (type == designerStringTypeId()) {
m_stringManager.initialize(this, property, PropertySheetStringValue());
m_stringAttributes.insert(property, ValidationMultiLine);
@@ -2122,12 +1850,12 @@ void DesignerPropertyManager::initializeProperty(QtProperty *property)
QtVariantPropertyManager::initializeProperty(property);
m_fontManager.postInitializeProperty(this, property, type, DesignerPropertyManager::enumTypeId());
if (type == QMetaType::Double)
- setAttribute(property, QStringLiteral("decimals"), 6);
+ setAttribute(property, u"decimals"_s, 6);
}
void DesignerPropertyManager::createIconSubProperty(QtProperty *iconProperty, QIcon::Mode mode, QIcon::State state, const QString &subName)
{
- QPair<QIcon::Mode, QIcon::State> pair = qMakePair(mode, state);
+ const auto pair = std::make_pair(mode, state);
QtVariantProperty *subProp = addProperty(DesignerPropertyManager::designerPixmapTypeId(), subName);
m_propertyToIconSubProperties[iconProperty][pair] = subProp;
m_iconSubPropertyToState[subProp] = pair;
@@ -2166,10 +1894,15 @@ void DesignerPropertyManager::uninitializeProperty(QtProperty *property)
m_keySequenceManager.uninitialize(property);
if (QtProperty *iconTheme = m_propertyToTheme.value(property)) {
- delete iconTheme;
+ delete iconTheme; // Delete first (QTBUG-126182)
m_iconSubPropertyToProperty.remove(iconTheme);
}
+ if (QtProperty *iconThemeEnum = m_propertyToThemeEnum.value(property)) {
+ delete iconThemeEnum; // Delete first (QTBUG-126182)
+ m_iconSubPropertyToProperty.remove(iconThemeEnum);
+ }
+
m_propertyToAlignH.remove(property);
m_propertyToAlignV.remove(property);
@@ -2184,7 +1917,7 @@ void DesignerPropertyManager::uninitializeProperty(QtProperty *property)
m_pixmapValues.remove(property);
m_defaultPixmaps.remove(property);
- QMap<QPair<QIcon::Mode, QIcon::State>, QtProperty *> iconSubProperties = m_propertyToIconSubProperties.value(property);
+ const auto &iconSubProperties = m_propertyToIconSubProperties.value(property);
for (auto itIcon = iconSubProperties.cbegin(), end = iconSubProperties.cend(); itIcon != end; ++itIcon) {
QtProperty *subIcon = itIcon.value();
delete subIcon;
@@ -2195,6 +1928,7 @@ void DesignerPropertyManager::uninitializeProperty(QtProperty *property)
m_iconSubPropertyToState.remove(property);
m_iconSubPropertyToProperty.remove(property);
+ m_intValues.remove(property);
m_uintValues.remove(property);
m_longLongValues.remove(property);
m_uLongLongValues.remove(property);
@@ -2234,11 +1968,17 @@ bool DesignerPropertyManager::resetIconSubProperty(QtProperty *property)
pixmapProperty->setValue(QVariant::fromValue(PropertySheetPixmapValue()));
return true;
}
- if (m_propertyToTheme.contains(iconProperty)) {
+ if (attributeValue(property, themeAttributeC).toBool()) {
QtVariantProperty *themeProperty = variantProperty(property);
themeProperty->setValue(QString());
return true;
}
+ if (attributeValue(property, themeEnumAttributeC).toBool()) {
+ QtVariantProperty *themeEnumProperty = variantProperty(property);
+ themeEnumProperty->setValue(-1);
+ return true;
+ }
+
return false;
}
@@ -2316,23 +2056,23 @@ void DesignerEditorFactory::slotAttributeChanged(QtProperty *property, const QSt
{
QtVariantPropertyManager *manager = propertyManager(property);
const int type = manager->propertyType(property);
- if (type == DesignerPropertyManager::designerPixmapTypeId() && attribute == QLatin1String(defaultResourceAttributeC)) {
+ if (type == DesignerPropertyManager::designerPixmapTypeId() && attribute == defaultResourceAttributeC) {
const QPixmap pixmap = qvariant_cast<QPixmap>(value);
applyToEditors(m_pixmapPropertyToEditors.value(property), &PixmapEditor::setDefaultPixmap, pixmap);
} else if (type == DesignerPropertyManager::designerStringTypeId() || type == QMetaType::QString) {
- if (attribute == QLatin1String(validationModesAttributeC)) {
+ if (attribute == validationModesAttributeC) {
const TextPropertyValidationMode validationMode = static_cast<TextPropertyValidationMode>(value.toInt());
applyToEditors(m_stringPropertyToEditors.value(property), &TextEditor::setTextPropertyValidationMode, validationMode);
}
- if (attribute == QLatin1String(fontAttributeC)) {
+ if (attribute == fontAttributeC) {
const QFont font = qvariant_cast<QFont>(value);
applyToEditors(m_stringPropertyToEditors.value(property), &TextEditor::setRichTextDefaultFont, font);
}
- if (attribute == QLatin1String(themeAttributeC)) {
+ if (attribute == themeAttributeC) {
const bool themeEnabled = value.toBool();
applyToEditors(m_stringPropertyToEditors.value(property), &TextEditor::setIconThemeModeEnabled, themeEnabled);
}
- } else if (type == QMetaType::QPalette && attribute == QLatin1String(superPaletteAttributeC)) {
+ } else if (type == QMetaType::QPalette && attribute == superPaletteAttributeC) {
const QPalette palette = qvariant_cast<QPalette>(value);
applyToEditors(m_palettePropertyToEditors.value(property), &PaletteEditorButton::setSuperPalette, palette);
}
@@ -2343,14 +2083,17 @@ void DesignerEditorFactory::slotPropertyChanged(QtProperty *property)
QtVariantPropertyManager *manager = propertyManager(property);
const int type = manager->propertyType(property);
if (type == DesignerPropertyManager::designerIconTypeId()) {
- QPixmap defaultPixmap;
- if (!property->isModified())
- defaultPixmap = qvariant_cast<QIcon>(manager->attributeValue(property, QLatin1String(defaultResourceAttributeC))).pixmap(16, 16);
- else if (m_fwb)
- defaultPixmap = m_fwb->iconCache()->icon(qvariant_cast<PropertySheetIconValue>(manager->value(property))).pixmap(16, 16);
+ QIcon defaultPixmap;
+ if (!property->isModified()) {
+ const auto attributeValue = manager->attributeValue(property, defaultResourceAttributeC);
+ defaultPixmap = attributeValue.value<QIcon>();
+ } else if (m_fwb) {
+ const auto value = manager->value(property);
+ defaultPixmap = m_fwb->iconCache()->icon(value.value<PropertySheetIconValue>());
+ }
const auto editors = m_iconPropertyToEditors.value(property);
for (PixmapEditor *editor : editors)
- editor->setDefaultPixmap(defaultPixmap);
+ editor->setDefaultPixmapIcon(defaultPixmap);
}
}
@@ -2368,6 +2111,12 @@ void DesignerEditorFactory::slotValueChanged(QtProperty *property, const QVarian
case QMetaType::QPalette:
applyToEditors(m_palettePropertyToEditors.value(property), &PaletteEditorButton::setPalette, qvariant_cast<QPalette>(value));
break;
+ case QMetaType::Int: {
+ auto it = m_intPropertyToComboEditors.constFind(property);
+ if (it != m_intPropertyToComboEditors.cend())
+ applyToEditors(it.value(), &QComboBox::setCurrentIndex, value.toInt());
+ }
+ break;
case QMetaType::UInt:
applyToEditors(m_uintPropertyToEditors.value(property), &QLineEdit::setText, QString::number(value.toUInt()));
break;
@@ -2390,6 +2139,7 @@ void DesignerEditorFactory::slotValueChanged(QtProperty *property, const QVarian
if (type == DesignerPropertyManager::designerIconTypeId()) {
PropertySheetIconValue iconValue = qvariant_cast<PropertySheetIconValue>(value);
applyToEditors(m_iconPropertyToEditors.value(property), &PixmapEditor::setTheme, iconValue.theme());
+ applyToEditors(m_iconPropertyToEditors.value(property), &PixmapEditor::setThemeEnum, iconValue.themeEnum());
applyToEditors(m_iconPropertyToEditors.value(property), &PixmapEditor::setPath, iconValue.pixmap(QIcon::Normal, QIcon::Off).path());
} else if (type == DesignerPropertyManager::designerPixmapTypeId()) {
applyToEditors(m_pixmapPropertyToEditors.value(property), &PixmapEditor::setPath, qvariant_cast<PropertySheetPixmapValue>(value).path());
@@ -2428,12 +2178,13 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
}
break;
case QMetaType::QString: {
- const TextPropertyValidationMode tvm = static_cast<TextPropertyValidationMode>(manager->attributeValue(property, QLatin1String(validationModesAttributeC)).toInt());
+ const int itvm = manager->attributeValue(property, validationModesAttributeC).toInt();
+ const auto tvm = static_cast<TextPropertyValidationMode>(itvm);
TextEditor *ed = createTextEditor(parent, tvm, manager->value(property).toString());
- const QVariant richTextDefaultFont = manager->attributeValue(property, QLatin1String(fontAttributeC));
+ const QVariant richTextDefaultFont = manager->attributeValue(property, fontAttributeC);
if (richTextDefaultFont.metaType().id() == QMetaType::QFont)
ed->setRichTextDefaultFont(qvariant_cast<QFont>(richTextDefaultFont));
- const bool themeEnabled = manager->attributeValue(property, QLatin1String(themeAttributeC)).toBool();
+ const bool themeEnabled = manager->attributeValue(property, themeAttributeC).toBool();
ed->setIconThemeModeEnabled(themeEnabled);
m_stringPropertyToEditors[property].append(ed);
m_editorToStringProperty[ed] = property;
@@ -2444,7 +2195,7 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
break;
case QMetaType::QPalette: {
PaletteEditorButton *ed = new PaletteEditorButton(m_core, qvariant_cast<QPalette>(manager->value(property)), parent);
- ed->setSuperPalette(qvariant_cast<QPalette>(manager->attributeValue(property, QLatin1String(superPaletteAttributeC))));
+ ed->setSuperPalette(qvariant_cast<QPalette>(manager->attributeValue(property, superPaletteAttributeC)));
m_palettePropertyToEditors[property].append(ed);
m_editorToPaletteProperty[ed] = property;
connect(ed, &QObject::destroyed, this, &DesignerEditorFactory::slotEditorDestroyed);
@@ -2452,6 +2203,20 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
editor = ed;
}
break;
+ case QMetaType::Int:
+ if (manager->attributeValue(property, themeEnumAttributeC).toBool()) {
+ auto *ed = IconThemeEnumEditor::createComboBox(parent);
+ ed->setCurrentIndex(manager->value(property).toInt());
+ connect(ed, &QComboBox::currentIndexChanged, this,
+ &DesignerEditorFactory::slotIntChanged);
+ connect(ed, &QObject::destroyed, this, &DesignerEditorFactory::slotEditorDestroyed);
+ m_intPropertyToComboEditors[property].append(ed);
+ m_comboEditorToIntProperty.insert(ed, property);
+ editor = ed;
+ } else {
+ editor = QtVariantEditorFactory::createEditor(manager, property, parent);
+ }
+ break;
case QMetaType::UInt: {
QLineEdit *ed = new QLineEdit(parent);
ed->setValidator(new QULongLongValidator(0, UINT_MAX, ed));
@@ -2509,7 +2274,7 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
PixmapEditor *ed = new PixmapEditor(m_core, parent);
ed->setPixmapCache(m_fwb->pixmapCache());
ed->setPath(qvariant_cast<PropertySheetPixmapValue>(manager->value(property)).path());
- ed->setDefaultPixmap(qvariant_cast<QPixmap>(manager->attributeValue(property, QLatin1String(defaultResourceAttributeC))));
+ ed->setDefaultPixmap(qvariant_cast<QPixmap>(manager->attributeValue(property, defaultResourceAttributeC)));
ed->setSpacing(m_spacing);
m_pixmapPropertyToEditors[property].append(ed);
m_editorToPixmapProperty[ed] = property;
@@ -2522,24 +2287,26 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
ed->setIconThemeModeEnabled(true);
PropertySheetIconValue value = qvariant_cast<PropertySheetIconValue>(manager->value(property));
ed->setTheme(value.theme());
+ ed->setThemeEnum(value.themeEnum());
ed->setPath(value.pixmap(QIcon::Normal, QIcon::Off).path());
- QPixmap defaultPixmap;
+ QIcon defaultPixmap;
if (!property->isModified())
- defaultPixmap = qvariant_cast<QIcon>(manager->attributeValue(property, QLatin1String(defaultResourceAttributeC))).pixmap(16, 16);
+ defaultPixmap = qvariant_cast<QIcon>(manager->attributeValue(property, defaultResourceAttributeC));
else if (m_fwb)
- defaultPixmap = m_fwb->iconCache()->icon(value).pixmap(16, 16);
- ed->setDefaultPixmap(defaultPixmap);
+ defaultPixmap = m_fwb->iconCache()->icon(value);
+ ed->setDefaultPixmapIcon(defaultPixmap);
ed->setSpacing(m_spacing);
m_iconPropertyToEditors[property].append(ed);
m_editorToIconProperty[ed] = property;
connect(ed, &QObject::destroyed, this, &DesignerEditorFactory::slotEditorDestroyed);
connect(ed, &PixmapEditor::pathChanged, this, &DesignerEditorFactory::slotIconChanged);
connect(ed, &PixmapEditor::themeChanged, this, &DesignerEditorFactory::slotIconThemeChanged);
+ connect(ed, &PixmapEditor::themeEnumChanged, this, &DesignerEditorFactory::slotIconThemeEnumChanged);
editor = ed;
} else if (type == DesignerPropertyManager::designerStringTypeId()) {
- const TextPropertyValidationMode tvm = static_cast<TextPropertyValidationMode>(manager->attributeValue(property, QLatin1String(validationModesAttributeC)).toInt());
+ const TextPropertyValidationMode tvm = static_cast<TextPropertyValidationMode>(manager->attributeValue(property, validationModesAttributeC).toInt());
TextEditor *ed = createTextEditor(parent, tvm, qvariant_cast<PropertySheetStringValue>(manager->value(property)).value());
- const QVariant richTextDefaultFont = manager->attributeValue(property, QLatin1String(fontAttributeC));
+ const QVariant richTextDefaultFont = manager->attributeValue(property, fontAttributeC);
if (richTextDefaultFont.metaType().id() == QMetaType::QFont)
ed->setRichTextDefaultFont(qvariant_cast<QFont>(richTextDefaultFont));
m_stringPropertyToEditors[property].append(ed);
@@ -2571,14 +2338,14 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
break;
}
return m_resetDecorator->editor(editor,
- manager->variantProperty(property)->attributeValue(QLatin1String(resettableAttributeC)).toBool(),
+ manager->variantProperty(property)->attributeValue(resettableAttributeC).toBool(),
manager, property, parent);
}
template <class Editor>
bool removeEditor(QObject *object,
- QMap<QtProperty *, QList<Editor> > *propertyToEditors,
- QMap<Editor, QtProperty *> *editorToProperty)
+ QHash<const QtProperty *, QList<Editor>> *propertyToEditors,
+ QHash<Editor, QtProperty *> *editorToProperty)
{
if (!propertyToEditors)
return false;
@@ -2616,6 +2383,8 @@ void DesignerEditorFactory::slotEditorDestroyed(QObject *object)
return;
if (removeEditor(object, &m_longLongPropertyToEditors, &m_editorToLongLongProperty))
return;
+ if (removeEditor(object, &m_intPropertyToComboEditors, &m_comboEditorToIntProperty))
+ return;
if (removeEditor(object, &m_uLongLongPropertyToEditors, &m_editorToULongLongProperty))
return;
if (removeEditor(object, &m_urlPropertyToEditors, &m_editorToUrlProperty))
@@ -2628,7 +2397,7 @@ void DesignerEditorFactory::slotEditorDestroyed(QObject *object)
template<class Editor>
bool updateManager(QtVariantEditorFactory *factory, bool *changingPropertyValue,
- const QMap<Editor, QtProperty *> &editorToProperty, QWidget *editor, const QVariant &value)
+ const QHash<Editor, QtProperty *> &editorToProperty, QWidget *editor, const QVariant &value)
{
if (!editor)
return false;
@@ -2655,6 +2424,12 @@ void DesignerEditorFactory::slotLongLongChanged(const QString &value)
updateManager(this, &m_changingPropertyValue, m_editorToLongLongProperty, qobject_cast<QWidget *>(sender()), value.toLongLong());
}
+void DesignerEditorFactory::slotIntChanged(int v)
+{
+ updateManager(this, &m_changingPropertyValue, m_comboEditorToIntProperty,
+ qobject_cast<QWidget *>(sender()), v);
+}
+
void DesignerEditorFactory::slotULongLongChanged(const QString &value)
{
updateManager(this, &m_changingPropertyValue, m_editorToULongLongProperty, qobject_cast<QWidget *>(sender()), value.toULongLong());
@@ -2671,7 +2446,7 @@ void DesignerEditorFactory::slotByteArrayChanged(const QString &value)
}
template <class Editor>
-QtProperty *findPropertyForEditor(const QMap<Editor *, QtProperty *> &editorMap,
+QtProperty *findPropertyForEditor(const QHash<Editor *, QtProperty *> &editorMap,
const QObject *sender)
{
for (auto it = editorMap.constBegin(), cend = editorMap.constEnd(); it != cend; ++it)
@@ -2746,6 +2521,14 @@ void DesignerEditorFactory::slotIconThemeChanged(const QString &value)
QVariant::fromValue(icon));
}
+void DesignerEditorFactory::slotIconThemeEnumChanged(int value)
+{
+ PropertySheetIconValue icon;
+ icon.setThemeEnum(value);
+ updateManager(this, &m_changingPropertyValue, m_editorToIconProperty,
+ qobject_cast<QWidget *>(sender()), QVariant::fromValue(icon));
+}
+
void DesignerEditorFactory::slotStringListChanged(const QStringList &value)
{
if (QtProperty *prop = findPropertyForEditor(m_editorToStringListProperty, sender())) {
@@ -2863,8 +2646,7 @@ void ResetDecorator::slotPropertyChanged(QtProperty *property)
void ResetDecorator::slotEditorDestroyed(QObject *object)
{
- const QMap<ResetWidget *, QtProperty *>::ConstIterator rcend = m_resetWidgetToProperty.constEnd();
- for (QMap<ResetWidget *, QtProperty *>::ConstIterator itEditor = m_resetWidgetToProperty.constBegin(); itEditor != rcend; ++itEditor) {
+ for (auto itEditor = m_resetWidgetToProperty.cbegin(), cend = m_resetWidgetToProperty.cend(); itEditor != cend; ++itEditor) {
if (itEditor.key() == object) {
ResetWidget *editor = itEditor.key();
QtProperty *property = itEditor.value();
diff --git a/src/designer/src/components/propertyeditor/designerpropertymanager.h b/src/designer/src/components/propertyeditor/designerpropertymanager.h
index c3f55942a..be5c224bb 100644
--- a/src/designer/src/components/propertyeditor/designerpropertymanager.h
+++ b/src/designer/src/components/propertyeditor/designerpropertymanager.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef DESIGNERPROPERTYMANAGER_H
#define DESIGNERPROPERTYMANAGER_H
@@ -37,15 +12,16 @@
#include <shared_enums_p.h>
#include <QtCore/qurl.h>
-#include <QtCore/qmap.h>
+#include <QtCore/qhash.h>
#include <QtGui/qfont.h>
#include <QtGui/qicon.h>
QT_BEGIN_NAMESPACE
-typedef QPair<QString, uint> DesignerIntPair;
+using DesignerIntPair = std::pair<QString, uint>;
using DesignerFlagList = QList<DesignerIntPair>;
+class QComboBox;
class QDesignerFormEditorInterface;
class QLineEdit;
class QUrl;
@@ -80,8 +56,8 @@ private slots:
void slotPropertyChanged(QtProperty *property);
void slotEditorDestroyed(QObject *object);
private:
- QMap<QtProperty *, QList<ResetWidget *> > m_createdResetWidgets;
- QMap<ResetWidget *, QtProperty *> m_resetWidgetToProperty;
+ QHash<const QtProperty *, QList<ResetWidget *>> m_createdResetWidgets;
+ QHash<ResetWidget *, QtProperty *> m_resetWidgetToProperty;
int m_spacing;
const QDesignerFormEditorInterface *m_core;
};
@@ -104,16 +80,16 @@ public:
int expectedTypeId, const QVariant &value);
private:
- QHash<QtProperty *, PropertySheetValue> m_values;
- QHash<QtProperty *, QtProperty *> m_valueToComment;
- QHash<QtProperty *, QtProperty *> m_valueToTranslatable;
- QHash<QtProperty *, QtProperty *> m_valueToDisambiguation;
- QHash<QtProperty *, QtProperty *> m_valueToId;
-
- QHash<QtProperty *, QtProperty *> m_commentToValue;
- QHash<QtProperty *, QtProperty *> m_translatableToValue;
- QHash<QtProperty *, QtProperty *> m_disambiguationToValue;
- QHash<QtProperty *, QtProperty *> m_idToValue;
+ QHash<const QtProperty *, PropertySheetValue> m_values;
+ QHash<const QtProperty *, QtProperty *> m_valueToComment;
+ QHash<const QtProperty *, QtProperty *> m_valueToTranslatable;
+ QHash<const QtProperty *, QtProperty *> m_valueToDisambiguation;
+ QHash<const QtProperty *, QtProperty *> m_valueToId;
+
+ QHash<const QtProperty *, QtProperty *> m_commentToValue;
+ QHash<const QtProperty *, QtProperty *> m_translatableToValue;
+ QHash<const QtProperty *, QtProperty *> m_disambiguationToValue;
+ QHash<const QtProperty *, QtProperty *> m_idToValue;
};
class DesignerPropertyManager : public QtVariantPropertyManager
@@ -177,21 +153,18 @@ private Q_SLOTS:
private:
void createIconSubProperty(QtProperty *iconProperty, QIcon::Mode mode, QIcon::State state, const QString &subName);
- typedef QMap<QtProperty *, bool> PropertyBoolMap;
- PropertyBoolMap m_resetMap;
+ QHash<const QtProperty *, bool> m_resetMap;
- int bitCount(int mask) const;
struct FlagData
{
uint val{0};
DesignerFlagList flags;
QList<uint> values;
};
- typedef QMap<QtProperty *, FlagData> PropertyFlagDataMap;
- PropertyFlagDataMap m_flagValues;
- typedef QMap<QtProperty *, QList<QtProperty *> > PropertyToPropertyListMap;
- PropertyToPropertyListMap m_propertyToFlags;
- QMap<QtProperty *, QtProperty *> m_flagToProperty;
+
+ QHash<const QtProperty *, FlagData> m_flagValues;
+ QHash<const QtProperty *, QList<QtProperty *>> m_propertyToFlags;
+ QHash<const QtProperty *, QtProperty *> m_flagToProperty;
int alignToIndexH(uint align) const;
int alignToIndexV(uint align) const;
@@ -199,18 +172,19 @@ private:
uint indexVToAlign(int idx) const;
QString indexHToString(int idx) const;
QString indexVToString(int idx) const;
- QMap<QtProperty *, uint> m_alignValues;
- typedef QMap<QtProperty *, QtProperty *> PropertyToPropertyMap;
+ QHash<const QtProperty *, uint> m_alignValues;
+ using PropertyToPropertyMap = QHash<const QtProperty *, QtProperty *>;
PropertyToPropertyMap m_propertyToAlignH;
PropertyToPropertyMap m_propertyToAlignV;
PropertyToPropertyMap m_alignHToProperty;
PropertyToPropertyMap m_alignVToProperty;
QHash<const QtProperty *, Qt::Alignment> m_alignDefault;
- QMap<QtProperty *, QMap<QPair<QIcon::Mode, QIcon::State>, QtProperty *> > m_propertyToIconSubProperties;
- QMap<QtProperty *, QPair<QIcon::Mode, QIcon::State> > m_iconSubPropertyToState;
+ QHash<const QtProperty *, QMap<std::pair<QIcon::Mode, QIcon::State>, QtProperty *>> m_propertyToIconSubProperties;
+ QHash<const QtProperty *, std::pair<QIcon::Mode, QIcon::State>> m_iconSubPropertyToState;
PropertyToPropertyMap m_iconSubPropertyToProperty;
PropertyToPropertyMap m_propertyToTheme;
+ PropertyToPropertyMap m_propertyToThemeEnum;
TranslatablePropertyManager<PropertySheetStringValue> m_stringManager;
TranslatablePropertyManager<PropertySheetKeySequenceValue> m_keySequenceManager;
@@ -221,29 +195,28 @@ private:
QPalette val;
QPalette superPalette;
};
- typedef QMap<QtProperty *, PaletteData> PropertyPaletteDataMap;
- PropertyPaletteDataMap m_paletteValues;
+ QHash<const QtProperty *, PaletteData> m_paletteValues;
- QMap<QtProperty *, qdesigner_internal::PropertySheetPixmapValue> m_pixmapValues;
- QMap<QtProperty *, qdesigner_internal::PropertySheetIconValue> m_iconValues;
+ QHash<const QtProperty *, qdesigner_internal::PropertySheetPixmapValue> m_pixmapValues;
+ QHash<const QtProperty *, qdesigner_internal::PropertySheetIconValue> m_iconValues;
- QMap<QtProperty *, uint> m_uintValues;
- QMap<QtProperty *, qlonglong> m_longLongValues;
- QMap<QtProperty *, qulonglong> m_uLongLongValues;
- QMap<QtProperty *, QUrl> m_urlValues;
- QMap<QtProperty *, QByteArray> m_byteArrayValues;
+ QHash<const QtProperty *, int> m_intValues;
+ QHash<const QtProperty *, uint> m_uintValues;
+ QHash<const QtProperty *, qlonglong> m_longLongValues;
+ QHash<const QtProperty *, qulonglong> m_uLongLongValues;
+ QHash<const QtProperty *, QUrl> m_urlValues;
+ QHash<const QtProperty *, QByteArray> m_byteArrayValues;
- typedef QMap<QtProperty *, int> PropertyIntMap;
- PropertyIntMap m_stringAttributes;
- typedef QMap<QtProperty *, QFont> PropertyFontMap;
- PropertyFontMap m_stringFontAttributes;
- PropertyBoolMap m_stringThemeAttributes;
+ QHash<const QtProperty *, int> m_stringAttributes;
+ QHash<const QtProperty *, QFont> m_stringFontAttributes;
+ QHash<const QtProperty *, bool> m_stringThemeAttributes;
+ QHash<const QtProperty *, bool> m_intThemeEnumAttributes;
BrushPropertyManager m_brushManager;
FontPropertyManager m_fontManager;
- QMap<QtProperty *, QPixmap> m_defaultPixmaps;
- QMap<QtProperty *, QIcon> m_defaultIcons;
+ QHash<const QtProperty *, QPixmap> m_defaultPixmaps;
+ QHash<const QtProperty *, QIcon> m_defaultIcons;
bool m_changingSubValue;
QDesignerFormEditorInterface *m_core;
@@ -280,7 +253,9 @@ private slots:
void slotPixmapChanged(const QString &value);
void slotIconChanged(const QString &value);
void slotIconThemeChanged(const QString &value);
+ void slotIconThemeEnumChanged(int value);
void slotUintChanged(const QString &value);
+ void slotIntChanged(int);
void slotLongLongChanged(const QString &value);
void slotULongLongChanged(const QString &value);
void slotUrlChanged(const QString &value);
@@ -296,28 +271,30 @@ private:
int m_spacing;
- QMap<QtProperty *, QList<TextEditor *> > m_stringPropertyToEditors;
- QMap<TextEditor *, QtProperty *> m_editorToStringProperty;
- QMap<QtProperty *, QList<QKeySequenceEdit *> > m_keySequencePropertyToEditors;
- QMap<QKeySequenceEdit *, QtProperty *> m_editorToKeySequenceProperty;
- QMap<QtProperty *, QList<PaletteEditorButton *> > m_palettePropertyToEditors;
- QMap<PaletteEditorButton *, QtProperty *> m_editorToPaletteProperty;
- QMap<QtProperty *, QList<PixmapEditor *> > m_pixmapPropertyToEditors;
- QMap<PixmapEditor *, QtProperty *> m_editorToPixmapProperty;
- QMap<QtProperty *, QList<PixmapEditor *> > m_iconPropertyToEditors;
- QMap<PixmapEditor *, QtProperty *> m_editorToIconProperty;
- QMap<QtProperty *, QList<QLineEdit *> > m_uintPropertyToEditors;
- QMap<QLineEdit *, QtProperty *> m_editorToUintProperty;
- QMap<QtProperty *, QList<QLineEdit *> > m_longLongPropertyToEditors;
- QMap<QLineEdit *, QtProperty *> m_editorToLongLongProperty;
- QMap<QtProperty *, QList<QLineEdit *> > m_uLongLongPropertyToEditors;
- QMap<QLineEdit *, QtProperty *> m_editorToULongLongProperty;
- QMap<QtProperty *, QList<TextEditor *> > m_urlPropertyToEditors;
- QMap<TextEditor *, QtProperty *> m_editorToUrlProperty;
- QMap<QtProperty *, QList<TextEditor *> > m_byteArrayPropertyToEditors;
- QMap<TextEditor *, QtProperty *> m_editorToByteArrayProperty;
- QMap<QtProperty *, QList<StringListEditorButton *> > m_stringListPropertyToEditors;
- QMap<StringListEditorButton *, QtProperty *> m_editorToStringListProperty;
+ QHash<const QtProperty *, QList<TextEditor *>> m_stringPropertyToEditors;
+ QHash<TextEditor *, QtProperty *> m_editorToStringProperty;
+ QHash<const QtProperty *, QList<QKeySequenceEdit *>> m_keySequencePropertyToEditors;
+ QHash<QKeySequenceEdit *, QtProperty *> m_editorToKeySequenceProperty;
+ QHash<const QtProperty *, QList<PaletteEditorButton *>> m_palettePropertyToEditors;
+ QHash<PaletteEditorButton *, QtProperty *> m_editorToPaletteProperty;
+ QHash<const QtProperty *, QList<PixmapEditor *>> m_pixmapPropertyToEditors;
+ QHash<PixmapEditor *, QtProperty *> m_editorToPixmapProperty;
+ QHash<const QtProperty *, QList<PixmapEditor *>> m_iconPropertyToEditors;
+ QHash<PixmapEditor *, QtProperty *> m_editorToIconProperty;
+ QHash<const QtProperty *, QList<QComboBox *>> m_intPropertyToComboEditors;
+ QHash<QComboBox *, QtProperty *> m_comboEditorToIntProperty;
+ QHash<const QtProperty *, QList<QLineEdit *>> m_uintPropertyToEditors;
+ QHash<QLineEdit *, QtProperty *> m_editorToUintProperty;
+ QHash<const QtProperty *, QList<QLineEdit *>> m_longLongPropertyToEditors;
+ QHash<QLineEdit *, QtProperty *> m_editorToLongLongProperty;
+ QHash<const QtProperty *, QList<QLineEdit *>> m_uLongLongPropertyToEditors;
+ QHash<QLineEdit *, QtProperty *> m_editorToULongLongProperty;
+ QHash<const QtProperty *, QList<TextEditor *>> m_urlPropertyToEditors;
+ QHash<TextEditor *, QtProperty *> m_editorToUrlProperty;
+ QHash<const QtProperty *, QList<TextEditor *>> m_byteArrayPropertyToEditors;
+ QHash<TextEditor *, QtProperty *> m_editorToByteArrayProperty;
+ QHash<const QtProperty *, QList<StringListEditorButton *>> m_stringListPropertyToEditors;
+ QHash<StringListEditorButton *, QtProperty *> m_editorToStringListProperty;
};
} // namespace qdesigner_internal
diff --git a/src/designer/src/components/propertyeditor/fontmapping.xml b/src/designer/src/components/propertyeditor/fontmapping.xml
index 20a1f63c4..d7a716e39 100644
--- a/src/designer/src/components/propertyeditor/fontmapping.xml
+++ b/src/designer/src/components/propertyeditor/fontmapping.xml
@@ -1,32 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Linguist module 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$
-**
-****************************************************************************-->
+<!--
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+-->
<!DOCTYPE fontmapping
[
diff --git a/src/designer/src/components/propertyeditor/fontpropertymanager.cpp b/src/designer/src/components/propertyeditor/fontpropertymanager.cpp
index 4974e7975..fdd33add2 100644
--- a/src/designer/src/components/propertyeditor/fontpropertymanager.cpp
+++ b/src/designer/src/components/propertyeditor/fontpropertymanager.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "fontpropertymanager.h"
#include "qtpropertymanager.h"
@@ -41,21 +16,36 @@
#include <QtCore/qtextstream.h>
#include <QtCore/qxmlstream.h>
+#include <utility>
+
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
+ using DisambiguatedTranslation = std::pair<const char *, const char *>;
+
static const char *aliasingC[] = {
QT_TRANSLATE_NOOP("FontPropertyManager", "PreferDefault"),
QT_TRANSLATE_NOOP("FontPropertyManager", "NoAntialias"),
QT_TRANSLATE_NOOP("FontPropertyManager", "PreferAntialias")
};
+ static const DisambiguatedTranslation hintingPreferenceC[] = {
+ QT_TRANSLATE_NOOP3("FontPropertyManager", "PreferDefaultHinting", "QFont::StyleStrategy combo"),
+ QT_TRANSLATE_NOOP3("FontPropertyManager", "PreferNoHinting", "QFont::StyleStrategy combo"),
+ QT_TRANSLATE_NOOP3("FontPropertyManager", "PreferVerticalHinting", "QFont::StyleStrategy combo"),
+ QT_TRANSLATE_NOOP3("FontPropertyManager", "PreferFullHinting", "QFont::StyleStrategy combo")
+ };
+
FontPropertyManager::FontPropertyManager()
{
- const int nameCount = sizeof(aliasingC)/sizeof(const char *);
- for (int i = 0; i < nameCount; i++)
- m_aliasingEnumNames.push_back(QCoreApplication::translate("FontPropertyManager", aliasingC[i]));
+ for (const auto *a : aliasingC)
+ m_aliasingEnumNames.append(QCoreApplication::translate("FontPropertyManager", a));
+
+ for (const auto &h : hintingPreferenceC)
+ m_hintingPreferenceEnumNames.append(QCoreApplication::translate("FontPropertyManager", h.first, h.second));
QString errorMessage;
if (!readFamilyMapping(&m_familyMappings, &errorMessage)) {
@@ -69,7 +59,7 @@ namespace qdesigner_internal {
ResetMap &resetMap)
{
if (m_createdFontProperty) {
- PropertyToSubPropertiesMap::iterator it = m_propertyToFontSubProperties.find(m_createdFontProperty);
+ auto it = m_propertyToFontSubProperties.find(m_createdFontProperty);
if (it == m_propertyToFontSubProperties.end())
it = m_propertyToFontSubProperties.insert(m_createdFontProperty, PropertyList());
const int index = it.value().size();
@@ -110,17 +100,26 @@ namespace qdesigner_internal {
QtVariantProperty *antialiasing = vm->addProperty(enumTypeId, QCoreApplication::translate("FontPropertyManager", "Antialiasing"));
const QFont font = qvariant_cast<QFont>(vm->variantProperty(property)->value());
- antialiasing->setAttribute(QStringLiteral("enumNames"), m_aliasingEnumNames);
+ antialiasing->setAttribute(u"enumNames"_s, m_aliasingEnumNames);
antialiasing->setValue(antialiasingToIndex(font.styleStrategy()));
property->addSubProperty(antialiasing);
m_propertyToAntialiasing[property] = antialiasing;
m_antialiasingToProperty[antialiasing] = property;
+
+ QtVariantProperty *hintingPreference = vm->addProperty(enumTypeId, QCoreApplication::translate("FontPropertyManager", "HintingPreference"));
+ hintingPreference->setAttribute(u"enumNames"_s, m_hintingPreferenceEnumNames);
+ hintingPreference->setValue(hintingPreferenceToIndex(font.hintingPreference()));
+ property->addSubProperty(hintingPreference);
+
+ m_propertyToHintingPreference[property] = hintingPreference;
+ m_hintingPreferenceToProperty[hintingPreference] = property;
+
// Fiddle family names
if (!m_familyMappings.isEmpty()) {
- const PropertyToSubPropertiesMap::iterator it = m_propertyToFontSubProperties.find(m_createdFontProperty);
+ const auto it = m_propertyToFontSubProperties.find(m_createdFontProperty);
QtVariantProperty *familyProperty = vm->variantProperty(it.value().constFirst());
- const QString enumNamesAttribute = QStringLiteral("enumNames");
+ const QString enumNamesAttribute = u"enumNames"_s;
QStringList plainFamilyNames = familyProperty->attributeValue(enumNamesAttribute).toStringList();
// Did someone load fonts or something?
if (m_designerFamilyNames.size() != plainFamilyNames.size())
@@ -133,7 +132,7 @@ namespace qdesigner_internal {
bool FontPropertyManager::uninitializeProperty(QtProperty *property)
{
- const PropertyToPropertyMap::iterator ait = m_propertyToAntialiasing.find(property);
+ const auto ait = m_propertyToAntialiasing.find(property);
if (ait != m_propertyToAntialiasing.end()) {
QtProperty *antialiasing = ait.value();
m_antialiasingToProperty.remove(antialiasing);
@@ -141,7 +140,15 @@ namespace qdesigner_internal {
delete antialiasing;
}
- PropertyToSubPropertiesMap::iterator sit = m_propertyToFontSubProperties.find(property);
+ const auto hit = m_propertyToHintingPreference.find(property);
+ if (hit != m_propertyToHintingPreference.end()) {
+ QtProperty *hintingPreference = hit.value();
+ m_hintingPreferenceToProperty.remove(hintingPreference);
+ m_propertyToHintingPreference.erase(hit);
+ delete hintingPreference;
+ }
+
+ const auto sit = m_propertyToFontSubProperties.find(property);
if (sit == m_propertyToFontSubProperties.end())
return false;
@@ -155,20 +162,30 @@ namespace qdesigner_internal {
void FontPropertyManager::slotPropertyDestroyed(QtProperty *property)
{
removeAntialiasingProperty(property);
+ removeHintingPreferenceProperty(property);
}
void FontPropertyManager::removeAntialiasingProperty(QtProperty *property)
{
- const PropertyToPropertyMap::iterator ait = m_antialiasingToProperty.find(property);
+ const auto ait = m_antialiasingToProperty.find(property);
if (ait == m_antialiasingToProperty.end())
return;
m_propertyToAntialiasing[ait.value()] = 0;
m_antialiasingToProperty.erase(ait);
}
+ void FontPropertyManager::removeHintingPreferenceProperty(QtProperty *property)
+ {
+ const auto hit = m_hintingPreferenceToProperty.find(property);
+ if (hit == m_hintingPreferenceToProperty.end())
+ return;
+ m_propertyToHintingPreference[hit.value()] = nullptr;
+ m_hintingPreferenceToProperty.erase(hit);
+ }
+
bool FontPropertyManager::resetFontSubProperty(QtVariantPropertyManager *vm, QtProperty *property)
{
- const PropertyToPropertyMap::iterator it = m_fontSubPropertyToProperty.find(property);
+ const auto it = m_fontSubPropertyToProperty.find(property);
if (it == m_fontSubPropertyToProperty.end())
return false;
@@ -207,31 +224,80 @@ namespace qdesigner_internal {
return QFont::PreferDefault;
}
+ int FontPropertyManager::hintingPreferenceToIndex(QFont::HintingPreference h)
+ {
+ switch (h) {
+ case QFont::PreferDefaultHinting:
+ return 0;
+ case QFont::PreferNoHinting:
+ return 1;
+ case QFont::PreferVerticalHinting:
+ return 2;
+ case QFont::PreferFullHinting:
+ return 3;
+ }
+ return 0;
+ }
+
+ QFont::HintingPreference FontPropertyManager::indexToHintingPreference(int idx)
+ {
+ switch (idx) {
+ case 0:
+ return QFont::PreferDefaultHinting;
+ case 1:
+ return QFont::PreferNoHinting;
+ case 2:
+ return QFont::PreferVerticalHinting;
+ case 3:
+ return QFont::PreferFullHinting;
+ }
+ return QFont::PreferDefaultHinting;
+ }
+
unsigned FontPropertyManager::fontFlag(int idx)
{
switch (idx) {
- case 0: return QFont::FamilyResolved;
- case 1: return QFont::SizeResolved;
- case 2: return QFont::WeightResolved;
- case 3: return QFont::StyleResolved;
- case 4: return QFont::UnderlineResolved;
- case 5: return QFont::StrikeOutResolved;
- case 6: return QFont::KerningResolved;
- case 7: return QFont::StyleStrategyResolved;
+ case 0:
+ return QFont::FamilyResolved | QFont::FamiliesResolved;
+ case 1:
+ return QFont::SizeResolved;
+ case 2:
+ case 7:
+ return QFont::WeightResolved;
+ case 3:
+ return QFont::StyleResolved;
+ case 4:
+ return QFont::UnderlineResolved;
+ case 5:
+ return QFont::StrikeOutResolved;
+ case 6:
+ return QFont::KerningResolved;
+ case 8:
+ return QFont::StyleStrategyResolved;
+ case 9:
+ return QFont::HintingPreferenceResolved;
}
return 0;
}
int FontPropertyManager::valueChanged(QtVariantPropertyManager *vm, QtProperty *property, const QVariant &value)
{
- QtProperty *antialiasingProperty = m_antialiasingToProperty.value(property, 0);
- if (!antialiasingProperty) {
- if (m_propertyToFontSubProperties.contains(property)) {
- updateModifiedState(property, value);
- }
- return DesignerPropertyManager::NoMatch;
- }
+ if (auto *antialiasingProperty = m_antialiasingToProperty.value(property, nullptr))
+ return antialiasingValueChanged(vm, antialiasingProperty, value);
+
+ if (auto *hintingPreferenceProperty = m_hintingPreferenceToProperty.value(property, nullptr))
+ return hintingPreferenceValueChanged(vm, hintingPreferenceProperty, value);
+
+ if (m_propertyToFontSubProperties.contains(property))
+ updateModifiedState(property, value);
+
+ return DesignerPropertyManager::NoMatch;
+ }
+ int FontPropertyManager::antialiasingValueChanged(QtVariantPropertyManager *vm,
+ QtProperty *antialiasingProperty,
+ const QVariant &value)
+ {
QtVariantProperty *fontProperty = vm->variantProperty(antialiasingProperty);
const QFont::StyleStrategy newValue = indexToAntialiasing(value.toInt());
@@ -245,9 +311,26 @@ namespace qdesigner_internal {
return DesignerPropertyManager::Changed;
}
+ int FontPropertyManager::hintingPreferenceValueChanged(QtVariantPropertyManager *vm,
+ QtProperty *hintingPreferenceProperty,
+ const QVariant &value)
+ {
+ QtVariantProperty *fontProperty = vm->variantProperty(hintingPreferenceProperty);
+ const QFont::HintingPreference newValue = indexToHintingPreference(value.toInt());
+
+ QFont font = qvariant_cast<QFont>(fontProperty->value());
+ const QFont::HintingPreference oldValue = font.hintingPreference();
+ if (newValue == oldValue)
+ return DesignerPropertyManager::Unchanged;
+
+ font.setHintingPreference(newValue);
+ fontProperty->setValue(QVariant::fromValue(font));
+ return DesignerPropertyManager::Changed;
+ }
+
void FontPropertyManager::updateModifiedState(QtProperty *property, const QVariant &value)
{
- const PropertyToSubPropertiesMap::iterator it = m_propertyToFontSubProperties.find(property);
+ const auto it = m_propertyToFontSubProperties.find(property);
if (it == m_propertyToFontSubProperties.end())
return;
@@ -274,6 +357,14 @@ namespace qdesigner_internal {
antialiasing->setValue(antialiasingToIndex(font.styleStrategy()));
}
}
+
+ if (QtProperty *hintingPreferenceProperty = m_propertyToHintingPreference.value(property, nullptr)) {
+ if (auto *hintingPreference = vm->variantProperty(hintingPreferenceProperty)) {
+ QFont font = qvariant_cast<QFont>(value);
+ hintingPreference->setValue(hintingPreferenceToIndex(font.hintingPreference()));
+ }
+ }
+
}
/* Parse a mappings file of the form:
@@ -281,14 +372,14 @@ namespace qdesigner_internal {
* <mapping><family>DejaVu Sans</family><display>DejaVu Sans [CE]</display></mapping>
* ... which is used to display on which platforms fonts are available.*/
- static const char *rootTagC = "fontmappings";
- static const char *mappingTagC = "mapping";
- static const char *familyTagC = "family";
- static const char *displayTagC = "display";
+static constexpr auto rootTagC = "fontmappings"_L1;
+static constexpr auto mappingTagC = "mapping"_L1;
+static constexpr auto familyTagC = "family"_L1;
+static constexpr auto displayTagC = "display"_L1;
static QString msgXmlError(const QXmlStreamReader &r, const QString& fileName)
{
- return QString::fromUtf8("An error has been encountered at line %1 of %2: %3:").arg(r.lineNumber()).arg(fileName, r.errorString());
+ return u"An error has been encountered at line %1 of %2: %3:"_s.arg(r.lineNumber()).arg(fileName, r.errorString());
}
/* Switch stages when encountering a start element (state table) */
@@ -299,14 +390,14 @@ namespace qdesigner_internal {
{
switch (currentStage) {
case ParseBeginning:
- return startElement == QLatin1String(rootTagC) ? ParseWithinRoot : ParseError;
+ return startElement == rootTagC ? ParseWithinRoot : ParseError;
case ParseWithinRoot:
case ParseWithinDisplay: // Next mapping, was in <display>
- return startElement == QLatin1String(mappingTagC) ? ParseWithinMapping : ParseError;
+ return startElement == mappingTagC ? ParseWithinMapping : ParseError;
case ParseWithinMapping:
- return startElement == QLatin1String(familyTagC) ? ParseWithinFamily : ParseError;
+ return startElement == familyTagC ? ParseWithinFamily : ParseError;
case ParseWithinFamily:
- return startElement == QLatin1String(displayTagC) ? ParseWithinDisplay : ParseError;
+ return startElement == displayTagC ? ParseWithinDisplay : ParseError;
case ParseError:
break;
}
@@ -316,10 +407,10 @@ namespace qdesigner_internal {
bool FontPropertyManager::readFamilyMapping(NameMap *rc, QString *errorMessage)
{
rc->clear();
- const QString fileName = QStringLiteral(":/qt-project.org/propertyeditor/fontmapping.xml");
+ const QString fileName = u":/qt-project.org/propertyeditor/fontmapping.xml"_s;
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly)) {
- *errorMessage = QString::fromUtf8("Unable to open %1: %2").arg(fileName, file.errorString());
+ *errorMessage = "Unable to open %1: %2"_L1.arg(fileName, file.errorString());
return false;
}
@@ -338,7 +429,7 @@ namespace qdesigner_internal {
stage = nextStage(stage, reader.name());
switch (stage) {
case ParseError:
- reader.raiseError(QString::fromUtf8("Unexpected element <%1>.").arg(reader.name().toString()));
+ reader.raiseError("Unexpected element <%1>."_L1.arg(reader.name()));
*errorMessage = msgXmlError(reader, fileName);
return false;
case ParseWithinFamily:
@@ -350,6 +441,7 @@ namespace qdesigner_internal {
default:
break;
}
+ break;
default:
break;
}
diff --git a/src/designer/src/components/propertyeditor/fontpropertymanager.h b/src/designer/src/components/propertyeditor/fontpropertymanager.h
index 1041cd357..3e628dbf2 100644
--- a/src/designer/src/components/propertyeditor/fontpropertymanager.h
+++ b/src/designer/src/components/propertyeditor/fontpropertymanager.h
@@ -1,34 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef FONTPROPERTYMANAGER_H
#define FONTPROPERTYMANAGER_H
+#include <QtCore/qhash.h>
#include <QtCore/qmap.h>
#include <QtCore/qstringlist.h>
#include <QtGui/qfont.h>
@@ -55,7 +31,7 @@ class FontPropertyManager {
public:
FontPropertyManager();
- using ResetMap = QMap<QtProperty *, bool>;
+ using ResetMap = QHash<const QtProperty *, bool>;
using NameMap = QMap<QString, QString>;
// Call before QtVariantPropertyManager::initializeProperty.
@@ -80,24 +56,36 @@ public:
static bool readFamilyMapping(NameMap *rc, QString *errorMessage);
private:
- using PropertyToPropertyMap = QMap<QtProperty *, QtProperty *>;
+ using PropertyToPropertyMap = QHash<QtProperty *, QtProperty *>;
using PropertyList = QList<QtProperty *>;
- using PropertyToSubPropertiesMap = QMap<QtProperty *, PropertyList>;
void removeAntialiasingProperty(QtProperty *);
+ void removeHintingPreferenceProperty(QtProperty *);
+ int antialiasingValueChanged(QtVariantPropertyManager *vm,
+ QtProperty *antialiasingProperty, const QVariant &value);
+ int hintingPreferenceValueChanged(QtVariantPropertyManager *vm,
+ QtProperty *hintingPreferenceProperty,
+ const QVariant &value);
void updateModifiedState(QtProperty *property, const QVariant &value);
static int antialiasingToIndex(QFont::StyleStrategy antialias);
static QFont::StyleStrategy indexToAntialiasing(int idx);
+ static int hintingPreferenceToIndex(QFont::HintingPreference h);
+ static QFont::HintingPreference indexToHintingPreference(int idx);
+
static unsigned fontFlag(int idx);
PropertyToPropertyMap m_propertyToAntialiasing;
PropertyToPropertyMap m_antialiasingToProperty;
+ PropertyToPropertyMap m_propertyToHintingPreference;
+ PropertyToPropertyMap m_hintingPreferenceToProperty;
+
- PropertyToSubPropertiesMap m_propertyToFontSubProperties;
- QMap<QtProperty *, int> m_fontSubPropertyToFlag;
+ QHash<QtProperty *, PropertyList> m_propertyToFontSubProperties;
+ QHash<QtProperty *, int> m_fontSubPropertyToFlag;
PropertyToPropertyMap m_fontSubPropertyToProperty;
QtProperty *m_createdFontProperty = nullptr;
QStringList m_aliasingEnumNames;
+ QStringList m_hintingPreferenceEnumNames;
// Font families with Designer annotations
QStringList m_designerFamilyNames;
NameMap m_familyMappings;
diff --git a/src/designer/src/components/propertyeditor/newdynamicpropertydialog.cpp b/src/designer/src/components/propertyeditor/newdynamicpropertydialog.cpp
index 91d554c8b..a8972c332 100644
--- a/src/designer/src/components/propertyeditor/newdynamicpropertydialog.cpp
+++ b/src/designer/src/components/propertyeditor/newdynamicpropertydialog.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "newdynamicpropertydialog.h"
#include "ui_newdynamicpropertydialog.h"
@@ -35,74 +10,76 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
NewDynamicPropertyDialog::NewDynamicPropertyDialog(QDesignerDialogGuiInterface *dialogGui,
QWidget *parent) :
QDialog(parent),
m_dialogGui(dialogGui),
- m_ui(new Ui::NewDynamicPropertyDialog)
+ m_ui(new QT_PREPEND_NAMESPACE(qdesigner_internal)::Ui::NewDynamicPropertyDialog)
{
m_ui->setupUi(this);
connect(m_ui->m_lineEdit, &QLineEdit::textChanged, this, &NewDynamicPropertyDialog::nameChanged);
+ connect(m_ui->m_buttonBox, &QDialogButtonBox::clicked,
+ this, &NewDynamicPropertyDialog::buttonBoxClicked);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
-
- m_ui->m_comboBox->addItem(QStringLiteral("String"),
+ m_ui->m_comboBox->addItem(u"String"_s,
QVariant(QMetaType(QMetaType::QString)));
- m_ui->m_comboBox->addItem(QStringLiteral("StringList"),
+ m_ui->m_comboBox->addItem(u"StringList"_s,
QVariant(QMetaType(QMetaType::QStringList)));
- m_ui->m_comboBox->addItem(QStringLiteral("Char"),
+ m_ui->m_comboBox->addItem(u"Char"_s,
QVariant(QMetaType(QMetaType::QChar)));
- m_ui->m_comboBox->addItem(QStringLiteral("ByteArray"),
+ m_ui->m_comboBox->addItem(u"ByteArray"_s,
QVariant(QMetaType(QMetaType::QByteArray)));
- m_ui->m_comboBox->addItem(QStringLiteral("Url"),
+ m_ui->m_comboBox->addItem(u"Url"_s,
QVariant(QMetaType(QMetaType::QUrl)));
- m_ui->m_comboBox->addItem(QStringLiteral("Bool"),
+ m_ui->m_comboBox->addItem(u"Bool"_s,
QVariant(QMetaType(QMetaType::Bool)));
- m_ui->m_comboBox->addItem(QStringLiteral("Int"),
+ m_ui->m_comboBox->addItem(u"Int"_s,
QVariant(QMetaType(QMetaType::Int)));
- m_ui->m_comboBox->addItem(QStringLiteral("UInt"),
+ m_ui->m_comboBox->addItem(u"UInt"_s,
QVariant(QMetaType(QMetaType::UInt)));
- m_ui->m_comboBox->addItem(QStringLiteral("LongLong"),
+ m_ui->m_comboBox->addItem(u"LongLong"_s,
QVariant(QMetaType(QMetaType::LongLong)));
- m_ui->m_comboBox->addItem(QStringLiteral("ULongLong"),
+ m_ui->m_comboBox->addItem(u"ULongLong"_s,
QVariant(QMetaType(QMetaType::ULongLong)));
- m_ui->m_comboBox->addItem(QStringLiteral("Double"),
+ m_ui->m_comboBox->addItem(u"Double"_s,
QVariant(QMetaType(QMetaType::Double)));
- m_ui->m_comboBox->addItem(QStringLiteral("Size"),
+ m_ui->m_comboBox->addItem(u"Size"_s,
QVariant(QMetaType(QMetaType::QSize)));
- m_ui->m_comboBox->addItem(QStringLiteral("SizeF"),
+ m_ui->m_comboBox->addItem(u"SizeF"_s,
QVariant(QMetaType(QMetaType::QSizeF)));
- m_ui->m_comboBox->addItem(QStringLiteral("Point"),
+ m_ui->m_comboBox->addItem(u"Point"_s,
QVariant(QMetaType(QMetaType::QPoint)));
- m_ui->m_comboBox->addItem(QStringLiteral("PointF"),
+ m_ui->m_comboBox->addItem(u"PointF"_s,
QVariant(QMetaType(QMetaType::QPointF)));
- m_ui->m_comboBox->addItem(QStringLiteral("Rect"),
+ m_ui->m_comboBox->addItem(u"Rect"_s,
QVariant(QMetaType(QMetaType::QRect)));
- m_ui->m_comboBox->addItem(QStringLiteral("RectF"),
+ m_ui->m_comboBox->addItem(u"RectF"_s,
QVariant(QMetaType(QMetaType::QRectF)));
- m_ui->m_comboBox->addItem(QStringLiteral("Date"),
+ m_ui->m_comboBox->addItem(u"Date"_s,
QVariant(QMetaType(QMetaType::QDate)));
- m_ui->m_comboBox->addItem(QStringLiteral("Time"),
+ m_ui->m_comboBox->addItem(u"Time"_s,
QVariant(QMetaType(QMetaType::QTime)));
- m_ui->m_comboBox->addItem(QStringLiteral("DateTime"),
+ m_ui->m_comboBox->addItem(u"DateTime"_s,
QVariant(QMetaType(QMetaType::QDateTime)));
- m_ui->m_comboBox->addItem(QStringLiteral("Font"),
+ m_ui->m_comboBox->addItem(u"Font"_s,
QVariant(QMetaType(QMetaType::QFont)));
- m_ui->m_comboBox->addItem(QStringLiteral("Palette"),
+ m_ui->m_comboBox->addItem(u"Palette"_s,
QVariant(QMetaType(QMetaType::QPalette)));
- m_ui->m_comboBox->addItem(QStringLiteral("Color"),
+ m_ui->m_comboBox->addItem(u"Color"_s,
QVariant(QMetaType(QMetaType::QColor)));
- m_ui->m_comboBox->addItem(QStringLiteral("Pixmap"),
+ m_ui->m_comboBox->addItem(u"Pixmap"_s,
QVariant(QMetaType(QMetaType::QPixmap)));
- m_ui->m_comboBox->addItem(QStringLiteral("Icon"),
+ m_ui->m_comboBox->addItem(u"Icon"_s,
QVariant(QMetaType(QMetaType::QIcon)));
- m_ui->m_comboBox->addItem(QStringLiteral("Cursor"),
+ m_ui->m_comboBox->addItem(u"Cursor"_s,
QVariant(QMetaType(QMetaType::QCursor)));
- m_ui->m_comboBox->addItem(QStringLiteral("SizePolicy"),
+ m_ui->m_comboBox->addItem(u"SizePolicy"_s,
QVariant(QMetaType(QMetaType::QSizePolicy)));
- m_ui->m_comboBox->addItem(QStringLiteral("KeySequence"),
+ m_ui->m_comboBox->addItem(u"KeySequence"_s,
QVariant(QMetaType(QMetaType::QKeySequence)));
m_ui->m_comboBox->setCurrentIndex(0); // String
@@ -160,14 +137,14 @@ bool NewDynamicPropertyDialog::validatePropertyName(const QString& name)
information(tr("The current object already has a property named '%1'.\nPlease select another, unique one.").arg(name));
return false;
}
- if (!QDesignerPropertySheet::internalDynamicPropertiesEnabled() && name.startsWith(QStringLiteral("_q_"))) {
+ if (!QDesignerPropertySheet::internalDynamicPropertiesEnabled() && name.startsWith("_q_"_L1)) {
information(tr("The '_q_' prefix is reserved for the Qt library.\nPlease select another name."));
return false;
}
return true;
}
-void NewDynamicPropertyDialog::on_m_buttonBox_clicked(QAbstractButton *btn)
+void NewDynamicPropertyDialog::buttonBoxClicked(QAbstractButton *btn)
{
const int role = m_ui->m_buttonBox->buttonRole(btn);
switch (role) {
diff --git a/src/designer/src/components/propertyeditor/newdynamicpropertydialog.h b/src/designer/src/components/propertyeditor/newdynamicpropertydialog.h
index 0c3e24570..0142e4482 100644
--- a/src/designer/src/components/propertyeditor/newdynamicpropertydialog.h
+++ b/src/designer/src/components/propertyeditor/newdynamicpropertydialog.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef NEWDYNAMICPROPERTYDIALOG_P_H
#define NEWDYNAMICPROPERTYDIALOG_P_H
@@ -71,7 +46,7 @@ public:
private slots:
- void on_m_buttonBox_clicked(QAbstractButton *btn);
+ void buttonBoxClicked(QAbstractButton *btn);
void nameChanged(const QString &);
private:
diff --git a/src/designer/src/components/propertyeditor/paletteeditor.cpp b/src/designer/src/components/propertyeditor/paletteeditor.cpp
index 228213ee6..b51bd6895 100644
--- a/src/designer/src/components/propertyeditor/paletteeditor.cpp
+++ b/src/designer/src/components/propertyeditor/paletteeditor.cpp
@@ -1,33 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "paletteeditor.h"
+#include <qdesigner_utils_p.h>
#include <iconloader_p.h>
#include <qtcolorbutton.h>
@@ -44,6 +20,7 @@
#include <QtWidgets/qlabel.h>
#include <QtWidgets/qmenu.h>
#include <QtWidgets/qheaderview.h>
+#include <QtWidgets/qstyle.h>
#include <QtGui/qaction.h>
#if QT_CONFIG(clipboard)
@@ -60,6 +37,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
enum { BrushRole = 33 };
@@ -75,7 +54,21 @@ PaletteEditor::PaletteEditor(QDesignerFormEditorInterface *core, QWidget *parent
auto loadButton = ui.buttonBox->addButton(tr("Load..."), QDialogButtonBox::ActionRole);
connect(loadButton, &QPushButton::clicked, this, &PaletteEditor::load);
+ connect(ui.buildButton, &QtColorButton::colorChanged,
+ this, &PaletteEditor::buildButtonColorChanged);
+ connect(ui.activeRadio, &QAbstractButton::clicked,
+ this, &PaletteEditor::activeRadioClicked);
+ connect(ui.inactiveRadio, &QAbstractButton::clicked,
+ this, &PaletteEditor::inactiveRadioClicked);
+ connect(ui.disabledRadio, &QAbstractButton::clicked,
+ this, &PaletteEditor::disabledRadioClicked);
+ connect(ui.computeRadio, &QAbstractButton::clicked,
+ this, &PaletteEditor::computeRadioClicked);
+ connect(ui.detailsRadio, &QAbstractButton::clicked,
+ this, &PaletteEditor::detailsRadioClicked);
+
ui.paletteView->setModel(m_paletteModel);
+ ui.previewGroupBox->setTitle(tr("Preview (%1)").arg(style()->objectName()));
updatePreviewPalette();
updateStyledButton();
ui.paletteView->setModel(m_paletteModel);
@@ -110,18 +103,15 @@ QPalette PaletteEditor::palette() const
void PaletteEditor::setPalette(const QPalette &palette)
{
m_editPalette = palette;
- const uint mask = palette.resolveMask();
- for (int i = 0; i < static_cast<int>(QPalette::NColorRoles); ++i) {
- if (!(mask & (1 << i))) {
- m_editPalette.setBrush(QPalette::Active, static_cast<QPalette::ColorRole>(i),
- m_parentPalette.brush(QPalette::Active, static_cast<QPalette::ColorRole>(i)));
- m_editPalette.setBrush(QPalette::Inactive, static_cast<QPalette::ColorRole>(i),
- m_parentPalette.brush(QPalette::Inactive, static_cast<QPalette::ColorRole>(i)));
- m_editPalette.setBrush(QPalette::Disabled, static_cast<QPalette::ColorRole>(i),
- m_parentPalette.brush(QPalette::Disabled, static_cast<QPalette::ColorRole>(i)));
+ for (int r = 0; r < static_cast<int>(QPalette::NColorRoles); ++r) {
+ for (int g = 0; g < static_cast<int>(QPalette::NColorGroups); ++g) {
+ const auto role = static_cast<QPalette::ColorRole>(r);
+ const auto group = static_cast<QPalette::ColorGroup>(g);
+ if (!palette.isBrushSet(group, role))
+ m_editPalette.setBrush(group, role, m_parentPalette.brush(group, role));
}
}
- m_editPalette.setResolveMask(mask);
+ m_editPalette.setResolveMask(palette.resolveMask());
updatePreviewPalette();
updateStyledButton();
m_paletteUpdated = true;
@@ -136,30 +126,30 @@ void PaletteEditor::setPalette(const QPalette &palette, const QPalette &parentPa
setPalette(palette);
}
-void PaletteEditor::on_buildButton_colorChanged(const QColor &)
+void PaletteEditor::buildButtonColorChanged()
{
buildPalette();
}
-void PaletteEditor::on_activeRadio_clicked()
+void PaletteEditor::activeRadioClicked()
{
m_currentColorGroup = QPalette::Active;
updatePreviewPalette();
}
-void PaletteEditor::on_inactiveRadio_clicked()
+void PaletteEditor::inactiveRadioClicked()
{
m_currentColorGroup = QPalette::Inactive;
updatePreviewPalette();
}
-void PaletteEditor::on_disabledRadio_clicked()
+void PaletteEditor::disabledRadioClicked()
{
m_currentColorGroup = QPalette::Disabled;
updatePreviewPalette();
}
-void PaletteEditor::on_computeRadio_clicked()
+void PaletteEditor::computeRadioClicked()
{
if (m_compute)
return;
@@ -169,7 +159,7 @@ void PaletteEditor::on_computeRadio_clicked()
m_paletteModel->setCompute(true);
}
-void PaletteEditor::on_detailsRadio_clicked()
+void PaletteEditor::detailsRadioClicked()
{
if (!m_compute)
return;
@@ -229,15 +219,12 @@ QPalette PaletteEditor::getPalette(QDesignerFormEditorInterface *core, QWidget*
{
PaletteEditor dlg(core, parent);
QPalette parentPalette(parentPal);
- uint mask = init.resolveMask();
- for (int i = 0; i < static_cast<int>(QPalette::NColorRoles); ++i) {
- if (!(mask & (1 << i))) {
- parentPalette.setBrush(QPalette::Active, static_cast<QPalette::ColorRole>(i),
- init.brush(QPalette::Active, static_cast<QPalette::ColorRole>(i)));
- parentPalette.setBrush(QPalette::Inactive, static_cast<QPalette::ColorRole>(i),
- init.brush(QPalette::Inactive, static_cast<QPalette::ColorRole>(i)));
- parentPalette.setBrush(QPalette::Disabled, static_cast<QPalette::ColorRole>(i),
- init.brush(QPalette::Disabled, static_cast<QPalette::ColorRole>(i)));
+ for (int r = 0; r < static_cast<int>(QPalette::NColorRoles); ++r) {
+ for (int g = 0; g < static_cast<int>(QPalette::NColorGroups); ++g) {
+ const auto role = static_cast<QPalette::ColorRole>(r);
+ const auto group = static_cast<QPalette::ColorGroup>(g);
+ if (!init.isBrushSet(group, role))
+ parentPalette.setBrush(group, role, init.brush(group, role));
}
}
dlg.setPalette(init, parentPalette);
@@ -285,8 +272,6 @@ void PaletteEditor::viewContextMenuRequested(const QPoint &pos)
m_paletteModel->setData(index, QVariant(brush), BrushRole);
}
-static inline QString paletteSuffix() { return QStringLiteral("xml"); }
-
static inline QString paletteFilter()
{
return PaletteEditor::tr("QPalette UI file (*.xml)");
@@ -343,7 +328,7 @@ static bool loadPalette(const QString &fileName, QPalette *pal, QString *errorMe
*errorMessage = msgCannotReadPalette(fileName, reader);
return false;
}
- if (reader.name() != QLatin1String("palette")) {
+ if (reader.name() != "palette"_L1) {
const auto why = PaletteEditor::tr("Invalid element \"%1\", expected \"palette\".")
.arg(reader.name().toString());
*errorMessage = msgCannotReadPalette(fileName, reader, why);
@@ -363,7 +348,7 @@ void PaletteEditor::save()
{
QFileDialog dialog(this, tr("Save Palette"), QString(), paletteFilter());
dialog.setAcceptMode(QFileDialog::AcceptSave);
- dialog.setDefaultSuffix(paletteSuffix());
+ dialog.setDefaultSuffix(u"xml"_s);
while (dialog.exec() == QDialog::Accepted) {
QString errorMessage;
if (savePalette(dialog.selectedFiles().constFirst(), palette(), &errorMessage))
@@ -388,6 +373,11 @@ void PaletteEditor::load()
}
//////////////////////
+// Column 0: Role name and reset button. Uses a boolean value indicating
+// whether the role is modified for the edit role.
+// Column 1: Color group Active
+// Column 2: Color group Inactive (visibility depending on m_compute/detail radio group)
+// Column 3: Color group Disabled
PaletteModel::PaletteModel(QObject *parent) :
QAbstractTableModel(parent)
@@ -400,7 +390,7 @@ PaletteModel::PaletteModel(QObject *parent) :
for (int r = QPalette::WindowText; r < QPalette::NColorRoles; r++) {
const auto role = static_cast<QPalette::ColorRole>(r);
if (role != QPalette::NoRole)
- m_roleEntries.append({QLatin1String(e.key(r)), role});
+ m_roleEntries.append({QLatin1StringView(e.key(r)), role});
}
}
@@ -419,6 +409,12 @@ QBrush PaletteModel::brushAt(const QModelIndex &index) const
return m_palette.brush(columnToGroup(index.column()), roleAt(index.row()));
}
+// Palette resolve mask with all group bits for a row/role
+quint64 PaletteModel::rowMask(const QModelIndex &index) const
+{
+ return paletteResolveMask(roleAt(index.row()));
+}
+
QVariant PaletteModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
@@ -428,15 +424,11 @@ QVariant PaletteModel::data(const QModelIndex &index, int role) const
if (index.column() < 0 || index.column() >= 4)
return QVariant();
- if (index.column() == 0) {
+ if (index.column() == 0) { // Role name/bold print if changed
if (role == Qt::DisplayRole)
return m_roleEntries.at(index.row()).name;
- if (role == Qt::EditRole) {
- const uint mask = m_palette.resolveMask();
- if (mask & (1 << int(roleAt(index.row()))))
- return true;
- return false;
- }
+ if (role == Qt::EditRole)
+ return (rowMask(index) & m_palette.resolveMask()) != 0;
return QVariant();
}
if (role == Qt::ToolTipRole)
@@ -495,11 +487,12 @@ bool PaletteModel::setData(const QModelIndex &index, const QVariant &value, int
return true;
}
if (index.column() == 0 && role == Qt::EditRole) {
- uint mask = m_palette.resolveMask();
+ auto mask = m_palette.resolveMask();
const bool isMask = qvariant_cast<bool>(value);
- if (isMask)
- mask |= (1 << int(colorRole));
- else {
+ const auto bitMask = rowMask(index);
+ if (isMask) {
+ mask |= bitMask;
+ } else {
m_palette.setBrush(QPalette::Active, colorRole,
m_parentPalette.brush(QPalette::Active, colorRole));
m_palette.setBrush(QPalette::Inactive, colorRole,
@@ -507,7 +500,7 @@ bool PaletteModel::setData(const QModelIndex &index, const QVariant &value, int
m_palette.setBrush(QPalette::Disabled, colorRole,
m_parentPalette.brush(QPalette::Disabled, colorRole));
- mask &= ~(1 << int(colorRole));
+ mask &= ~bitMask;
}
m_palette.setResolveMask(mask);
emit paletteChanged(m_palette);
@@ -575,7 +568,7 @@ int PaletteModel::groupToColumn(QPalette::ColorGroup group) const
int PaletteModel::rowOf(QPalette::ColorRole role) const
{
- for (int row = 0, size = m_roleEntries.size(); row < size; ++row) {
+ for (qsizetype row = 0, size = m_roleEntries.size(); row < size; ++row) {
if (m_roleEntries.at(row).role == role)
return row;
}
@@ -635,7 +628,7 @@ RoleEditor::RoleEditor(QWidget *parent) :
QToolButton *button = new QToolButton(this);
button->setToolButtonStyle(Qt::ToolButtonIconOnly);
- button->setIcon(createIconSet(QStringLiteral("resetproperty.png")));
+ button->setIcon(createIconSet("resetproperty.png"_L1));
button->setIconSize(QSize(8,8));
button->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding));
layout->addWidget(button);
diff --git a/src/designer/src/components/propertyeditor/paletteeditor.h b/src/designer/src/components/propertyeditor/paletteeditor.h
index 8ff10c591..2f29bfd76 100644
--- a/src/designer/src/components/propertyeditor/paletteeditor.h
+++ b/src/designer/src/components/propertyeditor/paletteeditor.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef PALETTEEDITOR_H
#define PALETTEEDITOR_H
@@ -59,12 +34,12 @@ public:
private slots:
- void on_buildButton_colorChanged(const QColor &);
- void on_activeRadio_clicked();
- void on_inactiveRadio_clicked();
- void on_disabledRadio_clicked();
- void on_computeRadio_clicked();
- void on_detailsRadio_clicked();
+ void buildButtonColorChanged();
+ void activeRadioClicked();
+ void inactiveRadioClicked();
+ void disabledRadioClicked();
+ void computeRadioClicked();
+ void detailsRadioClicked();
void paletteChanged(const QPalette &palette);
void viewContextMenuRequested(const QPoint &pos);
@@ -121,6 +96,9 @@ public:
QPalette::ColorRole colorRole() const { return QPalette::NoRole; }
void setCompute(bool on) { m_compute = on; }
+
+ quint64 rowMask(const QModelIndex &index) const;
+
signals:
void paletteChanged(const QPalette &palette);
private:
diff --git a/src/designer/src/components/propertyeditor/paletteeditor.ui b/src/designer/src/components/propertyeditor/paletteeditor.ui
index 2bb8cfedc..129165c73 100644
--- a/src/designer/src/components/propertyeditor/paletteeditor.ui
+++ b/src/designer/src/components/propertyeditor/paletteeditor.ui
@@ -1,32 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <comment>*********************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-*********************************************************************</comment>
+ <comment>
+* Copyright (C) 2016 The Qt Company Ltd.
+* SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+</comment>
<class>qdesigner_internal::PaletteEditor</class>
<widget class="QDialog" name="qdesigner_internal::PaletteEditor">
<property name="geometry">
@@ -133,7 +110,7 @@
</widget>
</item>
<item>
- <widget class="QGroupBox" name="GroupBox126">
+ <widget class="QGroupBox" name="previewGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
diff --git a/src/designer/src/components/propertyeditor/paletteeditorbutton.cpp b/src/designer/src/components/propertyeditor/paletteeditorbutton.cpp
index f3370a4aa..4f6661bdc 100644
--- a/src/designer/src/components/propertyeditor/paletteeditorbutton.cpp
+++ b/src/designer/src/components/propertyeditor/paletteeditorbutton.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "paletteeditorbutton.h"
#include "paletteeditor.h"
@@ -33,7 +8,7 @@
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+namespace qdesigner_internal {
PaletteEditorButton::PaletteEditorButton(QDesignerFormEditorInterface *core, const QPalette &palette, QWidget *parent)
: QToolButton(parent),
@@ -69,4 +44,6 @@ void PaletteEditorButton::showPaletteEditor()
}
}
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
diff --git a/src/designer/src/components/propertyeditor/paletteeditorbutton.h b/src/designer/src/components/propertyeditor/paletteeditorbutton.h
index 947d80edb..01b9c211a 100644
--- a/src/designer/src/components/propertyeditor/paletteeditorbutton.h
+++ b/src/designer/src/components/propertyeditor/paletteeditorbutton.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef PALETTEEDITORBUTTON_H
#define PALETTEEDITORBUTTON_H
diff --git a/src/designer/src/components/propertyeditor/pixmapeditor.cpp b/src/designer/src/components/propertyeditor/pixmapeditor.cpp
new file mode 100644
index 000000000..312fd135c
--- /dev/null
+++ b/src/designer/src/components/propertyeditor/pixmapeditor.cpp
@@ -0,0 +1,420 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+#include "pixmapeditor.h"
+#include <iconloader_p.h>
+#include <iconselector_p.h>
+#include <qdesigner_utils_p.h>
+
+#include <QtDesigner/abstractformeditor.h>
+
+#include <QtWidgets/qapplication.h>
+#include <QtWidgets/qlabel.h>
+#include <QtWidgets/qtoolbutton.h>
+#include <QtWidgets/qboxlayout.h>
+#include <QtWidgets/qlineedit.h>
+#include <QtWidgets/qdialogbuttonbox.h>
+#include <QtWidgets/qpushbutton.h>
+#include <QtWidgets/qfiledialog.h>
+#include <QtWidgets/qmenu.h>
+
+#include <QtGui/qaction.h>
+#if QT_CONFIG(clipboard)
+#include <QtGui/qclipboard.h>
+#endif
+#include <QtGui/qevent.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+static constexpr QSize ICON_SIZE{16, 16};
+
+namespace qdesigner_internal {
+
+static void createIconThemeDialog(QDialog *topLevel, const QString &labelText,
+ QWidget *themeEditor)
+{
+ QVBoxLayout *layout = new QVBoxLayout(topLevel);
+ QLabel *label = new QLabel(labelText, topLevel);
+ QDialogButtonBox *buttons = new QDialogButtonBox(topLevel);
+ buttons->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+ QObject::connect(buttons, &QDialogButtonBox::accepted, topLevel, &QDialog::accept);
+ QObject::connect(buttons, &QDialogButtonBox::rejected, topLevel, &QDialog::reject);
+
+ layout->addWidget(label);
+ layout->addWidget(themeEditor);
+ layout->addWidget(buttons);
+}
+
+IconThemeDialog::IconThemeDialog(QWidget *parent)
+ : QDialog(parent)
+{
+ setWindowTitle(tr("Set Icon From XDG Theme"));
+ m_editor = new IconThemeEditor(this);
+ createIconThemeDialog(this, tr("Select icon name from XDG theme:"), m_editor);
+}
+
+std::optional<QString> IconThemeDialog::getTheme(QWidget *parent, const QString &theme)
+{
+ IconThemeDialog dlg(parent);
+ dlg.m_editor->setTheme(theme);
+ if (dlg.exec() == QDialog::Accepted)
+ return dlg.m_editor->theme();
+ return std::nullopt;
+}
+
+IconThemeEnumDialog::IconThemeEnumDialog(QWidget *parent)
+ : QDialog(parent)
+{
+ setWindowTitle(tr("Set Icon From Theme"));
+ m_editor = new IconThemeEnumEditor(this);
+ createIconThemeDialog(this, tr("Select icon name from theme:"), m_editor);
+}
+
+std::optional<int> IconThemeEnumDialog::getTheme(QWidget *parent, int theme)
+{
+ IconThemeEnumDialog dlg(parent);
+ dlg.m_editor->setThemeEnum(theme);
+ if (dlg.exec() == QDialog::Accepted)
+ return dlg.m_editor->themeEnum();
+ return std::nullopt;
+}
+
+PixmapEditor::PixmapEditor(QDesignerFormEditorInterface *core, QWidget *parent) :
+ QWidget(parent),
+ m_iconThemeModeEnabled(false),
+ m_core(core),
+ m_pixmapLabel(new QLabel(this)),
+ m_pathLabel(new QLabel(this)),
+ m_button(new QToolButton(this)),
+ m_resourceAction(new QAction(tr("Choose Resource..."), this)),
+ m_fileAction(new QAction(tr("Choose File..."), this)),
+ m_themeEnumAction(new QAction(tr("Set Icon From Theme..."), this)),
+ m_themeAction(new QAction(tr("Set Icon From XDG Theme..."), this)),
+ m_copyAction(new QAction(createIconSet(QIcon::ThemeIcon::EditCopy, "editcopy.png"_L1),
+ tr("Copy Path"), this)),
+ m_pasteAction(new QAction(createIconSet(QIcon::ThemeIcon::EditPaste, "editpaste.png"_L1),
+ tr("Paste Path"), this)),
+ m_layout(new QHBoxLayout(this)),
+ m_pixmapCache(nullptr)
+{
+ m_layout->addWidget(m_pixmapLabel);
+ m_layout->addWidget(m_pathLabel);
+ m_button->setText(tr("..."));
+ m_button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored);
+ m_button->setFixedWidth(30);
+ m_button->setPopupMode(QToolButton::MenuButtonPopup);
+ m_layout->addWidget(m_button);
+ m_layout->setContentsMargins(QMargins());
+ m_layout->setSpacing(0);
+ m_pixmapLabel->setFixedWidth(ICON_SIZE.width());
+ m_pixmapLabel->setAlignment(Qt::AlignCenter);
+ m_pathLabel->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed));
+ m_themeAction->setVisible(false);
+ m_themeEnumAction->setVisible(false);
+
+ QMenu *menu = new QMenu(this);
+ menu->addAction(m_resourceAction);
+ menu->addAction(m_fileAction);
+ menu->addAction(m_themeEnumAction);
+ menu->addAction(m_themeAction);
+
+ m_button->setMenu(menu);
+ m_button->setText(tr("..."));
+
+ connect(m_button, &QAbstractButton::clicked, this, &PixmapEditor::defaultActionActivated);
+ connect(m_resourceAction, &QAction::triggered, this, &PixmapEditor::resourceActionActivated);
+ connect(m_fileAction, &QAction::triggered, this, &PixmapEditor::fileActionActivated);
+ connect(m_themeEnumAction, &QAction::triggered, this, &PixmapEditor::themeEnumActionActivated);
+ connect(m_themeAction, &QAction::triggered, this, &PixmapEditor::themeActionActivated);
+#if QT_CONFIG(clipboard)
+ connect(m_copyAction, &QAction::triggered, this, &PixmapEditor::copyActionActivated);
+ connect(m_pasteAction, &QAction::triggered, this, &PixmapEditor::pasteActionActivated);
+#endif
+ setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored));
+ setFocusProxy(m_button);
+
+#if QT_CONFIG(clipboard)
+ connect(QApplication::clipboard(), &QClipboard::dataChanged,
+ this, &PixmapEditor::clipboardDataChanged);
+ clipboardDataChanged();
+#endif
+}
+
+void PixmapEditor::setPixmapCache(DesignerPixmapCache *cache)
+{
+ m_pixmapCache = cache;
+}
+
+void PixmapEditor::setIconThemeModeEnabled(bool enabled)
+{
+ if (m_iconThemeModeEnabled == enabled)
+ return;
+ m_iconThemeModeEnabled = enabled;
+ m_themeAction->setVisible(enabled);
+ m_themeEnumAction->setVisible(enabled);
+}
+
+void PixmapEditor::setSpacing(int spacing)
+{
+ m_layout->setSpacing(spacing);
+}
+
+void PixmapEditor::setPath(const QString &path)
+{
+ m_path = path;
+ updateLabels();
+}
+
+void PixmapEditor::setTheme(const QString &theme)
+{
+ m_theme = theme;
+ updateLabels();
+}
+
+QString PixmapEditor::msgThemeIcon(const QString &t)
+{
+ return tr("[Theme] %1").arg(t);
+}
+
+QString PixmapEditor::msgMissingThemeIcon(const QString &t)
+{
+ return tr("[Theme] %1 (missing)").arg(t);
+}
+
+void PixmapEditor::setThemeEnum(int e)
+{
+ m_themeEnum = e;
+ updateLabels();
+}
+
+void PixmapEditor::updateLabels()
+{
+ m_pathLabel->setText(displayText(m_themeEnum, m_theme, m_path));
+ switch (state()) {
+ case State::Empty:
+ case State::MissingXdgTheme:
+ case State::MissingThemeEnum:
+ m_pixmapLabel->setPixmap(m_defaultPixmap);
+ m_copyAction->setEnabled(false);
+ break;
+ case State::ThemeEnum:
+ m_pixmapLabel->setPixmap(QIcon::fromTheme(static_cast<QIcon::ThemeIcon>(m_themeEnum)).pixmap(ICON_SIZE));
+ m_copyAction->setEnabled(true);
+ break;
+ case State::XdgTheme:
+ m_pixmapLabel->setPixmap(QIcon::fromTheme(m_theme).pixmap(ICON_SIZE));
+ m_copyAction->setEnabled(true);
+ break;
+ case State::Path:
+ case State::PathFallback:
+ if (m_pixmapCache) {
+ auto pixmap = m_pixmapCache->pixmap(PropertySheetPixmapValue(m_path));
+ m_pixmapLabel->setPixmap(QIcon(pixmap).pixmap(ICON_SIZE));
+ }
+ m_copyAction->setEnabled(true);
+ break;
+ }
+}
+
+void PixmapEditor::setDefaultPixmapIcon(const QIcon &icon)
+{
+ m_defaultPixmap = icon.pixmap(ICON_SIZE);
+ if (state() == State::Empty)
+ m_pixmapLabel->setPixmap(m_defaultPixmap);
+}
+
+void PixmapEditor::setDefaultPixmap(const QPixmap &pixmap)
+{
+ setDefaultPixmapIcon(QIcon(pixmap));
+}
+
+void PixmapEditor::contextMenuEvent(QContextMenuEvent *event)
+{
+ QMenu menu(this);
+ menu.addAction(m_copyAction);
+ menu.addAction(m_pasteAction);
+ menu.exec(event->globalPos());
+ event->accept();
+}
+
+void PixmapEditor::defaultActionActivated()
+{
+ if (m_iconThemeModeEnabled) {
+ themeEnumActionActivated();
+ return;
+ }
+ // Default to resource
+ const PropertySheetPixmapValue::PixmapSource ps = m_path.isEmpty()
+ ? PropertySheetPixmapValue::ResourcePixmap
+ : PropertySheetPixmapValue::getPixmapSource(m_core, m_path);
+ switch (ps) {
+ case PropertySheetPixmapValue::LanguageResourcePixmap:
+ case PropertySheetPixmapValue::ResourcePixmap:
+ resourceActionActivated();
+ break;
+ case PropertySheetPixmapValue::FilePixmap:
+ fileActionActivated();
+ break;
+ }
+}
+
+void PixmapEditor::resourceActionActivated()
+{
+ const QString oldPath = m_path;
+ const QString newPath = IconSelector::choosePixmapResource(m_core, m_core->resourceModel(),
+ oldPath, this);
+ if (!newPath.isEmpty() && newPath != oldPath) {
+ setTheme({});
+ setThemeEnum(-1);
+ setPath(newPath);
+ emit pathChanged(newPath);
+ }
+}
+
+void PixmapEditor::fileActionActivated()
+{
+ const QString newPath = IconSelector::choosePixmapFile(m_path, m_core->dialogGui(), this);
+ if (!newPath.isEmpty() && newPath != m_path) {
+ setTheme({});
+ setThemeEnum(-1);
+ setPath(newPath);
+ emit pathChanged(newPath);
+ }
+}
+
+void PixmapEditor::themeEnumActionActivated()
+{
+ const auto newThemeO = IconThemeEnumDialog::getTheme(this, {});
+ if (newThemeO.has_value()) {
+ const int newTheme = newThemeO.value();
+ if (newTheme != m_themeEnum) {
+ setThemeEnum(newTheme);
+ setTheme({});
+ setPath({});
+ emit themeEnumChanged(newTheme);
+ }
+ }
+}
+
+void PixmapEditor::themeActionActivated()
+{
+ const auto newThemeO = IconThemeDialog::getTheme(this, m_theme);
+ if (newThemeO.has_value()) {
+ const QString newTheme = newThemeO.value();
+ if (newTheme != m_theme) {
+ setTheme(newTheme);
+ setThemeEnum(-1);
+ setPath({});
+ emit themeChanged(newTheme);
+ }
+ }
+}
+
+PixmapEditor::State PixmapEditor::stateFromData(int themeEnum, const QString &xdgTheme,
+ const QString &path)
+{
+ if (themeEnum != -1) {
+ if (QIcon::hasThemeIcon(static_cast<QIcon::ThemeIcon>(themeEnum)))
+ return State::ThemeEnum;
+ return path.isEmpty() ? State::MissingThemeEnum : State::PathFallback;
+ }
+ if (!xdgTheme.isEmpty()) {
+ if (QIcon::hasThemeIcon(xdgTheme))
+ return State::XdgTheme;
+ return path.isEmpty() ? State::MissingXdgTheme : State::PathFallback;
+ }
+ return path.isEmpty() ? State::Empty : State::Path;
+}
+
+PixmapEditor::State PixmapEditor::state() const
+{
+ return stateFromData(m_themeEnum, m_theme, m_path);
+}
+
+QString PixmapEditor::displayText(int themeEnum, const QString &xdgTheme, const QString &path)
+{
+ switch (stateFromData(themeEnum, xdgTheme, path)) {
+ case State::ThemeEnum:
+ return msgThemeIcon(IconThemeEnumEditor::iconName(themeEnum));
+ case State::MissingThemeEnum:
+ return msgMissingThemeIcon(IconThemeEnumEditor::iconName(themeEnum));
+ case State::XdgTheme:
+ return msgThemeIcon(xdgTheme);
+ case State::MissingXdgTheme:
+ return msgMissingThemeIcon(xdgTheme);
+ case State::Path:
+ return QFileInfo(path).fileName();
+ case State::PathFallback:
+ return tr("%1 (fallback)").arg(QFileInfo(path).fileName());
+ case State::Empty:
+ break;
+ }
+ return {};
+}
+
+QString PixmapEditor::displayText(const PropertySheetIconValue &icon)
+{
+ const auto &paths = icon.paths();
+ const auto &it = paths.constFind({QIcon::Normal, QIcon::Off});
+ const QString path = it != paths.constEnd() ? it.value().path() : QString{};
+ return displayText(icon.themeEnum(), icon.theme(), path);
+}
+
+#if QT_CONFIG(clipboard)
+void PixmapEditor::copyActionActivated()
+{
+ QClipboard *clipboard = QApplication::clipboard();
+ switch (state()) {
+ case State::ThemeEnum:
+ case State::MissingThemeEnum:
+ clipboard->setText(IconThemeEnumEditor::iconName(m_themeEnum));
+ break;
+ case State::XdgTheme:
+ case State::MissingXdgTheme:
+ clipboard->setText(m_theme);
+ break;
+ case State::Path:
+ case State::PathFallback:
+ clipboard->setText(m_path);
+ break;
+ case State::Empty:
+ break;
+ }
+}
+
+void PixmapEditor::pasteActionActivated()
+{
+ QClipboard *clipboard = QApplication::clipboard();
+ QString subtype = u"plain"_s;
+ QString text = clipboard->text(subtype);
+ if (!text.isNull()) {
+ QStringList list = text.split(u'\n');
+ if (!list.isEmpty()) {
+ text = list.at(0);
+ if (m_iconThemeModeEnabled && QIcon::hasThemeIcon(text)) {
+ setTheme(text);
+ setPath(QString());
+ emit themeChanged(text);
+ } else {
+ setPath(text);
+ setTheme(QString());
+ emit pathChanged(text);
+ }
+ }
+ }
+}
+
+void PixmapEditor::clipboardDataChanged()
+{
+ QClipboard *clipboard = QApplication::clipboard();
+ QString subtype = u"plain"_s;
+ const QString text = clipboard->text(subtype);
+ m_pasteAction->setEnabled(!text.isNull());
+}
+#endif // QT_CONFIG(clipboard)
+
+} // qdesigner_internal
+
+QT_END_NAMESPACE
diff --git a/src/designer/src/components/propertyeditor/pixmapeditor.h b/src/designer/src/components/propertyeditor/pixmapeditor.h
new file mode 100644
index 000000000..9ca730595
--- /dev/null
+++ b/src/designer/src/components/propertyeditor/pixmapeditor.h
@@ -0,0 +1,128 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+#ifndef PIXMAPEDITOR_H
+#define PIXMAPEDITOR_H
+
+#include <QtWidgets/qdialog.h>
+
+#include <QtGui/qpixmap.h>
+
+#include <optional>
+
+QT_BEGIN_NAMESPACE
+
+class QLabel;
+class QHBoxLayout;
+class QToolButton;
+
+class QDesignerFormEditorInterface;
+
+namespace qdesigner_internal {
+
+class DesignerPixmapCache;
+class IconThemeEditor;
+class IconThemeEnumEditor;
+class PropertySheetIconValue;
+
+class IconThemeDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ static std::optional<QString> getTheme(QWidget *parent, const QString &theme);
+private:
+ explicit IconThemeDialog(QWidget *parent);
+ IconThemeEditor *m_editor;
+};
+
+class IconThemeEnumDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ static std::optional<int> getTheme(QWidget *parent, int theme);
+
+private:
+ IconThemeEnumDialog(QWidget *parent);
+ IconThemeEnumEditor *m_editor;
+};
+
+class PixmapEditor : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit PixmapEditor(QDesignerFormEditorInterface *core, QWidget *parent);
+
+ void setSpacing(int spacing);
+ void setPixmapCache(DesignerPixmapCache *cache);
+ void setIconThemeModeEnabled(bool enabled);
+
+ static QString msgThemeIcon(const QString &t);
+ static QString msgMissingThemeIcon(const QString &t);
+ static QString displayText(const PropertySheetIconValue &icon);
+
+public slots:
+ void setPath(const QString &path);
+ void setTheme(const QString &theme);
+ void setThemeEnum(int e);
+ void setDefaultPixmap(const QPixmap &pixmap);
+ void setDefaultPixmapIcon(const QIcon &icon);
+
+signals:
+ void pathChanged(const QString &path);
+ void themeEnumChanged(int themeEnum);
+ void themeChanged(const QString &theme);
+
+protected:
+ void contextMenuEvent(QContextMenuEvent *event) override;
+
+private slots:
+ void defaultActionActivated();
+ void resourceActionActivated();
+ void fileActionActivated();
+ void themeEnumActionActivated();
+ void themeActionActivated();
+#if QT_CONFIG(clipboard)
+ void copyActionActivated();
+ void pasteActionActivated();
+ void clipboardDataChanged();
+#endif
+private:
+ enum class State {
+ Empty,
+ ThemeEnum,
+ MissingThemeEnum,
+ XdgTheme,
+ MissingXdgTheme,
+ Path,
+ PathFallback // Non-existent theme icon, falling back to path
+ };
+
+ static State stateFromData(int themeEnum, const QString &xdgTheme, const QString &path);
+ State state() const;
+ static QString displayText(int themeEnum, const QString &xdgTheme, const QString &path);
+
+ void updateLabels();
+ bool m_iconThemeModeEnabled;
+ QDesignerFormEditorInterface *m_core;
+ QLabel *m_pixmapLabel;
+ QLabel *m_pathLabel;
+ QToolButton *m_button;
+ QAction *m_resourceAction;
+ QAction *m_fileAction;
+ QAction *m_themeEnumAction;
+ QAction *m_themeAction;
+ QAction *m_copyAction;
+ QAction *m_pasteAction;
+ QHBoxLayout *m_layout;
+ QPixmap m_defaultPixmap;
+ QString m_path;
+ QString m_theme;
+ int m_themeEnum = -1;
+ DesignerPixmapCache *m_pixmapCache;
+};
+
+} // namespace qdesigner_internal
+
+QT_END_NAMESPACE
+
+#endif // PIXMAPEDITOR_H
diff --git a/src/designer/src/components/propertyeditor/previewframe.cpp b/src/designer/src/components/propertyeditor/previewframe.cpp
index c093663e2..04a3141c2 100644
--- a/src/designer/src/components/propertyeditor/previewframe.cpp
+++ b/src/designer/src/components/propertyeditor/previewframe.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "previewframe.h"
#include "previewwidget.h"
diff --git a/src/designer/src/components/propertyeditor/previewframe.h b/src/designer/src/components/propertyeditor/previewframe.h
index 436c468a1..f368bb8d2 100644
--- a/src/designer/src/components/propertyeditor/previewframe.h
+++ b/src/designer/src/components/propertyeditor/previewframe.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef PREVIEWFRAME_H
#define PREVIEWFRAME_H
diff --git a/src/designer/src/components/propertyeditor/previewwidget.cpp b/src/designer/src/components/propertyeditor/previewwidget.cpp
index c489fc09a..722338dd9 100644
--- a/src/designer/src/components/propertyeditor/previewwidget.cpp
+++ b/src/designer/src/components/propertyeditor/previewwidget.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "previewwidget.h"
@@ -36,7 +11,7 @@
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+namespace qdesigner_internal {
PreviewWidget::PreviewWidget(QWidget *parent)
: QWidget(parent)
@@ -56,5 +31,6 @@ PreviewWidget::PreviewWidget(QWidget *parent)
PreviewWidget::~PreviewWidget() = default;
+} // namespace qdesigner_internal
QT_END_NAMESPACE
diff --git a/src/designer/src/components/propertyeditor/previewwidget.h b/src/designer/src/components/propertyeditor/previewwidget.h
index 36e5ef9fe..5b129ef82 100644
--- a/src/designer/src/components/propertyeditor/previewwidget.h
+++ b/src/designer/src/components/propertyeditor/previewwidget.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef PREVIEWWIDGET_H
#define PREVIEWWIDGET_H
diff --git a/src/designer/src/components/propertyeditor/previewwidget.ui b/src/designer/src/components/propertyeditor/previewwidget.ui
index 077ff24b4..dcbf62723 100644
--- a/src/designer/src/components/propertyeditor/previewwidget.ui
+++ b/src/designer/src/components/propertyeditor/previewwidget.ui
@@ -1,32 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <comment>*********************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-*********************************************************************</comment>
+<comment>
+* Copyright (C) 2016 The Qt Company Ltd.
+* SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+</comment>
<class>qdesigner_internal::PreviewWidget</class>
<widget class="QWidget" name="qdesigner_internal::PreviewWidget">
<property name="geometry">
diff --git a/src/designer/src/components/propertyeditor/propertyeditor.cpp b/src/designer/src/components/propertyeditor/propertyeditor.cpp
index c80cf794c..50ef8e1fc 100644
--- a/src/designer/src/components/propertyeditor/propertyeditor.cpp
+++ b/src/designer/src/components/propertyeditor/propertyeditor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "propertyeditor.h"
@@ -70,17 +45,19 @@
#include <QtCore/qdebug.h>
#include <QtCore/qtextstream.h>
-static const char *SettingsGroupC = "PropertyEditor";
-static const char *ViewKeyC = "View";
-static const char *ColorKeyC = "Colored";
-static const char *SortedKeyC = "Sorted";
-static const char *ExpansionKeyC = "ExpandedItems";
-static const char *SplitterPositionKeyC = "SplitterPosition";
-
enum SettingsView { TreeView, ButtonView };
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
+static constexpr auto SettingsGroupC = "PropertyEditor"_L1;
+static constexpr auto ViewKeyC = "View"_L1;
+static constexpr auto ColorKeyC = "Colored"_L1;
+static constexpr auto SortedKeyC = "Sorted"_L1;
+static constexpr auto ExpansionKeyC = "ExpandedItems"_L1;
+static constexpr auto SplitterPositionKeyC = "SplitterPosition"_L1;
+
// ---------------------------------------------------------------------------------
namespace qdesigner_internal {
@@ -135,20 +112,20 @@ void ElidingLabel::paintEvent(QPaintEvent *) {
// ----------- PropertyEditor::Strings
PropertyEditor::Strings::Strings() :
- m_fontProperty(QStringLiteral("font")),
- m_qLayoutWidget(QStringLiteral("QLayoutWidget")),
- m_designerPrefix(QStringLiteral("QDesigner")),
- m_layout(QStringLiteral("Layout")),
- m_validationModeAttribute(QStringLiteral("validationMode")),
- m_fontAttribute(QStringLiteral("font")),
- m_superPaletteAttribute(QStringLiteral("superPalette")),
- m_enumNamesAttribute(QStringLiteral("enumNames")),
- m_resettableAttribute(QStringLiteral("resettable")),
- m_flagsAttribute(QStringLiteral("flags"))
+ m_alignmentProperties{u"alignment"_s,
+ u"layoutLabelAlignment"_s, // QFormLayout
+ u"layoutFormAlignment"_s},
+ m_fontProperty(u"font"_s),
+ m_qLayoutWidget(u"QLayoutWidget"_s),
+ m_designerPrefix(u"QDesigner"_s),
+ m_layout(u"Layout"_s),
+ m_validationModeAttribute(u"validationMode"_s),
+ m_fontAttribute(u"font"_s),
+ m_superPaletteAttribute(u"superPalette"_s),
+ m_enumNamesAttribute(u"enumNames"_s),
+ m_resettableAttribute(u"resettable"_s),
+ m_flagsAttribute(u"flags"_s)
{
- m_alignmentProperties.insert(QStringLiteral("alignment"));
- m_alignmentProperties.insert(QStringLiteral("layoutLabelAlignment")); // QFormLayout
- m_alignmentProperties.insert(QStringLiteral("layoutFormAlignment"));
}
// ----------- PropertyEditor
@@ -206,41 +183,33 @@ PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *pare
m_propertyManager(new DesignerPropertyManager(m_core, this)),
m_stackedWidget(new QStackedWidget),
m_filterWidget(new QLineEdit),
- 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_addDynamicAction(new QAction(createIconSet("plus.png"_L1), tr("Add Dynamic Property..."), this)),
+ m_removeDynamicAction(new QAction(createIconSet("minus.png"_L1), tr("Remove Dynamic Property"), this)),
+ m_sortingAction(new QAction(createIconSet("sort.png"_L1), tr("Sorting"), this)),
+ m_coloringAction(new QAction(createIconSet("color.png"_L1), 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)
{
- QList<QColor> colors;
- colors.reserve(6);
- colors.push_back(QColor(255, 230, 191));
- colors.push_back(QColor(255, 255, 191));
- colors.push_back(QColor(191, 255, 191));
- colors.push_back(QColor(199, 255, 255));
- colors.push_back(QColor(234, 191, 255));
- colors.push_back(QColor(255, 191, 239));
- m_colors.reserve(colors.count());
+ const QColor colors[] = {{255, 230, 191}, {255, 255, 191}, {191, 255, 191},
+ {199, 255, 255}, {234, 191, 255}, {255, 191, 239}};
const int darknessFactor = 250;
- for (int i = 0; i < colors.count(); i++) {
- const QColor &c = colors.at(i);
- m_colors.push_back(qMakePair(c, c.darker(darknessFactor)));
- }
+ m_colors.reserve(std::size(colors));
+ for (const QColor &c : colors)
+ m_colors.append({c, c.darker(darknessFactor)});
QColor dynamicColor(191, 207, 255);
QColor layoutColor(255, 191, 191);
- m_dynamicColor = qMakePair(dynamicColor, dynamicColor.darker(darknessFactor));
- m_layoutColor = qMakePair(layoutColor, layoutColor.darker(darknessFactor));
+ m_dynamicColor = {dynamicColor, dynamicColor.darker(darknessFactor)};
+ m_layoutColor = {layoutColor, layoutColor.darker(darknessFactor)};
updateForegroundBrightness();
QActionGroup *actionGroup = new QActionGroup(this);
m_treeAction->setCheckable(true);
- m_treeAction->setIcon(createIconSet(QStringLiteral("widgets/listview.png")));
+ m_treeAction->setIcon(createIconSet("widgets/listview.png"_L1));
m_buttonAction->setCheckable(true);
- m_buttonAction->setIcon(createIconSet(QStringLiteral("dropdownbutton.png")));
+ m_buttonAction->setIcon(createIconSet("dropdownbutton.png"_L1));
actionGroup->addAction(m_treeAction);
actionGroup->addAction(m_buttonAction);
@@ -270,7 +239,7 @@ PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *pare
connect(m_removeDynamicAction, &QAction::triggered, this, &PropertyEditor::slotRemoveDynamicProperty);
// Configure
QAction *configureAction = new QAction(tr("Configure Property Editor"), this);
- configureAction->setIcon(createIconSet(QStringLiteral("configure.png")));
+ configureAction->setIcon(createIconSet("configure.png"_L1));
QMenu *configureMenu = new QMenu(this);
configureAction->setMenu(configureMenu);
@@ -339,13 +308,13 @@ PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *pare
// retrieve initial settings
QDesignerSettingsInterface *settings = m_core->settingsManager();
- settings->beginGroup(QLatin1String(SettingsGroupC));
- const SettingsView view = settings->value(QLatin1String(ViewKeyC), TreeView).toInt() == TreeView ? TreeView : ButtonView;
+ settings->beginGroup(SettingsGroupC);
+ const SettingsView view = settings->value(ViewKeyC, TreeView).toInt() == TreeView ? TreeView : ButtonView;
// Coloring not available unless treeview and not sorted
- m_sorting = settings->value(QLatin1String(SortedKeyC), false).toBool();
- m_coloring = settings->value(QLatin1String(ColorKeyC), true).toBool();
- const QVariantMap expansionState = settings->value(QLatin1String(ExpansionKeyC), QVariantMap()).toMap();
- const int splitterPosition = settings->value(QLatin1String(SplitterPositionKeyC), 150).toInt();
+ m_sorting = settings->value(SortedKeyC, false).toBool();
+ m_coloring = settings->value(ColorKeyC, true).toBool();
+ const QVariantMap expansionState = settings->value(ExpansionKeyC, QVariantMap()).toMap();
+ const int splitterPosition = settings->value(SplitterPositionKeyC, 150).toInt();
settings->endGroup();
// Apply settings
m_sortingAction->setChecked(m_sorting);
@@ -364,16 +333,17 @@ PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *pare
break;
}
// Restore expansionState from QVariant map
- if (!expansionState.isEmpty()) {
- const QVariantMap::const_iterator cend = expansionState.constEnd();
- for (QVariantMap::const_iterator it = expansionState.constBegin(); it != cend; ++it)
- m_expansionState.insert(it.key(), it.value().toBool());
- }
+ for (auto it = expansionState.cbegin(), cend = expansionState.cend(); it != cend; ++it)
+ m_expansionState.insert(it.key(), it.value().toBool());
+
updateActionsState();
}
PropertyEditor::~PropertyEditor()
{
+ // Prevent emission of QtTreePropertyBrowser::itemChanged() when deleting
+ // the current item, causing asserts.
+ m_treeBrowser->setCurrentItem(nullptr);
storeExpansionState();
saveSettings();
}
@@ -381,19 +351,16 @@ PropertyEditor::~PropertyEditor()
void PropertyEditor::saveSettings() const
{
QDesignerSettingsInterface *settings = m_core->settingsManager();
- settings->beginGroup(QLatin1String(SettingsGroupC));
- settings->setValue(QLatin1String(ViewKeyC), QVariant(m_treeAction->isChecked() ? TreeView : ButtonView));
- settings->setValue(QLatin1String(ColorKeyC), QVariant(m_coloring));
- settings->setValue(QLatin1String(SortedKeyC), QVariant(m_sorting));
+ settings->beginGroup(SettingsGroupC);
+ settings->setValue(ViewKeyC, QVariant(m_treeAction->isChecked() ? TreeView : ButtonView));
+ settings->setValue(ColorKeyC, QVariant(m_coloring));
+ settings->setValue(SortedKeyC, QVariant(m_sorting));
// Save last expansionState as QVariant map
QVariantMap expansionState;
- if (!m_expansionState.isEmpty()) {
- const QMap<QString, bool>::const_iterator cend = m_expansionState.constEnd();
- for (QMap<QString, bool>::const_iterator it = m_expansionState.constBegin(); it != cend; ++it)
- expansionState.insert(it.key(), QVariant(it.value()));
- }
- settings->setValue(QLatin1String(ExpansionKeyC), expansionState);
- settings->setValue(QLatin1String(SplitterPositionKeyC), m_treeBrowser->splitterPosition());
+ for (auto it = m_expansionState.cbegin(), cend = m_expansionState.cend(); it != cend; ++it)
+ expansionState.insert(it.key(), QVariant(it.value()));
+ settings->setValue(ExpansionKeyC, expansionState);
+ settings->setValue(SplitterPositionKeyC, m_treeBrowser->splitterPosition());
settings->endGroup();
}
@@ -435,16 +402,13 @@ bool PropertyEditor::isItemVisible(QtBrowserItem *item) const
void PropertyEditor::storePropertiesExpansionState(const QList<QtBrowserItem *> &items)
{
- const QChar bar = QLatin1Char('|');
for (QtBrowserItem *propertyItem : items) {
if (!propertyItem->children().isEmpty()) {
QtProperty *property = propertyItem->property();
const QString propertyName = property->propertyName();
- const QMap<QtProperty *, QString>::const_iterator itGroup = m_propertyToGroup.constFind(property);
+ const auto itGroup = m_propertyToGroup.constFind(property);
if (itGroup != m_propertyToGroup.constEnd()) {
- QString key = itGroup.value();
- key += bar;
- key += propertyName;
+ const QString key = itGroup.value() + u'|' + propertyName;
m_expansionState[key] = isExpanded(propertyItem);
}
}
@@ -478,17 +442,14 @@ void PropertyEditor::collapseAll()
void PropertyEditor::applyPropertiesExpansionState(const QList<QtBrowserItem *> &items)
{
- const QChar bar = QLatin1Char('|');
for (QtBrowserItem *propertyItem : items) {
- const QMap<QString, bool>::const_iterator excend = m_expansionState.constEnd();
+ const auto excend = m_expansionState.cend();
QtProperty *property = propertyItem->property();
const QString propertyName = property->propertyName();
- const QMap<QtProperty *, QString>::const_iterator itGroup = m_propertyToGroup.constFind(property);
+ const auto itGroup = m_propertyToGroup.constFind(property);
if (itGroup != m_propertyToGroup.constEnd()) {
- QString key = itGroup.value();
- key += bar;
- key += propertyName;
- const QMap<QString, bool>::const_iterator pit = m_expansionState.constFind(key);
+ const QString key = itGroup.value() + u'|' + propertyName;
+ const auto pit = m_expansionState.constFind(key);
if (pit != excend)
setExpanded(propertyItem, pit.value());
else
@@ -503,10 +464,10 @@ void PropertyEditor::applyExpansionState()
if (m_sorting) {
applyPropertiesExpansionState(items);
} else {
- const QMap<QString, bool>::const_iterator excend = m_expansionState.constEnd();
+ const auto excend = m_expansionState.cend();
for (QtBrowserItem *item : items) {
const QString groupName = item->property()->propertyName();
- const QMap<QString, bool>::const_iterator git = m_expansionState.constFind(groupName);
+ const auto git = m_expansionState.constFind(groupName);
if (git != excend)
setExpanded(item, git.value());
else
@@ -576,19 +537,19 @@ QColor PropertyEditor::propertyColor(QtProperty *property) const
QtProperty *groupProperty = property;
- QMap<QtProperty *, QString>::ConstIterator itProp = m_propertyToGroup.constFind(property);
+ const auto itProp = m_propertyToGroup.constFind(property);
if (itProp != m_propertyToGroup.constEnd())
groupProperty = m_nameToGroup.value(itProp.value());
const int groupIdx = m_groups.indexOf(groupProperty);
- QPair<QColor, QColor> pair;
+ std::pair<QColor, QColor> pair;
if (groupIdx != -1) {
if (groupProperty == m_dynamicGroup)
pair = m_dynamicColor;
else if (isLayoutGroup(groupProperty))
pair = m_layoutColor;
else
- pair = m_colors[groupIdx % m_colors.count()];
+ pair = m_colors[groupIdx % m_colors.size()];
}
if (!m_brightness)
return pair.first;
@@ -601,7 +562,7 @@ void PropertyEditor::fillView()
for (auto itProperty = m_nameToProperty.cbegin(), end = m_nameToProperty.cend(); itProperty != end; ++itProperty)
m_currentBrowser->addProperty(itProperty.value());
} else {
- for (QtProperty *group : qAsConst(m_groups)) {
+ for (QtProperty *group : std::as_const(m_groups)) {
QtBrowserItem *item = m_currentBrowser->addProperty(group);
if (m_currentBrowser == m_treeBrowser)
m_treeBrowser->setBackgroundColor(item, propertyColor(group));
@@ -733,7 +694,7 @@ void PropertyEditor::setReadOnly(bool /*readOnly*/)
void PropertyEditor::setPropertyValue(const QString &name, const QVariant &value, bool changed)
{
- const QMap<QString, QtVariantProperty*>::const_iterator it = m_nameToProperty.constFind(name);
+ const auto it = m_nameToProperty.constFind(name);
if (it == m_nameToProperty.constEnd())
return;
QtVariantProperty *property = it.value();
@@ -751,10 +712,10 @@ void PropertyEditor::updatePropertySheet()
updateToolBarLabel();
const int propertyCount = m_propertySheet->count();
- const QMap<QString, QtVariantProperty*>::const_iterator npcend = m_nameToProperty.constEnd();
+ const auto npcend = m_nameToProperty.cend();
for (int i = 0; i < propertyCount; ++i) {
const QString propertyName = m_propertySheet->propertyName(i);
- QMap<QString, QtVariantProperty*>::const_iterator it = m_nameToProperty.constFind(propertyName);
+ const auto it = m_nameToProperty.constFind(propertyName);
if (it != npcend)
updateBrowserValue(it.value(), m_propertySheet->property(i));
}
@@ -784,7 +745,7 @@ void PropertyEditor::updateToolBarLabel()
QString classLabelText;
if (!objectName.isEmpty())
- classLabelText += objectName + QStringLiteral(" : ");
+ classLabelText += objectName + " : "_L1;
classLabelText += className;
m_classLabel->setText(classLabelText);
@@ -824,7 +785,7 @@ void PropertyEditor::updateBrowserValue(QtVariantProperty *property, const QVari
m_updatingBrowser = true;
property->setValue(v);
if (sheet && sheet->isResourceProperty(index))
- property->setAttribute(QStringLiteral("defaultResource"), sheet->defaultResourceProperty(index));
+ property->setAttribute(u"defaultResource"_s, sheet->defaultResourceProperty(index));
m_updatingBrowser = false;
}
@@ -846,14 +807,14 @@ QString PropertyEditor::realClassName(QObject *object) const
if (!object)
return QString();
- QString className = QLatin1String(object->metaObject()->className());
+ QString className = QLatin1StringView(object->metaObject()->className());
const QDesignerWidgetDataBaseInterface *db = core()->widgetDataBase();
if (QDesignerWidgetDataBaseItemInterface *widgetItem = db->item(db->indexOfObject(object, true))) {
className = widgetItem->name();
if (object->isWidgetType() && className == m_strings.m_qLayoutWidget
&& static_cast<QWidget*>(object)->layout()) {
- className = QLatin1String(static_cast<QWidget*>(object)->layout()->metaObject()->className());
+ className = QLatin1StringView(static_cast<QWidget*>(object)->layout()->metaObject()->className());
}
}
@@ -948,7 +909,7 @@ void PropertyEditor::setObject(QObject *object)
if (m_propertySheet->indexOf(propertyName) != i)
continue;
const QString groupName = m_propertySheet->propertyGroup(i);
- const QMap<QString, QtVariantProperty *>::const_iterator rit = toRemove.constFind(propertyName);
+ const auto rit = toRemove.constFind(propertyName);
if (rit != toRemove.constEnd()) {
QtVariantProperty *property = rit.value();
const int propertyType = property->propertyType();
@@ -1012,10 +973,10 @@ void PropertyEditor::setObject(QObject *object)
m_updatingBrowser = false;
} else if (type == DesignerPropertyManager::designerFlagTypeId()) {
const PropertySheetFlagValue f = qvariant_cast<PropertySheetFlagValue>(value);
- QList<QPair<QString, uint> > flags;
+ QList<std::pair<QString, uint>> flags;
for (const QString &name : f.metaFlags.keys()) {
const uint val = f.metaFlags.keyToValue(name);
- flags.append(qMakePair(name, val));
+ flags.append({name, val});
}
m_updatingBrowser = true;
QVariant v;
@@ -1034,8 +995,8 @@ void PropertyEditor::setObject(QObject *object)
descriptionToolTip = customData.propertyToolTip(propertyName);
if (descriptionToolTip.isEmpty()) {
if (const char *typeS = typeName(type)) {
- descriptionToolTip = propertyName + QLatin1String(" (")
- + QLatin1String(typeS) + QLatin1Char(')');
+ descriptionToolTip = propertyName + " ("_L1
+ + QLatin1StringView(typeS) + ')'_L1;
}
}
if (!descriptionToolTip.isEmpty())
@@ -1058,16 +1019,16 @@ void PropertyEditor::setObject(QObject *object)
QtVariantProperty *groupProperty = nullptr;
if (newProperty) {
- QMap<QString, QtVariantProperty*>::const_iterator itPrev(m_nameToProperty.insert(propertyName, property));
+ auto itPrev = m_nameToProperty.insert(propertyName, property);
m_propertyToGroup[property] = groupName;
if (m_sorting) {
QtProperty *previous = nullptr;
- if (itPrev != m_nameToProperty.constBegin())
+ if (itPrev != m_nameToProperty.begin())
previous = (--itPrev).value();
m_currentBrowser->insertProperty(property, previous);
}
}
- const QMap<QString, QtVariantProperty*>::const_iterator gnit = m_nameToGroup.constFind(groupName);
+ const auto gnit = m_nameToGroup.constFind(groupName);
if (gnit != m_nameToGroup.constEnd()) {
groupProperty = gnit.value();
} else {
@@ -1108,11 +1069,11 @@ void PropertyEditor::setObject(QObject *object)
updateBrowserValue(property, value);
property->setModified(m_propertySheet->isChanged(i));
- if (propertyName == QStringLiteral("geometry") && type == QMetaType::QRect) {
+ if (propertyName == "geometry"_L1 && type == QMetaType::QRect) {
const auto &subProperties = property->subProperties();
for (QtProperty *subProperty : subProperties) {
const QString subPropertyName = subProperty->propertyName();
- if (subPropertyName == QStringLiteral("X") || subPropertyName == QStringLiteral("Y"))
+ if (subPropertyName == "X"_L1 || subPropertyName == "Y"_L1)
subProperty->setEnabled(!isMainContainer);
}
}
diff --git a/src/designer/src/components/propertyeditor/propertyeditor.h b/src/designer/src/components/propertyeditor/propertyeditor.h
index 331a72303..48cd03b25 100644
--- a/src/designer/src/components/propertyeditor/propertyeditor.h
+++ b/src/designer/src/components/propertyeditor/propertyeditor.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef PROPERTYEDITOR_H
#define PROPERTYEDITOR_H
@@ -155,7 +130,7 @@ private:
DesignerEditorFactory *m_groupFactory;
QPointer<QObject> m_object;
QMap<QString, QtVariantProperty*> m_nameToProperty;
- QMap<QtProperty*, QString> m_propertyToGroup;
+ QHash<QtProperty *, QString> m_propertyToGroup;
QMap<QString, QtVariantProperty*> m_nameToGroup;
QList<QtProperty *> m_groups;
QtProperty *m_dynamicGroup = nullptr;
@@ -180,9 +155,9 @@ private:
QMap<QString, bool> m_expansionState;
QString m_filterPattern;
- QList<QPair<QColor, QColor> > m_colors;
- QPair<QColor, QColor> m_dynamicColor;
- QPair<QColor, QColor> m_layoutColor;
+ QList<std::pair<QColor, QColor> > m_colors;
+ std::pair<QColor, QColor> m_dynamicColor;
+ std::pair<QColor, QColor> m_layoutColor;
bool m_brightness = false;
};
diff --git a/src/designer/src/components/propertyeditor/propertyeditor.qrc b/src/designer/src/components/propertyeditor/propertyeditor.qrc
deleted file mode 100644
index 6c0dc18ca..000000000
--- a/src/designer/src/components/propertyeditor/propertyeditor.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/qt-project.org/propertyeditor">
- <file>fontmapping.xml</file>
- </qresource>
-</RCC>
diff --git a/src/designer/src/components/propertyeditor/propertyeditor_global.h b/src/designer/src/components/propertyeditor/propertyeditor_global.h
index 174930115..7172218f8 100644
--- a/src/designer/src/components/propertyeditor/propertyeditor_global.h
+++ b/src/designer/src/components/propertyeditor/propertyeditor_global.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef PROPERTYEDITOR_GLOBAL_H
#define PROPERTYEDITOR_GLOBAL_H
diff --git a/src/designer/src/components/propertyeditor/qlonglongvalidator.cpp b/src/designer/src/components/propertyeditor/qlonglongvalidator.cpp
index 9a780cf94..906ffdf80 100644
--- a/src/designer/src/components/propertyeditor/qlonglongvalidator.cpp
+++ b/src/designer/src/components/propertyeditor/qlonglongvalidator.cpp
@@ -1,36 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qlonglongvalidator.h"
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+using namespace Qt::StringLiterals;
+
+namespace qdesigner_internal {
// ----------------------------------------------------------------------------
QLongLongValidator::QLongLongValidator(QObject * parent)
@@ -49,9 +26,9 @@ QLongLongValidator::~QLongLongValidator() = default;
QValidator::State QLongLongValidator::validate(QString & input, int &) const
{
- if (input.contains(QLatin1Char(' ')))
+ if (input.contains(u' '))
return Invalid;
- if (input.isEmpty() || (b < 0 && input == QString(QLatin1Char('-'))))
+ if (input.isEmpty() || (b < 0 && input == "-"_L1))
return Intermediate;
bool ok;
qlonglong entered = input.toLongLong(&ok);
@@ -103,7 +80,7 @@ QValidator::State QULongLongValidator::validate(QString & input, int &) const
bool ok;
qulonglong entered = input.toULongLong(&ok);
- if (input.contains(QLatin1Char(' ')) || input.contains(QLatin1Char('-')) || !ok)
+ if (input.contains(u' ') || input.contains(u'-') || !ok)
return Invalid;
if (entered >= b && entered <= t)
@@ -128,4 +105,6 @@ void QULongLongValidator::setTop(qulonglong top)
setRange(bottom(), top);
}
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
diff --git a/src/designer/src/components/propertyeditor/qlonglongvalidator.h b/src/designer/src/components/propertyeditor/qlonglongvalidator.h
index 3f1669448..4a70908e2 100644
--- a/src/designer/src/components/propertyeditor/qlonglongvalidator.h
+++ b/src/designer/src/components/propertyeditor/qlonglongvalidator.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QLONGLONGVALIDATOR_H
#define QLONGLONGVALIDATOR_H
diff --git a/src/designer/src/components/propertyeditor/stringlisteditor.cpp b/src/designer/src/components/propertyeditor/stringlisteditor.cpp
index 1cfdb1f3c..3e170ee69 100644
--- a/src/designer/src/components/propertyeditor/stringlisteditor.cpp
+++ b/src/designer/src/components/propertyeditor/stringlisteditor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "stringlisteditor.h"
#include <iconloader_p.h>
@@ -32,13 +7,14 @@
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+using namespace Qt::StringLiterals;
+
+namespace qdesigner_internal {
StringListEditor::StringListEditor(QWidget *parent)
: QDialog(parent), m_model(new QStringListModel(this))
{
setupUi(this);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
listView->setModel(m_model);
connect(listView->selectionModel(),
@@ -48,10 +24,16 @@ StringListEditor::StringListEditor(QWidget *parent)
&QAbstractItemDelegate::closeEditor,
this, &StringListEditor::currentValueChanged);
- QIcon upIcon = createIconSet(QString::fromUtf8("up.png"));
- QIcon downIcon = createIconSet(QString::fromUtf8("down.png"));
- QIcon minusIcon = createIconSet(QString::fromUtf8("minus.png"));
- QIcon plusIcon = createIconSet(QString::fromUtf8("plus.png"));
+ connect(upButton, &QAbstractButton::clicked, this, &StringListEditor::upButtonClicked);
+ connect(downButton, &QAbstractButton::clicked, this, &StringListEditor::downButtonClicked);
+ connect(newButton, &QAbstractButton::clicked, this, &StringListEditor::newButtonClicked);
+ connect(deleteButton, &QAbstractButton::clicked, this, &StringListEditor::deleteButtonClicked);
+ connect(valueEdit, &QLineEdit::textEdited, this, &StringListEditor::valueEdited);
+
+ QIcon upIcon = createIconSet("up.png"_L1);
+ QIcon downIcon = createIconSet("down.png"_L1);
+ QIcon minusIcon = createIconSet("minus.png"_L1);
+ QIcon plusIcon = createIconSet("plus.png"_L1);
upButton->setIcon(upIcon);
downButton->setIcon(downIcon);
newButton->setIcon(plusIcon);
@@ -96,7 +78,7 @@ void StringListEditor::currentValueChanged()
updateUi();
}
-void StringListEditor::on_upButton_clicked()
+void StringListEditor::upButtonClicked()
{
int from = currentIndex();
int to = currentIndex() - 1;
@@ -107,7 +89,7 @@ void StringListEditor::on_upButton_clicked()
updateUi();
}
-void StringListEditor::on_downButton_clicked()
+void StringListEditor::downButtonClicked()
{
int from = currentIndex();
int to = currentIndex() + 1;
@@ -118,7 +100,7 @@ void StringListEditor::on_downButton_clicked()
updateUi();
}
-void StringListEditor::on_newButton_clicked()
+void StringListEditor::newButtonClicked()
{
int to = currentIndex();
if (to == -1)
@@ -130,14 +112,14 @@ void StringListEditor::on_newButton_clicked()
editString(to);
}
-void StringListEditor::on_deleteButton_clicked()
+void StringListEditor::deleteButtonClicked()
{
removeString(currentIndex());
setCurrentIndex(currentIndex());
updateUi();
}
-void StringListEditor::on_valueEdit_textEdited(const QString &text)
+void StringListEditor::valueEdited(const QString &text)
{
setStringAt(currentIndex(), text);
}
@@ -194,4 +176,6 @@ void StringListEditor::editString(int index)
listView->edit(m_model->index(index, 0));
}
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
diff --git a/src/designer/src/components/propertyeditor/stringlisteditor.h b/src/designer/src/components/propertyeditor/stringlisteditor.h
index bb623d900..a64250fcc 100644
--- a/src/designer/src/components/propertyeditor/stringlisteditor.h
+++ b/src/designer/src/components/propertyeditor/stringlisteditor.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef STRINGLISTEDITOR_H
#define STRINGLISTEDITOR_H
@@ -49,11 +24,11 @@ public:
QWidget *parent, const QStringList &init = QStringList(), int *result = nullptr);
private slots:
- void on_upButton_clicked();
- void on_downButton_clicked();
- void on_newButton_clicked();
- void on_deleteButton_clicked();
- void on_valueEdit_textEdited(const QString &text);
+ void upButtonClicked();
+ void downButtonClicked();
+ void newButtonClicked();
+ void deleteButtonClicked();
+ void valueEdited(const QString &text);
void currentIndexChanged(const QModelIndex &current, const QModelIndex &previous);
void currentValueChanged();
diff --git a/src/designer/src/components/propertyeditor/stringlisteditor.ui b/src/designer/src/components/propertyeditor/stringlisteditor.ui
index 4a1540702..c7a718c9f 100644
--- a/src/designer/src/components/propertyeditor/stringlisteditor.ui
+++ b/src/designer/src/components/propertyeditor/stringlisteditor.ui
@@ -1,31 +1,8 @@
<ui version="4.0" >
- <comment>*********************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-*********************************************************************</comment>
+<comment>
+* Copyright (C) 2016 The Qt Company Ltd.
+* SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+</comment>
<class>qdesigner_internal::Dialog</class>
<widget class="QDialog" name="qdesigner_internal::Dialog" >
<property name="geometry" >
diff --git a/src/designer/src/components/propertyeditor/stringlisteditorbutton.cpp b/src/designer/src/components/propertyeditor/stringlisteditorbutton.cpp
index 110990b51..59323686c 100644
--- a/src/designer/src/components/propertyeditor/stringlisteditorbutton.cpp
+++ b/src/designer/src/components/propertyeditor/stringlisteditorbutton.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "stringlisteditorbutton.h"
#include "stringlisteditor.h"
@@ -33,7 +8,7 @@
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+namespace qdesigner_internal {
StringListEditorButton::StringListEditorButton(
const QStringList &stringList, QWidget *parent)
@@ -63,4 +38,6 @@ void StringListEditorButton::showStringListEditor()
}
}
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
diff --git a/src/designer/src/components/propertyeditor/stringlisteditorbutton.h b/src/designer/src/components/propertyeditor/stringlisteditorbutton.h
index f2e28f4bf..8a41c065d 100644
--- a/src/designer/src/components/propertyeditor/stringlisteditorbutton.h
+++ b/src/designer/src/components/propertyeditor/stringlisteditorbutton.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef STRINGLISTEDITORBUTTON_H
#define STRINGLISTEDITORBUTTON_H
diff --git a/src/designer/src/components/signalsloteditor/connectdialog.cpp b/src/designer/src/components/signalsloteditor/connectdialog.cpp
index bb59e0c1c..6f122b16c 100644
--- a/src/designer/src/components/signalsloteditor/connectdialog.cpp
+++ b/src/designer/src/components/signalsloteditor/connectdialog.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "connectdialog_p.h"
#include "signalslot_utils_p.h"
@@ -42,9 +17,11 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
static QString realClassName(QDesignerFormEditorInterface *core, QWidget *widget)
{
- QString class_name = QLatin1String(widget->metaObject()->className());
+ QString class_name = QLatin1StringView(widget->metaObject()->className());
const QDesignerWidgetDataBaseInterface *wdb = core->widgetDataBase();
const int idx = wdb->indexOfObject(widget);
if (idx != -1)
@@ -54,7 +31,7 @@ static QString realClassName(QDesignerFormEditorInterface *core, QWidget *widget
static QString widgetLabel(QDesignerFormEditorInterface *core, QWidget *widget)
{
- return QString::fromUtf8("%1 (%2)")
+ return "%1 (%2)"_L1
.arg(qdesigner_internal::realObjectName(core, widget),
realClassName(core, widget));
}
@@ -73,8 +50,6 @@ ConnectDialog::ConnectDialog(QDesignerFormWindowInterface *formWindow,
{
m_ui.setupUi(this);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
-
connect(m_ui.signalList, &QListWidget::itemClicked,
this, &ConnectDialog::selectSignal);
connect(m_ui.slotList, &QListWidget::itemClicked,
@@ -220,9 +195,7 @@ void ConnectDialog::populateSlotList(const QString &signal)
QVariant variantFont = QVariant::fromValue(font);
QListWidgetItem *curr = nullptr;
- QMap<QString, QString>::ConstIterator itMember = memberToClassName.constBegin();
- const QMap<QString, QString>::ConstIterator itMemberEnd = memberToClassName.constEnd();
- while (itMember != itMemberEnd) {
+ for (auto itMember = memberToClassName.cbegin(), itMemberEnd = memberToClassName.cend(); itMember != itMemberEnd; ++itMember) {
const QString member = itMember.key();
QListWidgetItem *item = new QListWidgetItem(m_ui.slotList);
item->setText(member);
@@ -235,7 +208,6 @@ void ConnectDialog::populateSlotList(const QString &signal)
item->setData(Qt::FontRole, variantFont);
item->setData(Qt::ForegroundRole, QColor(Qt::red));
}
- ++itMember;
}
if (curr)
@@ -262,9 +234,7 @@ void ConnectDialog::populateSignalList()
QVariant variantFont = QVariant::fromValue(font);
QListWidgetItem *curr = nullptr;
- QMap<QString, QString>::ConstIterator itMember = memberToClassName.constBegin();
- const QMap<QString, QString>::ConstIterator itMemberEnd = memberToClassName.constEnd();
- while (itMember != itMemberEnd) {
+ for (auto itMember = memberToClassName.cbegin(), itMemberEnd = memberToClassName.cend(); itMember != itMemberEnd; ++itMember) {
const QString member = itMember.key();
QListWidgetItem *item = new QListWidgetItem(m_ui.signalList);
@@ -278,7 +248,6 @@ void ConnectDialog::populateSignalList()
item->setData(Qt::FontRole, variantFont);
item->setData(Qt::ForegroundRole, QColor(Qt::red));
}
- ++itMember;
}
if (curr) {
diff --git a/src/designer/src/components/signalsloteditor/connectdialog_p.h b/src/designer/src/components/signalsloteditor/connectdialog_p.h
index 0cd600557..fe9fae32d 100644
--- a/src/designer/src/components/signalsloteditor/connectdialog_p.h
+++ b/src/designer/src/components/signalsloteditor/connectdialog_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef CONNECTDIALOG_H
#define CONNECTDIALOG_H
@@ -86,7 +61,7 @@ private:
const WidgetMode m_sourceMode;
const WidgetMode m_destinationMode;
QDesignerFormWindowInterface *m_formWindow;
- Ui::ConnectDialog m_ui;
+ QT_PREPEND_NAMESPACE(Ui)::ConnectDialog m_ui;
};
}
diff --git a/src/designer/src/components/signalsloteditor/signalslot_utils.cpp b/src/designer/src/components/signalsloteditor/signalslot_utils.cpp
index c7a960ef3..f8db32ee3 100644
--- a/src/designer/src/components/signalsloteditor/signalslot_utils.cpp
+++ b/src/designer/src/components/signalsloteditor/signalslot_utils.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "signalslot_utils_p.h"
@@ -42,7 +17,7 @@
QT_BEGIN_NAMESPACE
-using ClassNameSignaturePair = QPair<QString, QString>;
+using ClassNameSignaturePair = std::pair<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
diff --git a/src/designer/src/components/signalsloteditor/signalslot_utils_p.h b/src/designer/src/components/signalsloteditor/signalslot_utils_p.h
index 7ab98c3d4..e7441f855 100644
--- a/src/designer/src/components/signalsloteditor/signalslot_utils_p.h
+++ b/src/designer/src/components/signalsloteditor/signalslot_utils_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef SIGNALSLOTUTILS_P_H
#define SIGNALSLOTUTILS_P_H
diff --git a/src/designer/src/components/signalsloteditor/signalsloteditor.cpp b/src/designer/src/components/signalsloteditor/signalsloteditor.cpp
index 28bb2c736..76239f07e 100644
--- a/src/designer/src/components/signalsloteditor/signalsloteditor.cpp
+++ b/src/designer/src/components/signalsloteditor/signalsloteditor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "signalsloteditor.h"
#include "signalsloteditor_p.h"
@@ -33,6 +8,7 @@
#include <metadatabase_p.h>
#include <qdesigner_formwindowcommand_p.h>
+#include <signalslotdialog_p.h>
#include <QtDesigner/private/ui4_p.h>
#include <QtDesigner/abstractformwindow.h>
@@ -49,6 +25,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
/*******************************************************************************
@@ -76,13 +54,13 @@ DomConnection *SignalSlotConnection::toUi() const
QPoint tp = endPointPos(EndPoint::Target);
DomConnectionHint *hint = new DomConnectionHint;
- hint->setAttributeType(QStringLiteral("sourcelabel"));
+ hint->setAttributeType(u"sourcelabel"_s);
hint->setElementX(sp.x());
hint->setElementY(sp.y());
list.append(hint);
hint = new DomConnectionHint;
- hint->setAttributeType(QStringLiteral("destinationlabel"));
+ hint->setAttributeType(u"destinationlabel"_s);
hint->setElementX(tp.x());
hint->setElementY(tp.y());
list.append(hint);
@@ -373,6 +351,21 @@ void SignalSlotEditor::fromUi(const DomConnections *connections, QWidget *parent
if (connections == nullptr)
return;
+ // For old forms, that were saved before Qt 4 times, there was no <slots>
+ // section inside ui file. Currently, when we specify custom signals or slots
+ // for the form, we add them into the <slots> section. For all signals / slots
+ // inside <slots> section uic creates string-based connections.
+ // In order to fix old forms, we detect if a signal or slot used inside connection
+ // is a custom (fake) one, like it's being done inside SignalSlotDialog.
+ // In case of a fake signal / slot we register it inside meta data base, so that
+ // the next save will add a missing <slots> section.
+ QStringList existingSlots, existingSignals;
+ SignalSlotDialog::existingMethodsFromMemberSheet(m_form_window->core(), parent,
+ existingSlots, existingSignals);
+ QStringList fakeSlots, fakeSignals;
+ SignalSlotDialog::fakeMethodsFromMetaDataBase(m_form_window->core(), parent,
+ fakeSlots, fakeSignals);
+
setBackground(parent);
clear();
const auto &list = connections->elementConnection();
@@ -397,33 +390,48 @@ void SignalSlotEditor::fromUi(const DomConnections *connections, QWidget *parent
for (DomConnectionHint *hint : hints) {
QString attr_type = hint->attributeType();
QPoint p = QPoint(hint->elementX(), hint->elementY());
- if (attr_type == QStringLiteral("sourcelabel"))
+ if (attr_type == "sourcelabel"_L1)
sp = p;
- else if (attr_type == QStringLiteral("destinationlabel"))
+ else if (attr_type == "destinationlabel"_L1)
tp = p;
}
}
+ const QString sourceSignal = dom_con->elementSignal();
+ if (source == parent && !existingSignals.contains(sourceSignal)
+ && !fakeSignals.contains(sourceSignal)) {
+ fakeSignals.append(sourceSignal);
+ }
+
+ const QString destSlot = dom_con->elementSlot();
+ if (destination == parent && !existingSlots.contains(destSlot)
+ && !fakeSlots.contains(destSlot)) {
+ fakeSlots.append(destSlot);
+ }
+
+
SignalSlotConnection *con = new SignalSlotConnection(this);
con->setEndPoint(EndPoint::Source, source, sp);
con->setEndPoint(EndPoint::Target, destination, tp);
- con->setSignal(dom_con->elementSignal());
- con->setSlot(dom_con->elementSlot());
+ con->setSignal(sourceSignal);
+ con->setSlot(destSlot);
addConnection(con);
}
+ SignalSlotDialog::fakeMethodsToMetaDataBase(m_form_window->core(), parent,
+ fakeSlots, fakeSignals);
}
static bool skipWidget(const QWidget *w)
{
- const QString name = QLatin1String(w->metaObject()->className());
- if (name == QStringLiteral("QDesignerWidget"))
+ const QString name = QLatin1StringView(w->metaObject()->className());
+ if (name == "QDesignerWidget"_L1)
return true;
- if (name == QStringLiteral("QLayoutWidget"))
+ if (name == "QLayoutWidget"_L1)
return true;
- if (name == QStringLiteral("qdesigner_internal::FormWindow"))
+ if (name == "qdesigner_internal::FormWindow"_L1)
return true;
- if (name == QStringLiteral("Spacer"))
+ if (name == "Spacer"_L1)
return true;
return false;
}
diff --git a/src/designer/src/components/signalsloteditor/signalsloteditor.h b/src/designer/src/components/signalsloteditor/signalsloteditor.h
index c235c1d94..6ce498908 100644
--- a/src/designer/src/components/signalsloteditor/signalsloteditor.h
+++ b/src/designer/src/components/signalsloteditor/signalsloteditor.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef SIGNALSLOTEDITOR_H
#define SIGNALSLOTEDITOR_H
diff --git a/src/designer/src/components/signalsloteditor/signalsloteditor_global.h b/src/designer/src/components/signalsloteditor/signalsloteditor_global.h
index 4b087ac60..fbe025316 100644
--- a/src/designer/src/components/signalsloteditor/signalsloteditor_global.h
+++ b/src/designer/src/components/signalsloteditor/signalsloteditor_global.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef SIGNALSLOTEDITOR_GLOBAL_H
#define SIGNALSLOTEDITOR_GLOBAL_H
diff --git a/src/designer/src/components/signalsloteditor/signalsloteditor_p.h b/src/designer/src/components/signalsloteditor/signalsloteditor_p.h
index 1a44c101a..70157a3b4 100644
--- a/src/designer/src/components/signalsloteditor/signalsloteditor_p.h
+++ b/src/designer/src/components/signalsloteditor/signalsloteditor_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef SIGNALSLOTEDITOR_P_H
#define SIGNALSLOTEDITOR_P_H
diff --git a/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp b/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp
index 60cfdfa6a..8b0b1f75a 100644
--- a/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp
+++ b/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "signalsloteditor_plugin.h"
#include "signalsloteditor_tool.h"
@@ -36,7 +11,9 @@
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+using namespace Qt::StringLiterals;
+
+namespace qdesigner_internal {
SignalSlotEditorPlugin::SignalSlotEditorPlugin() = default;
@@ -52,10 +29,10 @@ void SignalSlotEditorPlugin::initialize(QDesignerFormEditorInterface *core)
Q_ASSERT(!isInitialized());
m_action = new QAction(tr("Edit Signals/Slots"), this);
- m_action->setObjectName(QStringLiteral("__qt_edit_signals_slots_action"));
+ m_action->setObjectName(u"__qt_edit_signals_slots_action"_s);
m_action->setShortcut(tr("F4"));
- QIcon icon = QIcon::fromTheme(QStringLiteral("designer-edit-signals"),
- QIcon(core->resourceLocation() + QStringLiteral("/signalslottool.png")));
+ QIcon icon = QIcon::fromTheme(u"designer-edit-signals"_s,
+ QIcon(core->resourceLocation() + "/signalslottool.png"_L1));
m_action->setIcon(icon);
m_action->setEnabled(false);
@@ -112,6 +89,8 @@ void SignalSlotEditorPlugin::activeFormWindowChanged(QDesignerFormWindowInterfac
m_action->setEnabled(formWindow != nullptr);
}
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
#include "moc_signalsloteditor_plugin.cpp"
diff --git a/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.h b/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.h
index fc4cabdcd..dc70c676d 100644
--- a/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.h
+++ b/src/designer/src/components/signalsloteditor/signalsloteditor_plugin.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef SIGNALSLOTEDITOR_PLUGIN_H
#define SIGNALSLOTEDITOR_PLUGIN_H
diff --git a/src/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp b/src/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp
index ec828b017..9b5e72fbd 100644
--- a/src/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp
+++ b/src/designer/src/components/signalsloteditor/signalsloteditor_tool.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "signalsloteditor_tool.h"
#include "signalsloteditor.h"
@@ -38,7 +13,7 @@
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+namespace qdesigner_internal {
SignalSlotEditorTool::SignalSlotEditorTool(QDesignerFormWindowInterface *formWindow, QObject *parent)
: QDesignerFormWindowToolInterface(parent),
@@ -107,4 +82,6 @@ void SignalSlotEditorTool::loadFromDom(DomUI *ui, QWidget *mainContainer)
m_editor->fromUi(ui->elementConnections(), mainContainer);
}
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
diff --git a/src/designer/src/components/signalsloteditor/signalsloteditor_tool.h b/src/designer/src/components/signalsloteditor/signalsloteditor_tool.h
index acd71f479..762738930 100644
--- a/src/designer/src/components/signalsloteditor/signalsloteditor_tool.h
+++ b/src/designer/src/components/signalsloteditor/signalsloteditor_tool.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef SIGNALSLOTEDITOR_TOOL_H
#define SIGNALSLOTEDITOR_TOOL_H
diff --git a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
index 1ed2e9da2..1efc66064 100644
--- a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
+++ b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "signalsloteditorwindow.h"
#include "signalsloteditor_p.h"
@@ -67,6 +42,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
// 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)
@@ -427,7 +404,7 @@ void InlineEditorModel::addTitle(const QString &title)
const int cnt = rowCount();
insertRows(cnt, 1);
QModelIndex cat_idx = index(cnt, 0);
- setData(cat_idx, QString(title + QLatin1Char(':')), Qt::DisplayRole);
+ setData(cat_idx, QString(title + u':'), Qt::DisplayRole);
setData(cat_idx, TitleItem, Qt::UserRole);
QFont font = QApplication::font();
font.setBold(true);
@@ -456,16 +433,13 @@ void InlineEditorModel::addTextList(const QMap<QString, bool> &text_list)
QFont font = QApplication::font();
font.setItalic(true);
QVariant fontVariant = QVariant::fromValue(font);
- QMap<QString, bool>::ConstIterator it = text_list.constBegin();
- const QMap<QString, bool>::ConstIterator itEnd = text_list.constEnd();
- while (it != itEnd) {
+ for (auto it = text_list.cbegin(), itEnd = text_list.cend(); it != itEnd; ++it) {
const QModelIndex text_idx = index(cnt++, 0);
setData(text_idx, it.key(), Qt::DisplayRole);
if (it.value()) {
setData(text_idx, fontVariant, Qt::FontRole);
setData(text_idx, QColor(Qt::red), Qt::ForegroundRole);
}
- ++it;
}
}
@@ -645,7 +619,7 @@ QWidget *ConnectionDelegate::createEditor(QWidget *parent,
continue;
// Mark deprecated members by passing bool=true.
QMap<QString, bool> markedMemberList;
- for (const QString &member : qAsConst(classInfo.m_memberList))
+ for (const QString &member : std::as_const(classInfo.m_memberList))
markedMemberList.insert(member, false);
inline_editor->addTitle(classInfo.m_className);
inline_editor->addTextList(markedMemberList);
@@ -707,11 +681,11 @@ SignalSlotEditorWindow::SignalSlotEditorWindow(QDesignerFormEditorInterface *cor
QToolBar *toolBar = new QToolBar;
toolBar->setIconSize(QSize(22, 22));
- m_add_button->setIcon(createIconSet(QStringLiteral("plus.png")));
+ m_add_button->setIcon(createIconSet("plus.png"_L1));
connect(m_add_button, &QAbstractButton::clicked, this, &SignalSlotEditorWindow::addConnection);
toolBar->addWidget(m_add_button);
- m_remove_button->setIcon(createIconSet(QStringLiteral("minus.png")));
+ m_remove_button->setIcon(createIconSet("minus.png"_L1));
connect(m_remove_button, &QAbstractButton::clicked, this, &SignalSlotEditorWindow::removeConnection);
toolBar->addWidget(m_remove_button);
diff --git a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.h b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.h
index 4d7af91f8..07891d0cd 100644
--- a/src/designer/src/components/signalsloteditor/signalsloteditorwindow.h
+++ b/src/designer/src/components/signalsloteditor/signalsloteditorwindow.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef SIGNALSLOTEDITORWINDOW_H
#define SIGNALSLOTEDITORWINDOW_H
diff --git a/src/designer/src/components/tabordereditor/tabordereditor.cpp b/src/designer/src/components/tabordereditor/tabordereditor.cpp
index fbebc89dc..e2869decc 100644
--- a/src/designer/src/components/tabordereditor/tabordereditor.cpp
+++ b/src/designer/src/components/tabordereditor/tabordereditor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "tabordereditor.h"
@@ -50,6 +25,8 @@ Q_DECLARE_METATYPE(QWidgetList)
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace {
enum { VBOX_MARGIN = 1, HBOX_MARGIN = 4, BG_ALPHA = 32 };
}
@@ -155,7 +132,7 @@ void TabOrderEditor::paintEvent(QPaintEvent *e)
if (!m_beginning && cur < 0)
cur = m_tab_order_list.size() - 1;
- for (int i = 0; i < m_tab_order_list.size(); ++i) {
+ for (qsizetype i = 0; i < m_tab_order_list.size(); ++i) {
QWidget *widget = m_tab_order_list.at(i);
if (!isWidgetVisible(widget))
continue;
@@ -190,7 +167,7 @@ bool TabOrderEditor::skipWidget(QWidget *w) const
QExtensionManager *ext = formWindow()->core()->extensionManager();
if (const QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(ext, w)) {
- const int index = sheet->indexOf(QStringLiteral("focusPolicy"));
+ const int index = sheet->indexOf(u"focusPolicy"_s);
if (index != -1) {
bool ok = false;
Qt::FocusPolicy q = (Qt::FocusPolicy) Utils::valueOf(sheet->property(index), &ok);
@@ -212,7 +189,7 @@ void TabOrderEditor::initTabOrder()
}
// Remove any widgets that have been removed form the form
- for (int i = 0; i < m_tab_order_list.size(); ) {
+ for (qsizetype i = 0; i < m_tab_order_list.size(); ) {
QWidget *w = m_tab_order_list.at(i);
if (!formWindow()->mainContainer()->isAncestorOf(w) || skipWidget(w))
m_tab_order_list.removeAt(i);
@@ -247,7 +224,7 @@ void TabOrderEditor::initTabOrder()
}
m_indicator_region = QRegion();
- for (int i = 0; i < m_tab_order_list.size(); ++i) {
+ for (qsizetype i = 0; i < m_tab_order_list.size(); ++i) {
if (m_tab_order_list.at(i)->isVisible())
m_indicator_region |= indicatorRect(i);
}
@@ -272,7 +249,7 @@ void TabOrderEditor::mouseMoveEvent(QMouseEvent *e)
int TabOrderEditor::widgetIndexAt(const QPoint &pos) const
{
int target_index = -1;
- for (int i = 0; i < m_tab_order_list.size(); ++i) {
+ for (qsizetype i = 0; i < m_tab_order_list.size(); ++i) {
if (!m_tab_order_list.at(i)->isVisible())
continue;
if (indicatorRect(i).contains(pos)) {
@@ -294,14 +271,16 @@ void TabOrderEditor::mousePressEvent(QMouseEvent *e)
if (core->widgetFactory()->isPassiveInteractor(child)) {
QMouseEvent event(QEvent::MouseButtonPress,
- child->mapFromGlobal(e->globalPosition().toPoint()),
- e->button(), e->buttons(), e->modifiers());
+ child->mapFromGlobal(e->globalPosition().toPoint()),
+ e->globalPosition().toPoint(), e->button(), e->buttons(),
+ e->modifiers());
qApp->sendEvent(child, &event);
QMouseEvent event2(QEvent::MouseButtonRelease,
- child->mapFromGlobal(e->globalPosition().toPoint()),
- e->button(), e->buttons(), e->modifiers());
+ child->mapFromGlobal(e->globalPosition().toPoint()),
+ e->globalPosition().toPoint(), e->button(), e->buttons(),
+ e->modifiers());
qApp->sendEvent(child, &event2);
diff --git a/src/designer/src/components/tabordereditor/tabordereditor.h b/src/designer/src/components/tabordereditor/tabordereditor.h
index 3cfcba17b..37151249f 100644
--- a/src/designer/src/components/tabordereditor/tabordereditor.h
+++ b/src/designer/src/components/tabordereditor/tabordereditor.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef TABORDEREDITOR_H
#define TABORDEREDITOR_H
diff --git a/src/designer/src/components/tabordereditor/tabordereditor_global.h b/src/designer/src/components/tabordereditor/tabordereditor_global.h
index 1ca5f2612..68d5c86ef 100644
--- a/src/designer/src/components/tabordereditor/tabordereditor_global.h
+++ b/src/designer/src/components/tabordereditor/tabordereditor_global.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef TABORDEREDITOR_GLOBAL_H
#define TABORDEREDITOR_GLOBAL_H
diff --git a/src/designer/src/components/tabordereditor/tabordereditor_plugin.cpp b/src/designer/src/components/tabordereditor/tabordereditor_plugin.cpp
index a95d1fe16..2fe3a4212 100644
--- a/src/designer/src/components/tabordereditor/tabordereditor_plugin.cpp
+++ b/src/designer/src/components/tabordereditor/tabordereditor_plugin.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtGui/qaction.h>
@@ -37,7 +12,9 @@
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+using namespace Qt::StringLiterals;
+
+namespace qdesigner_internal {
TabOrderEditorPlugin::TabOrderEditorPlugin() = default;
@@ -53,9 +30,9 @@ void TabOrderEditorPlugin::initialize(QDesignerFormEditorInterface *core)
Q_ASSERT(!isInitialized());
m_action = new QAction(tr("Edit Tab Order"), this);
- m_action->setObjectName(QStringLiteral("_qt_edit_tab_order_action"));
- QIcon icon = QIcon::fromTheme(QStringLiteral("designer-edit-tabs"),
- QIcon(core->resourceLocation() + QStringLiteral("/tabordertool.png")));
+ m_action->setObjectName(u"_qt_edit_tab_order_action"_s);
+ QIcon icon = QIcon::fromTheme(u"designer-edit-tabs"_s,
+ QIcon(core->resourceLocation() + "/tabordertool.png"_L1));
m_action->setIcon(icon);
m_action->setEnabled(false);
@@ -112,6 +89,8 @@ QAction *TabOrderEditorPlugin::action() const
return m_action;
}
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
#include "moc_tabordereditor_plugin.cpp"
diff --git a/src/designer/src/components/tabordereditor/tabordereditor_plugin.h b/src/designer/src/components/tabordereditor/tabordereditor_plugin.h
index cf7b28d56..99168099c 100644
--- a/src/designer/src/components/tabordereditor/tabordereditor_plugin.h
+++ b/src/designer/src/components/tabordereditor/tabordereditor_plugin.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef TABORDEREDITOR_PLUGIN_H
#define TABORDEREDITOR_PLUGIN_H
diff --git a/src/designer/src/components/tabordereditor/tabordereditor_tool.cpp b/src/designer/src/components/tabordereditor/tabordereditor_tool.cpp
index 64da96937..46270b007 100644
--- a/src/designer/src/components/tabordereditor/tabordereditor_tool.cpp
+++ b/src/designer/src/components/tabordereditor/tabordereditor_tool.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "tabordereditor_tool.h"
#include "tabordereditor.h"
@@ -37,7 +12,7 @@
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+namespace qdesigner_internal {
TabOrderEditorTool::TabOrderEditorTool(QDesignerFormWindowInterface *formWindow, QObject *parent)
: QDesignerFormWindowToolInterface(parent),
@@ -95,4 +70,6 @@ QAction *TabOrderEditorTool::action() const
return m_action;
}
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
diff --git a/src/designer/src/components/tabordereditor/tabordereditor_tool.h b/src/designer/src/components/tabordereditor/tabordereditor_tool.h
index 73792de43..bbd4f5c64 100644
--- a/src/designer/src/components/tabordereditor/tabordereditor_tool.h
+++ b/src/designer/src/components/tabordereditor/tabordereditor_tool.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef TABORDEREDITOR_TOOL_H
#define TABORDEREDITOR_TOOL_H
diff --git a/src/designer/src/components/taskmenu/button_taskmenu.cpp b/src/designer/src/components/taskmenu/button_taskmenu.cpp
index 5facfdad3..7edf6c04a 100644
--- a/src/designer/src/components/taskmenu/button_taskmenu.cpp
+++ b/src/designer/src/components/taskmenu/button_taskmenu.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "button_taskmenu.h"
#include "inplace_editor.h"
@@ -54,6 +29,8 @@ Q_DECLARE_METATYPE(QButtonGroup*)
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
enum { debugButtonMenu = 0 };
@@ -111,18 +88,16 @@ void ButtonGroupCommand::addButtonsToGroup()
{
if (debugButtonMenu)
qDebug() << "Adding " << m_buttonList << " to " << m_buttonGroup;
- const ButtonList::const_iterator cend = m_buttonList.constEnd();
- for (ButtonList::const_iterator it = m_buttonList.constBegin(); it != cend; ++it)
- m_buttonGroup->addButton(*it);
+ for (auto *b : std::as_const(m_buttonList))
+ m_buttonGroup->addButton(b);
}
void ButtonGroupCommand::removeButtonsFromGroup()
{
if (debugButtonMenu)
qDebug() << "Removing " << m_buttonList << " from " << m_buttonGroup;
- const ButtonList::const_iterator cend = m_buttonList.constEnd();
- for (ButtonList::const_iterator it = m_buttonList.constBegin(); it != cend; ++it)
- m_buttonGroup->removeButton(*it);
+ for (auto *b : std::as_const(m_buttonList))
+ m_buttonGroup->removeButton(b);
}
void ButtonGroupCommand::createButtonGroup()
@@ -148,9 +123,8 @@ void ButtonGroupCommand::breakButtonGroup()
// Button group was selected, that is, break was invoked via its context menu. Remove it from property editor, select the buttons
if (core->propertyEditor()->object() == m_buttonGroup) {
fw->clearSelection(false);
- const ButtonList::const_iterator cend = m_buttonList.constEnd();
- for (ButtonList::const_iterator it = m_buttonList.constBegin(); it != cend; ++it)
- fw->selectWidget(*it, true);
+ for (auto *b : std::as_const(m_buttonList))
+ fw->selectWidget(b, true);
}
// Now remove and refresh object inspector
removeButtonsFromGroup();
@@ -165,13 +139,12 @@ QString ButtonGroupCommand::nameList(const ButtonList& bl)
{
QString rc;
const QChar quote = QLatin1Char('\'');
- const QString separator = QStringLiteral(", ");
- const int size = bl.size();
- for (int i = 0; i < size; i++) {
+ const auto separator = ", "_L1;
+ for (qsizetype i = 0, size = bl.size(); i < size; ++i) {
if (i)
rc += separator;
rc += quote;
- rc += bl[i]->objectName();
+ rc += bl.at(i)->objectName();
rc += quote;
}
return rc;
@@ -183,13 +156,13 @@ ButtonGroupList ButtonGroupCommand::managedButtonGroups(const QDesignerFormWindo
const QDesignerMetaDataBaseInterface *mdb = formWindow->core()->metaDataBase();
ButtonGroupList bl;
// Check 1st order children for managed button groups
- const QObjectList children = formWindow->mainContainer()->children();
- const QObjectList::const_iterator cend = children.constEnd();
- for (QObjectList::const_iterator it = children.constBegin(); it != cend; ++it) {
- if (!(*it)->isWidgetType())
- if (QButtonGroup *bg = qobject_cast<QButtonGroup *>(*it))
+ for (auto *o : formWindow->mainContainer()->children()) {
+ if (!o->isWidgetType()) {
+ if (QButtonGroup *bg = qobject_cast<QButtonGroup *>(o)) {
if (mdb->item(bg))
bl.push_back(bg);
+ }
+ }
}
return bl;
}
@@ -217,7 +190,7 @@ bool CreateButtonGroupCommand::init(const ButtonList &bl)
return false;
QDesignerFormWindowInterface *fw = formWindow();
QButtonGroup *buttonGroup = new QButtonGroup(fw->mainContainer());
- buttonGroup->setObjectName(QStringLiteral("buttonGroup"));
+ buttonGroup->setObjectName(u"buttonGroup"_s);
fw->ensureUniqueObjectName(buttonGroup);
initialize(bl, buttonGroup);
return true;
@@ -328,10 +301,10 @@ void ButtonGroupMenu::selectGroup()
// Select and make current button "current" again by selecting it last (if there is any)
const ButtonList buttons = m_buttonGroup->buttons();
m_formWindow->clearSelection(false);
- const ButtonList::const_iterator cend = buttons.constEnd();
- for (ButtonList::const_iterator it = buttons.constBegin(); it != cend; ++it)
- if (*it != m_currentButton)
- m_formWindow->selectWidget(*it, true);
+ for (auto *b : buttons) {
+ if (b != m_currentButton)
+ m_formWindow->selectWidget(b, true);
+ }
if (m_currentButton)
m_formWindow->selectWidget(m_currentButton, true);
}
@@ -382,7 +355,7 @@ protected:
};
ButtonTextTaskMenuInlineEditor::ButtonTextTaskMenuInlineEditor(QAbstractButton *button, QObject *parent) :
- TaskMenuInlineEditor(button, ValidationMultiLine, QStringLiteral("text"), parent)
+ TaskMenuInlineEditor(button, ValidationMultiLine, u"text"_s, parent)
{
}
@@ -405,7 +378,7 @@ protected:
};
LinkDescriptionTaskMenuInlineEditor::LinkDescriptionTaskMenuInlineEditor(QAbstractButton *button, QObject *parent) :
- TaskMenuInlineEditor(button, ValidationMultiLine, QStringLiteral("description"), parent)
+ TaskMenuInlineEditor(button, ValidationMultiLine, u"description"_s, parent)
{
}
@@ -480,7 +453,7 @@ bool ButtonTaskMenu::refreshAssignMenu(const QDesignerFormWindowInterface *fw, i
// Assign to other
const ButtonGroupList bl = ButtonGroupCommand::managedButtonGroups(fw);
// Groups: Any groups to add to except the current?
- const int groupCount = bl.size();
+ const auto groupCount = bl.size();
const bool hasAddGroups = groupCount > 1 || (groupCount == 1 && !bl.contains(currentGroup));
if (hasAddGroups) {
if (!m_assignGroupSubMenu->isEmpty())
@@ -488,11 +461,8 @@ bool ButtonTaskMenu::refreshAssignMenu(const QDesignerFormWindowInterface *fw, i
// Create a new action group
m_assignActionGroup = new QActionGroup(this);
connect(m_assignActionGroup, &QActionGroup::triggered, this, &ButtonTaskMenu::addToGroup);
-
- const ButtonGroupList::const_iterator cend = bl.constEnd();
- for (ButtonGroupList::const_iterator it = bl.constBegin(); it != cend; ++it) {
- QButtonGroup *bg = *it;
- if (*it != currentGroup) {
+ for (auto *bg : bl) {
+ if (bg != currentGroup) {
QAction *a = new QAction(bg->objectName(), m_assignGroupSubMenu);
a->setData(QVariant::fromValue(bg));
m_assignActionGroup->addAction(a);
diff --git a/src/designer/src/components/taskmenu/button_taskmenu.h b/src/designer/src/components/taskmenu/button_taskmenu.h
index ab58c0630..9623bea14 100644
--- a/src/designer/src/components/taskmenu/button_taskmenu.h
+++ b/src/designer/src/components/taskmenu/button_taskmenu.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef BUTTON_TASKMENU_H
#define BUTTON_TASKMENU_H
diff --git a/src/designer/src/components/taskmenu/combobox_taskmenu.cpp b/src/designer/src/components/taskmenu/combobox_taskmenu.cpp
index 6613b03d2..75c1959b5 100644
--- a/src/designer/src/components/taskmenu/combobox_taskmenu.cpp
+++ b/src/designer/src/components/taskmenu/combobox_taskmenu.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "combobox_taskmenu.h"
#include "listwidgeteditor.h"
@@ -46,7 +21,7 @@
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+namespace qdesigner_internal {
ComboBoxTaskMenu::ComboBoxTaskMenu(QComboBox *button, QObject *parent)
: QDesignerTaskMenu(button, parent),
@@ -116,4 +91,6 @@ void ComboBoxTaskMenu::updateSelection()
m_editor->deleteLater();
}
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
diff --git a/src/designer/src/components/taskmenu/combobox_taskmenu.h b/src/designer/src/components/taskmenu/combobox_taskmenu.h
index 8ff36c1a8..47dad220d 100644
--- a/src/designer/src/components/taskmenu/combobox_taskmenu.h
+++ b/src/designer/src/components/taskmenu/combobox_taskmenu.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef COMBOBOX_TASKMENU_H
#define COMBOBOX_TASKMENU_H
diff --git a/src/designer/src/components/taskmenu/containerwidget_taskmenu.cpp b/src/designer/src/components/taskmenu/containerwidget_taskmenu.cpp
index 1bbca9d10..a9cec6eb2 100644
--- a/src/designer/src/components/taskmenu/containerwidget_taskmenu.cpp
+++ b/src/designer/src/components/taskmenu/containerwidget_taskmenu.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "containerwidget_taskmenu.h"
@@ -53,6 +28,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
ContainerWidgetTaskMenu::ContainerWidgetTaskMenu(QWidget *widget, ContainerType type, QObject *parent) :
@@ -292,7 +269,7 @@ ContainerWidgetTaskMenuFactory::ContainerWidgetTaskMenuFactory(QDesignerFormEdit
QObject *ContainerWidgetTaskMenuFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const
{
- if (iid != QStringLiteral("QDesignerInternalTaskMenuExtension") || !object->isWidgetType())
+ if (iid != "QDesignerInternalTaskMenuExtension"_L1 || !object->isWidgetType())
return nullptr;
QWidget *widget = qobject_cast<QWidget*>(object);
diff --git a/src/designer/src/components/taskmenu/containerwidget_taskmenu.h b/src/designer/src/components/taskmenu/containerwidget_taskmenu.h
index b0f4127ee..e27cb29ca 100644
--- a/src/designer/src/components/taskmenu/containerwidget_taskmenu.h
+++ b/src/designer/src/components/taskmenu/containerwidget_taskmenu.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef CONTAINERWIDGER_TASKMENU_H
#define CONTAINERWIDGER_TASKMENU_H
diff --git a/src/designer/src/components/taskmenu/groupbox_taskmenu.cpp b/src/designer/src/components/taskmenu/groupbox_taskmenu.cpp
index bc6cb5524..f8818bdf0 100644
--- a/src/designer/src/components/taskmenu/groupbox_taskmenu.cpp
+++ b/src/designer/src/components/taskmenu/groupbox_taskmenu.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "groupbox_taskmenu.h"
#include "inplace_editor.h"
@@ -38,6 +13,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
// -------- GroupBoxTaskMenuInlineEditor
@@ -51,7 +28,7 @@ protected:
};
GroupBoxTaskMenuInlineEditor::GroupBoxTaskMenuInlineEditor(QGroupBox *w, QObject *parent) :
- TaskMenuInlineEditor(w, ValidationSingleLine, QStringLiteral("title"), parent)
+ TaskMenuInlineEditor(w, ValidationSingleLine, u"title"_s, parent)
{
}
diff --git a/src/designer/src/components/taskmenu/groupbox_taskmenu.h b/src/designer/src/components/taskmenu/groupbox_taskmenu.h
index e09a883a0..6217273c7 100644
--- a/src/designer/src/components/taskmenu/groupbox_taskmenu.h
+++ b/src/designer/src/components/taskmenu/groupbox_taskmenu.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef GROUPBOX_TASKMENU_H
#define GROUPBOX_TASKMENU_H
@@ -56,7 +31,7 @@ private:
QList<QAction*> m_taskActions;
};
-typedef ExtensionFactory<QDesignerTaskMenuExtension, QGroupBox, GroupBoxTaskMenu> GroupBoxTaskMenuFactory;
+using GroupBoxTaskMenuFactory = ExtensionFactory<QDesignerTaskMenuExtension, QGroupBox, GroupBoxTaskMenu>;
} // namespace qdesigner_internal
QT_END_NAMESPACE
diff --git a/src/designer/src/components/taskmenu/inplace_editor.cpp b/src/designer/src/components/taskmenu/inplace_editor.cpp
index e86a78792..5afbea3a4 100644
--- a/src/designer/src/components/taskmenu/inplace_editor.cpp
+++ b/src/designer/src/components/taskmenu/inplace_editor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "abstractformwindow.h"
#include "inplace_editor.h"
@@ -40,6 +15,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
// ----------------- InPlaceEditor
@@ -53,7 +30,7 @@ InPlaceEditor::InPlaceEditor(QWidget *widget,
m_InPlaceWidgetHelper(this, widget, fw)
{
setAlignment(m_InPlaceWidgetHelper.alignment());
- setObjectName(QStringLiteral("__qt__passive_m_editor"));
+ setObjectName(u"__qt__passive_m_editor"_s);
setText(text);
selectAll();
diff --git a/src/designer/src/components/taskmenu/inplace_editor.h b/src/designer/src/components/taskmenu/inplace_editor.h
index 8f87bf491..c8b28f0ba 100644
--- a/src/designer/src/components/taskmenu/inplace_editor.h
+++ b/src/designer/src/components/taskmenu/inplace_editor.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef INPLACE_EDITOR_H
#define INPLACE_EDITOR_H
@@ -62,9 +37,8 @@ private:
// To use it for a particular widget/property, overwrite the method
// returning the edit area.
-class TaskMenuInlineEditor : public QObject {
- TaskMenuInlineEditor(const TaskMenuInlineEditor&);
- TaskMenuInlineEditor &operator=(const TaskMenuInlineEditor&);
+class TaskMenuInlineEditor : public QObject
+{
Q_OBJECT
public slots:
diff --git a/src/designer/src/components/taskmenu/inplace_widget_helper.cpp b/src/designer/src/components/taskmenu/inplace_widget_helper.cpp
index 5b38e832f..0183076bd 100644
--- a/src/designer/src/components/taskmenu/inplace_widget_helper.cpp
+++ b/src/designer/src/components/taskmenu/inplace_widget_helper.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "abstractformwindow.h"
#include "inplace_widget_helper.h"
diff --git a/src/designer/src/components/taskmenu/inplace_widget_helper.h b/src/designer/src/components/taskmenu/inplace_widget_helper.h
index f74d39830..587f3a415 100644
--- a/src/designer/src/components/taskmenu/inplace_widget_helper.h
+++ b/src/designer/src/components/taskmenu/inplace_widget_helper.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef INPLACE_WIDGETHELPER_H
#define INPLACE_WIDGETHELPER_H
diff --git a/src/designer/src/components/taskmenu/itemlisteditor.cpp b/src/designer/src/components/taskmenu/itemlisteditor.cpp
index cb0d6bb40..893716565 100644
--- a/src/designer/src/components/taskmenu/itemlisteditor.cpp
+++ b/src/designer/src/components/taskmenu/itemlisteditor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "itemlisteditor.h"
#include <abstractformbuilder.h>
@@ -41,6 +16,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
class ItemPropertyBrowser : public QtTreePropertyBrowser
@@ -53,7 +30,7 @@ public:
const QString widthSampleString = QCoreApplication::translate("ItemPropertyBrowser", "XX Icon Selected off");
m_width = fontMetrics().horizontalAdvance(widthSampleString);
setSplitterPosition(m_width);
- m_width += fontMetrics().horizontalAdvance(QStringLiteral("/this/is/some/random/path"));
+ m_width += fontMetrics().horizontalAdvance(u"/this/is/some/random/path"_s);
}
QSize sizeHint() const override
@@ -70,7 +47,6 @@ AbstractItemEditor::AbstractItemEditor(QDesignerFormWindowInterface *form, QWidg
: QWidget(parent),
m_iconCache(qobject_cast<FormWindowBase *>(form)->iconCache())
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_propertyManager = new DesignerPropertyManager(form->core(), this);
m_editorFactory = new DesignerEditorFactory(form->core(), this);
m_editorFactory->setSpacing(0);
@@ -122,23 +98,23 @@ void AbstractItemEditor::setupProperties(const PropertyDefinition *propList,
for (int i = 0; propList[i].name; i++) {
int type = propList[i].typeFunc ? propList[i].typeFunc() : propList[i].type;
int role = propList[i].role;
- QtVariantProperty *prop = m_propertyManager->addProperty(type, QLatin1String(propList[i].name));
+ QtVariantProperty *prop = m_propertyManager->addProperty(type, QLatin1StringView(propList[i].name));
if (role == Qt::TextAlignmentRole) {
prop->setAttribute(DesignerPropertyManager::alignDefaultAttribute(),
QVariant(uint(alignDefault)));
}
Q_ASSERT(prop);
if (role == Qt::ToolTipPropertyRole || role == Qt::WhatsThisPropertyRole)
- prop->setAttribute(QStringLiteral("validationMode"), ValidationRichText);
+ prop->setAttribute(u"validationMode"_s, ValidationRichText);
else if (role == Qt::DisplayPropertyRole)
- prop->setAttribute(QStringLiteral("validationMode"), ValidationMultiLine);
+ prop->setAttribute(u"validationMode"_s, ValidationMultiLine);
else if (role == Qt::StatusTipPropertyRole)
- prop->setAttribute(QStringLiteral("validationMode"), ValidationSingleLine);
+ prop->setAttribute(u"validationMode"_s, ValidationSingleLine);
else if (role == ItemFlagsShadowRole)
- prop->setAttribute(QStringLiteral("flagNames"), c2qStringList(itemFlagNames));
+ prop->setAttribute(u"flagNames"_s, c2qStringList(itemFlagNames));
else if (role == Qt::CheckStateRole)
- prop->setAttribute(QStringLiteral("enumNames"), c2qStringList(checkStateNames));
- prop->setAttribute(QStringLiteral("resettable"), true);
+ prop->setAttribute(u"enumNames"_s, c2qStringList(checkStateNames));
+ prop->setAttribute(u"resettable"_s, true);
m_properties.append(prop);
m_rootProperties.append(prop);
m_propertyToRole.insert(prop, role);
@@ -250,7 +226,7 @@ void AbstractItemEditor::cacheReloaded()
void AbstractItemEditor::updateBrowser()
{
BoolBlocker block(m_updatingBrowser);
- for (QtVariantProperty *prop : qAsConst(m_properties)) {
+ for (QtVariantProperty *prop : std::as_const(m_properties)) {
int role = m_propertyToRole.value(prop);
QVariant val = getItemData(role);
@@ -269,7 +245,7 @@ void AbstractItemEditor::updateBrowser()
}
if (m_propertyBrowser->topLevelItems().isEmpty()) {
- for (QtVariantProperty *prop : qAsConst(m_rootProperties))
+ for (QtVariantProperty *prop : std::as_const(m_rootProperties))
m_propertyBrowser->addProperty(prop);
}
}
@@ -295,12 +271,26 @@ ItemListEditor::ItemListEditor(QDesignerFormWindowInterface *form, QWidget *pare
injectPropertyBrowser(this, ui.widget);
connect(ui.showPropertiesButton, &QAbstractButton::clicked,
this, &ItemListEditor::togglePropertyBrowser);
+
+ connect(ui.newListItemButton, &QAbstractButton::clicked,
+ this, &ItemListEditor::newListItemButtonClicked);
+ connect(ui.deleteListItemButton, &QAbstractButton::clicked,
+ this, &ItemListEditor::deleteListItemButtonClicked);
+ connect(ui.moveListItemUpButton, &QAbstractButton::clicked,
+ this, &ItemListEditor::moveListItemUpButtonClicked);
+ connect(ui.moveListItemDownButton, &QAbstractButton::clicked,
+ this, &ItemListEditor::moveListItemDownButtonClicked);
+ connect(ui.listWidget, &QListWidget::currentRowChanged,
+ this, &ItemListEditor::listWidgetCurrentRowChanged);
+ connect(ui.listWidget, &QListWidget::itemChanged,
+ this, &ItemListEditor::listWidgetItemChanged);
+
setPropertyBrowserVisible(false);
- QIcon upIcon = createIconSet(QString::fromUtf8("up.png"));
- QIcon downIcon = createIconSet(QString::fromUtf8("down.png"));
- QIcon minusIcon = createIconSet(QString::fromUtf8("minus.png"));
- QIcon plusIcon = createIconSet(QString::fromUtf8("plus.png"));
+ QIcon upIcon = createIconSet("up.png"_L1);
+ QIcon downIcon = createIconSet("down.png"_L1);
+ QIcon minusIcon = createIconSet("minus.png"_L1);
+ QIcon plusIcon = createIconSet("plus.png"_L1);
ui.moveListItemUpButton->setIcon(upIcon);
ui.moveListItemDownButton->setIcon(downIcon);
ui.newListItemButton->setIcon(plusIcon);
@@ -328,7 +318,7 @@ void ItemListEditor::setCurrentIndex(int idx)
m_updating = false;
}
-void ItemListEditor::on_newListItemButton_clicked()
+void ItemListEditor::newListItemButtonClicked()
{
int row = ui.listWidget->currentRow() + 1;
@@ -347,7 +337,7 @@ void ItemListEditor::on_newListItemButton_clicked()
ui.listWidget->editItem(item);
}
-void ItemListEditor::on_deleteListItemButton_clicked()
+void ItemListEditor::deleteListItemButtonClicked()
{
int row = ui.listWidget->currentRow();
@@ -364,7 +354,7 @@ void ItemListEditor::on_deleteListItemButton_clicked()
ui.listWidget->setCurrentRow(row);
}
-void ItemListEditor::on_moveListItemUpButton_clicked()
+void ItemListEditor::moveListItemUpButtonClicked()
{
int row = ui.listWidget->currentRow();
if (row <= 0)
@@ -375,7 +365,7 @@ void ItemListEditor::on_moveListItemUpButton_clicked()
emit itemMovedUp(row);
}
-void ItemListEditor::on_moveListItemDownButton_clicked()
+void ItemListEditor::moveListItemDownButtonClicked()
{
int row = ui.listWidget->currentRow();
if (row == -1 || row == ui.listWidget->count() - 1)
@@ -386,14 +376,14 @@ void ItemListEditor::on_moveListItemDownButton_clicked()
emit itemMovedDown(row);
}
-void ItemListEditor::on_listWidget_currentRowChanged()
+void ItemListEditor::listWidgetCurrentRowChanged()
{
updateEditor();
if (!m_updating)
emit indexChanged(ui.listWidget->currentRow());
}
-void ItemListEditor::on_listWidget_itemChanged(QListWidgetItem *item)
+void ItemListEditor::listWidgetItemChanged(QListWidgetItem *item)
{
if (m_updatingBrowser)
return;
@@ -425,9 +415,11 @@ void ItemListEditor::setItemData(int role, const QVariant &v)
{
QListWidgetItem *item = ui.listWidget->currentItem();
bool reLayout = false;
- if ((role == Qt::EditRole && (v.toString().count(QLatin1Char('\n')) != item->data(role).toString().count(QLatin1Char('\n'))))
- || role == Qt::FontRole)
+ if ((role == Qt::EditRole
+ && (v.toString().count(u'\n') != item->data(role).toString().count(u'\n')))
+ || role == Qt::FontRole) {
reLayout = true;
+ }
QVariant newValue = v;
if (role == Qt::FontRole && newValue.metaType().id() == QMetaType::QFont) {
QFont oldFont = ui.listWidget->font();
diff --git a/src/designer/src/components/taskmenu/itemlisteditor.h b/src/designer/src/components/taskmenu/itemlisteditor.h
index c7dee8764..084a32947 100644
--- a/src/designer/src/components/taskmenu/itemlisteditor.h
+++ b/src/designer/src/components/taskmenu/itemlisteditor.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ITEMLISTEDITOR_H
#define ITEMLISTEDITOR_H
@@ -53,8 +28,10 @@ class DesignerEditorFactory;
class BoolBlocker
{
public:
- inline BoolBlocker(bool &b):block(b), reset(b){block = true;}
- inline ~BoolBlocker(){block = reset; }
+ Q_DISABLE_COPY_MOVE(BoolBlocker);
+
+ inline explicit BoolBlocker(bool &b) noexcept : block(b), reset(b) { block = true; }
+ inline ~BoolBlocker() noexcept { block = reset; }
private:
bool &block;
bool reset;
@@ -133,12 +110,12 @@ signals:
void itemMovedDown(int idx);
private slots:
- void on_newListItemButton_clicked();
- void on_deleteListItemButton_clicked();
- void on_moveListItemUpButton_clicked();
- void on_moveListItemDownButton_clicked();
- void on_listWidget_currentRowChanged();
- void on_listWidget_itemChanged(QListWidgetItem * item);
+ void newListItemButtonClicked();
+ void deleteListItemButtonClicked();
+ void moveListItemUpButtonClicked();
+ void moveListItemDownButtonClicked();
+ void listWidgetCurrentRowChanged();
+ void listWidgetItemChanged(QListWidgetItem * item);
void togglePropertyBrowser();
void cacheReloaded();
diff --git a/src/designer/src/components/taskmenu/itemlisteditor.ui b/src/designer/src/components/taskmenu/itemlisteditor.ui
index d016c4dd3..75394acf6 100644
--- a/src/designer/src/components/taskmenu/itemlisteditor.ui
+++ b/src/designer/src/components/taskmenu/itemlisteditor.ui
@@ -1,31 +1,8 @@
<ui version="4.0" >
- <comment>*********************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-*********************************************************************</comment>
+<comment>
+* Copyright (C) 2016 The Qt Company Ltd.
+* SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+</comment>
<class>qdesigner_internal::ItemListEditor</class>
<widget class="QWidget" name="qdesigner_internal::ItemListEditor" >
<property name="geometry" >
diff --git a/src/designer/src/components/taskmenu/label_taskmenu.cpp b/src/designer/src/components/taskmenu/label_taskmenu.cpp
index aaaa619a6..14a58d8ce 100644
--- a/src/designer/src/components/taskmenu/label_taskmenu.cpp
+++ b/src/designer/src/components/taskmenu/label_taskmenu.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "label_taskmenu.h"
#include "inplace_editor.h"
@@ -37,10 +12,12 @@
#include <QtGui/qaction.h>
#include <QtGui/qtextdocument.h>
-static const char *textPropertyC = "text";
-
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
+static constexpr auto textPropertyC = "text"_L1;
+
namespace qdesigner_internal {
// -------- LabelTaskMenuInlineEditor
@@ -54,7 +31,7 @@ protected:
};
LabelTaskMenuInlineEditor::LabelTaskMenuInlineEditor(QLabel *w, QObject *parent) :
- TaskMenuInlineEditor(w, ValidationRichText, QLatin1String(textPropertyC), parent)
+ TaskMenuInlineEditor(w, ValidationRichText, textPropertyC, parent)
{
}
@@ -98,7 +75,7 @@ QList<QAction*> LabelTaskMenu::taskActions() const
void LabelTaskMenu::editRichText()
{
- changeTextProperty(QLatin1String(textPropertyC), QString(), MultiSelectionMode, m_label->textFormat());
+ changeTextProperty(textPropertyC, QString(), MultiSelectionMode, m_label->textFormat());
}
}
diff --git a/src/designer/src/components/taskmenu/label_taskmenu.h b/src/designer/src/components/taskmenu/label_taskmenu.h
index a1744b583..b7aed921f 100644
--- a/src/designer/src/components/taskmenu/label_taskmenu.h
+++ b/src/designer/src/components/taskmenu/label_taskmenu.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef LABEL_TASKMENU_H
#define LABEL_TASKMENU_H
diff --git a/src/designer/src/components/taskmenu/layouttaskmenu.cpp b/src/designer/src/components/taskmenu/layouttaskmenu.cpp
index 39ea6df2e..256fd2912 100644
--- a/src/designer/src/components/taskmenu/layouttaskmenu.cpp
+++ b/src/designer/src/components/taskmenu/layouttaskmenu.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "layouttaskmenu.h"
#include <formlayoutmenu_p.h>
diff --git a/src/designer/src/components/taskmenu/layouttaskmenu.h b/src/designer/src/components/taskmenu/layouttaskmenu.h
index afd1afe0f..d0b37407e 100644
--- a/src/designer/src/components/taskmenu/layouttaskmenu.h
+++ b/src/designer/src/components/taskmenu/layouttaskmenu.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef LAYOUTTASKMENU_H
#define LAYOUTTASKMENU_H
diff --git a/src/designer/src/components/taskmenu/lineedit_taskmenu.cpp b/src/designer/src/components/taskmenu/lineedit_taskmenu.cpp
index f52a060e6..88dcf456a 100644
--- a/src/designer/src/components/taskmenu/lineedit_taskmenu.cpp
+++ b/src/designer/src/components/taskmenu/lineedit_taskmenu.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "lineedit_taskmenu.h"
#include "inplace_editor.h"
@@ -38,6 +13,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
// -------- LineEditTaskMenuInlineEditor
@@ -51,7 +28,7 @@ protected:
};
LineEditTaskMenuInlineEditor::LineEditTaskMenuInlineEditor(QLineEdit *w, QObject *parent) :
- TaskMenuInlineEditor(w, ValidationSingleLine, QStringLiteral("text"), parent)
+ TaskMenuInlineEditor(w, ValidationSingleLine, u"text"_s, parent)
{
}
diff --git a/src/designer/src/components/taskmenu/lineedit_taskmenu.h b/src/designer/src/components/taskmenu/lineedit_taskmenu.h
index e28ab7336..efc000275 100644
--- a/src/designer/src/components/taskmenu/lineedit_taskmenu.h
+++ b/src/designer/src/components/taskmenu/lineedit_taskmenu.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef LINEEDIT_TASKMENU_H
#define LINEEDIT_TASKMENU_H
diff --git a/src/designer/src/components/taskmenu/listwidget_taskmenu.cpp b/src/designer/src/components/taskmenu/listwidget_taskmenu.cpp
index d4b2cb71a..4bb08c4c2 100644
--- a/src/designer/src/components/taskmenu/listwidget_taskmenu.cpp
+++ b/src/designer/src/components/taskmenu/listwidget_taskmenu.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "listwidget_taskmenu.h"
#include "listwidgeteditor.h"
@@ -45,7 +20,7 @@
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+namespace qdesigner_internal {
ListWidgetTaskMenu::ListWidgetTaskMenu(QListWidget *button, QObject *parent)
: QDesignerTaskMenu(button, parent),
@@ -100,4 +75,6 @@ void ListWidgetTaskMenu::updateSelection()
m_editor->deleteLater();
}
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
diff --git a/src/designer/src/components/taskmenu/listwidget_taskmenu.h b/src/designer/src/components/taskmenu/listwidget_taskmenu.h
index 63708be61..a08d4b6c6 100644
--- a/src/designer/src/components/taskmenu/listwidget_taskmenu.h
+++ b/src/designer/src/components/taskmenu/listwidget_taskmenu.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef LISTWIDGET_TASKMENU_H
#define LISTWIDGET_TASKMENU_H
diff --git a/src/designer/src/components/taskmenu/listwidgeteditor.cpp b/src/designer/src/components/taskmenu/listwidgeteditor.cpp
index 668978c0d..84e9b0a5d 100644
--- a/src/designer/src/components/taskmenu/listwidgeteditor.cpp
+++ b/src/designer/src/components/taskmenu/listwidgeteditor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "listwidgeteditor.h"
#include <designerpropertymanager.h>
@@ -39,13 +14,12 @@
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+namespace qdesigner_internal {
ListWidgetEditor::ListWidgetEditor(QDesignerFormWindowInterface *form,
QWidget *parent)
: QDialog(parent)
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QDialogButtonBox *buttonBox = new QDialogButtonBox;
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
@@ -122,4 +96,6 @@ ListContents ListWidgetEditor::contents() const
return retVal;
}
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
diff --git a/src/designer/src/components/taskmenu/listwidgeteditor.h b/src/designer/src/components/taskmenu/listwidgeteditor.h
index 510dc0ef4..b16f63b1f 100644
--- a/src/designer/src/components/taskmenu/listwidgeteditor.h
+++ b/src/designer/src/components/taskmenu/listwidgeteditor.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef LISTWIDGETEDITOR_H
#define LISTWIDGETEDITOR_H
diff --git a/src/designer/src/components/taskmenu/menutaskmenu.cpp b/src/designer/src/components/taskmenu/menutaskmenu.cpp
index 87cd4bee5..6b95a1bf4 100644
--- a/src/designer/src/components/taskmenu/menutaskmenu.cpp
+++ b/src/designer/src/components/taskmenu/menutaskmenu.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "menutaskmenu.h"
diff --git a/src/designer/src/components/taskmenu/menutaskmenu.h b/src/designer/src/components/taskmenu/menutaskmenu.h
index 935836896..1d290d43b 100644
--- a/src/designer/src/components/taskmenu/menutaskmenu.h
+++ b/src/designer/src/components/taskmenu/menutaskmenu.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef MENUTASKMENU_H
#define MENUTASKMENU_H
diff --git a/src/designer/src/components/taskmenu/tablewidget_taskmenu.cpp b/src/designer/src/components/taskmenu/tablewidget_taskmenu.cpp
index e0d8d5c94..9ace1eacf 100644
--- a/src/designer/src/components/taskmenu/tablewidget_taskmenu.cpp
+++ b/src/designer/src/components/taskmenu/tablewidget_taskmenu.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "tablewidget_taskmenu.h"
#include "tablewidgeteditor.h"
@@ -44,7 +19,7 @@
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+namespace qdesigner_internal {
TableWidgetTaskMenu::TableWidgetTaskMenu(QTableWidget *button, QObject *parent)
: QDesignerTaskMenu(button, parent),
@@ -98,4 +73,6 @@ void TableWidgetTaskMenu::updateSelection()
m_editor->deleteLater();
}
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
diff --git a/src/designer/src/components/taskmenu/tablewidget_taskmenu.h b/src/designer/src/components/taskmenu/tablewidget_taskmenu.h
index b4d5462f2..6c3c79c3c 100644
--- a/src/designer/src/components/taskmenu/tablewidget_taskmenu.h
+++ b/src/designer/src/components/taskmenu/tablewidget_taskmenu.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef TABLEWIDGET_TASKMENU_H
#define TABLEWIDGET_TASKMENU_H
diff --git a/src/designer/src/components/taskmenu/tablewidgeteditor.cpp b/src/designer/src/components/taskmenu/tablewidgeteditor.cpp
index ab4cf8bba..725db1151 100644
--- a/src/designer/src/components/taskmenu/tablewidgeteditor.cpp
+++ b/src/designer/src/components/taskmenu/tablewidgeteditor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "tablewidgeteditor.h"
#include <abstractformbuilder.h>
@@ -44,17 +19,19 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
TableWidgetEditor::TableWidgetEditor(QDesignerFormWindowInterface *form, QDialog *dialog)
: AbstractItemEditor(form, nullptr), m_updatingBrowser(false)
{
m_columnEditor = new ItemListEditor(form, this);
- m_columnEditor->setObjectName(QStringLiteral("columnEditor"));
+ m_columnEditor->setObjectName(u"columnEditor"_s);
m_columnEditor->setAlignDefault(Qt::AlignCenter);
m_columnEditor->setNewItemText(tr("New Column"));
m_rowEditor = new ItemListEditor(form, this);
- m_rowEditor->setObjectName(QStringLiteral("rowEditor"));
+ m_rowEditor->setObjectName(u"rowEditor"_s);
m_rowEditor->setNewItemText(tr("New Row"));
ui.setupUi(dialog);
@@ -66,41 +43,40 @@ TableWidgetEditor::TableWidgetEditor(QDesignerFormWindowInterface *form, QDialog
ui.tabWidget->insertTab(0, m_columnEditor, tr("&Columns"));
ui.tabWidget->insertTab(1, m_rowEditor, tr("&Rows"));
ui.tabWidget->setCurrentIndex(0);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
ui.tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
connect(iconCache(), &DesignerIconCache::reloaded, this, &TableWidgetEditor::cacheReloaded);
connect(ui.tableWidget, &QTableWidget::currentCellChanged,
- this, &TableWidgetEditor::on_tableWidget_currentCellChanged);
+ this, &TableWidgetEditor::tableWidgetCurrentCellChanged);
connect(ui.tableWidget, &QTableWidget::itemChanged,
- this, &TableWidgetEditor::on_tableWidget_itemChanged);
+ this, &TableWidgetEditor::tableWidgetItemChanged);
connect(m_columnEditor, &ItemListEditor::indexChanged,
- this, &TableWidgetEditor::on_columnEditor_indexChanged);
+ this, &TableWidgetEditor::columnEditorIndexChanged);
connect(m_columnEditor, &ItemListEditor::itemChanged,
- this, &TableWidgetEditor::on_columnEditor_itemChanged);
+ this, &TableWidgetEditor::columnEditorItemChanged);
connect(m_columnEditor, &ItemListEditor::itemInserted,
- this, &TableWidgetEditor::on_columnEditor_itemInserted);
+ this, &TableWidgetEditor::columnEditorItemInserted);
connect(m_columnEditor, &ItemListEditor::itemDeleted,
- this, &TableWidgetEditor::on_columnEditor_itemDeleted);
+ this, &TableWidgetEditor::columnEditorItemDeleted);
connect(m_columnEditor, &ItemListEditor::itemMovedUp,
- this, &TableWidgetEditor::on_columnEditor_itemMovedUp);
+ this, &TableWidgetEditor::columnEditorItemMovedUp);
connect(m_columnEditor, &ItemListEditor::itemMovedDown,
- this, &TableWidgetEditor::on_columnEditor_itemMovedDown);
+ this, &TableWidgetEditor::columnEditorItemMovedDown);
connect(m_rowEditor, &ItemListEditor::indexChanged,
- this, &TableWidgetEditor::on_rowEditor_indexChanged);
+ this, &TableWidgetEditor::rowEditorIndexChanged);
connect(m_rowEditor, &ItemListEditor::itemChanged,
- this, &TableWidgetEditor::on_rowEditor_itemChanged);
+ this, &TableWidgetEditor::rowEditorItemChanged);
connect(m_rowEditor, &ItemListEditor::itemInserted,
- this, &TableWidgetEditor::on_rowEditor_itemInserted);
+ this, &TableWidgetEditor::rowEditorItemInserted);
connect(m_rowEditor, &ItemListEditor::itemDeleted,
- this, &TableWidgetEditor::on_rowEditor_itemDeleted);
+ this, &TableWidgetEditor::rowEditorItemDeleted);
connect(m_rowEditor, &ItemListEditor::itemMovedUp,
- this, &TableWidgetEditor::on_rowEditor_itemMovedUp);
+ this, &TableWidgetEditor::rowEditorItemMovedUp);
connect(m_rowEditor, &ItemListEditor::itemMovedDown,
- this, &TableWidgetEditor::on_rowEditor_itemMovedDown);
+ this, &TableWidgetEditor::rowEditorItemMovedDown);
}
static AbstractItemEditor::PropertyDefinition tableHeaderPropList[] = {
@@ -199,14 +175,14 @@ int TableWidgetEditor::defaultItemFlags() const
return flags;
}
-void TableWidgetEditor::on_tableWidget_currentCellChanged(int currentRow, int currentCol, int, int /* XXX remove me */)
+void TableWidgetEditor::tableWidgetCurrentCellChanged(int currentRow, int currentCol)
{
m_rowEditor->setCurrentIndex(currentRow);
m_columnEditor->setCurrentIndex(currentCol);
updateBrowser();
}
-void TableWidgetEditor::on_tableWidget_itemChanged(QTableWidgetItem *item)
+void TableWidgetEditor::tableWidgetItemChanged(QTableWidgetItem *item)
{
if (m_updatingBrowser)
return;
@@ -219,22 +195,22 @@ void TableWidgetEditor::on_tableWidget_itemChanged(QTableWidgetItem *item)
updateBrowser();
}
-void TableWidgetEditor::on_columnEditor_indexChanged(int col)
+void TableWidgetEditor::columnEditorIndexChanged(int col)
{
ui.tableWidget->setCurrentCell(ui.tableWidget->currentRow(), col);
}
-void TableWidgetEditor::on_columnEditor_itemChanged(int idx, int role, const QVariant &v)
+void TableWidgetEditor::columnEditorItemChanged(int idx, int role, const QVariant &v)
{
ui.tableWidget->horizontalHeaderItem(idx)->setData(role, v);
}
-void TableWidgetEditor::on_rowEditor_indexChanged(int col)
+void TableWidgetEditor::rowEditorIndexChanged(int col)
{
ui.tableWidget->setCurrentCell(col, ui.tableWidget->currentColumn());
}
-void TableWidgetEditor::on_rowEditor_itemChanged(int idx, int role, const QVariant &v)
+void TableWidgetEditor::rowEditorItemChanged(int idx, int role, const QVariant &v)
{
ui.tableWidget->verticalHeaderItem(idx)->setData(role, v);
}
@@ -342,7 +318,7 @@ void TableWidgetEditor::moveRowsUp(int fromRow, int toRow)
}
}
-void TableWidgetEditor::on_columnEditor_itemInserted(int idx)
+void TableWidgetEditor::columnEditorItemInserted(int idx)
{
const int columnCount = ui.tableWidget->columnCount();
ui.tableWidget->setColumnCount(columnCount + 1);
@@ -360,7 +336,7 @@ void TableWidgetEditor::on_columnEditor_itemInserted(int idx)
updateEditor();
}
-void TableWidgetEditor::on_columnEditor_itemDeleted(int idx)
+void TableWidgetEditor::columnEditorItemDeleted(int idx)
{
const int columnCount = ui.tableWidget->columnCount();
@@ -370,21 +346,21 @@ void TableWidgetEditor::on_columnEditor_itemDeleted(int idx)
updateEditor();
}
-void TableWidgetEditor::on_columnEditor_itemMovedUp(int idx)
+void TableWidgetEditor::columnEditorItemMovedUp(int idx)
{
moveColumnsRight(idx - 1, idx);
ui.tableWidget->setCurrentCell(ui.tableWidget->currentRow(), idx - 1);
}
-void TableWidgetEditor::on_columnEditor_itemMovedDown(int idx)
+void TableWidgetEditor::columnEditorItemMovedDown(int idx)
{
moveColumnsLeft(idx, idx + 1);
ui.tableWidget->setCurrentCell(ui.tableWidget->currentRow(), idx + 1);
}
-void TableWidgetEditor::on_rowEditor_itemInserted(int idx)
+void TableWidgetEditor::rowEditorItemInserted(int idx)
{
const int rowCount = ui.tableWidget->rowCount();
ui.tableWidget->setRowCount(rowCount + 1);
@@ -402,7 +378,7 @@ void TableWidgetEditor::on_rowEditor_itemInserted(int idx)
updateEditor();
}
-void TableWidgetEditor::on_rowEditor_itemDeleted(int idx)
+void TableWidgetEditor::rowEditorItemDeleted(int idx)
{
const int rowCount = ui.tableWidget->rowCount();
@@ -412,14 +388,14 @@ void TableWidgetEditor::on_rowEditor_itemDeleted(int idx)
updateEditor();
}
-void TableWidgetEditor::on_rowEditor_itemMovedUp(int idx)
+void TableWidgetEditor::rowEditorItemMovedUp(int idx)
{
moveRowsUp(idx - 1, idx);
ui.tableWidget->setCurrentCell(idx - 1, ui.tableWidget->currentColumn());
}
-void TableWidgetEditor::on_rowEditor_itemMovedDown(int idx)
+void TableWidgetEditor::rowEditorItemMovedDown(int idx)
{
moveRowsDown(idx, idx + 1);
@@ -434,7 +410,6 @@ void TableWidgetEditor::cacheReloaded()
TableWidgetEditorDialog::TableWidgetEditorDialog(QDesignerFormWindowInterface *form, QWidget *parent) :
QDialog(parent), m_editor(form, this)
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
}
TableWidgetContents TableWidgetEditorDialog::fillContentsFromTableWidget(QTableWidget *tableWidget)
diff --git a/src/designer/src/components/taskmenu/tablewidgeteditor.h b/src/designer/src/components/taskmenu/tablewidgeteditor.h
index cedea521d..defc05f3c 100644
--- a/src/designer/src/components/taskmenu/tablewidgeteditor.h
+++ b/src/designer/src/components/taskmenu/tablewidgeteditor.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef TABLEWIDGETEDITOR_H
#define TABLEWIDGETEDITOR_H
@@ -56,24 +31,24 @@ public:
private slots:
- void on_tableWidget_currentCellChanged(int currentRow, int currentCol, int, int);
- void on_tableWidget_itemChanged(QTableWidgetItem *item);
+ void tableWidgetCurrentCellChanged(int currentRow, int currentCol);
+ void tableWidgetItemChanged(QTableWidgetItem *item);
- void on_columnEditor_indexChanged(int idx);
- void on_columnEditor_itemChanged(int idx, int role, const QVariant &v);
+ void columnEditorIndexChanged(int idx);
+ void columnEditorItemChanged(int idx, int role, const QVariant &v);
- void on_columnEditor_itemInserted(int idx);
- void on_columnEditor_itemDeleted(int idx);
- void on_columnEditor_itemMovedUp(int idx);
- void on_columnEditor_itemMovedDown(int idx);
+ void columnEditorItemInserted(int idx);
+ void columnEditorItemDeleted(int idx);
+ void columnEditorItemMovedUp(int idx);
+ void columnEditorItemMovedDown(int idx);
- void on_rowEditor_indexChanged(int idx);
- void on_rowEditor_itemChanged(int idx, int role, const QVariant &v);
+ void rowEditorIndexChanged(int idx);
+ void rowEditorItemChanged(int idx, int role, const QVariant &v);
- void on_rowEditor_itemInserted(int idx);
- void on_rowEditor_itemDeleted(int idx);
- void on_rowEditor_itemMovedUp(int idx);
- void on_rowEditor_itemMovedDown(int idx);
+ void rowEditorItemInserted(int idx);
+ void rowEditorItemDeleted(int idx);
+ void rowEditorItemMovedUp(int idx);
+ void rowEditorItemMovedDown(int idx);
void togglePropertyBrowser();
diff --git a/src/designer/src/components/taskmenu/tablewidgeteditor.ui b/src/designer/src/components/taskmenu/tablewidgeteditor.ui
index 7fbf2e2d8..ad067bae9 100644
--- a/src/designer/src/components/taskmenu/tablewidgeteditor.ui
+++ b/src/designer/src/components/taskmenu/tablewidgeteditor.ui
@@ -1,31 +1,8 @@
<ui version="4.0" >
- <comment>*********************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-*********************************************************************</comment>
+<comment>
+* Copyright (C) 2016 The Qt Company Ltd.
+* SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+</comment>
<class>qdesigner_internal::TableWidgetEditor</class>
<widget class="QDialog" name="qdesigner_internal::TableWidgetEditor" >
<property name="geometry" >
diff --git a/src/designer/src/components/taskmenu/taskmenu_component.cpp b/src/designer/src/components/taskmenu/taskmenu_component.cpp
index 39ac4bc90..8da00ee87 100644
--- a/src/designer/src/components/taskmenu/taskmenu_component.cpp
+++ b/src/designer/src/components/taskmenu/taskmenu_component.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "taskmenu_component.h"
#include "button_taskmenu.h"
@@ -46,7 +21,9 @@
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+using namespace Qt::StringLiterals;
+
+namespace qdesigner_internal {
TaskMenuComponent::TaskMenuComponent(QDesignerFormEditorInterface *core, QObject *parent)
: QObject(parent),
@@ -55,7 +32,7 @@ TaskMenuComponent::TaskMenuComponent(QDesignerFormEditorInterface *core, QObject
Q_ASSERT(m_core != nullptr);
QExtensionManager *mgr = core->extensionManager();
- const QString taskMenuId = QStringLiteral("QDesignerInternalTaskMenuExtension");
+ const QString taskMenuId = u"QDesignerInternalTaskMenuExtension"_s;
ButtonTaskMenuFactory::registerExtension(mgr, taskMenuId);
CommandLinkButtonTaskMenuFactory::registerExtension(mgr, taskMenuId); // Order!
@@ -87,5 +64,8 @@ QDesignerFormEditorInterface *TaskMenuComponent::core() const
return m_core;
}
+
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
diff --git a/src/designer/src/components/taskmenu/taskmenu_component.h b/src/designer/src/components/taskmenu/taskmenu_component.h
index f57d19848..c97eb3e94 100644
--- a/src/designer/src/components/taskmenu/taskmenu_component.h
+++ b/src/designer/src/components/taskmenu/taskmenu_component.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef TASKMENU_COMPONENT_H
#define TASKMENU_COMPONENT_H
diff --git a/src/designer/src/components/taskmenu/taskmenu_global.h b/src/designer/src/components/taskmenu/taskmenu_global.h
index 7aef031db..a8e6a3dda 100644
--- a/src/designer/src/components/taskmenu/taskmenu_global.h
+++ b/src/designer/src/components/taskmenu/taskmenu_global.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef TASKMENU_GLOBAL_H
#define TASKMENU_GLOBAL_H
diff --git a/src/designer/src/components/taskmenu/textedit_taskmenu.cpp b/src/designer/src/components/taskmenu/textedit_taskmenu.cpp
index 989458392..ed85cf792 100644
--- a/src/designer/src/components/taskmenu/textedit_taskmenu.cpp
+++ b/src/designer/src/components/taskmenu/textedit_taskmenu.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "textedit_taskmenu.h"
@@ -37,12 +12,14 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
TextEditTaskMenu::TextEditTaskMenu(QTextEdit *textEdit, QObject *parent) :
QDesignerTaskMenu(textEdit, parent),
m_format(Qt::RichText),
- m_property(QStringLiteral("html")),
+ m_property(u"html"_s),
m_windowTitle(tr("Edit HTML")),
m_editTextAction(new QAction(tr("Change HTML..."), this))
{
@@ -52,7 +29,7 @@ TextEditTaskMenu::TextEditTaskMenu(QTextEdit *textEdit, QObject *parent) :
TextEditTaskMenu::TextEditTaskMenu(QPlainTextEdit *textEdit, QObject *parent) :
QDesignerTaskMenu(textEdit, parent),
m_format(Qt::PlainText),
- m_property(QStringLiteral("plainText")),
+ m_property(u"plainText"_s),
m_windowTitle(tr("Edit Text")),
m_editTextAction(new QAction(tr("Change Plain Text..."), this))
{
diff --git a/src/designer/src/components/taskmenu/textedit_taskmenu.h b/src/designer/src/components/taskmenu/textedit_taskmenu.h
index 2e50b8ca1..38814f468 100644
--- a/src/designer/src/components/taskmenu/textedit_taskmenu.h
+++ b/src/designer/src/components/taskmenu/textedit_taskmenu.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef TEXTEDIT_TASKMENU_H
#define TEXTEDIT_TASKMENU_H
diff --git a/src/designer/src/components/taskmenu/toolbar_taskmenu.cpp b/src/designer/src/components/taskmenu/toolbar_taskmenu.cpp
index 3fc1b8b4d..3b230704a 100644
--- a/src/designer/src/components/taskmenu/toolbar_taskmenu.cpp
+++ b/src/designer/src/components/taskmenu/toolbar_taskmenu.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "toolbar_taskmenu.h"
#include "qdesigner_toolbar_p.h"
diff --git a/src/designer/src/components/taskmenu/toolbar_taskmenu.h b/src/designer/src/components/taskmenu/toolbar_taskmenu.h
index 3e8d5909b..ea6e1cf51 100644
--- a/src/designer/src/components/taskmenu/toolbar_taskmenu.h
+++ b/src/designer/src/components/taskmenu/toolbar_taskmenu.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef TOOLBAR_TASKMENU_H
#define TOOLBAR_TASKMENU_H
diff --git a/src/designer/src/components/taskmenu/treewidget_taskmenu.cpp b/src/designer/src/components/taskmenu/treewidget_taskmenu.cpp
index 6b4969c52..6ce0b3969 100644
--- a/src/designer/src/components/taskmenu/treewidget_taskmenu.cpp
+++ b/src/designer/src/components/taskmenu/treewidget_taskmenu.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "treewidget_taskmenu.h"
#include "treewidgeteditor.h"
@@ -43,7 +18,7 @@
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+namespace qdesigner_internal {
TreeWidgetTaskMenu::TreeWidgetTaskMenu(QTreeWidget *button, QObject *parent)
: QDesignerTaskMenu(button, parent),
@@ -97,4 +72,6 @@ void TreeWidgetTaskMenu::updateSelection()
m_editor->deleteLater();
}
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
diff --git a/src/designer/src/components/taskmenu/treewidget_taskmenu.h b/src/designer/src/components/taskmenu/treewidget_taskmenu.h
index 9a9c882df..5ad6c34c8 100644
--- a/src/designer/src/components/taskmenu/treewidget_taskmenu.h
+++ b/src/designer/src/components/taskmenu/treewidget_taskmenu.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef TREEWIDGET_TASKMENU_H
#define TREEWIDGET_TASKMENU_H
@@ -64,7 +39,7 @@ private:
QAction *m_editItemsAction;
};
-typedef ExtensionFactory<QDesignerTaskMenuExtension, QTreeWidget, TreeWidgetTaskMenu> TreeWidgetTaskMenuFactory;
+using TreeWidgetTaskMenuFactory = ExtensionFactory<QDesignerTaskMenuExtension, QTreeWidget, TreeWidgetTaskMenu>;
} // namespace qdesigner_internal
QT_END_NAMESPACE
diff --git a/src/designer/src/components/taskmenu/treewidgeteditor.cpp b/src/designer/src/components/taskmenu/treewidgeteditor.cpp
index a7117beb5..bb89b0da1 100644
--- a/src/designer/src/components/taskmenu/treewidgeteditor.cpp
+++ b/src/designer/src/components/taskmenu/treewidgeteditor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "treewidgeteditor.h"
#include <formwindowbase_p.h>
@@ -45,13 +20,15 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
TreeWidgetEditor::TreeWidgetEditor(QDesignerFormWindowInterface *form, QDialog *dialog)
: AbstractItemEditor(form, nullptr), m_updatingBrowser(false)
{
m_columnEditor = new ItemListEditor(form, this);
- m_columnEditor->setObjectName(QStringLiteral("columnEditor"));
+ m_columnEditor->setObjectName(u"columnEditor"_s);
m_columnEditor->setNewItemText(tr("New Column"));
ui.setupUi(dialog);
@@ -62,42 +39,48 @@ TreeWidgetEditor::TreeWidgetEditor(QDesignerFormWindowInterface *form, QDialog *
ui.tabWidget->insertTab(0, m_columnEditor, tr("&Columns"));
ui.tabWidget->setCurrentIndex(0);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
- ui.newItemButton->setIcon(createIconSet(QString::fromUtf8("plus.png")));
- ui.newSubItemButton->setIcon(createIconSet(QString::fromUtf8("downplus.png")));
- ui.deleteItemButton->setIcon(createIconSet(QString::fromUtf8("minus.png")));
- ui.moveItemUpButton->setIcon(createIconSet(QString::fromUtf8("up.png")));
- ui.moveItemDownButton->setIcon(createIconSet(QString::fromUtf8("down.png")));
- ui.moveItemRightButton->setIcon(createIconSet(QString::fromUtf8("leveldown.png")));
- ui.moveItemLeftButton->setIcon(createIconSet(QString::fromUtf8("levelup.png")));
+ ui.newItemButton->setIcon(createIconSet("plus.png"_L1));
+ ui.newSubItemButton->setIcon(createIconSet("downplus.png"_L1));
+ ui.deleteItemButton->setIcon(createIconSet("minus.png"_L1));
+ ui.moveItemUpButton->setIcon(createIconSet("up.png"_L1));
+ ui.moveItemDownButton->setIcon(createIconSet("down.png"_L1));
+ ui.moveItemRightButton->setIcon(createIconSet("leveldown.png"_L1));
+ ui.moveItemLeftButton->setIcon(createIconSet("levelup.png"_L1));
ui.treeWidget->header()->setSectionsMovable(false);
- connect(ui.newItemButton, &QAbstractButton::clicked, this, &TreeWidgetEditor::on_newItemButton_clicked);
- connect(ui.newSubItemButton, &QAbstractButton::clicked, this, &TreeWidgetEditor::on_newSubItemButton_clicked);
- connect(ui.moveItemUpButton, &QAbstractButton::clicked, this, &TreeWidgetEditor::on_moveItemUpButton_clicked);
- connect(ui.moveItemDownButton, &QAbstractButton::clicked, this, &TreeWidgetEditor::on_moveItemDownButton_clicked);
- connect(ui.moveItemRightButton, &QAbstractButton::clicked, this, &TreeWidgetEditor::on_moveItemRightButton_clicked);
- connect(ui.moveItemLeftButton, &QAbstractButton::clicked, this, &TreeWidgetEditor::on_moveItemLeftButton_clicked);
- connect(ui.deleteItemButton, &QAbstractButton::clicked, this, &TreeWidgetEditor::on_deleteItemButton_clicked);
+ connect(ui.newItemButton, &QAbstractButton::clicked,
+ this, &TreeWidgetEditor::newItemButtonClicked);
+ connect(ui.newSubItemButton, &QAbstractButton::clicked,
+ this, &TreeWidgetEditor::newSubItemButtonClicked);
+ connect(ui.moveItemUpButton, &QAbstractButton::clicked,
+ this, &TreeWidgetEditor::moveItemUpButtonClicked);
+ connect(ui.moveItemDownButton, &QAbstractButton::clicked,
+ this, &TreeWidgetEditor::moveItemDownButtonClicked);
+ connect(ui.moveItemRightButton, &QAbstractButton::clicked,
+ this, &TreeWidgetEditor::moveItemRightButtonClicked);
+ connect(ui.moveItemLeftButton, &QAbstractButton::clicked,
+ this, &TreeWidgetEditor::moveItemLeftButtonClicked);
+ connect(ui.deleteItemButton, &QAbstractButton::clicked,
+ this, &TreeWidgetEditor::deleteItemButtonClicked);
connect(ui.treeWidget, &QTreeWidget::currentItemChanged,
- this, &TreeWidgetEditor::on_treeWidget_currentItemChanged);
+ this, &TreeWidgetEditor::treeWidgetCurrentItemChanged);
connect(ui.treeWidget, &QTreeWidget::itemChanged,
- this, &TreeWidgetEditor::on_treeWidget_itemChanged);
+ this, &TreeWidgetEditor::treeWidgetItemChanged);
connect(m_columnEditor, &ItemListEditor::indexChanged,
- this, &TreeWidgetEditor::on_columnEditor_indexChanged);
+ this, &TreeWidgetEditor::columnEditorIndexChanged);
connect(m_columnEditor, &ItemListEditor::itemChanged,
- this, &TreeWidgetEditor::on_columnEditor_itemChanged);
+ this, &TreeWidgetEditor::columnEditorItemChanged);
connect(m_columnEditor, &ItemListEditor::itemInserted,
- this, &TreeWidgetEditor::on_columnEditor_itemInserted);
+ this, &TreeWidgetEditor::columnEditorItemInserted);
connect(m_columnEditor, &ItemListEditor::itemDeleted,
- this, &TreeWidgetEditor::on_columnEditor_itemDeleted);
+ this, &TreeWidgetEditor::columnEditorItemDeleted);
connect(m_columnEditor, &ItemListEditor::itemMovedUp,
- this, &TreeWidgetEditor::on_columnEditor_itemMovedUp);
+ this, &TreeWidgetEditor::columnEditorItemMovedUp);
connect(m_columnEditor, &ItemListEditor::itemMovedDown,
- this, &TreeWidgetEditor::on_columnEditor_itemMovedDown);
+ this, &TreeWidgetEditor::columnEditorItemMovedDown);
connect(iconCache(), &DesignerIconCache::reloaded, this, &TreeWidgetEditor::cacheReloaded);
}
@@ -138,7 +121,7 @@ QtVariantProperty *TreeWidgetEditor::setupPropertyGroup(const QString &title, Pr
{
setupProperties(propDefs);
QtVariantProperty *groupProp = m_propertyManager->addProperty(QtVariantPropertyManager::groupTypeId(), title);
- for (QtVariantProperty *prop : qAsConst(m_rootProperties))
+ for (QtVariantProperty *prop : std::as_const(m_rootProperties))
groupProp->addSubProperty(prop);
m_rootProperties.clear();
return groupProp;
@@ -202,7 +185,7 @@ int TreeWidgetEditor::defaultItemFlags() const
return flags;
}
-void TreeWidgetEditor::on_newItemButton_clicked()
+void TreeWidgetEditor::newItemButtonClicked()
{
QTreeWidgetItem *curItem = ui.treeWidget->currentItem();
QTreeWidgetItem *newItem = nullptr;
@@ -225,7 +208,7 @@ void TreeWidgetEditor::on_newItemButton_clicked()
ui.treeWidget->editItem(newItem, ui.treeWidget->currentColumn());
}
-void TreeWidgetEditor::on_newSubItemButton_clicked()
+void TreeWidgetEditor::newSubItemButtonClicked()
{
QTreeWidgetItem *curItem = ui.treeWidget->currentItem();
if (!curItem)
@@ -244,7 +227,7 @@ void TreeWidgetEditor::on_newSubItemButton_clicked()
ui.treeWidget->editItem(newItem, ui.treeWidget->currentColumn());
}
-void TreeWidgetEditor::on_deleteItemButton_clicked()
+void TreeWidgetEditor::deleteItemButtonClicked()
{
QTreeWidgetItem *curItem = ui.treeWidget->currentItem();
if (!curItem)
@@ -280,7 +263,7 @@ void TreeWidgetEditor::on_deleteItemButton_clicked()
updateEditor();
}
-void TreeWidgetEditor::on_moveItemUpButton_clicked()
+void TreeWidgetEditor::moveItemUpButtonClicked()
{
QTreeWidgetItem *curItem = ui.treeWidget->currentItem();
if (!curItem)
@@ -310,7 +293,7 @@ void TreeWidgetEditor::on_moveItemUpButton_clicked()
updateEditor();
}
-void TreeWidgetEditor::on_moveItemDownButton_clicked()
+void TreeWidgetEditor::moveItemDownButtonClicked()
{
QTreeWidgetItem *curItem = ui.treeWidget->currentItem();
if (!curItem)
@@ -343,7 +326,7 @@ void TreeWidgetEditor::on_moveItemDownButton_clicked()
updateEditor();
}
-void TreeWidgetEditor::on_moveItemLeftButton_clicked()
+void TreeWidgetEditor::moveItemLeftButtonClicked()
{
QTreeWidgetItem *curItem = ui.treeWidget->currentItem();
if (!curItem)
@@ -368,7 +351,7 @@ void TreeWidgetEditor::on_moveItemLeftButton_clicked()
updateEditor();
}
-void TreeWidgetEditor::on_moveItemRightButton_clicked()
+void TreeWidgetEditor::moveItemRightButtonClicked()
{
QTreeWidgetItem *curItem = ui.treeWidget->currentItem();
if (!curItem)
@@ -413,13 +396,13 @@ void TreeWidgetEditor::setPropertyBrowserVisible(bool v)
m_propertyBrowser->setVisible(v);
}
-void TreeWidgetEditor::on_treeWidget_currentItemChanged()
+void TreeWidgetEditor::treeWidgetCurrentItemChanged()
{
m_columnEditor->setCurrentIndex(ui.treeWidget->currentColumn());
updateEditor();
}
-void TreeWidgetEditor::on_treeWidget_itemChanged(QTreeWidgetItem *item, int column)
+void TreeWidgetEditor::treeWidgetItemChanged(QTreeWidgetItem *item, int column)
{
if (m_updatingBrowser)
return;
@@ -432,13 +415,13 @@ void TreeWidgetEditor::on_treeWidget_itemChanged(QTreeWidgetItem *item, int colu
updateBrowser();
}
-void TreeWidgetEditor::on_columnEditor_indexChanged(int idx)
+void TreeWidgetEditor::columnEditorIndexChanged(int idx)
{
if (QTreeWidgetItem *item = ui.treeWidget->currentItem())
ui.treeWidget->setCurrentItem(item, idx);
}
-void TreeWidgetEditor::on_columnEditor_itemChanged(int idx, int role, const QVariant &v)
+void TreeWidgetEditor::columnEditorItemChanged(int idx, int role, const QVariant &v)
{
if (role == Qt::DisplayPropertyRole)
ui.treeWidget->headerItem()->setData(idx, Qt::EditRole, qvariant_cast<PropertySheetStringValue>(v).value());
@@ -561,7 +544,7 @@ void TreeWidgetEditor::moveColumnsRight(int fromColumn, int toColumn)
moveColumns(toColumn, fromColumn, 1);
}
-void TreeWidgetEditor::on_columnEditor_itemInserted(int idx)
+void TreeWidgetEditor::columnEditorItemInserted(int idx)
{
int columnCount = ui.treeWidget->columnCount();
ui.treeWidget->setColumnCount(columnCount + 1);
@@ -571,7 +554,7 @@ void TreeWidgetEditor::on_columnEditor_itemInserted(int idx)
updateEditor();
}
-void TreeWidgetEditor::on_columnEditor_itemDeleted(int idx)
+void TreeWidgetEditor::columnEditorItemDeleted(int idx)
{
closeEditors();
@@ -585,7 +568,7 @@ void TreeWidgetEditor::on_columnEditor_itemDeleted(int idx)
updateEditor();
}
-void TreeWidgetEditor::on_columnEditor_itemMovedUp(int idx)
+void TreeWidgetEditor::columnEditorItemMovedUp(int idx)
{
moveColumnsRight(idx - 1, idx);
@@ -593,7 +576,7 @@ void TreeWidgetEditor::on_columnEditor_itemMovedUp(int idx)
updateEditor();
}
-void TreeWidgetEditor::on_columnEditor_itemMovedDown(int idx)
+void TreeWidgetEditor::columnEditorItemMovedDown(int idx)
{
moveColumnsLeft(idx, idx + 1);
@@ -618,7 +601,6 @@ void TreeWidgetEditor::cacheReloaded()
TreeWidgetEditorDialog::TreeWidgetEditorDialog(QDesignerFormWindowInterface *form, QWidget *parent) :
QDialog(parent), m_editor(form, this)
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
}
TreeWidgetContents TreeWidgetEditorDialog::fillContentsFromTreeWidget(QTreeWidget *treeWidget)
diff --git a/src/designer/src/components/taskmenu/treewidgeteditor.h b/src/designer/src/components/taskmenu/treewidgeteditor.h
index 9b1a607e4..b2d306f0a 100644
--- a/src/designer/src/components/taskmenu/treewidgeteditor.h
+++ b/src/designer/src/components/taskmenu/treewidgeteditor.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef TREEWIDGETEDITOR_H
#define TREEWIDGETEDITOR_H
@@ -55,24 +30,24 @@ public:
TreeWidgetContents contents() const;
private slots:
- void on_newItemButton_clicked();
- void on_newSubItemButton_clicked();
- void on_deleteItemButton_clicked();
- void on_moveItemUpButton_clicked();
- void on_moveItemDownButton_clicked();
- void on_moveItemRightButton_clicked();
- void on_moveItemLeftButton_clicked();
-
- void on_treeWidget_currentItemChanged();
- void on_treeWidget_itemChanged(QTreeWidgetItem *item, int column);
-
- void on_columnEditor_indexChanged(int idx);
- void on_columnEditor_itemChanged(int idx, int role, const QVariant &v);
-
- void on_columnEditor_itemInserted(int idx);
- void on_columnEditor_itemDeleted(int idx);
- void on_columnEditor_itemMovedUp(int idx);
- void on_columnEditor_itemMovedDown(int idx);
+ void newItemButtonClicked();
+ void newSubItemButtonClicked();
+ void deleteItemButtonClicked();
+ void moveItemUpButtonClicked();
+ void moveItemDownButtonClicked();
+ void moveItemRightButtonClicked();
+ void moveItemLeftButtonClicked();
+
+ void treeWidgetCurrentItemChanged();
+ void treeWidgetItemChanged(QTreeWidgetItem *item, int column);
+
+ void columnEditorIndexChanged(int idx);
+ void columnEditorItemChanged(int idx, int role, const QVariant &v);
+
+ void columnEditorItemInserted(int idx);
+ void columnEditorItemDeleted(int idx);
+ void columnEditorItemMovedUp(int idx);
+ void columnEditorItemMovedDown(int idx);
void togglePropertyBrowser();
void cacheReloaded();
diff --git a/src/designer/src/components/taskmenu/treewidgeteditor.ui b/src/designer/src/components/taskmenu/treewidgeteditor.ui
index ea72a444b..688b2f45a 100644
--- a/src/designer/src/components/taskmenu/treewidgeteditor.ui
+++ b/src/designer/src/components/taskmenu/treewidgeteditor.ui
@@ -1,31 +1,8 @@
<ui version="4.0" >
- <comment>*********************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-*********************************************************************</comment>
+<comment>
+* Copyright (C) 2016 The Qt Company Ltd.
+* SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+</comment>
<class>qdesigner_internal::TreeWidgetEditor</class>
<widget class="QDialog" name="qdesigner_internal::TreeWidgetEditor" >
<property name="geometry" >
diff --git a/src/designer/src/components/widgetbox/widgetbox.cpp b/src/designer/src/components/widgetbox/widgetbox.cpp
index bf42f2048..7294799f9 100644
--- a/src/designer/src/components/widgetbox/widgetbox.cpp
+++ b/src/designer/src/components/widgetbox/widgetbox.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "widgetbox.h"
#include "widgetboxtreewidget.h"
@@ -110,7 +85,7 @@ WidgetBox::WidgetBox(QDesignerFormEditorInterface *core, QWidget *parent, Qt::Wi
l->addWidget(toolBar);
// View
- connect(m_view, &WidgetBoxTreeWidget::pressed,
+ connect(m_view, &WidgetBoxTreeWidget::widgetBoxPressed,
this, &WidgetBox::handleMousePress);
l->addWidget(m_view);
diff --git a/src/designer/src/components/widgetbox/widgetbox.h b/src/designer/src/components/widgetbox/widgetbox.h
index 27e1b461a..cf43b63b4 100644
--- a/src/designer/src/components/widgetbox/widgetbox.h
+++ b/src/designer/src/components/widgetbox/widgetbox.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef WIDGETBOX_H
#define WIDGETBOX_H
diff --git a/src/designer/src/components/widgetbox/widgetbox.qrc b/src/designer/src/components/widgetbox/widgetbox.qrc
deleted file mode 100644
index 2cac8a95e..000000000
--- a/src/designer/src/components/widgetbox/widgetbox.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/qt-project.org/widgetbox">
- <file>widgetbox.xml</file>
- </qresource>
-</RCC>
diff --git a/src/designer/src/components/widgetbox/widgetbox.xml b/src/designer/src/components/widgetbox/widgetbox.xml
index 802c28f67..4cb29cd20 100644
--- a/src/designer/src/components/widgetbox/widgetbox.xml
+++ b/src/designer/src/components/widgetbox/widgetbox.xml
@@ -1,31 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--/***************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Linguist module 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$
-**
-****************************************************************************-->
+<!--
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+-->
<widgetbox version="4.2">
<category name="Layouts">
diff --git a/src/designer/src/components/widgetbox/widgetbox_dnditem.cpp b/src/designer/src/components/widgetbox/widgetbox_dnditem.cpp
index c44fa4169..afbfc0567 100644
--- a/src/designer/src/components/widgetbox/widgetbox_dnditem.cpp
+++ b/src/designer/src/components/widgetbox/widgetbox_dnditem.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "widgetbox_dnditem.h"
@@ -47,6 +22,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
/*******************************************************************************
** WidgetBoxResource
@@ -83,7 +60,7 @@ WidgetBoxResource::WidgetBoxResource(QDesignerFormEditorInterface *core) :
QWidget *WidgetBoxResource::createWidget(const QString &widgetName, QWidget *parentWidget, const QString &name)
{
- if (widgetName == QStringLiteral("Spacer")) {
+ if (widgetName == "Spacer"_L1) {
Spacer *spacer = new Spacer(parentWidget);
spacer->setObjectName(name);
return spacer;
@@ -124,9 +101,8 @@ void WidgetBoxResource::createCustomWidgets(DomCustomWidgets *dc)
static QSize geometryProp(const DomWidget *dw)
{
const auto &prop_list = dw->elementProperty();
- const QString geometry = QStringLiteral("geometry");
for (DomProperty *prop : prop_list) {
- if (prop->attributeName() != geometry)
+ if (prop->attributeName() != "geometry"_L1)
continue;
DomRect *dr = prop->elementRect();
if (dr == nullptr)
diff --git a/src/designer/src/components/widgetbox/widgetbox_dnditem.h b/src/designer/src/components/widgetbox/widgetbox_dnditem.h
index 1a5e3bade..f8f25d58e 100644
--- a/src/designer/src/components/widgetbox/widgetbox_dnditem.h
+++ b/src/designer/src/components/widgetbox/widgetbox_dnditem.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef WIDGETBOX_DNDITEM_H
#define WIDGETBOX_DNDITEM_H
diff --git a/src/designer/src/components/widgetbox/widgetbox_global.h b/src/designer/src/components/widgetbox/widgetbox_global.h
index 06f0e2b7c..68ebc3554 100644
--- a/src/designer/src/components/widgetbox/widgetbox_global.h
+++ b/src/designer/src/components/widgetbox/widgetbox_global.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef WIDGETBOX_GLOBAL_H
#define WIDGETBOX_GLOBAL_H
diff --git a/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp b/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp
index 2f5b7f536..1e90ef08e 100644
--- a/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp
+++ b/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "widgetboxcategorylistview.h"
@@ -46,13 +21,15 @@
#include <QtCore/qtextstream.h>
#include <QtCore/qregularexpression.h>
-static const char *widgetElementC = "widget";
-static const char *nameAttributeC = "name";
-static const char *uiOpeningTagC = "<ui>";
-static const char *uiClosingTagC = "</ui>";
-
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
+static constexpr auto widgetElementC = "widget"_L1;
+static constexpr auto nameAttributeC = "name"_L1;
+static constexpr auto uiOpeningTagC = "<ui>"_L1;
+static constexpr auto uiClosingTagC = "</ui>"_L1;
+
enum { FilterRole = Qt::UserRole + 11 };
static QString domToString(const QDomElement &elt)
@@ -130,10 +107,8 @@ public:
bool removeCustomWidgets();
private:
- using WidgetBoxCategoryEntrys = QList<WidgetBoxCategoryEntry>;
-
QDesignerFormEditorInterface *m_core;
- WidgetBoxCategoryEntrys m_items;
+ QList<WidgetBoxCategoryEntry> m_items;
QListView::ViewMode m_viewMode;
};
@@ -163,8 +138,7 @@ void WidgetBoxCategoryModel::setViewMode(QListView::ViewMode vm)
int WidgetBoxCategoryModel::indexOfWidget(const QString &name)
{
- const int count = m_items.size();
- for (int i = 0; i < count; i++)
+ for (qsizetype i = 0, count = m_items.size(); i < count; ++i)
if (m_items.at(i).widget.name() == name)
return i;
return -1;
@@ -173,9 +147,8 @@ int WidgetBoxCategoryModel::indexOfWidget(const QString &name)
QDesignerWidgetBoxInterface::Category WidgetBoxCategoryModel::category() const
{
QDesignerWidgetBoxInterface::Category rc;
- const WidgetBoxCategoryEntrys::const_iterator cend = m_items.constEnd();
- for (WidgetBoxCategoryEntrys::const_iterator it = m_items.constBegin(); it != cend; ++it)
- rc.addWidget(it->widget);
+ for (const auto &c : m_items)
+ rc.addWidget(c.widget);
return rc;
}
@@ -184,7 +157,7 @@ bool WidgetBoxCategoryModel::removeCustomWidgets()
// Typically, we are a whole category of custom widgets, so, remove all
// and do reset.
bool changed = false;
- for (WidgetBoxCategoryEntrys::iterator it = m_items.begin(); it != m_items.end(); )
+ for (auto it = m_items.begin(); it != m_items.end(); )
if (it->widget.type() == QDesignerWidgetBoxInterface::Widget::Custom) {
if (!changed)
beginResetModel();
@@ -200,21 +173,21 @@ bool WidgetBoxCategoryModel::removeCustomWidgets()
void WidgetBoxCategoryModel::addWidget(const QDesignerWidgetBoxInterface::Widget &widget, const QIcon &icon,bool editable)
{
- // build item. Filter on name + class name if it is different and not a layout.
+ static const QRegularExpression classNameRegExp(QStringLiteral("<widget +class *= *\"([^\"]+)\""));
+ Q_ASSERT(classNameRegExp.isValid());
+ const auto match = classNameRegExp.match(widget.domXml());
+ const QString className = match.hasMatch() ? match.captured(1) : QString{};
+
+ // Filter on name + class name if it is different and not a layout.
QString filter = widget.name();
- if (!filter.contains(QStringLiteral("Layout"))) {
- static const QRegularExpression classNameRegExp(QStringLiteral("<widget +class *= *\"([^\"]+)\""));
- Q_ASSERT(classNameRegExp.isValid());
- const QRegularExpressionMatch match = classNameRegExp.match(widget.domXml());
- if (match.hasMatch()) {
- const QString className = match.captured(1);
- if (!filter.contains(className))
- filter += className;
- }
- }
+ if (!className.isEmpty() && !filter.contains("Layout"_L1) && !filter.contains(className))
+ filter += className;
+
WidgetBoxCategoryEntry item(widget, filter, icon, editable);
const QDesignerWidgetDataBaseInterface *db = m_core->widgetDataBase();
- const int dbIndex = db->indexOfClassName(widget.name());
+ int dbIndex = className.isEmpty() ? -1 : db->indexOfClassName(className);
+ if (dbIndex == -1)
+ dbIndex = db->indexOfClassName(widget.name());
if (dbIndex != -1) {
const QDesignerWidgetDataBaseItemInterface *dbItem = db->item(dbIndex);
const QString toolTip = dbItem->toolTip();
@@ -251,10 +224,8 @@ QVariant WidgetBoxCategoryModel::data(const QModelIndex &index, int role) const
return QVariant(item.toolTip);
// Icon mode tooltip should contain the class name
QString tt = item.widget.name();
- if (!item.toolTip.isEmpty()) {
- tt += QLatin1Char('\n');
- tt += item.toolTip;
- }
+ if (!item.toolTip.isEmpty())
+ tt += u'\n' + item.toolTip;
return QVariant(tt);
}
@@ -279,9 +250,9 @@ bool WidgetBoxCategoryModel::setData(const QModelIndex &index, const QVariant &v
item.widget.setName(newName);
const QDomDocument doc = stringToDom(WidgetBoxCategoryListView::widgetDomXml(item.widget));
- QDomElement widget_elt = doc.firstChildElement(QLatin1String(widgetElementC));
+ QDomElement widget_elt = doc.firstChildElement(widgetElementC);
if (!widget_elt.isNull()) {
- widget_elt.setAttribute(QLatin1String(nameAttributeC), newName);
+ widget_elt.setAttribute(nameAttributeC, newName);
item.widget.setDomXml(domToString(widget_elt));
}
emit dataChanged(index, index);
@@ -351,7 +322,7 @@ QWidget *WidgetBoxCategoryEntryDelegate::createEditor(QWidget *parent,
{
QWidget *result = QItemDelegate::createEditor(parent, option, index);
if (QLineEdit *line_edit = qobject_cast<QLineEdit*>(result)) {
- static const QRegularExpression re(QStringLiteral("^[_a-zA-Z][_a-zA-Z0-9]*$"));
+ static const QRegularExpression re(u"^[_a-zA-Z][_a-zA-Z0-9]*$"_s);
Q_ASSERT(re.isValid());
line_edit->setValidator(new QRegularExpressionValidator(re, line_edit));
}
@@ -409,7 +380,7 @@ void WidgetBoxCategoryListView::slotPressed(const QModelIndex &index)
const QDesignerWidgetBoxInterface::Widget wgt = m_model->widgetAt(m_proxyModel->mapToSource(index));
if (wgt.isNull())
return;
- emit pressed(wgt.name(), widgetDomXml(wgt), QCursor::pos());
+ emit widgetBoxPressed(wgt.name(), widgetDomXml(wgt), QCursor::pos());
}
void WidgetBoxCategoryListView::removeCurrentItem()
@@ -475,13 +446,8 @@ QString WidgetBoxCategoryListView::widgetDomXml(const QDesignerWidgetBoxInterfac
{
QString domXml = widget.domXml();
- if (domXml.isEmpty()) {
- domXml = QLatin1String(uiOpeningTagC);
- domXml += QStringLiteral("<widget class=\"");
- domXml += widget.name();
- domXml += QStringLiteral("\"/>");
- domXml += QLatin1String(uiClosingTagC);
- }
+ if (domXml.isEmpty())
+ domXml = uiOpeningTagC + "<widget class=\""_L1 + widget.name() +"\"/>"_L1 + uiClosingTagC;
return domXml;
}
diff --git a/src/designer/src/components/widgetbox/widgetboxcategorylistview.h b/src/designer/src/components/widgetbox/widgetboxcategorylistview.h
index 28db852f6..9223a2f49 100644
--- a/src/designer/src/components/widgetbox/widgetboxcategorylistview.h
+++ b/src/designer/src/components/widgetbox/widgetboxcategorylistview.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef WIDGETBOXCATEGORYLISTVIEW_H
#define WIDGETBOXCATEGORYLISTVIEW_H
@@ -79,7 +54,7 @@ public:
signals:
void scratchPadChanged();
- void pressed(const QString &name, const QString &xml, const QPoint &globalPos);
+ void widgetBoxPressed(const QString &name, const QString &xml, const QPoint &globalPos);
void itemRemoved();
void lastItemRemoved();
diff --git a/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp b/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp
index 1fef65ffb..4dca4a1d1 100644
--- a/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp
+++ b/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "widgetboxtreewidget.h"
#include "widgetboxcategorylistview.h"
@@ -57,23 +32,25 @@
#include <QtCore/qtimer.h>
#include <QtCore/qdebug.h>
-static const char *widgetBoxRootElementC = "widgetbox";
-static const char *widgetElementC = "widget";
-static const char *uiElementC = "ui";
-static const char *categoryElementC = "category";
-static const char *categoryEntryElementC = "categoryentry";
-static const char *nameAttributeC = "name";
-static const char *typeAttributeC = "type";
-static const char *iconAttributeC = "icon";
-static const char *defaultTypeValueC = "default";
-static const char *customValueC = "custom";
-static const char *iconPrefixC = "__qt_icon__";
-static const char *scratchPadValueC = "scratchpad";
-static const char *invisibleNameC = "[invisible]";
+QT_BEGIN_NAMESPACE
-enum TopLevelRole { NORMAL_ITEM, SCRATCHPAD_ITEM, CUSTOM_ITEM };
+using namespace Qt::StringLiterals;
+
+static constexpr auto widgetBoxRootElementC = "widgetbox"_L1;
+static constexpr auto wbWidgetElementC = "widget"_L1;
+static constexpr auto uiElementC = "ui"_L1;
+static constexpr auto categoryElementC = "category"_L1;
+static constexpr auto categoryEntryElementC = "categoryentry"_L1;
+static constexpr auto wbNameAttributeC = "name"_L1;
+static constexpr auto typeAttributeC = "type"_L1;
+static constexpr auto iconAttributeC = "icon"_L1;
+static constexpr auto defaultTypeValueC = "default"_L1;
+static constexpr auto customValueC = "custom"_L1;
+static constexpr auto iconPrefixC = "__qt_icon__"_L1;
+static constexpr auto scratchPadValueC = "scratchpad"_L1;
+static constexpr auto invisibleNameC = "[invisible]"_L1;
-QT_BEGIN_NAMESPACE
+enum TopLevelRole { NORMAL_ITEM, SCRATCHPAD_ITEM, CUSTOM_ITEM };
static void setTopLevelRole(TopLevelRole tlr, QTreeWidgetItem *item)
{
@@ -113,8 +90,8 @@ QIcon WidgetBoxTreeWidget::iconForWidget(const QString &iconName) const
if (iconName.isEmpty())
return qdesigner_internal::qtLogoIcon();
- if (iconName.startsWith(QLatin1String(iconPrefixC))) {
- const IconCache::const_iterator it = m_pluginIcons.constFind(iconName);
+ if (iconName.startsWith(iconPrefixC)) {
+ const auto it = m_pluginIcons.constFind(iconName);
if (it != m_pluginIcons.constEnd())
return it.value();
}
@@ -131,9 +108,9 @@ WidgetBoxCategoryListView *WidgetBoxTreeWidget::categoryViewAt(int idx) const
return rc;
}
-static const char widgetBoxSettingsGroupC[] = "WidgetBox";
-static const char widgetBoxExpandedKeyC[] = "Closed categories";
-static const char widgetBoxViewModeKeyC[] = "View mode";
+static constexpr auto widgetBoxSettingsGroupC = "WidgetBox"_L1;
+static constexpr auto widgetBoxExpandedKeyC = "Closed categories"_L1;
+static constexpr auto widgetBoxViewModeKeyC = "View mode"_L1;
void WidgetBoxTreeWidget::saveExpandedState() const
{
@@ -146,9 +123,9 @@ void WidgetBoxTreeWidget::saveExpandedState() const
}
}
QDesignerSettingsInterface *settings = m_core->settingsManager();
- settings->beginGroup(QLatin1String(widgetBoxSettingsGroupC));
- settings->setValue(QLatin1String(widgetBoxExpandedKeyC), closedCategories);
- settings->setValue(QLatin1String(widgetBoxViewModeKeyC), m_iconMode);
+ settings->beginGroup(widgetBoxSettingsGroupC);
+ settings->setValue(widgetBoxExpandedKeyC, closedCategories);
+ settings->setValue(widgetBoxViewModeKeyC, m_iconMode);
settings->endGroup();
}
@@ -156,10 +133,10 @@ void WidgetBoxTreeWidget::restoreExpandedState()
{
using StringSet = QSet<QString>;
QDesignerSettingsInterface *settings = m_core->settingsManager();
- const QString groupKey = QLatin1String(widgetBoxSettingsGroupC) + QLatin1Char('/');
- m_iconMode = settings->value(groupKey + QLatin1String(widgetBoxViewModeKeyC)).toBool();
+ const QString groupKey = widgetBoxSettingsGroupC + u'/';
+ m_iconMode = settings->value(groupKey + widgetBoxViewModeKeyC).toBool();
updateViewMode();
- const auto &closedCategoryList = settings->value(groupKey + QLatin1String(widgetBoxExpandedKeyC), QStringList()).toStringList();
+ const auto &closedCategoryList = settings->value(groupKey + widgetBoxExpandedKeyC, QStringList()).toStringList();
const StringSet closedCategories(closedCategoryList.cbegin(), closedCategoryList.cend());
expandAll();
if (closedCategories.isEmpty())
@@ -253,8 +230,8 @@ WidgetBoxCategoryListView *WidgetBoxTreeWidget::addCategoryView(QTreeWidgetItem
categoryView->setViewMode(iconMode ? QListView::IconMode : QListView::ListMode);
connect(categoryView, &WidgetBoxCategoryListView::scratchPadChanged,
this, &WidgetBoxTreeWidget::slotSave);
- connect(categoryView, &WidgetBoxCategoryListView::pressed,
- this, &WidgetBoxTreeWidget::pressed);
+ connect(categoryView, &WidgetBoxCategoryListView::widgetBoxPressed,
+ this, &WidgetBoxTreeWidget::widgetBoxPressed);
connect(categoryView, &WidgetBoxCategoryListView::itemRemoved,
this, &WidgetBoxTreeWidget::slotScratchPadItemDeleted);
connect(categoryView, &WidgetBoxCategoryListView::lastItemRemoved,
@@ -325,7 +302,7 @@ bool WidgetBoxTreeWidget::loadContents(const QString &contents)
return false;
}
- for (const Category &cat : qAsConst(cat_list))
+ for (const Category &cat : std::as_const(cat_list))
addCategory(cat);
addCustomCategories(false);
@@ -345,9 +322,8 @@ void WidgetBoxTreeWidget::addCustomCategories(bool replace)
}
// re-add
const CategoryList customList = loadCustomCategoryList();
- const CategoryList::const_iterator cend = customList.constEnd();
- for (CategoryList::const_iterator it = customList.constBegin(); it != cend; ++it)
- addCategory(*it);
+ for (const auto &c : customList)
+ addCategory(c);
}
static inline QString msgXmlError(const QString &fileName, const QXmlStreamReader &r)
@@ -377,33 +353,33 @@ bool WidgetBoxTreeWidget::readCategories(const QString &fileName, const QString
switch (reader.readNext()) {
case QXmlStreamReader::StartElement: {
const auto tag = reader.name();
- if (tag == QLatin1String(widgetBoxRootElementC)) {
+ if (tag == widgetBoxRootElementC) {
//<widgetbox version="4.5">
continue;
}
- if (tag == QLatin1String(categoryElementC)) {
+ if (tag == categoryElementC) {
// <category name="Layouts">
const QXmlStreamAttributes attributes = reader.attributes();
- const QString categoryName = attributes.value(QLatin1String(nameAttributeC)).toString();
- if (categoryName == QLatin1String(invisibleNameC)) {
+ const QString categoryName = attributes.value(wbNameAttributeC).toString();
+ if (categoryName == invisibleNameC) {
ignoreEntries = true;
} else {
Category category(categoryName);
- if (attributes.value(QLatin1String(typeAttributeC)) == QLatin1String(scratchPadValueC))
+ if (attributes.value(typeAttributeC) == scratchPadValueC)
category.setType(Category::Scratchpad);
cats->push_back(category);
}
continue;
}
- if (tag == QLatin1String(categoryEntryElementC)) {
+ if (tag == categoryEntryElementC) {
// <categoryentry name="Vertical Layout" icon="win/editvlayout.png" type="default">
if (!ignoreEntries) {
QXmlStreamAttributes attr = reader.attributes();
- const QString widgetName = attr.value(QLatin1String(nameAttributeC)).toString();
- const QString widgetIcon = attr.value(QLatin1String(iconAttributeC)).toString();
+ const QString widgetName = attr.value(wbNameAttributeC).toString();
+ const QString widgetIcon = attr.value(iconAttributeC).toString();
const WidgetBoxTreeWidget::Widget::Type widgetType =
- attr.value(QLatin1String(typeAttributeC)).toString()
- == QLatin1String(customValueC) ?
+ attr.value(typeAttributeC).toString()
+ == customValueC ?
WidgetBoxTreeWidget::Widget::Custom :
WidgetBoxTreeWidget::Widget::Default;
@@ -422,14 +398,14 @@ bool WidgetBoxTreeWidget::readCategories(const QString &fileName, const QString
}
case QXmlStreamReader::EndElement: {
const auto tag = reader.name();
- if (tag == QLatin1String(widgetBoxRootElementC)) {
+ if (tag == widgetBoxRootElementC) {
continue;
}
- if (tag == QLatin1String(categoryElementC)) {
+ if (tag == categoryElementC) {
ignoreEntries = false;
continue;
}
- if (tag == QLatin1String(categoryEntryElementC)) {
+ if (tag == categoryEntryElementC) {
continue;
}
break;
@@ -483,10 +459,10 @@ bool WidgetBoxTreeWidget::readWidget(Widget *w, const QString &xml, QXmlStreamRe
if (nesting++ == 0) {
// First element must be <ui> or (legacy) <widget>
const auto name = r.name();
- if (name == QLatin1String(uiElementC)) {
+ if (name == uiElementC) {
startTagPosition = currentPosition;
} else {
- if (name == QLatin1String(widgetElementC)) {
+ if (name == wbWidgetElementC) {
startTagPosition = currentPosition;
parsedWidgetTag = true;
} else {
@@ -496,7 +472,7 @@ bool WidgetBoxTreeWidget::readWidget(Widget *w, const QString &xml, QXmlStreamRe
}
} else {
// We are within <ui> looking for the first <widget> tag
- if (!parsedWidgetTag && r.name() == QLatin1String(widgetElementC)) {
+ if (!parsedWidgetTag && r.name() == wbWidgetElementC) {
parsedWidgetTag = true;
}
}
@@ -523,23 +499,22 @@ bool WidgetBoxTreeWidget::readWidget(Widget *w, const QString &xml, QXmlStreamRe
}
// Oddity: Startposition is 1 off
QString widgetXml = xml.mid(startTagPosition, endTagPosition - startTagPosition);
- const QChar lessThan = QLatin1Char('<');
- if (!widgetXml.startsWith(lessThan))
- widgetXml.prepend(lessThan);
+ if (!widgetXml.startsWith(u'<'))
+ widgetXml.prepend(u'<');
w->setDomXml(widgetXml);
return true;
}
void WidgetBoxTreeWidget::writeCategories(QXmlStreamWriter &writer, const CategoryList &cat_list) const
{
- const QString widgetbox = QLatin1String(widgetBoxRootElementC);
- const QString name = QLatin1String(nameAttributeC);
- const QString type = QLatin1String(typeAttributeC);
- const QString icon = QLatin1String(iconAttributeC);
- const QString defaultType = QLatin1String(defaultTypeValueC);
- const QString category = QLatin1String(categoryElementC);
- const QString categoryEntry = QLatin1String(categoryEntryElementC);
- const QString iconPrefix = QLatin1String(iconPrefixC);
+ const QString widgetbox = widgetBoxRootElementC;
+ const QString name = wbNameAttributeC;
+ const QString type = typeAttributeC;
+ const QString icon = iconAttributeC;
+ const QString defaultType = defaultTypeValueC;
+ const QString category = categoryElementC;
+ const QString categoryEntry = categoryEntryElementC;
+ const QString iconPrefix = iconPrefixC;
//
// <widgetbox>
@@ -561,7 +536,7 @@ void WidgetBoxTreeWidget::writeCategories(QXmlStreamWriter &writer, const Catego
writer.writeStartElement(category);
writer.writeAttribute(name, cat.name());
if (cat.type() == Category::Scratchpad)
- writer.writeAttribute(type, QLatin1String(scratchPadValueC));
+ writer.writeAttribute(type, scratchPadValueC);
const int widgetCount = cat.widgetCount();
for (int i = 0; i < widgetCount; ++i) {
@@ -620,8 +595,8 @@ WidgetBoxTreeWidget::CategoryList WidgetBoxTreeWidget::loadCustomCategoryList()
static const QString customCatName = tr("Custom Widgets");
- const QString invisible = QLatin1String(invisibleNameC);
- const QString iconPrefix = QLatin1String(iconPrefixC);
+ const QString invisible = invisibleNameC;
+ const QString iconPrefix = iconPrefixC;
for (QDesignerCustomWidgetInterface *c : customWidgets) {
const QString dom_xml = c->domXml();
@@ -963,13 +938,15 @@ void WidgetBoxTreeWidget::dropWidgets(const QList<QDesignerDnDItemInterface*> &i
if (added) {
save();
- QApplication::setActiveWindow(this);
+ activateWindow();
// Is the new item visible in filtered mode?
const WidgetBoxCategoryListView::AccessMode am = WidgetBoxCategoryListView::FilteredAccess;
if (const int count = categoryView->count(am))
categoryView->setCurrentItem(am, count - 1);
categoryView->adjustSize(); // XXX
adjustSubListSize(scratch_item);
+ doItemsLayout();
+ scrollToItem(scratch_item, PositionAtTop);
}
}
diff --git a/src/designer/src/components/widgetbox/widgetboxtreewidget.h b/src/designer/src/components/widgetbox/widgetboxtreewidget.h
index 0961e658d..f55708105 100644
--- a/src/designer/src/components/widgetbox/widgetboxtreewidget.h
+++ b/src/designer/src/components/widgetbox/widgetboxtreewidget.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef WIDGETBOXTREEWIDGET_H
#define WIDGETBOXTREEWIDGET_H
@@ -82,7 +57,8 @@ public:
QIcon iconForWidget(const QString &iconName) const;
signals:
- void pressed(const QString &name, const QString &dom_xml, const QPoint &global_mouse_pos);
+ void widgetBoxPressed(const QString &name, const QString &dom_xml,
+ const QPoint &global_mouse_pos);
public slots:
void filter(const QString &);
@@ -123,8 +99,7 @@ private:
QDesignerFormEditorInterface *m_core;
QString m_file_name;
- using IconCache = QHash<QString, QIcon>;
- mutable IconCache m_pluginIcons;
+ mutable QHash<QString, QIcon> m_pluginIcons;
bool m_iconMode;
QTimer *m_scratchPadDeleteTimer;
};
diff --git a/src/designer/src/designer/CMakeLists.txt b/src/designer/src/designer/CMakeLists.txt
index 1ecaa4020..41ee89302 100644
--- a/src/designer/src/designer/CMakeLists.txt
+++ b/src/designer/src/designer/CMakeLists.txt
@@ -1,4 +1,6 @@
-# Generated from designer.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
#####################################################################
## designer App:
@@ -32,7 +34,7 @@ qt_internal_add_app(designer
../lib/sdk
../lib/shared
extra
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::CorePrivate
Qt::DesignerComponentsPrivate
Qt::DesignerPrivate
@@ -46,6 +48,9 @@ qt_internal_add_app(designer
"qdesigner_pch.h"
)
+# Due to QTBUG-110369, don't add designer as dependency to External Project examples.
+qt_internal_skip_dependency_for_examples(designer)
+
# Resources:
set(designer_resource_files
"images/designer.png"
@@ -76,7 +81,7 @@ qt_internal_add_resource(designer "qttoolbardialog"
)
set_target_properties(designer PROPERTIES
- QT_TARGET_DESCRIPTION "Qt Designer"
+ QT_TARGET_DESCRIPTION "Qt Widgets Designer"
)
## Scopes:
@@ -133,7 +138,6 @@ if(APPLE)
# special case end
endif()
-#### Keys ignored in scope 6:.:.:designer.pro:APPLE:
# FILETYPES.files = "uifile.icns"
# FILETYPES.path = "Contents/Resources"
# QMAKE_BUNDLE_DATA = "FILETYPES"
diff --git a/src/designer/src/designer/appfontdialog.cpp b/src/designer/src/designer/appfontdialog.cpp
index 7b40fb5b3..725e6d870 100644
--- a/src/designer/src/designer/appfontdialog.cpp
+++ b/src/designer/src/designer/appfontdialog.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "appfontdialog.h"
@@ -55,10 +30,12 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
enum {FileNameRole = Qt::UserRole + 1, IdRole = Qt::UserRole + 2 };
enum { debugAppFontWidget = 0 };
-static const char fontFileKeyC[] = "fontFiles";
+static constexpr auto fontFileKeyC = "fontFiles"_L1;
// AppFontManager: Singleton that maintains the mapping of loaded application font
// ids to the file names (which are not stored in QFontDatabase)
@@ -82,7 +59,7 @@ public:
bool removeAt(int index, QString *errorMessage);
// Store loaded fonts as pair of file name and Id
- using FileNameFontIdPair = QPair<QString,int>;
+ using FileNameFontIdPair = std::pair<QString, int>;
using FileNameFontIdPairs = QList<FileNameFontIdPair>;
const FileNameFontIdPairs &fonts() const;
@@ -102,12 +79,11 @@ void AppFontManager::save(QDesignerSettingsInterface *s, const QString &prefix)
{
// Store as list of file names
QStringList fontFiles;
- const FileNameFontIdPairs::const_iterator cend = m_fonts.constEnd();
- for (FileNameFontIdPairs::const_iterator it = m_fonts.constBegin(); it != cend; ++it)
- fontFiles.push_back(it->first);
+ for (const auto &fnp : m_fonts)
+ fontFiles.push_back(fnp.first);
s->beginGroup(prefix);
- s->setValue(QLatin1String(fontFileKeyC), fontFiles);
+ s->setValue(fontFileKeyC, fontFiles);
s->endGroup();
if (debugAppFontWidget)
@@ -116,19 +92,17 @@ void AppFontManager::save(QDesignerSettingsInterface *s, const QString &prefix)
void AppFontManager::restore(const QDesignerSettingsInterface *s, const QString &prefix)
{
- QString key = prefix;
- key += QLatin1Char('/');
- key += QLatin1String(fontFileKeyC);
+ const QString key = prefix + u'/' + fontFileKeyC;
const QStringList fontFiles = s->value(key, QStringList()).toStringList();
if (debugAppFontWidget)
qDebug() << "AppFontManager::restoring" << fontFiles.size() << "fonts from " << prefix;
if (!fontFiles.isEmpty()) {
QString errorMessage;
- const QStringList::const_iterator cend = fontFiles.constEnd();
- for (QStringList::const_iterator it = fontFiles.constBegin(); it != cend; ++it)
- if (add(*it, &errorMessage) == -1)
+ for (const auto &ff : fontFiles) {
+ if (add(ff, &errorMessage) == -1)
qWarning("%s", qPrintable(errorMessage));
+ }
}
}
@@ -145,9 +119,8 @@ int AppFontManager::add(const QString &fontFile, QString *errorMessage)
}
const QString fullPath = inf.absoluteFilePath();
// Check if already loaded
- const FileNameFontIdPairs::const_iterator cend = m_fonts.constEnd();
- for (FileNameFontIdPairs::const_iterator it = m_fonts.constBegin(); it != cend; ++it) {
- if (it->first == fullPath) {
+ for (const auto &fnp : std::as_const(m_fonts)) {
+ if (fnp.first == fullPath) {
*errorMessage = QCoreApplication::translate("AppFontManager", "The font file '%1' is already loaded.").arg(fontFile);
return -1;
}
@@ -167,9 +140,8 @@ int AppFontManager::add(const QString &fontFile, QString *errorMessage)
bool AppFontManager::remove(int id, QString *errorMessage)
{
- const int count = m_fonts.size();
- for (int i = 0; i < count; i++)
- if (m_fonts[i].second == id)
+ for (qsizetype i = 0, count = m_fonts.size(); i < count; ++i)
+ if (m_fonts.at(i).second == id)
return removeAt(i, errorMessage);
*errorMessage = QCoreApplication::translate("AppFontManager", "'%1' is not a valid font id.").arg(id);
@@ -178,9 +150,8 @@ bool AppFontManager::remove(int id, QString *errorMessage)
bool AppFontManager::remove(const QString &fontFile, QString *errorMessage)
{
- const int count = m_fonts.size();
- for (int i = 0; i < count; i++)
- if (m_fonts[i].first == fontFile)
+ for (qsizetype i = 0, count = m_fonts.size(); i < count; ++i)
+ if (m_fonts.at(i).first == fontFile)
return removeAt(i, errorMessage);
*errorMessage = QCoreApplication::translate("AppFontManager", "There is no loaded font matching the id '%1'.").arg(fontFile);
@@ -232,9 +203,8 @@ void AppFontModel::init(const AppFontManager &mgr)
using FileNameFontIdPairs = AppFontManager::FileNameFontIdPairs;
const FileNameFontIdPairs &fonts = mgr.fonts();
- const FileNameFontIdPairs::const_iterator cend = fonts.constEnd();
- for (FileNameFontIdPairs::const_iterator it = fonts.constBegin(); it != cend; ++it)
- add(it->first, it->second);
+ for (const auto &fnp : fonts)
+ add(fnp.first, fnp.second);
}
void AppFontModel::add(const QString &fontFile, int id)
@@ -250,11 +220,10 @@ void AppFontModel::add(const QString &fontFile, int id)
appendRow(fileItem);
const QStringList families = QFontDatabase::applicationFontFamilies(id);
- const QStringList::const_iterator cend = families.constEnd();
- for (QStringList::const_iterator it = families.constBegin(); it != cend; ++it) {
- QStandardItem *familyItem = new QStandardItem(*it);
+ for (const auto &fam : families) {
+ QStandardItem *familyItem = new QStandardItem(fam);
familyItem->setToolTip(fullPath);
- familyItem->setFont(QFont(*it));
+ familyItem->setFont(QFont(fam));
familyItem->setFlags(Qt::ItemIsEnabled);
fileItem->appendRow(familyItem);
}
@@ -283,16 +252,17 @@ AppFontWidget::AppFontWidget(QWidget *parent) :
connect(m_view->selectionModel(), &QItemSelectionModel::selectionChanged, this, &AppFontWidget::selectionChanged);
m_addButton->setToolTip(tr("Add font files"));
- m_addButton->setIcon(qdesigner_internal::createIconSet(QString::fromUtf8("plus.png")));
+ m_addButton->setIcon(qdesigner_internal::createIconSet("plus.png"_L1));
connect(m_addButton, &QAbstractButton::clicked, this, &AppFontWidget::addFiles);
m_removeButton->setEnabled(false);
m_removeButton->setToolTip(tr("Remove current font file"));
- m_removeButton->setIcon(qdesigner_internal::createIconSet(QString::fromUtf8("minus.png")));
+ m_removeButton->setIcon(qdesigner_internal::createIconSet("minus.png"_L1));
connect(m_removeButton, &QAbstractButton::clicked, this, &AppFontWidget::slotRemoveFiles);
m_removeAllButton->setToolTip(tr("Remove all font files"));
- m_removeAllButton->setIcon(qdesigner_internal::createIconSet(QString::fromUtf8("editdelete.png")));
+ m_removeAllButton->setIcon(qdesigner_internal::createIconSet(QIcon::ThemeIcon::EditDelete,
+ "editdelete.png"_L1));
connect(m_removeAllButton, &QAbstractButton::clicked, this, &AppFontWidget::slotRemoveAll);
QHBoxLayout *hLayout = new QHBoxLayout;
@@ -318,11 +288,10 @@ void AppFontWidget::addFiles()
QString errorMessage;
AppFontManager &fmgr = AppFontManager::instance();
- const QStringList::const_iterator cend = files.constEnd();
- for (QStringList::const_iterator it = files.constBegin(); it != cend; ++it) {
- const int id = fmgr.add(*it, &errorMessage);
+ for (const auto &f : files) {
+ const int id = fmgr.add(f, &errorMessage);
if (id != -1) {
- m_model->add(*it, id);
+ m_model->add(f, id);
} else {
QMessageBox::critical(this, tr("Error Adding Fonts"), errorMessage);
}
@@ -341,12 +310,11 @@ static void removeFonts(const QModelIndexList &selectedIndexes, AppFontModel *mo
rows.reserve(selectedIndexes.size());
QString errorMessage;
- const QModelIndexList::const_iterator cend = selectedIndexes.constEnd();
- for (QModelIndexList::const_iterator it = selectedIndexes.constBegin(); it != cend; ++it) {
- const int id = model->idAt(*it);
+ for (const auto &mi : selectedIndexes) {
+ const int id = model->idAt(mi);
if (id != -1) {
if (fmgr.remove(id, &errorMessage)) {
- rows.push_back(it->row());
+ rows.append(mi.row());
} else {
QMessageBox::critical(dialogParent, AppFontWidget::tr("Error Removing Fonts"), errorMessage);
}
@@ -354,8 +322,8 @@ static void removeFonts(const QModelIndexList &selectedIndexes, AppFontModel *mo
}
std::stable_sort(rows.begin(), rows.end());
- for (int i = rows.size() - 1; i >= 0; i--)
- model->removeRow(rows[i]);
+ for (qsizetype i = rows.size() - 1; i >= 0; --i)
+ model->removeRow(rows.at(i));
}
void AppFontWidget::slotRemoveFiles()
@@ -402,7 +370,6 @@ AppFontDialog::AppFontDialog(QWidget *parent) :
m_appFontWidget(new AppFontWidget)
{
setAttribute(Qt::WA_DeleteOnClose, true);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowTitle(tr("Additional Fonts"));
setModal(false);
QVBoxLayout *vl = new QVBoxLayout;
diff --git a/src/designer/src/designer/appfontdialog.h b/src/designer/src/designer/appfontdialog.h
index 4a5b128af..5b33c4a5b 100644
--- a/src/designer/src/designer/appfontdialog.h
+++ b/src/designer/src/designer/appfontdialog.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QDESIGNER_APPFONTWIDGET_H
#define QDESIGNER_APPFONTWIDGET_H
diff --git a/src/designer/src/designer/assistantclient.cpp b/src/designer/src/designer/assistantclient.cpp
index 45fee4393..43934c13e 100644
--- a/src/designer/src/designer/assistantclient.cpp
+++ b/src/designer/src/designer/assistantclient.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "assistantclient.h"
@@ -40,6 +15,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
enum { debugAssistantClient = 0 };
AssistantClient::AssistantClient() = default;
@@ -55,22 +32,19 @@ AssistantClient::~AssistantClient()
bool AssistantClient::showPage(const QString &path, QString *errorMessage)
{
- QString cmd = QStringLiteral("SetSource ");
- cmd += path;
+ const QString cmd = "SetSource "_L1 + path;
return sendCommand(cmd, errorMessage);
}
bool AssistantClient::activateIdentifier(const QString &identifier, QString *errorMessage)
{
- QString cmd = QStringLiteral("ActivateIdentifier ");
- cmd += identifier;
+ const QString cmd = "ActivateIdentifier "_L1 + identifier;
return sendCommand(cmd, errorMessage);
}
bool AssistantClient::activateKeyword(const QString &keyword, QString *errorMessage)
{
- QString cmd = QStringLiteral("ActivateKeyword ");
- cmd += keyword;
+ const QString cmd = "ActivateKeyword "_L1 + keyword;
return sendCommand(cmd, errorMessage);
}
@@ -85,7 +59,7 @@ bool AssistantClient::sendCommand(const QString &cmd, QString *errorMessage)
return false;
}
QTextStream str(m_process);
- str << cmd << QLatin1Char('\n') << Qt::endl;
+ str << cmd << "\n\n";
return true;
}
@@ -98,13 +72,13 @@ QString AssistantClient::binary()
{
QString app = QLibraryInfo::path(QLibraryInfo::BinariesPath) + QDir::separator();
#if !defined(Q_OS_MACOS)
- app += QStringLiteral("assistant");
+ app += "assistant"_L1;
#else
- app += QStringLiteral("Assistant.app/Contents/MacOS/Assistant");
+ app += "Assistant.app/Contents/MacOS/Assistant"_L1;
#endif
#if defined(Q_OS_WIN)
- app += QStringLiteral(".exe");
+ app += ".exe"_L1;
#endif
return app;
@@ -147,7 +121,7 @@ bool AssistantClient::ensureRunning(QString *errorMessage)
if (debugAssistantClient)
qDebug() << "Running " << app;
// run
- QStringList args(QStringLiteral("-enableRemoteControl"));
+ QStringList args{u"-enableRemoteControl"_s};
m_process->start(app, args);
if (!m_process->waitForStarted()) {
*errorMessage = QCoreApplication::translate("AssistantClient", "Unable to launch assistant (%1).").arg(app);
@@ -169,12 +143,12 @@ QString AssistantClient::documentUrl(const QString &module, int qtVersion)
QString AssistantClient::designerManualUrl(int qtVersion)
{
- return documentUrl(QStringLiteral("qtdesigner"), qtVersion);
+ return documentUrl(u"qtdesigner"_s, qtVersion);
}
QString AssistantClient::qtReferenceManualUrl(int qtVersion)
{
- return documentUrl(QStringLiteral("qtdoc"), qtVersion);
+ return documentUrl(u"qtdoc"_s, qtVersion);
}
QT_END_NAMESPACE
diff --git a/src/designer/src/designer/assistantclient.h b/src/designer/src/designer/assistantclient.h
index 94618662a..b1ee033d5 100644
--- a/src/designer/src/designer/assistantclient.h
+++ b/src/designer/src/designer/assistantclient.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ASSISTANTCLIENT_H
#define ASSISTANTCLIENT_H
@@ -50,7 +25,7 @@ public:
bool isRunning() const;
static QString documentUrl(const QString &prefix, int qtVersion = 0);
- // Root of the Qt Designer documentation
+ // Root of the Qt Widgets Designer documentation
static QString designerManualUrl(int qtVersion = 0);
// Root of the Qt Reference documentation
static QString qtReferenceManualUrl(int qtVersion = 0);
diff --git a/src/designer/src/designer/designer.qrc b/src/designer/src/designer/designer.qrc
deleted file mode 100644
index 5de379c78..000000000
--- a/src/designer/src/designer/designer.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
- <qresource prefix="/qt-project.org/designer">
- <file>images/designer.png</file>
- </qresource>
-</RCC>
diff --git a/src/designer/src/designer/designer_enums.h b/src/designer/src/designer/designer_enums.h
index c8aeff8bd..87f67d103 100644
--- a/src/designer/src/designer/designer_enums.h
+++ b/src/designer/src/designer/designer_enums.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef DESIGNERENUMS_H
#define DESIGNERENUMS_H
diff --git a/src/designer/src/designer/doc/qtdesigner.qdocconf b/src/designer/src/designer/doc/qtdesigner.qdocconf
index 964fb47ed..fb0a67e8d 100644
--- a/src/designer/src/designer/doc/qtdesigner.qdocconf
+++ b/src/designer/src/designer/doc/qtdesigner.qdocconf
@@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
include($QT_INSTALL_DOCS/config/exampleurl-qttools.qdocconf)
project = QtDesigner
-description = Qt Designer Manual
+description = Qt Widgets Designer Manual
examplesinstallpath = designer
qhp.projects = QtDesigner
@@ -10,29 +10,25 @@ qhp.projects = QtDesigner
qhp.QtDesigner.file = qtdesigner.qhp
qhp.QtDesigner.namespace = org.qt-project.qtdesigner.$QT_VERSION_TAG
qhp.QtDesigner.virtualFolder = qtdesigner
-qhp.QtDesigner.indexTitle = Qt Designer Manual
+qhp.QtDesigner.indexTitle = Qt Widgets Designer Manual
qhp.QtDesigner.subprojects = manual examples classes
qhp.QtDesigner.subprojects.manual.title = Manual
-qhp.QtDesigner.subprojects.manual.indexTitle = Qt Designer Manual
+qhp.QtDesigner.subprojects.manual.indexTitle = Qt Widgets Designer Manual
qhp.QtDesigner.subprojects.manual.selectors = fake:page
qhp.QtDesigner.subprojects.examples.title = Examples
-qhp.QtDesigner.subprojects.examples.indexTitle = Qt Designer Examples
+qhp.QtDesigner.subprojects.examples.indexTitle = Qt Widgets Designer Examples
qhp.QtDesigner.subprojects.examples.selectors = fake:example
qhp.QtDesigner.subprojects.examples.sortPages = true
qhp.QtDesigner.subprojects.classes.title = C++ Classes
-qhp.QtDesigner.subprojects.classes.indexTitle = Qt Designer C++ Classes
+qhp.QtDesigner.subprojects.classes.indexTitle = Qt Widgets Designer C++ Classes
qhp.QtDesigner.subprojects.classes.selectors = class fake:headerfile
qhp.QtDesigner.subprojects.classes.sortPages = true
language = Cpp
-headerdirs += .. \
- ../../uiplugin \
- ../../lib
-
-sourcedirs = .. \
- ../../uiplugin \
+{headerdirs,sourcedirs} += .. \
+ ../../../../uiplugin \
../../lib
exampledirs = ../../../../../examples/designer \
@@ -40,9 +36,8 @@ exampledirs = ../../../../../examples/designer \
imagedirs = images
-depends += qtdoc qtgui qtwidgets qtcore qtuitools qtquick qmake
+depends += qtdoc qtgui qtwidgets qtcore qtuitools qtquick qtcmake qmake
-navigation.landingpage = "Qt Designer Manual"
-navigation.cppclassespage = "Qt Designer C++ Classes"
+navigation.landingpage = "Qt Widgets Designer Manual"
+navigation.cppclassespage = "Qt Widgets Designer C++ Classes"
-warninglimit = 0
diff --git a/src/designer/src/designer/doc/snippets/CMakeLists.txt b/src/designer/src/designer/doc/snippets/CMakeLists.txt
new file mode 100644
index 000000000..974b43ffd
--- /dev/null
+++ b/src/designer/src/designer/doc/snippets/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+add_subdirectory(autoconnection)
+add_subdirectory(imagedialog)
+add_subdirectory(multipleinheritance)
+add_subdirectory(noautoconnection)
+
+add_subdirectory(singleinheritance)
+add_subdirectory(uitools/calculatorform)
diff --git a/src/designer/src/designer/doc/snippets/autoconnection/CMakeLists.txt b/src/designer/src/designer/doc/snippets/autoconnection/CMakeLists.txt
new file mode 100644
index 000000000..ba19d4501
--- /dev/null
+++ b/src/designer/src/designer/doc/snippets/autoconnection/CMakeLists.txt
@@ -0,0 +1,24 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(autoconnection LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTOUIC ON)
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+
+qt_add_executable(autoconnection
+ imagedialog.cpp imagedialog.h imagedialog.ui main.cpp)
+
+set_target_properties(autoconnection PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(autoconnection PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Widgets
+)
diff --git a/src/designer/src/designer/doc/snippets/autoconnection/autoconnection.pro b/src/designer/src/designer/doc/snippets/autoconnection/autoconnection.pro
index fba94debf..6937e8e54 100644
--- a/src/designer/src/designer/doc/snippets/autoconnection/autoconnection.pro
+++ b/src/designer/src/designer/doc/snippets/autoconnection/autoconnection.pro
@@ -1,4 +1,5 @@
TEMPLATE = app
+QT += widgets
FORMS = imagedialog.ui
HEADERS = imagedialog.h
SOURCES = imagedialog.cpp \
diff --git a/src/designer/src/designer/doc/snippets/autoconnection/imagedialog.cpp b/src/designer/src/designer/doc/snippets/autoconnection/imagedialog.cpp
index f561eaeda..8776e38cd 100644
--- a/src/designer/src/designer/doc/snippets/autoconnection/imagedialog.cpp
+++ b/src/designer/src/designer/doc/snippets/autoconnection/imagedialog.cpp
@@ -1,54 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-#include <QtGui>
+#include <QMessageBox>
#include "imagedialog.h"
@@ -66,14 +19,15 @@ ImageDialog::ImageDialog(QWidget *parent)
colorDepthCombo->addItem(tr("65536 colors (16 bits per pixel)"));
colorDepthCombo->addItem(tr("16 million colors (24 bits per pixel)"));
- connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(cancelButton, &QAbstractButton::clicked, this, &QDialog::reject);
}
void ImageDialog::on_okButton_clicked()
{
- if (nameLineEdit->text().isEmpty())
- (void) QMessageBox::information(this, tr("No Image Name"),
+ if (nameLineEdit->text().isEmpty()) {
+ QMessageBox::information(this, tr("No Image Name"),
tr("Please supply a name for the image."), QMessageBox::Cancel);
- else
+ } else {
accept();
+ }
}
diff --git a/src/designer/src/designer/doc/snippets/autoconnection/imagedialog.h b/src/designer/src/designer/doc/snippets/autoconnection/imagedialog.h
index 665824921..64d6b4e88 100644
--- a/src/designer/src/designer/doc/snippets/autoconnection/imagedialog.h
+++ b/src/designer/src/designer/doc/snippets/autoconnection/imagedialog.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef IMAGEDIALOG_H
#define IMAGEDIALOG_H
@@ -59,7 +12,7 @@ class ImageDialog : public QDialog, private Ui::ImageDialog
Q_OBJECT
public:
- ImageDialog(QWidget *parent = 0);
+ explicit ImageDialog(QWidget *parent = nullptr);
private slots:
void on_okButton_clicked();
diff --git a/src/designer/src/designer/doc/snippets/autoconnection/main.cpp b/src/designer/src/designer/doc/snippets/autoconnection/main.cpp
index 95daf2dec..5c05efddb 100644
--- a/src/designer/src/designer/doc/snippets/autoconnection/main.cpp
+++ b/src/designer/src/designer/doc/snippets/autoconnection/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "imagedialog.h"
diff --git a/src/designer/src/designer/doc/snippets/imagedialog/CMakeLists.txt b/src/designer/src/designer/doc/snippets/imagedialog/CMakeLists.txt
new file mode 100644
index 000000000..3ba729065
--- /dev/null
+++ b/src/designer/src/designer/doc/snippets/imagedialog/CMakeLists.txt
@@ -0,0 +1,24 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(imagedialog LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTOUIC ON)
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+
+qt_add_executable(imagedialog
+ imagedialog.ui main.cpp)
+
+set_target_properties(imagedialog PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(imagedialog PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Widgets
+)
diff --git a/src/designer/src/designer/doc/snippets/imagedialog/imagedialog.pro b/src/designer/src/designer/doc/snippets/imagedialog/imagedialog.pro
index 164a7b2cb..c0afe036d 100644
--- a/src/designer/src/designer/doc/snippets/imagedialog/imagedialog.pro
+++ b/src/designer/src/designer/doc/snippets/imagedialog/imagedialog.pro
@@ -1,3 +1,4 @@
TEMPLATE = app
+QT += widgets
FORMS = imagedialog.ui
SOURCES = main.cpp
diff --git a/src/designer/src/designer/doc/snippets/imagedialog/main.cpp b/src/designer/src/designer/doc/snippets/imagedialog/main.cpp
index 545898688..83272df09 100644
--- a/src/designer/src/designer/doc/snippets/imagedialog/main.cpp
+++ b/src/designer/src/designer/doc/snippets/imagedialog/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "ui_imagedialog.h"
#include <QApplication>
diff --git a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_extension_default_extensionfactory.cpp b/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_extension_default_extensionfactory.cpp
index 697f2a537..ab2b5d2d5 100644
--- a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_extension_default_extensionfactory.cpp
+++ b/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_extension_default_extensionfactory.cpp
@@ -1,65 +1,17 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [0]
QObject *ANewExtensionFactory::createExtension(QObject *object,
const QString &iid, QObject *parent) const
{
if (iid != Q_TYPEID(QDesignerContainerExtension))
- return 0;
+ return nullptr;
- if (MyCustomWidget *widget = qobject_cast<MyCustomWidget*>
- (object))
+ if (auto *widget = qobject_cast<MyCustomWidget*>(object))
return new MyContainerExtension(widget, parent);
- return 0;
+ return nullptr;
}
//! [0]
@@ -68,17 +20,17 @@
QObject *AGeneralExtensionFactory::createExtension(QObject *object,
const QString &iid, QObject *parent) const
{
- MyCustomWidget *widget = qobject_cast<MyCustomWidget*>(object);
+ auto *widget = qobject_cast<MyCustomWidget*>(object);
+ if (!widget)
+ return nullptr;
- if (widget && (iid == Q_TYPEID(QDesignerTaskMenuExtension))) {
+ if (iid == Q_TYPEID(QDesignerTaskMenuExtension))
return new MyTaskMenuExtension(widget, parent);
- } else if (widget && (iid == Q_TYPEID(QDesignerContainerExtension))) {
+ if (iid == Q_TYPEID(QDesignerContainerExtension))
return new MyContainerExtension(widget, parent);
- } else {
- return 0;
- }
+ return nullptr;
}
//! [1]
diff --git a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_extension_extension.cpp b/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_extension_extension.cpp
index afe14ee52..b5ed7f4c4 100644
--- a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_extension_extension.cpp
+++ b/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_extension_extension.cpp
@@ -1,58 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [0]
- QDesignerPropertySheetExtension *propertySheet;
- QExtensionManager manager = formEditor->extensionManager();
+ auto *manager = formEditor->extensionManager();
- propertySheet = qt_extension<QDesignerPropertySheetExtension*>(manager, widget);
+ auto *propertySheet = qt_extension<QDesignerPropertySheetExtension*>(manager, widget);
if(propertySheet) {...}
//! [0]
diff --git a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_extension_qextensionmanager.cpp b/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_extension_qextensionmanager.cpp
index f8059e9f0..0b79dd60d 100644
--- a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_extension_qextensionmanager.cpp
+++ b/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_extension_qextensionmanager.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [0]
void MyPlugin::initialize(QDesignerFormEditorInterface *formEditor)
@@ -54,8 +7,8 @@
if (initialized)
return;
- QExtensionManager *manager = formEditor->extensionManager();
- Q_ASSERT(manager != 0);
+ auto *manager = formEditor->extensionManager();
+ Q_ASSERT(manager != nullptr);
manager->registerExtensions(new MyExtensionFactory(manager),
Q_TYPEID(QDesignerTaskMenuExtension));
diff --git a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractformeditor.cpp b/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractformeditor.cpp
deleted file mode 100644
index 14d78b502..000000000
--- a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractformeditor.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
- QDesignerObjectInspectorInterface *objectInspector = nullptr;
- objectInspector = formEditor->objectInspector();
-
- QDesignerFormWindowManagerInterface *manager = nullptr;
- manager = formEditor->formWindowManager();
-
- objectInspector->setFormWindow(manager->formWindow(0));
-//! [0]
-
-
diff --git a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractformwindow.cpp b/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractformwindow.cpp
index 259eb4668..4a8f5df6b 100644
--- a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractformwindow.cpp
+++ b/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractformwindow.cpp
@@ -1,69 +1,18 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [0]
- QDesignerFormWindowInterface *formWindow;
- formWindow = QDesignerFormWindowInterface::findFormWindow(myWidget);
+ auto *formWindow = QDesignerFormWindowInterface::findFormWindow(myWidget);
//! [0]
//! [1]
QList<QDesignerFormWindowInterface *> forms;
- QDesignerFormWindowInterface *formWindow;
- QDesignerFormWindowManagerInterface *manager = formEditor->formWindowManager();
+ auto *manager = formEditor->formWindowManager();
- for (int i = 0; i < manager->formWindowCount(); i++) {
- formWindow = manager->formWindow(i);
- forms.append(formWindow);
- }
+ for (int i = 0; i < manager->formWindowCount(); ++i)
+ forms.append(manager->formWindow(i));
//! [1]
diff --git a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractformwindowcursor.cpp b/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractformwindowcursor.cpp
index 369d87fd6..c6552713b 100644
--- a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractformwindowcursor.cpp
+++ b/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractformwindowcursor.cpp
@@ -1,56 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [0]
- QDesignerFormWindowInterface *formWindow = nullptr;
- formWindow = QDesignerFormWindowInterface::findFormWindow(myWidget);
+ auto *formWindow = QDesignerFormWindowInterface::findFormWindow(myWidget);
formWindow->cursor()->setProperty(myWidget, myProperty, newValue);
//! [0]
diff --git a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractformwindowmanager.cpp b/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractformwindowmanager.cpp
index 7346d6e25..9427dbdc3 100644
--- a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractformwindowmanager.cpp
+++ b/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractformwindowmanager.cpp
@@ -1,59 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [0]
- QDesignerFormWindowManagerInterface *manager = nullptr;
- QDesignerFormWindowInterface *formWindow = nullptr;
-
- manager = formEditor->formWindowManager();
- formWindow = manager->formWindow(0);
+ auto *manager = formEditor->formWindowManager();
+ auto *formWindow = manager->formWindow(0);
manager->setActiveFormWindow(formWindow);
//! [0]
diff --git a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractobjectinspector.cpp b/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractobjectinspector.cpp
index 14d78b502..9d806a846 100644
--- a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractobjectinspector.cpp
+++ b/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractobjectinspector.cpp
@@ -1,59 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [0]
- QDesignerObjectInspectorInterface *objectInspector = nullptr;
- objectInspector = formEditor->objectInspector();
-
- QDesignerFormWindowManagerInterface *manager = nullptr;
- manager = formEditor->formWindowManager();
+ auto *objectInspector = formEditor->objectInspector();
+ auto *manager = formEditor->formWindowManager();
objectInspector->setFormWindow(manager->formWindow(0));
//! [0]
diff --git a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractpropertyeditor.cpp b/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractpropertyeditor.cpp
index 2ffd8146c..347988365 100644
--- a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractpropertyeditor.cpp
+++ b/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractpropertyeditor.cpp
@@ -1,69 +1,21 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [0]
- QDesignerPropertyEditorInterface *propertyEditor = nullptr;
- propertyEditor = formEditor->propertyEditor();
+ auto *propertyEditor = formEditor->propertyEditor();
- connect(propertyEditor, SIGNAL(propertyChanged(QString,QVariant)),
- this, SLOT(checkProperty(QString,QVariant)));
+ connect(propertyEditor, &QDesignerPropertyEditorInterface::propertyChanged,
+ this, &MyClass::checkProperty);
//! [0]
//! [1]
- void checkProperty(QString property, QVariant value) {
- QDesignerPropertyEditorInterface *propertyEditor = nullptr;
- propertyEditor = formEditor->propertyEditor();
+ void checkProperty(const QString &property, const QVariant &value)
+ {
+ auto *propertyEditor = formEditor->propertyEditor();
- QObject *object = propertyeditor->object();
- MyCustomWidget *widget = qobject_cast<MyCustomWidget>(object);
+ auto *object = propertyeditor->object();
+ auto *widget = qobject_cast<MyCustomWidget *>(object);
if (widget && property == aProperty && value != expectedValue)
{...}
diff --git a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractwidgetbox.cpp b/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractwidgetbox.cpp
index 850542211..a893306ea 100644
--- a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractwidgetbox.cpp
+++ b/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractwidgetbox.cpp
@@ -1,56 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [0]
- QDesignerWidgetBoxInterface *widgetBox = 0:
- widgetBox = formEditor->widgetBox();
+ auto *widgetBox = formEditor->widgetBox();
widgetBox->load();
//! [0]
diff --git a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_uilib_abstractformbuilder.cpp b/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_uilib_abstractformbuilder.cpp
deleted file mode 100644
index b7b9f5ec1..000000000
--- a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_uilib_abstractformbuilder.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
- MyForm::MyForm(QWidget *parent)
- : QWidget(parent)
- {
- QFormBuilder builder;
- QFile file(":/forms/myWidget.ui");
- file.open(QFile::ReadOnly);
- QWidget *myWidget = builder.load(&file, this);
- file.close();
-
- QVBoxLayout *layout = new QVBoxLayout;
- layout->addWidget(myWidget);
- setLayout(layout);
- }
-//! [0]
-
-
diff --git a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_uilib_formbuilder.cpp b/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_uilib_formbuilder.cpp
index c7fd41416..2120dcacb 100644
--- a/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_uilib_formbuilder.cpp
+++ b/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_uilib_formbuilder.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [0]
MyForm::MyForm(QWidget *parent)
@@ -58,9 +11,8 @@
QWidget *myWidget = builder.load(&file, this);
file.close();
- QVBoxLayout *layout = new QVBoxLayout;
+ auto *layout = new QVBoxLayout(this);
layout->addWidget(myWidget);
- setLayout(layout);
}
//! [0]
diff --git a/src/designer/src/designer/doc/snippets/manual/doc_src_designer-manual.cpp b/src/designer/src/designer/doc/snippets/manual/doc_src_designer-manual.cpp
index 3e077025d..f0483c05b 100644
--- a/src/designer/src/designer/doc/snippets/manual/doc_src_designer-manual.cpp
+++ b/src/designer/src/designer/doc/snippets/manual/doc_src_designer-manual.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [1]
#include <QtUiTools>
diff --git a/src/designer/src/designer/doc/snippets/manual/doc_src_designer-manual.js b/src/designer/src/designer/doc/snippets/manual/doc_src_designer-manual.js
index 949825cc5..da1ad350d 100644
--- a/src/designer/src/designer/doc/snippets/manual/doc_src_designer-manual.js
+++ b/src/designer/src/designer/doc/snippets/manual/doc_src_designer-manual.js
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [6]
widget.text = 'Hi - I was built ' + new Date().toString();
diff --git a/src/designer/src/designer/doc/snippets/manual/doc_src_designer-manual.pro b/src/designer/src/designer/doc/snippets/manual/doc_src_designer-manual.pro
index 26839e35a..f09f257e2 100644
--- a/src/designer/src/designer/doc/snippets/manual/doc_src_designer-manual.pro
+++ b/src/designer/src/designer/doc/snippets/manual/doc_src_designer-manual.pro
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#! [0]
QT += uitools
diff --git a/src/designer/src/designer/doc/snippets/multipleinheritance/CMakeLists.txt b/src/designer/src/designer/doc/snippets/multipleinheritance/CMakeLists.txt
new file mode 100644
index 000000000..c7e3d8aae
--- /dev/null
+++ b/src/designer/src/designer/doc/snippets/multipleinheritance/CMakeLists.txt
@@ -0,0 +1,24 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(multipleinheritance LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTOUIC ON)
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+
+qt_add_executable(multipleinheritance
+ imagedialog.cpp imagedialog.h imagedialog.ui main.cpp)
+
+set_target_properties(multipleinheritance PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(multipleinheritance PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Widgets
+)
diff --git a/src/designer/src/designer/doc/snippets/multipleinheritance/imagedialog.cpp b/src/designer/src/designer/doc/snippets/multipleinheritance/imagedialog.cpp
index 147c1cdf8..1c34df2bb 100644
--- a/src/designer/src/designer/doc/snippets/multipleinheritance/imagedialog.cpp
+++ b/src/designer/src/designer/doc/snippets/multipleinheritance/imagedialog.cpp
@@ -1,54 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "imagedialog.h"
@@ -64,6 +15,6 @@ ImageDialog::ImageDialog(QWidget *parent)
colorDepthCombo->addItem(tr("65536 colors (16 bits per pixel)"));
colorDepthCombo->addItem(tr("16 million colors (24 bits per pixel)"));
- connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
- connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(okButton, &QAbstractButton::clicked, this, &QDialog::accept);
+ connect(cancelButton, &QAbstractButton::clicked, this, &QDialog::reject);
}
diff --git a/src/designer/src/designer/doc/snippets/multipleinheritance/imagedialog.h b/src/designer/src/designer/doc/snippets/multipleinheritance/imagedialog.h
index 9a4513b96..f6bc3b62c 100644
--- a/src/designer/src/designer/doc/snippets/multipleinheritance/imagedialog.h
+++ b/src/designer/src/designer/doc/snippets/multipleinheritance/imagedialog.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef IMAGEDIALOG_H
#define IMAGEDIALOG_H
@@ -58,7 +11,7 @@ class ImageDialog : public QDialog, private Ui::ImageDialog
Q_OBJECT
public:
- ImageDialog(QWidget *parent = 0);
+ explicit ImageDialog(QWidget *parent = nullptr);
};
#endif
diff --git a/src/designer/src/designer/doc/snippets/multipleinheritance/main.cpp b/src/designer/src/designer/doc/snippets/multipleinheritance/main.cpp
index 95daf2dec..5c05efddb 100644
--- a/src/designer/src/designer/doc/snippets/multipleinheritance/main.cpp
+++ b/src/designer/src/designer/doc/snippets/multipleinheritance/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "imagedialog.h"
diff --git a/src/designer/src/designer/doc/snippets/multipleinheritance/multipleinheritance.pro b/src/designer/src/designer/doc/snippets/multipleinheritance/multipleinheritance.pro
index fba94debf..6937e8e54 100644
--- a/src/designer/src/designer/doc/snippets/multipleinheritance/multipleinheritance.pro
+++ b/src/designer/src/designer/doc/snippets/multipleinheritance/multipleinheritance.pro
@@ -1,4 +1,5 @@
TEMPLATE = app
+QT += widgets
FORMS = imagedialog.ui
HEADERS = imagedialog.h
SOURCES = imagedialog.cpp \
diff --git a/src/designer/src/designer/doc/snippets/noautoconnection/CMakeLists.txt b/src/designer/src/designer/doc/snippets/noautoconnection/CMakeLists.txt
new file mode 100644
index 000000000..967bc640c
--- /dev/null
+++ b/src/designer/src/designer/doc/snippets/noautoconnection/CMakeLists.txt
@@ -0,0 +1,24 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(noautoconnection LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTOUIC ON)
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+
+qt_add_executable(noautoconnection
+ imagedialog.cpp imagedialog.h imagedialog.ui main.cpp)
+
+set_target_properties(noautoconnection PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(noautoconnection PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Widgets
+)
diff --git a/src/designer/src/designer/doc/snippets/noautoconnection/imagedialog.cpp b/src/designer/src/designer/doc/snippets/noautoconnection/imagedialog.cpp
index 4e7569af6..e29c41095 100644
--- a/src/designer/src/designer/doc/snippets/noautoconnection/imagedialog.cpp
+++ b/src/designer/src/designer/doc/snippets/noautoconnection/imagedialog.cpp
@@ -1,54 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-#include <QtGui>
+#include <QMessageBox>
#include "imagedialog.h"
@@ -68,19 +21,20 @@ ImageDialog::ImageDialog(QWidget *parent)
colorDepthCombo->addItem(tr("65536 colors (16 bits per pixel)"));
colorDepthCombo->addItem(tr("16 million colors (24 bits per pixel)"));
- connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(cancelButton, &QAbstractButton::clicked, this, &QDialog::reject);
//! [1]
- connect(okButton, SIGNAL(clicked()), this, SLOT(checkValues()));
+ connect(okButton, &QAbstractButton::clicked, this, &ImageDialog::checkValues);
}
//! [1]
//! [2]
void ImageDialog::checkValues()
{
- if (nameLineEdit->text().isEmpty())
- (void) QMessageBox::information(this, tr("No Image Name"),
+ if (nameLineEdit->text().isEmpty()) {
+ QMessageBox::information(this, tr("No Image Name"),
tr("Please supply a name for the image."), QMessageBox::Cancel);
- else
+ } else {
accept();
+ }
}
//! [2]
diff --git a/src/designer/src/designer/doc/snippets/noautoconnection/imagedialog.h b/src/designer/src/designer/doc/snippets/noautoconnection/imagedialog.h
index d279be94e..611b90119 100644
--- a/src/designer/src/designer/doc/snippets/noautoconnection/imagedialog.h
+++ b/src/designer/src/designer/doc/snippets/noautoconnection/imagedialog.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef IMAGEDIALOG_H
#define IMAGEDIALOG_H
@@ -59,7 +12,7 @@ class ImageDialog : public QDialog, private Ui::ImageDialog
Q_OBJECT
public:
- ImageDialog(QWidget *parent = 0);
+ explicit ImageDialog(QWidget *parent = nullptr);
private slots:
void checkValues();
diff --git a/src/designer/src/designer/doc/snippets/noautoconnection/main.cpp b/src/designer/src/designer/doc/snippets/noautoconnection/main.cpp
index 95daf2dec..5c05efddb 100644
--- a/src/designer/src/designer/doc/snippets/noautoconnection/main.cpp
+++ b/src/designer/src/designer/doc/snippets/noautoconnection/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "imagedialog.h"
diff --git a/src/designer/src/designer/doc/snippets/noautoconnection/noautoconnection.pro b/src/designer/src/designer/doc/snippets/noautoconnection/noautoconnection.pro
index fba94debf..6937e8e54 100644
--- a/src/designer/src/designer/doc/snippets/noautoconnection/noautoconnection.pro
+++ b/src/designer/src/designer/doc/snippets/noautoconnection/noautoconnection.pro
@@ -1,4 +1,5 @@
TEMPLATE = app
+QT += widgets
FORMS = imagedialog.ui
HEADERS = imagedialog.h
SOURCES = imagedialog.cpp \
diff --git a/src/designer/src/designer/doc/snippets/plugins/doc_src_qtdesigner.cpp b/src/designer/src/designer/doc/snippets/plugins/doc_src_qtdesigner.cpp
index 79952c13c..6ac5db04f 100644
--- a/src/designer/src/designer/doc/snippets/plugins/doc_src_qtdesigner.cpp
+++ b/src/designer/src/designer/doc/snippets/plugins/doc_src_qtdesigner.cpp
@@ -1,57 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-#include <QtDesigner>
-//! [0]
-
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [2]
QDesignerMemberSheetExtension *memberSheet = nullptr;
@@ -280,7 +228,7 @@ QDesignerPropertySheetExtension *propertySheet = nullptr;
QExtensionManager manager = formEditor->extensionManager();
propertySheet = qt_extension<QDesignerPropertySheetExtension*>(manager, widget);
-int index = propertySheet->indexOf(QLatin1String("margin"));
+int index = propertySheet->indexOf(u"margin"_s);
propertySheet->setProperty(index, 10);
propertySheet->setChanged(index, true);
diff --git a/src/designer/src/designer/doc/snippets/plugins/doc_src_qtdesigner.pro b/src/designer/src/designer/doc/snippets/plugins/doc_src_qtdesigner.pro
deleted file mode 100644
index 45f3af52f..000000000
--- a/src/designer/src/designer/doc/snippets/plugins/doc_src_qtdesigner.pro
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#! [1]
-CONFIG += designer
-#! [1]
diff --git a/src/designer/src/designer/doc/snippets/singleinheritance/CMakeLists.txt b/src/designer/src/designer/doc/snippets/singleinheritance/CMakeLists.txt
new file mode 100644
index 000000000..ac5c2be1a
--- /dev/null
+++ b/src/designer/src/designer/doc/snippets/singleinheritance/CMakeLists.txt
@@ -0,0 +1,24 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(singleinheritanceinheritance LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTOUIC ON)
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+
+qt_add_executable(singleinheritanceinheritance
+ imagedialog.cpp imagedialog.h imagedialog.ui main.cpp)
+
+set_target_properties(singleinheritanceinheritance PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(singleinheritanceinheritance PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Widgets
+)
diff --git a/src/designer/src/designer/doc/snippets/singleinheritance/imagedialog.cpp b/src/designer/src/designer/doc/snippets/singleinheritance/imagedialog.cpp
index d6912dc7f..4cf642d17 100644
--- a/src/designer/src/designer/doc/snippets/singleinheritance/imagedialog.cpp
+++ b/src/designer/src/designer/doc/snippets/singleinheritance/imagedialog.cpp
@@ -1,54 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "imagedialog.h"
@@ -64,6 +15,6 @@ ImageDialog::ImageDialog(QWidget *parent)
ui.colorDepthCombo->addItem(tr("65536 colors (16 bits per pixel)"));
ui.colorDepthCombo->addItem(tr("16 million colors (24 bits per pixel)"));
- connect(ui.okButton, SIGNAL(clicked()), this, SLOT(accept()));
- connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(ui.okButton, &QAbstractButton::clicked, this, &QDialog::accept);
+ connect(ui.cancelButton, &QAbstractButton::clicked, this, &QDialog::reject);
}
diff --git a/src/designer/src/designer/doc/snippets/singleinheritance/imagedialog.h b/src/designer/src/designer/doc/snippets/singleinheritance/imagedialog.h
index 53657df1a..6fd2df0e0 100644
--- a/src/designer/src/designer/doc/snippets/singleinheritance/imagedialog.h
+++ b/src/designer/src/designer/doc/snippets/singleinheritance/imagedialog.h
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef IMAGEDIALOG_H
#define IMAGEDIALOG_H
@@ -58,7 +11,7 @@ class ImageDialog : public QDialog
Q_OBJECT
public:
- ImageDialog(QWidget *parent = 0);
+ explicit ImageDialog(QWidget *parent = nullptr);
private:
Ui::ImageDialog ui;
diff --git a/src/designer/src/designer/doc/snippets/singleinheritance/main.cpp b/src/designer/src/designer/doc/snippets/singleinheritance/main.cpp
index 95daf2dec..5c05efddb 100644
--- a/src/designer/src/designer/doc/snippets/singleinheritance/main.cpp
+++ b/src/designer/src/designer/doc/snippets/singleinheritance/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "imagedialog.h"
diff --git a/src/designer/src/designer/doc/snippets/singleinheritance/singleinheritance.pro b/src/designer/src/designer/doc/snippets/singleinheritance/singleinheritance.pro
index fba94debf..6937e8e54 100644
--- a/src/designer/src/designer/doc/snippets/singleinheritance/singleinheritance.pro
+++ b/src/designer/src/designer/doc/snippets/singleinheritance/singleinheritance.pro
@@ -1,4 +1,5 @@
TEMPLATE = app
+QT += widgets
FORMS = imagedialog.ui
HEADERS = imagedialog.h
SOURCES = imagedialog.cpp \
diff --git a/src/designer/src/designer/doc/snippets/uitools/calculatorform/CMakeLists.txt b/src/designer/src/designer/doc/snippets/uitools/calculatorform/CMakeLists.txt
new file mode 100644
index 000000000..ace6f3d1d
--- /dev/null
+++ b/src/designer/src/designer/doc/snippets/uitools/calculatorform/CMakeLists.txt
@@ -0,0 +1,26 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#! [0]
+cmake_minimum_required(VERSION 3.16)
+project(calculatorform LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTOUIC ON)
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+
+qt_add_executable(calculatorform
+ calculatorform.ui main.cpp)
+
+set_target_properties(calculatorform PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(calculatorform PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Widgets
+)
+#! [0]
diff --git a/src/designer/src/designer/doc/snippets/uitools/calculatorform/main.cpp b/src/designer/src/designer/doc/snippets/uitools/calculatorform/main.cpp
index e34c812a3..8e9c32bb0 100644
--- a/src/designer/src/designer/doc/snippets/uitools/calculatorform/main.cpp
+++ b/src/designer/src/designer/doc/snippets/uitools/calculatorform/main.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [0]
#include "ui_calculatorform.h"
diff --git a/src/designer/src/designer/doc/src/designer-custom-widgets.qdoc b/src/designer/src/designer/doc/src/designer-custom-widgets.qdoc
index 51c749c53..d7cc6a0fa 100644
--- a/src/designer/src/designer/doc/src/designer-custom-widgets.qdoc
+++ b/src/designer/src/designer/doc/src/designer-custom-widgets.qdoc
@@ -1,33 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\page qtdesigner-components.html
- \title Creating and Using Components for Qt Designer
+ \title Creating and Using Components for Qt Widgets Designer
\brief How to create and use custom widget plugins.
\ingroup best-practices
@@ -127,5 +103,5 @@
For a complete example using QUiLoader, see
the \l {calculatorbuilder}{Calculator Builder example}.
- \sa {Qt Designer Manual}, {Qt UI Tools}
+ \sa {Qt Widgets Designer Manual}, {Qt UI Tools}
*/
diff --git a/src/designer/src/designer/doc/src/designer-examples.qdoc b/src/designer/src/designer/doc/src/designer-examples.qdoc
index 72f7fb500..6eb9dc8a0 100644
--- a/src/designer/src/designer/doc/src/designer-examples.qdoc
+++ b/src/designer/src/designer/doc/src/designer-examples.qdoc
@@ -1,42 +1,18 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\group examples-designer
\ingroup all-examples
- \title Qt Designer Examples
- \brief Using Qt Designer to build your UI.
+ \title Qt Widgets Designer Examples
+ \brief Using \QD to build your UI.
- Qt Designer is a capable graphical user interface designer that lets you
+ \QD is a capable graphical user interface designer that lets you
create and configure forms without writing code. GUIs created with
- Qt Designer can be compiled into an application or created at run-time.
+ \QD can be compiled into an application or created at run-time.
- The following examples illustrate how to create and use Qt Designer forms
- and how to create Qt Designer custom widget plugins.
+ The following examples illustrate how to create and use \QD forms
+ and how to create \QD custom widget plugins.
*/
/*
@@ -44,11 +20,10 @@
\li \l{arthurplugin}{Arthur Plugin}
\li \l{calculatorbuilder}{Calculator Builder}\raisedaster
\li \l{calculatorform}{Calculator Form}\raisedaster
+ \li \l{calculatorform_mi}{Calculator Form/Multiple Inheritance}\raisedaster
\li \l{customwidgetplugin}{Custom Widget Plugin}\raisedaster
\li \l{taskmenuextension}{Task Menu Extension}\raisedaster
\li \l{containerextension}{Container Extension}\raisedaster
- \li \l{worldtimeclockbuilder}{World Time Clock Builder}\raisedaster
- \li \l{worldtimeclockplugin}{World Time Clock Plugin}\raisedaster
\endlist
Examples marked with an asterisk (*) are fully documented.
diff --git a/src/designer/src/designer/doc/src/designer-manual.qdoc b/src/designer/src/designer/doc/src/designer-manual.qdoc
index 82f81d98b..50a7835f1 100644
--- a/src/designer/src/designer/doc/src/designer-manual.qdoc
+++ b/src/designer/src/designer/doc/src/designer-manual.qdoc
@@ -1,89 +1,68 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\page qtdesigner-manual.html
- \title Qt Designer Manual
+ \title Qt Widgets Designer Manual
\ingroup qttools
- \keyword Qt Designer
+ \keyword Qt Widgets Designer
\QD is the Qt tool for designing and building graphical user
- interfaces (GUIs) with \l {Qt Widgets}. You can compose and customize your
- windows or dialogs in a what-you-see-is-what-you-get (WYSIWYG) manner, and
- test them using different styles and resolutions.
-
- Widgets and forms created with \QD integrate seamlessly with programmed
- code, using Qt's signals and slots mechanism, so that you can easily assign
- behavior to graphical elements. All properties set in \QD can be changed
- dynamically within the code. Furthermore, features like widget promotion
- and custom plugins allow you to use your own components with \QD.
-
- \note You have the option of using \l {Qt Quick} for user interface
+ interfaces (GUIs) with \l {Qt Widgets}. For user interface design with
+ \l {Qt Quick}, see \l {Qt Design Studio Manual} {Qt Design Studio}.
+
+ You can compose and customize your windows or dialogs in a
+ what-you-see-is-what-you-get (WYSIWYG) manner, and test them using different
+ styles and resolutions. Widgets and forms created with \QD integrate
+ seamlessly with programmed code, using Qt's signals and slots mechanism, so
+ that you can easily assign behavior to graphical elements. All properties
+ set in \QD can be changed dynamically within the code. Furthermore, features
+ like widget promotion and custom plugins allow you to use your own
+ components with \QD.
+
+ \note You have the option of using \l {Qt Quick} and
+ \l {Qt Design Studio Manual}{Qt Design Studio} for user interface
design rather than widgets. It is a much easier way to write many kinds of
applications. It enables a completely customizable appearance,
- touch-reactive elements, and smooth animated transitions, backed up by the
- power of OpenGL graphics acceleration.
+ touch-reactive elements, and smooth animated transitions, taking advantage
+ of hardware acceleration.
If you are new to \QD, you can take a look at the
- \l{Getting To Know Qt Designer} document. For a quick tutorial on how to
- use \QD, refer to \l{A Quick Start to Qt Designer}.
+ \l{Getting To Know Qt Widgets Designer} document. For a quick tutorial on how to
+ use \QD, refer to \l{A Quick Start to Qt Widgets Designer}.
\image designer-multiple-screenshot.png
\section1 Table of Contents
\list
- \li \l{A Quick Start to Qt Designer}
- \li \l{Qt Designer's Editing Modes}
+ \li \l{A Quick Start to Qt Widgets Designer}
+ \li \l{Qt Widgets Designer's Editing Modes}
\list
- \li \l{Qt Designer's Widget Editing Mode}{Widget Editing Mode}
- \li \l{Qt Designer's Signals and Slots Editing Mode}
+ \li \l{Qt Widgets Designer's Widget Editing Mode}{Widget Editing Mode}
+ \li \l{Qt Widgets Designer's Signals and Slots Editing Mode}
{Signals and Slots Editing Mode}
- \li \l{Qt Designer's Buddy Editing Mode}
+ \li \l{Qt Widgets Designer's Buddy Editing Mode}
{Buddy Editing Mode}
- \li \l{Qt Designer's Tab Order Editing Mode}
+ \li \l{Qt Widgets Designer's Tab Order Editing Mode}
{Tab Order Editing Mode}
\endlist
- \li \l{Using Layouts in Qt Designer}
- \li \l{Saving, Previewing and Printing Forms in Qt Designer}
- \li \l{Using Containers in Qt Designer}
- \li \l{Creating Main Windows in Qt Designer}
- \li \l{Editing Resources with Qt Designer}
- \li \l{Using Stylesheets with Qt Designer}
+ \li \l{Using Layouts in Qt Widgets Designer}
+ \li \l{Saving, Previewing and Printing Forms in Qt Widgets Designer}
+ \li \l{Using Containers in Qt Widgets Designer}
+ \li \l{Creating Main Windows in Qt Widgets Designer}
+ \li \l{Editing Resources with Qt Widgets Designer}
+ \li \l{Using Stylesheets with Qt Widgets Designer}
\li \l{Using a Designer UI File in Your C++ Application}
\li \l{Using a Designer UI File in Your Qt for Python Application}
\li Advanced Use
\list
- \li \l{Customizing Qt Designer Forms}
- \li \l{Using Custom Widgets with Qt Designer}
- \li \l{Creating Custom Widgets for Qt Designer}
+ \li \l{Customizing Qt Widgets Designer Forms}
+ \li \l{Using Custom Widgets with Qt Widgets Designer}
+ \li \l{Creating Custom Widgets for Qt Widgets Designer}
\li \l{Creating Custom Widget Extensions}
- \li \l{Qt Designer's UI File Format}
+ \li \l{Qt Widgets Designer's UI File Format}
\endlist
\endlist
*/
@@ -93,7 +72,7 @@
\page designer-to-know.html
- \title Getting to Know Qt Designer
+ \title Getting to Know Qt Widgets Designer
\image designer-screenshot.png
@@ -129,7 +108,7 @@
\table
\row
\li \inlineimage designer-main-window.png
- \li \b{Qt Designer's Main Window}
+ \li \b{Qt Widgets Designer's Main Window}
The menu bar provides all the standard actions for managing forms,
using the clipboard, and accessing application-specific help.
@@ -153,7 +132,7 @@
\table
\row
\li \inlineimage designer-widget-box.png
- \li \b{Qt Designer's Widget Box}
+ \li \b{Qt Widgets Designer's Widget Box}
The widget box provides a selection of standard Qt widgets, layouts,
and other objects that can be used to create user interfaces on forms.
@@ -162,7 +141,7 @@
You can display all of the available objects in a category by clicking
on the handle next to the category label. When in
- \l{Qt Designer's Widget Editing Mode}{Widget Editing
+ \l{Qt Widgets Designer's Widget Editing Mode}{Widget Editing
Mode}, you can add objects to a form by dragging the appropriate items
from the widget box onto the form, and dropping them in the required
locations.
@@ -260,7 +239,7 @@
\page designer-quick-start.html
- \title A Quick Start to Qt Designer
+ \title A Quick Start to Qt Widgets Designer
Using \QD involves \b four basic steps:
@@ -396,15 +375,15 @@
/*!
\page designer-editing-mode.html
- \previouspage Getting to Know Qt Designer
- \nextpage Using Layouts in Qt Designer
+ \previouspage Getting to Know Qt Widgets Designer
+ \nextpage Using Layouts in Qt Widgets Designer
- \title Qt Designer's Editing Modes
+ \title Qt Widgets Designer's Editing Modes
- \QD provides four editing modes: \l{Qt Designer's Widget Editing Mode}
- {Widget Editing Mode}, \l{Qt Designer's Signals and Slots Editing Mode}
- {Signals and Slots Editing Mode}, \l{Qt Designer's Buddy Editing Mode}
- {Buddy Editing Mode} and \l{Qt Designer's Tab Order Editing Mode}
+ \QD provides four editing modes: \l{Qt Widgets Designer's Widget Editing Mode}
+ {Widget Editing Mode}, \l{Qt Widgets Designer's Signals and Slots Editing Mode}
+ {Signals and Slots Editing Mode}, \l{Qt Widgets Designer's Buddy Editing Mode}
+ {Buddy Editing Mode} and \l{Qt Widgets Designer's Tab Order Editing Mode}
{Tab Order Editing Mode}. When working with \QD, you will always be in one
of these four modes. To switch between modes, simply select it from the
\gui{Edit} menu or the toolbar. The table below describes these modes in
@@ -414,27 +393,27 @@
\header \li \li \b{Editing Modes}
\row
\li \inlineimage designer-widget-tool.png
- \li In \l{Qt Designer's Widget Editing Mode}{Edit} mode, we can
+ \li In \l{Qt Widgets Designer's Widget Editing Mode}{Edit} mode, we can
change the appearance of the form, add layouts, and edit the
properties of each widget. To switch to this mode, press
\key{F3}. This is \QD's default mode.
\row
\li \inlineimage designer-connection-tool.png
- \li In \l{Qt Designer's Signals and Slots Editing Mode}
+ \li In \l{Qt Widgets Designer's Signals and Slots Editing Mode}
{Signals and Slots} mode, we can connect widgets together using
Qt's signals and slots mechanism. To switch to this mode, press
\key{F4}.
\row
\li \inlineimage designer-buddy-tool.png
- \li In \l{Qt Designer's Buddy Editing Mode}{Buddy Editing Mode},
+ \li In \l{Qt Widgets Designer's Buddy Editing Mode}{Buddy Editing Mode},
buddy widgets can be assigned to label widgets to help them
handle keyboard focus correctly.
\row
\li \inlineimage designer-tab-order-tool.png
- \li In \l{Qt Designer's Tab Order Editing Mode}
+ \li In \l{Qt Widgets Designer's Tab Order Editing Mode}
{Tab Order Editing Mode}, we can set the order in which widgets
receive the keyboard focus.
\endtable
@@ -444,10 +423,10 @@
/*!
\page designer-widget-mode.html
- \previouspage Qt Designer's Editing Modes
- \nextpage Qt Designer's Signals and Slots Editing Mode
+ \previouspage Qt Widgets Designer's Editing Modes
+ \nextpage Qt Widgets Designer's Signals and Slots Editing Mode
- \title Qt Designer's Widget Editing Mode
+ \title Qt Widgets Designer's Widget Editing Mode
\image designer-editing-mode.png
@@ -490,7 +469,7 @@
The widget box contains objects in a number of different categories, all of
which can be placed on the form as required. The only objects that require
a little more preparation are the \gui Container widgets. These are
- described in further detail in the \l{Using Containers in Qt Designer}
+ described in further detail in the \l{Using Containers in Qt Widgets Designer}
chapter.
@@ -683,10 +662,10 @@
/*!
\page designer-layouts.html
- \previouspage Qt Designer's Widget Editing Mode
- \nextpage Qt Designer's Signals and Slots Editing Mode
+ \previouspage Qt Widgets Designer's Widget Editing Mode
+ \nextpage Qt Widgets Designer's Signals and Slots Editing Mode
- \title Using Layouts in Qt Designer
+ \title Using Layouts in Qt Widgets Designer
Before a form can be used, the objects on the form need to be placed into
layouts. This ensures that the objects will be displayed properly when the
@@ -829,7 +808,7 @@
Although QSplitter is a container widget, \QD treats splitter objects as
layouts that are applied to existing widgets. To place a group of widgets
into a splitter, select them
- \l{Qt Designer's Widget Editing Mode#SelectingObjects}{as described here}
+ \l{Qt Widgets Designer's Widget Editing Mode#SelectingObjects}{as described here}
then apply the splitter layout by using the appropriate toolbar button,
keyboard shortcut, or \gui{Lay out} context menu entry.
@@ -886,9 +865,9 @@
/*!
\page designer-preview.html
- \previouspage Using Layouts in Qt Designer
- \nextpage Qt Designer's Buddy Editing Mode
- \title Saving, Previewing and Printing Forms in Qt Designer
+ \previouspage Using Layouts in Qt Widgets Designer
+ \nextpage Qt Widgets Designer's Buddy Editing Mode
+ \title Saving, Previewing and Printing Forms in Qt Widgets Designer
Although \QD's forms are accurate representations of the components being
edited, it is useful to preview the final appearance while editing. This
@@ -966,11 +945,11 @@
/*!
\page designer-connection-mode.html
- \previouspage Using Layouts in Qt Designer
- \nextpage Qt Designer's Buddy Editing Mode
+ \previouspage Using Layouts in Qt Widgets Designer
+ \nextpage Qt Widgets Designer's Buddy Editing Mode
- \title Qt Designer's Signals and Slots Editing Mode
+ \title Qt Widgets Designer's Signals and Slots Editing Mode
\image designer-connection-mode.png
@@ -1099,10 +1078,10 @@
/*!
\page designer-buddy-mode.html
- \previouspage Qt Designer's Signals and Slots Editing Mode
- \nextpage Qt Designer's Tab Order Editing Mode
+ \previouspage Qt Widgets Designer's Signals and Slots Editing Mode
+ \nextpage Qt Widgets Designer's Tab Order Editing Mode
- \title Qt Designer's Buddy Editing Mode
+ \title Qt Widgets Designer's Buddy Editing Mode
\image designer-buddy-mode.png
@@ -1116,7 +1095,7 @@
To enter buddy editing mode, open the \gui Edit menu and select
\gui{Edit Buddies}. This mode presents the widgets on the form in a similar
- way to \l{Qt Designer's Signals and Slots Editing Mode}{signals and slots
+ way to \l{Qt Widgets Designer's Signals and Slots Editing Mode}{signals and slots
editing mode} but in this mode, connections must start at label widgets.
Ideally, you should connect each label widget that provides a shortcut with
a suitable input widget, such as a QLineEdit.
@@ -1152,10 +1131,10 @@
/*!
\page designer-tab-order.html
- \previouspage Qt Designer's Buddy Editing Mode
- \nextpage Using Containers in Qt Designer
+ \previouspage Qt Widgets Designer's Buddy Editing Mode
+ \nextpage Using Containers in Qt Widgets Designer
- \title Qt Designer's Tab Order Editing Mode
+ \title Qt Widgets Designer's Tab Order Editing Mode
\image designer-tab-order-mode.png
@@ -1200,11 +1179,11 @@
/*!
\page designer-using-containers.html
- \previouspage Qt Designer's Tab Order Editing Mode
- \nextpage Creating Main Windows in Qt Designer
+ \previouspage Qt Widgets Designer's Tab Order Editing Mode
+ \nextpage Creating Main Windows in Qt Widgets Designer
- \title Using Containers in Qt Designer
+ \title Using Containers in Qt Widgets Designer
Container widgets provide high level control over groups of objects on a
form. They can be used to perform a variety of functions, such as managing
@@ -1254,8 +1233,7 @@
checkboxes and radio buttons with similar purposes.
Among the significant properties of group boxes are \c title, \c flat,
- \c checkable, and \c checked. These are demonstrated in the
- \l{widgets/groupbox}{Group Box} example, and described in the QGroupBox
+ \c checkable, and \c checked, as described in the \l QGroupBox
class documentation. Each group box can contain its own layout, and
this is necessary if it contains other widgets. To add a layout to the
group box, click inside it and apply the layout as usual.
@@ -1329,7 +1307,7 @@
Although dock widgets can be added to any type of form, they are
typically used with forms created from the
- \l{Creating Main Windows in Qt Designer}{main window template}.
+ \l{Creating Main Windows in Qt Widgets Designer}{main window template}.
\endtable
*/
@@ -1337,10 +1315,10 @@
/*!
\page designer-creating-mainwindows.html
- \previouspage Using Containers in Qt Designer
- \nextpage Editing Resources with Qt Designer
+ \previouspage Using Containers in Qt Widgets Designer
+ \nextpage Editing Resources with Qt Widgets Designer
- \title Creating Main Windows in Qt Designer
+ \title Creating Main Windows in Qt Widgets Designer
\QD can be used to create user interfaces for different purposes, and
it provides different kinds of form templates for each user interface. The
@@ -1372,9 +1350,9 @@
will not be displayed in the preview or in the finished window.
Once created, the properties of a menu can be accessed using the
- \l{Qt Designer's Widget Editing Mode#The Property Editor}{Property Editor},
+ \l{Qt Widgets Designer's Widget Editing Mode#The Property Editor}{Property Editor},
and each menu can be accessed for this purpose via the
- \l{Qt Designer's Widget Editing Mode#The Object Inspector}{The Object Inspector}.
+ \l{Qt Widgets Designer's Widget Editing Mode#The Object Inspector}{The Object Inspector}.
Existing menus can be removed by opening a context menu over the label in
the menu bar, and selecting \gui{Remove Menu 'menu_name'}.
@@ -1555,7 +1533,7 @@
\section1 Dock Widgets
- Dock widgets are \l{Using Containers in Qt Designer}{container widgets}
+ Dock widgets are \l{Using Containers in Qt Widgets Designer}{container widgets}
as well. They can be added to a form by dropping them onto the desired
dock area.
@@ -1589,10 +1567,10 @@
/*!
\page designer-resources.html
- \previouspage Creating Main Windows in Qt Designer
- \nextpage Using Stylesheets with Qt Designer
+ \previouspage Creating Main Windows in Qt Widgets Designer
+ \nextpage Using Stylesheets with Qt Widgets Designer
- \title Editing Resources with Qt Designer
+ \title Editing Resources with Qt Widgets Designer
\image designer-resources-editing.png
@@ -1693,10 +1671,10 @@ pixmap property in the property editor.
/*!
\page designer-stylesheet.html
- \previouspage Editing Resources with Qt Designer
+ \previouspage Editing Resources with Qt Widgets Designer
\nextpage Using a Designer UI File in Your C++ Application
- \title Using Stylesheets with Qt Designer
+ \title Using Stylesheets with Qt Widgets Designer
Since Qt 4.2, it is possible to edit stylesheets in \QD with the stylesheet
editor.
@@ -1719,13 +1697,13 @@ pixmap property in the property editor.
/*!
\page designer-using-a-ui-file.html
- \previouspage Using Stylesheets with Qt Designer
+ \previouspage Using Stylesheets with Qt Widgets Designer
\nextpage Using a Designer UI File in Your Qt for Python Application
\keyword Using a Designer UI File in Your Application
\title Using a Designer UI File in Your C++ Application
- Qt Designer UI files represent the widget tree of the form in XML format. The
+ Qt Widgets Designer UI files represent the widget tree of the form in XML format. The
forms can be processed:
\list
@@ -1773,7 +1751,7 @@ pixmap property in the property editor.
\endlist
To demonstrate, we create a simple Calculator Form application. It is based on the
- original \l{Calculator Form Example}{Calculator Form} example.
+ original \l{Calculator Form} example.
The application consists of one source file, \c main.cpp and a UI
file.
@@ -1782,10 +1760,19 @@ pixmap property in the property editor.
\image directapproach-calculatorform.png
- We will use \c qmake to build the executable, so we need to write a
- \c{.pro} file:
+ When using \c CMake to build the executable, a \c{CMakeLists.txt}
+ file is required:
- \snippet calculatorform/calculatorform.pro 0
+ \snippet uitools/calculatorform/CMakeLists.txt 0
+
+ The form is listed among the C++ source files in \c qt_add_executable().
+ The option \c CMAKE_AUTOUIC tells \c CMake to run the \c uic tool
+ to create a \c ui_calculatorform.h file that can be used
+ by the source files.
+
+ When using \c qmake to build the executable, a \c{.pro} file is required:
+
+ \snippet uitools/calculatorform/calculatorform.pro 0
The special feature of this file is the \c FORMS declaration that tells
\c qmake which files to process with \c uic. In this case, the
@@ -1793,8 +1780,8 @@ pixmap property in the property editor.
that can be used by any file listed in the \c SOURCES declaration.
\note You can use Qt Creator to create the Calculator Form project. It
- automatically generates the main.cpp, UI, and .pro files, which you can
- then modify.
+ automatically generates the main.cpp, UI, and a project file for the
+ desired build tool, which you can modify.
\section2 The Direct Approach
@@ -1841,16 +1828,19 @@ pixmap property in the property editor.
interface and other objects in your application.
The generated \c{Ui::CalculatorForm} structure is a member of the class.
- This approach is used in the \l{Calculator Form Example}{Calculator Form}
- example.
+ This approach is used in the \l{Calculator Form} example.
To ensure that we can use the user interface, we need to include the header
file that \c uic generates before referring to \c{Ui::CalculatorForm}:
\snippet calculatorform/calculatorform.h 0
- This means that the \c{.pro} file must be updated to include
- \c{calculatorform.h}:
+ The project file must be updated to include \c{calculatorform.h}.
+ For \c CMake:
+
+ \snippet calculatorform/CMakeLists.txt 1
+
+ For \c qmake:
\snippet calculatorform/calculatorform.pro 0
@@ -1935,20 +1925,17 @@ pixmap property in the property editor.
and enables signal and slot connections to be made in the usual way with
the \l{QObject::connect()}{connect()} function.
- This approach is used in the \l{Multiple Inheritance Example}
- {Multiple Inheritance} example.
-
We need to include the header file that \c uic generates from the
\c calculatorform.ui file, as follows:
- \snippet ../uitools/multipleinheritance/calculatorform.h 0
+ \snippet ../designer/calculatorform_mi/calculatorform.h 0
The class is defined in a similar way to the one used in the
\l{The Single Inheritance Approach}{single inheritance approach}, except that
this time we inherit from \e{both} QWidget and \c{Ui::CalculatorForm},
as follows:
- \snippet ../uitools/multipleinheritance/calculatorform.h 1
+ \snippet ../designer/calculatorform_mi/calculatorform.h 1
We inherit \c{Ui::CalculatorForm} privately to ensure that the user
interface objects are private in our subclass. We can also inherit it with
@@ -1959,7 +1946,7 @@ pixmap property in the property editor.
constructor used in the \l{The Single Inheritance Approach}
{single inheritance} example:
- \snippet ../uitools/multipleinheritance/calculatorform.cpp 0
+ \snippet ../designer/calculatorform_mi/calculatorform.cpp 0
In this case, the widgets used in the user interface can be accessed in the
same say as a widget created in code by hand. We no longer require the
@@ -1997,10 +1984,15 @@ pixmap property in the property editor.
A resource file containing a UI file is required to process forms at
run time. Also, the application needs to be configured to use the QtUiTools
- module. This is done by including the following declaration in a \c qmake
+ module. This is done by including the following declarations in a \c CMake
project file, ensuring that the application is compiled and linked
appropriately.
+ \snippet ../uitools/textfinder/CMakeLists.txt 0
+ \snippet ../uitools/textfinder/CMakeLists.txt 1
+
+ For \c qmake:
+
\snippet manual/doc_src_designer-manual.pro 0
The QUiLoader class provides a form loader object to construct the user
@@ -2014,7 +2006,7 @@ pixmap property in the property editor.
\snippet manual/doc_src_designer-manual.cpp 1
The QUiLoader::load() function is invoked as shown in this code from the
- \l{Text Finder Example}{Text Finder} example:
+ \l{Text Finder} example:
\snippet ../uitools/textfinder/textfinder.cpp 4
@@ -2085,13 +2077,17 @@ pixmap property in the property editor.
\snippet manual/doc_src_designer-manual.cpp 2
+ \note When renaming widgets in the form, the slot names need to be
+ adapted accordingly, which can become a maintenance problem.
+ For this reason, we recommend against using this in new code.
+
Using this convention, we can define and implement a slot that responds to
mouse clicks on the \gui OK button:
\snippet autoconnection/imagedialog.h 0
Another example of automatic signal and slot connection would be the
- \l{Text Finder Example}{Text Finder} with its \c{on_findButton_clicked()}
+ \l{Text Finder} with its \c{on_findButton_clicked()}
slot.
We use QMetaObject's system to enable signal and slot connections:
@@ -2114,7 +2110,7 @@ pixmap property in the property editor.
/*!
\page designer-using-a-ui-file-python.html
\previouspage Using a Designer UI File in Your C++ Application
- \nextpage Using Custom Widgets with Qt Designer
+ \nextpage Using Custom Widgets with Qt Widgets Designer
\title Using a Designer UI File in Your Qt for Python Application
@@ -2196,14 +2192,78 @@ pixmap property in the property editor.
widget.show()
sys.exit(app.exec_())
\endcode
+
+ \section1 Resource imports
+
+ \section2 Single directory usage
+
+ When using icons from \l{The Qt Resource System}{resource files}, say
+ \c resources.qrc, \c uic will generate an import of the form:
+
+ \code
+ import resources_rc
+ \endcode
+
+ This assumes that a file \c resources_rc.py generated by calling the
+ \l {Resource Compiler (rcc)} tool (passing the \c {-g python}
+ command line option) exists in the same directory as the form source.
+
+ \c uic has a command line option \c --rc-prefix causing the \c rc indicator
+ to be prepended:
+
+ \code
+ import rc_resources
+ \endcode
+
+ The command line option \c --from-imports causes the imports to be generated
+ relative to '.':
+
+ \code
+ from . import resources_rc
+ \endcode
+
+ \section2 Directory trees
+
+ Some projects have more complicated directory trees, for example:
+
+ \badcode
+ project
+ resources (resources.qrc)
+ ui (.ui files)
+ \endcode
+
+ The resource file is then not in the same directory as the form source
+ and the \c .ui files typically have relative paths to the resource files:
+
+ \badcode
+ <include location="../resources/resources.qrc"/>
+ \endcode
+
+ In this case, the command line option \c --absolute-imports can be used
+ to generate an absolute import in Python, resulting in:
+
+ \code
+ import resources.resources_rc
+ \endcode
+
+ based on the assumption that \c .. is the root directory of the project
+ contained in the Python import path list.
+
+ For more deeply nested trees, it is possible to use the
+ command line option \c {--python-paths <path list>} to pass a Python
+ import path list. \c uic will then try to determine the project root
+ by matching the form file path against the path components.
+
+ If \c {--python-paths} is not given, the environment variable
+ \c PYTHONPATH is by default checked.
*/
/*!
\page designer-customizing-forms.html
\previouspage Using a Designer UI File in Your Qt for Python Application
- \nextpage Using Custom Widgets with Qt Designer
+ \nextpage Using Custom Widgets with Qt Widgets Designer
- \title Customizing Qt Designer Forms
+ \title Customizing Qt Widgets Designer Forms
\image designer-form-settings.png
@@ -2256,10 +2316,10 @@ pixmap property in the property editor.
/*!
\page designer-using-custom-widgets.html
- \previouspage Customizing Qt Designer Forms
- \nextpage Creating Custom Widgets for Qt Designer
+ \previouspage Customizing Qt Widgets Designer Forms
+ \nextpage Creating Custom Widgets for Qt Widgets Designer
- \title Using Custom Widgets with Qt Designer
+ \title Using Custom Widgets with Qt Widgets Designer
\QD can display custom widgets through its extensible plugin mechanism,
allowing the range of designable widgets to be extended by the user and
@@ -2330,19 +2390,17 @@ pixmap property in the property editor.
\section2 User Defined Custom Widgets
- \image worldtimeclockplugin-example.png
-
Custom widgets can be adapted for use with \QD, giving designers the
opportunity to configure the user interface using the actual widgets that
will be used in an application rather than placeholder widgets. The process
of creating a custom widget plugin is described in the
- \l{Creating Custom Widgets for Qt Designer} chapter of this manual.
+ \l{Creating Custom Widgets for Qt Widgets Designer} chapter of this manual.
To use a plugin created in this way, it is necessary to ensure that the
plugin is located on a path that \QD searches for plugins. Generally,
plugins stored in \c{$QTDIR/plugins/designer} will be loaded when \QD
starts. Further information on building and installing plugins can be found
- \l{Creating Custom Widgets for Qt Designer#BuildingandInstallingthePlugin}
+ \l{Creating Custom Widgets for Qt Widgets Designer#BuildingandInstallingthePlugin}
{here}. You can also refer to the \l{How to Create Qt Plugins}
{Plugins HOWTO} document for information about creating plugins.
*/
@@ -2350,10 +2408,10 @@ pixmap property in the property editor.
/*!
\page designer-creating-custom-widgets.html
- \previouspage Using Custom Widgets with Qt Designer
+ \previouspage Using Custom Widgets with Qt Widgets Designer
\nextpage Creating Custom Widget Extensions
- \title Creating Custom Widgets for Qt Designer
+ \title Creating Custom Widgets for Qt Widgets Designer
\QD's plugin-based architecture allows user-defined and third party custom
widgets to be edited just like you do with standard Qt widgets. All of the
@@ -2362,8 +2420,6 @@ pixmap property in the property editor.
design process, custom widgets will appear the same as they do when
previewed.
- \image worldtimeclockplugin-example.png
-
The \l QtDesigner module provides you with the ability to create custom
widgets in \QD.
@@ -2371,7 +2427,7 @@ pixmap property in the property editor.
\section1 Getting Started
To integrate a custom widget with \QD, you require a suitable description
- for the widget and an appropriate \c{.pro} file.
+ for the widget and an appropriate project file.
\section2 Providing an Interface Description
@@ -2612,28 +2668,39 @@ pixmap property in the property editor.
\section2 A Simple Plugin
- The \l{Custom Widget Plugin Example} demonstrates a simple \QD plugin.
+ The \l{Custom Widget Plugin} demonstrates a simple \QD plugin.
- The \c{.pro} file for a plugin must specify the headers and sources for
+ The project file for a plugin must specify the headers and sources for
both the custom widget and the plugin interface. Typically, this file only
- has to specify that the plugin's project is to be built as a library, but
- with specific plugin support for \QD. This is done with the following
- declarations:
+ has to specify that the plugin's project will be built as a library, but
+ with specific plugin support for \QD. For \c CMake, this is done with
+ the following declarations:
- \snippet customwidgetplugin/customwidgetplugin.pro 0
- \snippet customwidgetplugin/customwidgetplugin.pro 2
+ \snippet customwidgetplugin/CMakeLists.txt 0
+ \snippet customwidgetplugin/CMakeLists.txt 1
+ \snippet customwidgetplugin/CMakeLists.txt 2
- The \c QT variable contains the keyword \c uiplugin. It indicates that
+ The link libraries list specifies \c Qt::UiPlugin. This indicates that
the plugin uses the abstract interfaces QDesignerCustomWidgetInterface
and QDesignerCustomWidgetCollectionInterface only and has no linkage
to the \QD libraries. When accessing other interfaces of \QD that have
- linkage, \c designer should be used instead; this ensures that the plugin
+ linkage, \c Designer should be used instead; this ensures that the plugin
dynamically links to the \QD libraries and has a run-time dependency on
them.
- If plugins are built in a mode that is incompatible with \QD, they will
- not be loaded and installed. For more information about plugins, see the
- \l{plugins-howto.html}{Plugins HOWTO} document.
+ It is also necessary to ensure that the plugin is installed together with
+ other \QD widget plugins:
+
+ \snippet customwidgetplugin/CMakeLists.txt 3
+ \snippet customwidgetplugin/CMakeLists.txt 4
+
+ For \c qmake:
+
+ \snippet customwidgetplugin/customwidgetplugin.pro 0
+ \snippet customwidgetplugin/customwidgetplugin.pro 2
+
+ The \c QT variable contains the keyword \c uiplugin, which is
+ the equivalent of the \c Qt::UiPlugin library.
It is also necessary to ensure that the plugin is installed together with
other \QD widget plugins:
@@ -2650,19 +2717,24 @@ pixmap property in the property editor.
See QCoreApplication::libraryPaths() for more information about customizing
paths for libraries and plugins with Qt applications.
+ If plugins are built in a mode that is incompatible with \QD, they will
+ not be loaded and installed. For more information about plugins, see the
+ \l{plugins-howto.html}{Plugins HOWTO} document.
+
\section2 Splitting up the Plugin
- In a real world scenario, you do not want to have dependencies of the
- application making use of the custom widgets to the \QD headers and
- libraries as introduced by the simple approach explained above.
+ The simple approach explained above introduces a problem particularly
+ when using the other interfaces of \QD that have linkage:
+ The application using the custom widget will then depend on
+ \QD headers and libraries. In a real world scenario, this is not desired.
The following sections describe how to resolve this.
\section3 Linking the Widget into the Application
- The source and header file of the custom widget can be shared
- between the application and \QD by creating a \c{.pri} file for
- inclusion:
+ When using \c qmake, the source and header file of the custom widget
+ can be shared between the application and \QD by creating a \c{.pri}
+ file for inclusion:
\code
INCLUDEPATH += $$PWD
@@ -2677,6 +2749,9 @@ pixmap property in the property editor.
include(customwidget.pri)
\endcode
+ When using \c CMake, the source files of the widget can similarly be
+ added to the application project.
+
\section3 Sharing the Widget Using a Library
Another approach is to put the widget into a library that is linked to
@@ -2694,13 +2769,13 @@ pixmap property in the property editor.
(see QUiLoader::pluginPaths() and related functions). To avoid having
to deploy the \QD libraries onto the target device, those plugins should
have no linkage to the \QD libraries (\c {QT = uiplugin}, see
- \l{Creating Custom Widgets for Qt Designer#BuildingandInstallingthePlugin}).
+ \l{Creating Custom Widgets for Qt Widgets Designer#BuildingandInstallingthePlugin}).
\section1 Related Examples
For more information on using custom widgets in \QD, refer to the
\l{customwidgetplugin}{Custom Widget Plugin} and
- \l{worldtimeclockplugin}{World Time Clock Plugin} examples for more
+ \l{taskmenuextension}{Task Menu Extension} examples for more
information about using custom widgets in \QD. Also, you can use the
QDesignerCustomWidgetCollectionInterface class to combine several custom
widgets into a single library.
@@ -2709,8 +2784,8 @@ pixmap property in the property editor.
/*!
\page designer-creating-custom-widgets-extensions.html
- \previouspage Creating Custom Widgets for Qt Designer
- \nextpage Qt Designer's UI File Format
+ \previouspage Creating Custom Widgets for Qt Widgets Designer
+ \nextpage Qt Widgets Designer's UI File Format
\title Creating Custom Widget Extensions
@@ -2811,7 +2886,7 @@ pixmap property in the property editor.
interfaces using a QObject pointer only.
- \section1 Exposing an Extension to Qt Designer
+ \section1 Exposing an Extension to Qt Widgets Designer
In \QD the extensions are not created until they are required. For this
reason, when implementing extensions, you must subclass QExtensionFactory
@@ -2849,12 +2924,12 @@ pixmap property in the property editor.
\snippet manual/doc_src_designer-manual.cpp 9
- \section2 Accessing Qt Designer's Extension Manager
+ \section2 Accessing Qt Widgets Designer's Extension Manager
When implementing a custom widget plugin, you must subclass the
QDesignerCustomWidgetInterface to expose your plugin to \QD. This is
covered in more detail in the
- \l{Creating Custom Widgets for Qt Designer} section. The registration of
+ \l{Creating Custom Widgets for Qt Widgets Designer} section. The registration of
an extension factory is typically made in the
QDesignerCustomWidgetInterface::initialize() function:
@@ -2881,7 +2956,7 @@ pixmap property in the property editor.
\page designer-ui-file-format.html
\previouspage Creating Custom Widget Extensions
- \title Qt Designer's UI File Format
+ \title Qt Widgets Designer's UI File Format
The \c UI file format used by \QD is described by the
\l{http://www.w3.org/XML/Schema}{XML schema} presented below,
diff --git a/src/designer/src/designer/doc/src/qtdesigner-index.qdoc b/src/designer/src/designer/doc/src/qtdesigner-index.qdoc
index 4330cd308..469cb587f 100644
--- a/src/designer/src/designer/doc/src/qtdesigner-index.qdoc
+++ b/src/designer/src/designer/doc/src/qtdesigner-index.qdoc
@@ -1,58 +1,45 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\page qtdesigner-index.html
- \title Qt Designer
+ \title Qt Widgets Designer
\brief Provides classes to create your own custom widget plugins for
- Qt Designer and classes to access Qt Designer components.
+ \QD and classes to access \QD components.
In addition, the QFormBuilder class provides the possibility of
constructing user interfaces from UI files at run-time.
- \section1 Getting Started
+ \note This documentation covers the tool \QD and classes
+ related to building graphical user interfaces for Qt Widgets.
+ \l {Qt Design Studio Manual}{Qt Design Studio} is a UI composition tool
+ that covers all steps of UI design and implementation for Qt Quick user
+ interfaces.
- To use Qt Designer classes,add this directive into the C++ files:
+ \if !defined(qtforpython)
- \snippet plugins/doc_src_qtdesigner.cpp 0
+ \section1 Using the Module
- To link against the Qt Designer module, add this line to the project file:
+ \include {module-use.qdocinc} {using the c++ api}
- \snippet plugins/doc_src_qtdesigner.pro 1
+ \section2 Building with CMake
+
+ \include {module-use.qdocinc} {building with cmake} {Designer}
+
+ \section2 Building with qmake
+
+ \include {module-use.qdocinc} {building_with_qmake} {designer}
+ \endif
\section1 Articles and Guides
- These articles contain information about Qt Designer.
+ These articles contain information about \QD.
\list
- \li \l{Creating and Using Components for Qt Designer} - Creating and using
+ \li \l{Creating and Using Components for Qt Widgets Designer} - Creating and using
custom widget plugins
- \li \l{Qt Designer Manual} - Using Qt Designer
+ \li \l{Qt Widgets Designer Manual} - Using Qt Widgets Designer
\endlist
\section1 API Reference
@@ -60,7 +47,7 @@
These are links to the API reference material.
\list
- \li \l{Qt Designer C++ Classes}{C++ Classes}
+ \li \l{Qt Widgets Designer C++ Classes}{C++ Classes}
\endlist
*/
diff --git a/src/designer/src/designer/doc/src/qtdesigner-module.qdoc b/src/designer/src/designer/doc/src/qtdesigner-module.qdoc
index 814c65195..1e545de8b 100644
--- a/src/designer/src/designer/doc/src/qtdesigner-module.qdoc
+++ b/src/designer/src/designer/doc/src/qtdesigner-module.qdoc
@@ -1,51 +1,18 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\module QtDesigner
- \title Qt Designer C++ Classes
+ \title Qt Widgets Designer C++ Classes
\ingroup modules
\qtcmakepackage Designer
\qtvariable designer
\brief Provides classes to create your own custom widget plugins for
- Qt Designer and classes to access Qt Designer components.
+ \QD and classes to access \QD components.
In addition, the QFormBuilder class provides the possibility of
constructing user interfaces from UI files at run-time.
-
- To include the definitions of the module classes, use the following
- directive:
-
- \snippet plugins/doc_src_qtdesigner.cpp 0
-
- To link against the module, add this line to your \c qmake .pro file:
-
- \snippet plugins/doc_src_qtdesigner.pro 1
*/
/*!
diff --git a/src/designer/src/designer/images/mdi.png b/src/designer/src/designer/images/mdi.png
deleted file mode 100644
index 5012ab304..000000000
--- a/src/designer/src/designer/images/mdi.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/designer/images/sdi.png b/src/designer/src/designer/images/sdi.png
deleted file mode 100644
index 7fff6e8b6..000000000
--- a/src/designer/src/designer/images/sdi.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/designer/images/workbench.png b/src/designer/src/designer/images/workbench.png
deleted file mode 100644
index 06716a44f..000000000
--- a/src/designer/src/designer/images/workbench.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/designer/main.cpp b/src/designer/src/designer/main.cpp
index 50c586ccc..445996202 100644
--- a/src/designer/src/designer/main.cpp
+++ b/src/designer/src/designer/main.cpp
@@ -1,42 +1,24 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner.h"
#include <QtCore/qlibraryinfo.h>
#include <QtCore/qdir.h>
+#include <QtCore/qoperatingsystemversion.h>
#include <stdlib.h>
QT_USE_NAMESPACE
+static const char rhiBackEndVar[] = "QSG_RHI_BACKEND";
+
int main(int argc, char *argv[])
{
- Q_INIT_RESOURCE(designer);
+ // Enable the QWebEngineView, QQuickWidget plugins on Windows.
+ if (QOperatingSystemVersion::currentType() == QOperatingSystemVersion::Windows
+ && !qEnvironmentVariableIsSet(rhiBackEndVar)) {
+ qputenv(rhiBackEndVar, "gl");
+ }
// required for QWebEngineView
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
diff --git a/src/designer/src/designer/mainwindow.cpp b/src/designer/src/designer/mainwindow.cpp
index 317deec8c..44dbfd25e 100644
--- a/src/designer/src/designer/mainwindow.cpp
+++ b/src/designer/src/designer/mainwindow.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "mainwindow.h"
#include "qdesigner.h"
@@ -54,10 +29,10 @@
#include <algorithm>
-static const char *uriListMimeFormatC = "text/uri-list";
-
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
using ActionList = QList<QAction *>;
// Helpers for creating toolbars and menu
@@ -69,7 +44,9 @@ static void addActionsToToolBar(const ActionList &actions, QToolBar *t)
t->addAction(action);
}
}
-static QToolBar *createToolBar(const QString &title, const QString &objectName, const ActionList &actions)
+
+static QToolBar *createToolBar(const QString &title, const QString &objectName,
+ const ActionList &actions)
{
QToolBar *rc = new QToolBar;
rc->setObjectName(objectName);
@@ -107,23 +84,28 @@ QList<QToolBar *> MainWindowBase::createToolBars(const QDesignerActions *actions
QList<QToolBar *> rc;
if (singleToolBar) {
//: Not currently used (main tool bar)
- QToolBar *main = createToolBar(tr("Main"), QStringLiteral("mainToolBar"), actions->fileActions()->actions());
+ QToolBar *main = createToolBar(tr("Main"), u"mainToolBar"_s,
+ actions->fileActions()->actions());
addActionsToToolBar(actions->editActions()->actions(), main);
addActionsToToolBar(actions->toolActions()->actions(), main);
addActionsToToolBar(actions->formActions()->actions(), main);
rc.push_back(main);
} else {
- rc.push_back(createToolBar(tr("File"), QStringLiteral("fileToolBar"), actions->fileActions()->actions()));
- rc.push_back(createToolBar(tr("Edit"), QStringLiteral("editToolBar"), actions->editActions()->actions()));
- rc.push_back(createToolBar(tr("Tools"), QStringLiteral("toolsToolBar"), actions->toolActions()->actions()));
- rc.push_back(createToolBar(tr("Form"), QStringLiteral("formToolBar"), actions->formActions()->actions()));
+ rc.append(createToolBar(tr("File"), u"fileToolBar"_s,
+ actions->fileActions()->actions()));
+ rc.append(createToolBar(tr("Edit"), u"editToolBar"_s,
+ actions->editActions()->actions()));
+ rc.append(createToolBar(tr("Tools"), u"toolsToolBar"_s,
+ actions->toolActions()->actions()));
+ rc.append(createToolBar(tr("Form"), u"formToolBar"_s,
+ actions->formActions()->actions()));
}
return rc;
}
QString MainWindowBase::mainWindowTitle()
{
- return tr("Qt Designer");
+ return tr("Qt Widgets Designer");
}
// Use the minor Qt version as settings versions to avoid conflicts
@@ -150,7 +132,7 @@ QStringList DockedMdiArea::uiFiles(const QMimeData *d) const
{
// Extract dropped UI files from Mime data.
QStringList rc;
- if (!d->hasFormat(QLatin1String(uriListMimeFormatC)))
+ if (!d->hasFormat("text/uri-list"_L1))
return rc;
const auto urls = d->urls();
if (urls.isEmpty())
@@ -179,10 +161,8 @@ bool DockedMdiArea::event(QEvent *event)
case QEvent::Drop: {
QDropEvent *e = static_cast<QDropEvent*>(event);
const QStringList files = uiFiles(e->mimeData());
- const QStringList::const_iterator cend = files.constEnd();
- for (QStringList::const_iterator it = files.constBegin(); it != cend; ++it) {
- emit fileDropped(*it);
- }
+ for (const auto &f : files)
+ emit fileDropped(f);
e->acceptProposedAction();
return true;
}
@@ -216,12 +196,12 @@ ToolBarManager::ToolBarManager(QMainWindow *configureableMainWindow,
m_toolbars(toolbars)
{
m_configureAction->setMenuRole(QAction::NoRole);
- m_configureAction->setObjectName(QStringLiteral("__qt_configure_tool_bars_action"));
+ m_configureAction->setObjectName(u"__qt_configure_tool_bars_action"_s);
connect(m_configureAction, &QAction::triggered, this, &ToolBarManager::configureToolBars);
m_manager->setMainWindow(configureableMainWindow);
- for (QToolBar *tb : qAsConst(m_toolbars)) {
+ for (QToolBar *tb : std::as_const(m_toolbars)) {
const QString title = tb->windowTitle();
m_manager->addToolBar(tb, title);
addActionsToToolBarManager(tb->actions(), title, m_manager);
@@ -232,7 +212,7 @@ ToolBarManager::ToolBarManager(QMainWindow *configureableMainWindow,
// Filter out the device profile preview actions which have int data().
ActionList previewActions = actions->styleActions()->actions();
- ActionList::iterator it = previewActions.begin();
+ auto it = previewActions.begin();
for ( ; (*it)->isSeparator() || (*it)->data().metaType().id() == QMetaType::Int; ++it) ;
previewActions.erase(previewActions.begin(), it);
addActionsToToolBarManager(previewActions, tr("Style"), m_manager);
@@ -265,7 +245,7 @@ void ToolBarManager::updateToolBarMenu()
std::stable_sort(m_toolbars.begin(), m_toolbars.end(), toolBarTitleLessThan);
// add to menu
m_toolBarMenu->clear();
- for (QToolBar *tb : qAsConst(m_toolbars))
+ for (QToolBar *tb : std::as_const(m_toolbars))
m_toolBarMenu->addAction(tb->toggleViewAction());
m_toolBarMenu->addAction(m_configureAction);
}
@@ -273,7 +253,6 @@ void ToolBarManager::updateToolBarMenu()
void ToolBarManager::configureToolBars()
{
QtToolBarDialog dlg(m_parent);
- dlg.setWindowFlags(dlg.windowFlags() & ~Qt::WindowContextHelpButtonHint);
dlg.setToolBarManager(m_manager);
dlg.exec();
updateToolBarMenu();
@@ -293,10 +272,9 @@ bool ToolBarManager::restoreState(const QByteArray &state, int version)
DockedMainWindow::DockedMainWindow(QDesignerWorkbench *wb,
QMenu *toolBarMenu,
- const QList<QDesignerToolWindow *> &toolWindows) :
- m_toolBarManager(nullptr)
+ const QList<QDesignerToolWindow *> &toolWindows)
{
- setObjectName(QStringLiteral("MDIWindow"));
+ setObjectName(u"MDIWindow"_s);
setWindowTitle(mainWindowTitle());
const QList<QToolBar *> toolbars = createToolBars(wb->actionManager(), false);
@@ -339,13 +317,10 @@ QMdiSubWindow *DockedMainWindow::createMdiSubWindow(QWidget *fw, Qt::WindowFlags
// designer menu actions
if (designerCloseActionShortCut == QKeySequence(QKeySequence::Close)) {
const ActionList systemMenuActions = rc->systemMenu()->actions();
- if (!systemMenuActions.isEmpty()) {
- const ActionList::const_iterator cend = systemMenuActions.constEnd();
- for (ActionList::const_iterator it = systemMenuActions.constBegin(); it != cend; ++it) {
- if ( (*it)->shortcut() == designerCloseActionShortCut) {
- (*it)->setShortcutContext(Qt::WidgetShortcut);
- break;
- }
+ for (auto *a : systemMenuActions) {
+ if (a->shortcut() == designerCloseActionShortCut) {
+ a->setShortcutContext(Qt::WidgetShortcut);
+ break;
}
}
}
@@ -357,7 +332,7 @@ DockedMainWindow::DockWidgetList DockedMainWindow::addToolWindows(const Designer
DockWidgetList rc;
for (QDesignerToolWindow *tw : tls) {
QDockWidget *dockWidget = new QDockWidget;
- dockWidget->setObjectName(tw->objectName() + QStringLiteral("_dock"));
+ dockWidget->setObjectName(tw->objectName() + "_dock"_L1);
dockWidget->setWindowTitle(tw->windowTitle());
addDockWidget(tw->dockWidgetAreaHint(), dockWidget);
dockWidget->setWidget(tw);
diff --git a/src/designer/src/designer/mainwindow.h b/src/designer/src/designer/mainwindow.h
index 756afd256..df41d6f34 100644
--- a/src/designer/src/designer/mainwindow.h
+++ b/src/designer/src/designer/mainwindow.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
@@ -167,7 +142,7 @@ private slots:
void slotSubWindowActivated(QMdiSubWindow*);
private:
- ToolBarManager *m_toolBarManager;
+ ToolBarManager *m_toolBarManager = nullptr;
};
QT_END_NAMESPACE
diff --git a/src/designer/src/designer/newform.cpp b/src/designer/src/designer/newform.cpp
index eea8c7813..3c77bc6a6 100644
--- a/src/designer/src/designer/newform.cpp
+++ b/src/designer/src/designer/newform.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "newform.h"
#include "qdesigner_workbench.h"
@@ -56,6 +31,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
NewForm::NewForm(QDesignerWorkbench *workbench, QWidget *parentWidget, const QString &fileName)
: QDialog(parentWidget, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint),
m_fileName(fileName),
@@ -63,8 +40,7 @@ NewForm::NewForm(QDesignerWorkbench *workbench, QWidget *parentWidget, const QSt
m_workbench(workbench),
m_chkShowOnStartup(new QCheckBox(tr("Show this Dialog on Startup"))),
m_createButton(new QPushButton(QApplication::translate("NewForm", "C&reate", nullptr))),
- m_recentButton(new QPushButton(QApplication::translate("NewForm", "Recent", nullptr))),
- m_buttonBox(nullptr)
+ m_recentButton(new QPushButton(QApplication::translate("NewForm", "Recent", nullptr)))
{
setWindowTitle(tr("New Form"));
QDesignerSettings settings(m_workbench->core());
@@ -125,11 +101,8 @@ NewForm::~NewForm()
void NewForm::recentFileChosen()
{
QAction *action = qobject_cast<QAction *>(sender());
- if (!action)
- return;
- if (action->objectName() == QStringLiteral("__qt_action_clear_menu_"))
- return;
- close();
+ if (action && action->objectName() != "__qt_action_clear_menu_"_L1)
+ close();
}
void NewForm::slotCurrentTemplateChanged(bool templateSelected)
@@ -183,7 +156,7 @@ bool NewForm::openTemplate(QString *ptrToErrorMessage)
QString tempPattern = QDir::tempPath();
if (!tempPattern.endsWith(QDir::separator())) // platform-dependant
tempPattern += QDir::separator();
- tempPattern += QStringLiteral("XXXXXX.ui");
+ tempPattern += "XXXXXX.ui"_L1;
QTemporaryFile tempFormFile(tempPattern);
tempFormFile.setAutoRemove(true);
diff --git a/src/designer/src/designer/newform.h b/src/designer/src/designer/newform.h
index 79b99f7c5..e13f68571 100644
--- a/src/designer/src/designer/newform.h
+++ b/src/designer/src/designer/newform.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef NEWFORM_H
#define NEWFORM_H
@@ -83,7 +58,7 @@ private:
QCheckBox *m_chkShowOnStartup;
QPushButton *m_createButton;
QPushButton *m_recentButton;
- QDialogButtonBox *m_buttonBox;
+ QDialogButtonBox *m_buttonBox = nullptr;
};
QT_END_NAMESPACE
diff --git a/src/designer/src/designer/preferencesdialog.cpp b/src/designer/src/designer/preferencesdialog.cpp
index 439f0194b..eac6e82dd 100644
--- a/src/designer/src/designer/preferencesdialog.cpp
+++ b/src/designer/src/designer/preferencesdialog.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "preferencesdialog.h"
#include "ui_preferencesdialog.h"
@@ -40,16 +15,15 @@ QT_BEGIN_NAMESPACE
PreferencesDialog::PreferencesDialog(QDesignerFormEditorInterface *core, QWidget *parentWidget) :
QDialog(parentWidget),
- m_ui(new Ui::PreferencesDialog()),
+ m_ui(new QT_PREPEND_NAMESPACE(Ui)::PreferencesDialog()),
m_core(core)
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_ui->setupUi(this);
m_optionsPages = core->optionsPages();
m_ui->m_optionTabWidget->clear();
- for (QDesignerOptionsPageInterface *optionsPage : qAsConst(m_optionsPages)) {
+ for (QDesignerOptionsPageInterface *optionsPage : std::as_const(m_optionsPages)) {
QWidget *page = optionsPage->createPage(this);
m_ui->m_optionTabWidget->addTab(page, optionsPage->name());
if (QDesignerAppearanceOptionsWidget *appearanceWidget = qobject_cast<QDesignerAppearanceOptionsWidget *>(page))
@@ -74,7 +48,7 @@ QPushButton *PreferencesDialog::applyButton() const
void PreferencesDialog::slotApply()
{
- for (QDesignerOptionsPageInterface *optionsPage : qAsConst(m_optionsPages))
+ for (QDesignerOptionsPageInterface *optionsPage : std::as_const(m_optionsPages))
optionsPage->apply();
}
@@ -99,7 +73,7 @@ void PreferencesDialog::slotUiModeChanged(bool modified)
void PreferencesDialog::closeOptionPages()
{
- for (QDesignerOptionsPageInterface *optionsPage : qAsConst(m_optionsPages))
+ for (QDesignerOptionsPageInterface *optionsPage : std::as_const(m_optionsPages))
optionsPage->finish();
}
diff --git a/src/designer/src/designer/preferencesdialog.h b/src/designer/src/designer/preferencesdialog.h
index 654e93388..5e25172e8 100644
--- a/src/designer/src/designer/preferencesdialog.h
+++ b/src/designer/src/designer/preferencesdialog.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef PREFERENCESDIALOG_H
#define PREFERENCESDIALOG_H
diff --git a/src/designer/src/designer/qdesigner.cpp b/src/designer/src/designer/qdesigner.cpp
index 3fa9472f2..0ec87e2b0 100644
--- a/src/designer/src/designer/qdesigner.cpp
+++ b/src/designer/src/designer/qdesigner.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
// designer
#include "qdesigner.h"
@@ -41,9 +16,11 @@
#include <QtGui/qicon.h>
#include <QtWidgets/qerrormessage.h>
#include <QtCore/qmetaobject.h>
+#include <QtCore/qdir.h>
#include <QtCore/qfile.h>
#include <QtCore/qlibraryinfo.h>
#include <QtCore/qlocale.h>
+#include <QtCore/qtextstream.h>
#include <QtCore/qtimer.h>
#include <QtCore/qtranslator.h>
#include <QtCore/qfileinfo.h>
@@ -55,16 +32,18 @@
QT_BEGIN_NAMESPACE
-static const char *designerApplicationName = "Designer";
-static const char designerDisplayName[] = "Qt Designer";
-static const char *designerWarningPrefix = "Designer: ";
+using namespace Qt::StringLiterals;
+
+static constexpr auto designerApplicationName = "Designer"_L1;
+static constexpr auto designerDisplayName = "Qt Widgets Designer"_L1;
+static constexpr auto designerWarningPrefix = "Designer: "_L1;
static QtMessageHandler previousMessageHandler = nullptr;
static void designerMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
// Only Designer warnings are displayed as box
QDesigner *designerApp = qDesigner;
- if (type != QtWarningMsg || !designerApp || !msg.startsWith(QLatin1String(designerWarningPrefix))) {
+ if (type != QtWarningMsg || !designerApp || !msg.startsWith(designerWarningPrefix)) {
previousMessageHandler(type, context, msg);
return;
}
@@ -72,18 +51,15 @@ static void designerMessageHandler(QtMsgType type, const QMessageLogContext &con
}
QDesigner::QDesigner(int &argc, char **argv)
- : QApplication(argc, argv),
- m_server(nullptr),
- m_client(nullptr),
- m_workbench(0), m_suppressNewFormShow(false)
+ : QApplication(argc, argv)
{
- setOrganizationName(QStringLiteral("QtProject"));
- QGuiApplication::setApplicationDisplayName(QLatin1String(designerDisplayName));
- setApplicationName(QLatin1String(designerApplicationName));
+ setOrganizationName(u"QtProject"_s);
+ QGuiApplication::setApplicationDisplayName(designerDisplayName);
+ setApplicationName(designerApplicationName);
QDesignerComponents::initializeResources();
-#if !defined(Q_OS_OSX) && !defined(Q_OS_WIN)
- setWindowIcon(QIcon(QStringLiteral(":/qt-project.org/designer/images/designer.png")));
+#if !defined(Q_OS_MACOS) && !defined(Q_OS_WIN)
+ setWindowIcon(QIcon(u":/qt-project.org/designer/images/designer.png"_s));
#endif
}
@@ -98,7 +74,7 @@ void QDesigner::showErrorMessage(const QString &message)
{
// strip the prefix
const QString qMessage =
- message.right(message.size() - int(qstrlen(designerWarningPrefix)));
+ message.right(message.size() - int(designerWarningPrefix.size()));
// If there is no main window yet, just store the message.
// The QErrorMessage would otherwise be hidden by the main window.
if (m_mainWindow) {
@@ -107,7 +83,7 @@ void QDesigner::showErrorMessage(const QString &message)
const QMessageLogContext emptyContext;
previousMessageHandler(QtWarningMsg, emptyContext, message); // just in case we crash
m_initializationErrors += qMessage;
- m_initializationErrors += QLatin1Char('\n');
+ m_initializationErrors += u'\n';
}
}
@@ -123,10 +99,9 @@ void QDesigner::showErrorMessageBox(const QString &msg)
if (!m_errorMessageDialog) {
m_lastErrorMessage.clear();
m_errorMessageDialog = new QErrorMessage(m_mainWindow);
- const QString title = QCoreApplication::translate("QDesigner", "%1 - warning").arg(QLatin1String(designerApplicationName));
+ const QString title = QCoreApplication::translate("QDesigner", "%1 - warning").arg(designerApplicationName);
m_errorMessageDialog->setWindowTitle(title);
m_errorMessageDialog->setMinimumSize(QSize(600, 250));
- m_errorMessageDialog->setWindowFlags(m_errorMessageDialog->windowFlags() & ~Qt::WindowContextHelpButtonHint);
}
m_errorMessageDialog->showMessage(msg);
m_lastErrorMessage = msg;
@@ -161,6 +136,7 @@ struct Options
{
QStringList files;
QString resourceDir{QLibraryInfo::path(QLibraryInfo::TranslationsPath)};
+ QStringList pluginPaths;
bool server{false};
quint16 clientPort{0};
bool enableInternalDynamicProperties{false};
@@ -170,28 +146,30 @@ static inline QDesigner::ParseArgumentsResult
parseDesignerCommandLineArguments(QCommandLineParser &parser, Options *options,
QString *errorMessage)
{
- parser.setApplicationDescription(QStringLiteral("Qt Designer ")
- + QLatin1String(QT_VERSION_STR)
- + QLatin1String("\n\nUI designer for QWidget-based applications."));
+ parser.setApplicationDescription(u"Qt Widgets Designer " QT_VERSION_STR "\n\nUI designer for QWidget-based applications."_s);
const QCommandLineOption helpOption = parser.addHelpOption();
parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
- const QCommandLineOption serverOption(QStringLiteral("server"),
- QStringLiteral("Server mode"));
+ const QCommandLineOption serverOption(u"server"_s,
+ u"Server mode"_s);
parser.addOption(serverOption);
- const QCommandLineOption clientOption(QStringLiteral("client"),
- QStringLiteral("Client mode"),
- QStringLiteral("port"));
+ const QCommandLineOption clientOption(u"client"_s,
+ u"Client mode"_s,
+ u"port"_s);
parser.addOption(clientOption);
- const QCommandLineOption resourceDirOption(QStringLiteral("resourcedir"),
- QStringLiteral("Resource directory"),
- QStringLiteral("directory"));
+ const QCommandLineOption resourceDirOption(u"resourcedir"_s,
+ u"Resource directory"_s,
+ u"directory"_s);
parser.addOption(resourceDirOption);
- const QCommandLineOption internalDynamicPropertyOption(QStringLiteral("enableinternaldynamicproperties"),
- QStringLiteral("Enable internal dynamic properties"));
+ const QCommandLineOption internalDynamicPropertyOption(u"enableinternaldynamicproperties"_s,
+ u"Enable internal dynamic properties"_s);
parser.addOption(internalDynamicPropertyOption);
+ const QCommandLineOption pluginPathsOption(u"plugin-path"_s,
+ u"Default plugin path list"_s,
+ u"path"_s);
+ parser.addOption(pluginPathsOption);
- parser.addPositionalArgument(QStringLiteral("files"),
- QStringLiteral("The UI files to open."));
+ parser.addPositionalArgument(u"files"_s,
+ u"The UI files to open."_s);
if (!parser.parse(QCoreApplication::arguments())) {
*errorMessage = parser.errorText();
@@ -202,19 +180,23 @@ static inline QDesigner::ParseArgumentsResult
return QDesigner::ParseArgumentsHelpRequested;
// There is no way to retrieve the complete help text from QCommandLineParser,
// so, call process() to display it.
- if (parser.isSet(u"help-all"_qs))
+ if (parser.isSet(u"help-all"_s))
parser.process(QCoreApplication::arguments()); // exits
options->server = parser.isSet(serverOption);
if (parser.isSet(clientOption)) {
bool ok;
options->clientPort = parser.value(clientOption).toUShort(&ok);
if (!ok) {
- *errorMessage = QStringLiteral("Non-numeric argument specified for -client");
+ *errorMessage = u"Non-numeric argument specified for -client"_s;
return QDesigner::ParseArgumentsError;
}
}
if (parser.isSet(resourceDirOption))
options->resourceDir = parser.value(resourceDirOption);
+ const auto pluginPathValues = parser.values(pluginPathsOption);
+ for (const auto &pluginPath : pluginPathValues)
+ options->pluginPaths.append(pluginPath.split(QDir::listSeparator(), Qt::SkipEmptyParts));
+
options->enableInternalDynamicProperties = parser.isSet(internalDynamicPropertyOption);
options->files = parser.positionalArguments();
return QDesigner::ParseArgumentsSuccess;
@@ -242,39 +224,36 @@ QDesigner::ParseArgumentsResult QDesigner::parseCommandLineArguments()
QDesignerPropertySheet::setInternalDynamicPropertiesEnabled(true);
std::unique_ptr<QTranslator> designerTranslator(new QTranslator(this));
- if (designerTranslator->load(QLocale(), QStringLiteral("designer"), QStringLiteral("_"), options.resourceDir)) {
+ if (designerTranslator->load(QLocale(), u"designer"_s, u"_"_s, options.resourceDir)) {
installTranslator(designerTranslator.release());
std::unique_ptr<QTranslator> qtTranslator(new QTranslator(this));
- if (qtTranslator->load(QLocale(), QStringLiteral("qt"), QStringLiteral("_"), options.resourceDir))
+ if (qtTranslator->load(QLocale(), u"qt"_s, u"_"_s, options.resourceDir))
installTranslator(qtTranslator.release());
}
- m_workbench = new QDesignerWorkbench();
+ m_workbench = new QDesignerWorkbench(options.pluginPaths);
emit initialized();
previousMessageHandler = qInstallMessageHandler(designerMessageHandler); // Warn when loading faulty forms
Q_ASSERT(previousMessageHandler);
- m_suppressNewFormShow = m_workbench->readInBackup();
-
- if (!options.files.isEmpty()) {
- const QStringList::const_iterator cend = options.files.constEnd();
- for (QStringList::const_iterator it = options.files.constBegin(); it != cend; ++it) {
- // Ensure absolute paths for recent file list to be unique
- QString fileName = *it;
- const QFileInfo fi(fileName);
- if (fi.exists() && fi.isRelative())
- fileName = fi.absoluteFilePath();
- m_workbench->readInForm(fileName);
- }
+ bool suppressNewFormShow = m_workbench->readInBackup();
+
+ for (auto fileName : std::as_const(options.files)) {
+ // Ensure absolute paths for recent file list to be unique
+ const QFileInfo fi(fileName);
+ if (fi.exists() && fi.isRelative())
+ fileName = fi.absoluteFilePath();
+ m_workbench->readInForm(fileName);
}
- if ( m_workbench->formWindowCount())
- m_suppressNewFormShow = true;
+
+ if (m_workbench->formWindowCount() > 0)
+ suppressNewFormShow = true;
// Show up error box with parent now if something went wrong
if (m_initializationErrors.isEmpty()) {
- if (!m_suppressNewFormShow && QDesignerSettings(m_workbench->core()).showNewFormOnStartup())
- QTimer::singleShot(100, this, &QDesigner::callCreateForm); // won't show anything if suppressed
+ if (!suppressNewFormShow)
+ m_workbench->showNewForm();
} else {
showErrorMessageBox(m_initializationErrors);
m_initializationErrors.clear();
@@ -287,10 +266,7 @@ bool QDesigner::event(QEvent *ev)
bool eaten;
switch (ev->type()) {
case QEvent::FileOpen:
- // Set it true first since, if it's a Qt 3 form, the messagebox from convert will fire the timer.
- m_suppressNewFormShow = true;
- if (!m_workbench->readInForm(static_cast<QFileOpenEvent *>(ev)->file()))
- m_suppressNewFormShow = false;
+ m_workbench->readInForm(static_cast<QFileOpenEvent *>(ev)->file());
eaten = true;
break;
case QEvent::Close: {
@@ -322,10 +298,4 @@ MainWindowBase *QDesigner::mainWindow() const
return m_mainWindow;
}
-void QDesigner::callCreateForm()
-{
- if (!m_suppressNewFormShow)
- m_workbench->actionManager()->createForm();
-}
-
QT_END_NAMESPACE
diff --git a/src/designer/src/designer/qdesigner.h b/src/designer/src/designer/qdesigner.h
index 91f36c538..5b763d7a1 100644
--- a/src/designer/src/designer/qdesigner.h
+++ b/src/designer/src/designer/qdesigner.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QDESIGNER_H
#define QDESIGNER_H
@@ -75,21 +50,17 @@ signals:
public slots:
void showErrorMessage(const QString &message);
-private slots:
- void callCreateForm();
-
private:
void showErrorMessageBox(const QString &);
- QDesignerServer *m_server;
- QDesignerClient *m_client;
- QDesignerWorkbench *m_workbench;
+ QDesignerServer *m_server = nullptr;
+ QDesignerClient *m_client = nullptr;
+ QDesignerWorkbench *m_workbench = nullptr;
QPointer<MainWindowBase> m_mainWindow;
QPointer<QErrorMessage> m_errorMessageDialog;
QString m_initializationErrors;
QString m_lastErrorMessage;
- bool m_suppressNewFormShow;
};
QT_END_NAMESPACE
diff --git a/src/designer/src/designer/qdesigner_actions.cpp b/src/designer/src/designer/qdesigner_actions.cpp
index 01c1cbcdd..07f347093 100644
--- a/src/designer/src/designer/qdesigner_actions.cpp
+++ b/src/designer/src/designer/qdesigner_actions.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_actions.h"
#include "designer_enums.h"
@@ -32,10 +7,10 @@
#include "qdesigner.h"
#include "qdesigner_workbench.h"
#include "qdesigner_formwindow.h"
+#include "mainwindow.h"
#include "newform.h"
#include "versiondialog.h"
#include "saveformastemplate.h"
-#include "qdesigner_toolwindow.h"
#include "preferencesdialog.h"
#include "appfontdialog.h"
@@ -88,21 +63,27 @@
#include <QtGui/qtransform.h>
#include <QtGui/qcursor.h>
+#include <QtCore/qdir.h>
#include <QtCore/qsize.h>
#include <QtCore/qlibraryinfo.h>
#include <QtCore/qbuffer.h>
#include <QtCore/qpluginloader.h>
#include <QtCore/qdebug.h>
#include <QtCore/qtimer.h>
+#include <QtCore/qtextstream.h>
#include <QtCore/qmetaobject.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qsavefile.h>
#include <QtCore/qscopedpointer.h>
#include <QtXml/qdom.h>
+#include <algorithm>
+
+#include <optional>
+
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+using namespace Qt::StringLiterals;
const char *QDesignerActions::defaultToolbarPropertyName = "__qt_defaultToolBarAction";
@@ -138,6 +119,21 @@ static QString fileDialogFilters(const QString &extension)
return QDesignerActions::tr("Designer UI files (*.%1);;All Files (*)").arg(extension);
}
+static QString fixResourceFileBackupPath(const QDesignerFormWindowInterface *fwi,
+ const QDir& backupDir);
+
+static QByteArray formWindowContents(const QDesignerFormWindowInterface *fw,
+ std::optional<QDir> alternativeDir = {})
+{
+ QString contents = alternativeDir.has_value()
+ ? fixResourceFileBackupPath(fw, alternativeDir.value()) : fw->contents();
+ if (auto *fwb = qobject_cast<const qdesigner_internal::FormWindowBase *>(fw)) {
+ if (fwb->lineTerminatorMode() == qdesigner_internal::FormWindowBase::CRLFLineTerminator)
+ contents.replace(u'\n', "\r\n"_L1);
+ }
+ return contents.toUtf8();
+}
+
QFileDialog *createSaveAsDialog(QWidget *parent, const QString &dir, const QString &extension)
{
auto result = new QFileDialog(parent, QDesignerActions::tr("Save Form As"),
@@ -161,16 +157,26 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
m_windowActions(createActionGroup(this)),
m_toolActions(createActionGroup(this, true)),
m_editWidgetsAction(new QAction(tr("Edit Widgets"), this)),
- m_newFormAction(new QAction(qdesigner_internal::createIconSet(QStringLiteral("filenew.png")), tr("&New..."), this)),
- m_openFormAction(new QAction(qdesigner_internal::createIconSet(QStringLiteral("fileopen.png")), tr("&Open..."), this)),
- m_saveFormAction(new QAction(qdesigner_internal::createIconSet(QStringLiteral("filesave.png")), tr("&Save"), this)),
- m_saveFormAsAction(new QAction(tr("Save &As..."), this)),
+ m_newFormAction(new QAction(qdesigner_internal::createIconSet(QIcon::ThemeIcon::DocumentNew,
+ "filenew.png"_L1),
+ tr("&New..."), this)),
+ m_openFormAction(new QAction(qdesigner_internal::createIconSet(QIcon::ThemeIcon::DocumentOpen,
+ "fileopen.png"_L1),
+ tr("&Open..."), this)),
+ m_saveFormAction(new QAction(qdesigner_internal::createIconSet(QIcon::ThemeIcon::DocumentSave,
+ "filesave.png"_L1),
+ tr("&Save"), this)),
+ m_saveFormAsAction(new QAction(QIcon::fromTheme(QIcon::ThemeIcon::DocumentSaveAs),
+ tr("Save &As..."), this)),
m_saveAllFormsAction(new QAction(tr("Save A&ll"), this)),
m_saveFormAsTemplateAction(new QAction(tr("Save As &Template..."), this)),
- m_closeFormAction(new QAction(tr("&Close"), this)),
+ m_closeFormAction(new QAction(QIcon::fromTheme(QIcon::ThemeIcon::WindowClose),
+ tr("&Close"), this)),
m_savePreviewImageAction(new QAction(tr("Save &Image..."), this)),
- m_printPreviewAction(new QAction(tr("&Print..."), this)),
- m_quitAction(new QAction(tr("&Quit"), this)),
+ m_printPreviewAction(new QAction(QIcon::fromTheme(QIcon::ThemeIcon::DocumentPrint),
+ tr("&Print..."), this)),
+ m_quitAction(new QAction(QIcon::fromTheme(QIcon::ThemeIcon::ApplicationExit),
+ tr("&Quit"), 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)),
@@ -180,16 +186,6 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
m_preferencesAction(new QAction(tr("Preferences..."), this)),
m_appFontAction(new QAction(tr("Additional Fonts..."), this))
{
-#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()));
- m_saveFormAction->setIcon(QIcon::fromTheme(QStringLiteral("document-save"), m_saveFormAction->icon()));
- m_saveFormAsAction->setIcon(QIcon::fromTheme(QStringLiteral("document-save-as"), m_saveFormAsAction->icon()));
- m_printPreviewAction->setIcon(QIcon::fromTheme(QStringLiteral("document-print"), m_printPreviewAction->icon()));
- m_closeFormAction->setIcon(QIcon::fromTheme(QStringLiteral("window-close"), m_closeFormAction->icon()));
- m_quitAction->setIcon(QIcon::fromTheme(QStringLiteral("application-exit"), m_quitAction->icon()));
-#endif
-
Q_ASSERT(m_core != nullptr);
qdesigner_internal::QDesignerFormWindowManager *ifwm = qobject_cast<qdesigner_internal::QDesignerFormWindowManager *>(m_core->formWindowManager());
Q_ASSERT(ifwm);
@@ -199,21 +195,21 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
connect(ifwm, &QDesignerFormWindowManagerInterface::formWindowSettingsChanged,
this, &QDesignerActions::formWindowSettingsChanged);
- m_editWidgetsAction->setObjectName(QStringLiteral("__qt_edit_widgets_action"));
- m_newFormAction->setObjectName(QStringLiteral("__qt_new_form_action"));
- m_openFormAction->setObjectName(QStringLiteral("__qt_open_form_action"));
- m_saveFormAction->setObjectName(QStringLiteral("__qt_save_form_action"));
- m_saveFormAsAction->setObjectName(QStringLiteral("__qt_save_form_as_action"));
- m_saveAllFormsAction->setObjectName(QStringLiteral("__qt_save_all_forms_action"));
- m_saveFormAsTemplateAction->setObjectName(QStringLiteral("__qt_save_form_as_template_action"));
- m_closeFormAction->setObjectName(QStringLiteral("__qt_close_form_action"));
- m_quitAction->setObjectName(QStringLiteral("__qt_quit_action"));
- m_previewFormAction->setObjectName(QStringLiteral("__qt_preview_form_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"));
+ m_editWidgetsAction->setObjectName(u"__qt_edit_widgets_action"_s);
+ m_newFormAction->setObjectName(u"__qt_new_form_action"_s);
+ m_openFormAction->setObjectName(u"__qt_open_form_action"_s);
+ m_saveFormAction->setObjectName(u"__qt_save_form_action"_s);
+ m_saveFormAsAction->setObjectName(u"__qt_save_form_as_action"_s);
+ m_saveAllFormsAction->setObjectName(u"__qt_save_all_forms_action"_s);
+ m_saveFormAsTemplateAction->setObjectName(u"__qt_save_form_as_template_action"_s);
+ m_closeFormAction->setObjectName(u"__qt_close_form_action"_s);
+ m_quitAction->setObjectName(u"__qt_quit_action"_s);
+ m_previewFormAction->setObjectName(u"__qt_preview_form_action"_s);
+ m_viewCppCodeAction->setObjectName(u"__qt_preview_cpp_code_action"_s);
+ m_viewPythonCodeAction->setObjectName(u"__qt_preview_python_code_action"_s);
+ m_minimizeAction->setObjectName(u"__qt_minimize_action"_s);
+ m_bringAllToFrontAction->setObjectName(u"__qt_bring_all_to_front_action"_s);
+ m_preferencesAction->setObjectName(u"__qt_preferences_action"_s);
m_helpActions = createHelpActions();
@@ -263,10 +259,10 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
m_printPreviewAction->setShortcut(QKeySequence::Print);
connect(m_printPreviewAction, &QAction::triggered, this, &QDesignerActions::printPreviewImage);
m_fileActions->addAction(m_printPreviewAction);
- m_printPreviewAction->setObjectName(QStringLiteral("__qt_print_action"));
+ m_printPreviewAction->setObjectName(u"__qt_print_action"_s);
connect(m_savePreviewImageAction, &QAction::triggered, this, &QDesignerActions::savePreviewImage);
- m_savePreviewImageAction->setObjectName(QStringLiteral("__qt_saveimage_action"));
+ m_savePreviewImageAction->setObjectName(u"__qt_saveimage_action"_s);
m_fileActions->addAction(m_savePreviewImageAction);
m_fileActions->addAction(createSeparator(this));
@@ -286,12 +282,12 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
// edit actions
//
QAction *undoAction = formWindowManager->action(QDesignerFormWindowManagerInterface::UndoAction);
- undoAction->setObjectName(QStringLiteral("__qt_undo_action"));
+ undoAction->setObjectName(u"__qt_undo_action"_s);
undoAction->setShortcut(QKeySequence::Undo);
m_editActions->addAction(undoAction);
QAction *redoAction = formWindowManager->action(QDesignerFormWindowManagerInterface::RedoAction);
- redoAction->setObjectName(QStringLiteral("__qt_redo_action"));
+ redoAction->setObjectName(u"__qt_redo_action"_s);
redoAction->setShortcut(QKeySequence::Redo);
m_editActions->addAction(redoAction);
@@ -323,8 +319,8 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
shortcuts.append(QKeySequence(Qt::Key_F3));
shortcuts.append(QKeySequence(Qt::Key_Escape));
m_editWidgetsAction->setShortcuts(shortcuts);
- QIcon fallback(m_core->resourceLocation() + QStringLiteral("/widgettool.png"));
- m_editWidgetsAction->setIcon(QIcon::fromTheme(QStringLiteral("designer-edit-widget"),
+ QIcon fallback(m_core->resourceLocation() + "/widgettool.png"_L1);
+ m_editWidgetsAction->setIcon(QIcon::fromTheme(u"designer-edit-widget"_s,
fallback));
connect(m_editWidgetsAction, &QAction::triggered, this, &QDesignerActions::editWidgetsSlot);
m_editWidgetsAction->setChecked(true);
@@ -332,7 +328,7 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
m_editWidgetsAction->setProperty(QDesignerActions::defaultToolbarPropertyName, true);
m_toolActions->addAction(m_editWidgetsAction);
- connect(formWindowManager, &QDesignerFormWindowManager::activeFormWindowChanged,
+ connect(formWindowManager, &qdesigner_internal::QDesignerFormWindowManager::activeFormWindowChanged,
this, &QDesignerActions::activeFormWindowChanged);
const QObjectList builtinPlugins = QPluginLoader::staticInstances()
@@ -442,15 +438,15 @@ QActionGroup *QDesignerActions::createHelpActions()
QActionGroup *helpActions = createActionGroup(this);
#ifndef QT_JAMBI_BUILD
- QAction *mainHelpAction = new QAction(tr("Qt Designer &Help"), this);
- mainHelpAction->setObjectName(QStringLiteral("__qt_designer_help_action"));
+ QAction *mainHelpAction = new QAction(tr("Qt Widgets Designer &Help"), this);
+ mainHelpAction->setObjectName(u"__qt_designer_help_action"_s);
connect(mainHelpAction, &QAction::triggered, this, &QDesignerActions::showDesignerHelp);
mainHelpAction->setShortcut(Qt::CTRL | Qt::Key_Question);
helpActions->addAction(mainHelpAction);
helpActions->addAction(createSeparator(this));
QAction *widgetHelp = new QAction(tr("Current Widget Help"), this);
- widgetHelp->setObjectName(QStringLiteral("__qt_current_widget_help_action"));
+ widgetHelp->setObjectName(u"__qt_current_widget_help_action"_s);
widgetHelp->setShortcut(Qt::Key_F1);
connect(widgetHelp, &QAction::triggered, this, &QDesignerActions::showWidgetSpecificHelp);
helpActions->addAction(widgetHelp);
@@ -459,21 +455,21 @@ QActionGroup *QDesignerActions::createHelpActions()
helpActions->addAction(createSeparator(this));
QAction *aboutPluginsAction = new QAction(tr("About Plugins"), this);
- aboutPluginsAction->setObjectName(QStringLiteral("__qt_about_plugins_action"));
+ aboutPluginsAction->setObjectName(u"__qt_about_plugins_action"_s);
aboutPluginsAction->setMenuRole(QAction::ApplicationSpecificRole);
connect(aboutPluginsAction, &QAction::triggered,
m_core->formWindowManager(), &QDesignerFormWindowManagerInterface::showPluginDialog);
helpActions->addAction(aboutPluginsAction);
- QAction *aboutDesignerAction = new QAction(tr("About Qt Designer"), this);
+ QAction *aboutDesignerAction = new QAction(tr("About Qt Widgets Designer"), this);
aboutDesignerAction->setMenuRole(QAction::AboutRole);
- aboutDesignerAction->setObjectName(QStringLiteral("__qt_about_designer_action"));
+ aboutDesignerAction->setObjectName(u"__qt_about_designer_action"_s);
connect(aboutDesignerAction, &QAction::triggered, this, &QDesignerActions::aboutDesigner);
helpActions->addAction(aboutDesignerAction);
QAction *aboutQtAction = new QAction(tr("About Qt"), this);
aboutQtAction->setMenuRole(QAction::AboutQtRole);
- aboutQtAction->setObjectName(QStringLiteral("__qt_about_qt_action"));
+ aboutQtAction->setObjectName(u"__qt_about_qt_action"_s);
connect(aboutQtAction, &QAction::triggered, qApp, &QApplication::aboutQt);
helpActions->addAction(aboutQtAction);
return helpActions;
@@ -492,12 +488,12 @@ QString QDesignerActions::uiExtension() const
= qt_extension<QDesignerLanguageExtension *>(m_core->extensionManager(), m_core);
if (lang)
return lang->uiExtension();
- return QStringLiteral("ui");
+ return u"ui"_s;
}
QAction *QDesignerActions::createRecentFilesMenu()
{
- QMenu *menu = new QMenu;
+ m_recentMenu.reset(new QMenu);
QAction *act;
// Need to insert this into the QAction.
for (int i = 0; i < MaxRecentFiles; ++i) {
@@ -505,20 +501,20 @@ QAction *QDesignerActions::createRecentFilesMenu()
act->setVisible(false);
connect(act, &QAction::triggered, this, &QDesignerActions::openRecentForm);
m_recentFilesActions->addAction(act);
- menu->addAction(act);
+ m_recentMenu->addAction(act);
}
updateRecentFileActions();
- menu->addSeparator();
- act = new QAction(QIcon::fromTheme(QStringLiteral("edit-clear")),
+ m_recentMenu->addSeparator();
+ act = new QAction(QIcon::fromTheme(QIcon::ThemeIcon::EditClear),
tr("Clear &Menu"), this);
- act->setObjectName(QStringLiteral("__qt_action_clear_menu_"));
+ act->setObjectName(u"__qt_action_clear_menu_"_s);
connect(act, &QAction::triggered, this, &QDesignerActions::clearRecentFiles);
m_recentFilesActions->addAction(act);
- menu->addAction(act);
+ m_recentMenu->addAction(act);
- act = new QAction(QIcon::fromTheme(QStringLiteral("document-open-recent")),
+ act = new QAction(QIcon::fromTheme(QIcon::ThemeIcon::DocumentOpenRecent),
tr("&Recent Forms"), this);
- act->setMenu(menu);
+ act->setMenu(m_recentMenu.get());
return act;
}
@@ -628,7 +624,7 @@ bool QDesignerActions::saveFormAs(QDesignerFormWindowInterface *fw)
dir = QDir::current().absolutePath();
} while (false);
dir += QDir::separator();
- dir += QStringLiteral("untitled.");
+ dir += "untitled."_L1;
dir += extension;
}
@@ -656,7 +652,7 @@ void QDesignerActions::saveAllForms()
QString fileNames;
QDesignerFormWindowManagerInterface *formWindowManager = core()->formWindowManager();
if (const int totalWindows = formWindowManager->formWindowCount()) {
- const QString separator = QStringLiteral(", ");
+ const auto separator = ", "_L1;
for (int i = 0; i < totalWindows; ++i) {
QDesignerFormWindowInterface *fw = formWindowManager->formWindow(i);
if (fw && fw->isDirty()) {
@@ -792,11 +788,8 @@ bool QDesignerActions::readInForm(const QString &fileName)
if (!fInfo.exists()) {
// Normalize file name
const QString directory = fInfo.absolutePath();
- if (QDir(directory).exists()) {
- newFormFileName = directory;
- newFormFileName += QLatin1Char('/');
- newFormFileName += fInfo.fileName();
- }
+ if (QDir(directory).exists())
+ newFormFileName = directory + u'/' + fInfo.fileName();
}
showNewFormDialog(newFormFileName);
return false;
@@ -813,14 +806,9 @@ bool QDesignerActions::writeOutForm(QDesignerFormWindowInterface *fw, const QStr
if (check) {
const QStringList problems = fw->checkContents();
if (!problems.isEmpty())
- QMessageBox::information(fw->window(), tr("Qt Designer"), problems.join(QLatin1String("<br>")));
+ QMessageBox::information(fw->window(), tr("Qt Widgets Designer"), problems.join("<br>"_L1));
}
- QString contents = fw->contents();
- if (qdesigner_internal::FormWindowBase *fwb = qobject_cast<qdesigner_internal::FormWindowBase *>(fw)) {
- if (fwb->lineTerminatorMode() == qdesigner_internal::FormWindowBase::CRLFLineTerminator)
- contents.replace(QLatin1Char('\n'), QStringLiteral("\r\n"));
- }
m_workbench->updateBackup(fw);
QSaveFile f(saveFile);
@@ -854,7 +842,7 @@ bool QDesignerActions::writeOutForm(QDesignerFormWindowInterface *fw, const QStr
}
// loop back around...
}
- f.write(contents.toUtf8());
+ f.write(formWindowContents(fw));
if (!f.commit()) {
QMessageBox box(QMessageBox::Warning, tr("Save Form"),
tr("Could not write file"),
@@ -912,32 +900,26 @@ void QDesignerActions::formWindowSettingsChanged(QDesignerFormWindowInterface *f
void QDesignerActions::updateRecentFileActions()
{
QStringList files = m_settings.recentFilesList();
- const int originalSize = files.size();
- int numRecentFiles = qMin(files.size(), int(MaxRecentFiles));
- const auto recentFilesActs = m_recentFilesActions->actions();
+ auto existingEnd = std::remove_if(files.begin(), files.end(),
+ [] (const QString &f) { return !QFileInfo::exists(f); });
+ if (existingEnd != files.end()) {
+ files.erase(existingEnd, files.end());
+ m_settings.setRecentFilesList(files);
+ }
- for (int i = 0; i < numRecentFiles; ++i) {
- const QFileInfo fi(files[i]);
- // If the file doesn't exist anymore, just remove it from the list so
- // people don't get confused.
- if (!fi.exists()) {
- files.removeAt(i);
- --i;
- numRecentFiles = qMin(files.size(), int(MaxRecentFiles));
- continue;
+ const auto recentFilesActs = m_recentFilesActions->actions();
+ qsizetype i = 0;
+ for (QAction *action : recentFilesActs) {
+ if (i < files.size()) {
+ const QString &file = files.at(i);
+ action->setText(QFileInfo(file).fileName());
+ action->setIconText(file);
+ action->setVisible(true);
+ } else {
+ action->setVisible(false);
}
- const QString text = fi.fileName();
- recentFilesActs[i]->setText(text);
- recentFilesActs[i]->setIconText(files[i]);
- recentFilesActs[i]->setVisible(true);
+ ++i;
}
-
- for (int j = numRecentFiles; j < MaxRecentFiles; ++j)
- recentFilesActs[j]->setVisible(false);
-
- // If there's been a change, right it back
- if (originalSize != files.size())
- m_settings.setRecentFilesList(files);
}
void QDesignerActions::openRecentForm()
@@ -989,7 +971,7 @@ QAction *QDesignerActions::minimizeAction() const
void QDesignerActions::showDesignerHelp()
{
QString url = AssistantClient::designerManualUrl();
- url += QStringLiteral("qtdesigner-manual.html");
+ url += "qtdesigner-manual.html"_L1;
showHelp(url);
}
@@ -1010,11 +992,11 @@ void QDesignerActions::showHelp(const QString &url)
void QDesignerActions::aboutDesigner()
{
VersionDialog mb(core()->topLevel());
- mb.setWindowTitle(tr("About Qt Designer"));
+ mb.setWindowTitle(tr("About Qt Widgets Designer"));
if (mb.exec()) {
- QMessageBox messageBox(QMessageBox::Information, QStringLiteral("Easter Egg"),
- QStringLiteral("Easter Egg"), QMessageBox::Ok, core()->topLevel());
- messageBox.setInformativeText(QStringLiteral("The Easter Egg has been removed."));
+ QMessageBox messageBox(QMessageBox::Information, u"Easter Egg"_s,
+ u"Easter Egg"_s, QMessageBox::Ok, core()->topLevel());
+ messageBox.setInformativeText(u"The Easter Egg has been removed."_s);
messageBox.exec();
}
}
@@ -1055,16 +1037,13 @@ void QDesignerActions::backupForms()
return;
- QStringList tmpFiles;
QMap<QString, QString> backupMap;
QDir backupDir(m_backupPath);
for (int i = 0; i < count; ++i) {
QDesignerFormWindow *fw = m_workbench->formWindow(i);
QDesignerFormWindowInterface *fwi = fw->editor();
- QString formBackupName;
- QTextStream(&formBackupName) << m_backupPath << QDir::separator()
- << QStringLiteral("backup") << i << QStringLiteral(".bak");
+ QString formBackupName = m_backupPath + "/backup"_L1 + QString::number(i) + ".bak"_L1;
QString fwn = QDir::toNativeSeparators(fwi->fileName());
if (fwn.isEmpty())
@@ -1072,49 +1051,33 @@ void QDesignerActions::backupForms()
backupMap.insert(fwn, formBackupName);
- QFile file(formBackupName.replace(m_backupPath, m_backupTmpPath));
- if (file.open(QFile::WriteOnly)){
- QString contents = fixResourceFileBackupPath(fwi, backupDir);
- if (qdesigner_internal::FormWindowBase *fwb = qobject_cast<qdesigner_internal::FormWindowBase *>(fwi)) {
- if (fwb->lineTerminatorMode() == qdesigner_internal::FormWindowBase::CRLFLineTerminator)
- contents.replace(QLatin1Char('\n'), QStringLiteral("\r\n"));
- }
- const QByteArray utf8Array = contents.toUtf8();
- if (file.write(utf8Array, utf8Array.size()) != utf8Array.size()) {
- backupMap.remove(fwn);
- qdesigner_internal::designerWarning(tr("The backup file %1 could not be written.").arg(file.fileName()));
- } else
- tmpFiles.append(formBackupName);
-
- file.close();
+ bool ok = false;
+ QSaveFile file(formBackupName);
+ if (file.open(QFile::WriteOnly)) {
+ file.write(formWindowContents(fw->editor(), backupDir));
+ ok = file.commit();
}
- }
- if(!tmpFiles.isEmpty()) {
- const QStringList backupFiles = backupDir.entryList(QDir::Files);
- for (const QString &backupFile : backupFiles)
- backupDir.remove(backupFile);
-
- for (const QString &tmpName : qAsConst(tmpFiles)) {
- QString name(tmpName);
- name.replace(m_backupTmpPath, m_backupPath);
- QFile tmpFile(tmpName);
- if (!tmpFile.copy(name))
- qdesigner_internal::designerWarning(tr("The backup file %1 could not be written.").arg(name));
- tmpFile.remove();
+ if (!ok) {
+ backupMap.remove(fwn);
+ qdesigner_internal::designerWarning(tr("The backup file %1 could not be written: %2").
+ arg(QDir::toNativeSeparators(file.fileName()),
+ file.errorString()));
}
+ }
+ if (!backupMap.isEmpty())
m_settings.setBackup(backupMap);
- }
}
-QString QDesignerActions::fixResourceFileBackupPath(QDesignerFormWindowInterface *fwi, const QDir& backupDir)
+static QString fixResourceFileBackupPath(const QDesignerFormWindowInterface *fwi,
+ const QDir& backupDir)
{
const QString content = fwi->contents();
- QDomDocument domDoc(QStringLiteral("backup"));
+ QDomDocument domDoc(u"backup"_s);
if(!domDoc.setContent(content))
return content;
- const QDomNodeList list = domDoc.elementsByTagName(QStringLiteral("resources"));
+ const QDomNodeList list = domDoc.elementsByTagName(u"resources"_s);
if (list.isEmpty())
return content;
@@ -1122,14 +1085,14 @@ QString QDesignerActions::fixResourceFileBackupPath(QDesignerFormWindowInterface
const QDomNode node = list.at(i);
if (!node.isNull()) {
const QDomElement element = node.toElement();
- if(!element.isNull() && element.tagName() == QStringLiteral("resources")) {
+ if (!element.isNull() && element.tagName() == "resources"_L1) {
QDomNode childNode = element.firstChild();
while (!childNode.isNull()) {
QDomElement childElement = childNode.toElement();
- if(!childElement.isNull() && childElement.tagName() == QStringLiteral("include")) {
- const QString attr = childElement.attribute(QStringLiteral("location"));
+ if (!childElement.isNull() && childElement.tagName() == "include"_L1) {
+ const QString attr = childElement.attribute(u"location"_s);
const QString path = fwi->absoluteDir().absoluteFilePath(attr);
- childElement.setAttribute(QStringLiteral("location"), backupDir.relativeFilePath(path));
+ childElement.setAttribute(u"location"_s, backupDir.relativeFilePath(path));
}
childNode = childNode.nextSibling();
}
@@ -1185,15 +1148,11 @@ void QDesignerActions::setWindowListSeparatorVisible(bool visible)
bool QDesignerActions::ensureBackupDirectories() {
- if (m_backupPath.isEmpty()) {
- // create names
- m_backupPath = dataDirectory() + u"/backup"_qs;
- m_backupTmpPath = m_backupPath + u"/tmp"_qs;
- }
+ if (m_backupPath.isEmpty()) // create names
+ m_backupPath = qdesigner_internal::dataDirectory() + u"/backup"_s;
// ensure directories
const QDir backupDir(m_backupPath);
- const QDir backupTmpDir(m_backupTmpPath);
if (!backupDir.exists()) {
if (!backupDir.mkpath(m_backupPath)) {
@@ -1202,13 +1161,6 @@ bool QDesignerActions::ensureBackupDirectories() {
return false;
}
}
- if (!backupTmpDir.exists()) {
- if (!backupTmpDir.mkpath(m_backupTmpPath)) {
- qdesigner_internal::designerWarning(tr("The temporary backup directory %1 could not be created.")
- .arg(QDir::toNativeSeparators(m_backupTmpPath)));
- return false;
- }
- }
return true;
}
@@ -1246,7 +1198,7 @@ QPixmap QDesignerActions::createPreviewPixmap(QDesignerFormWindowInterface *fw)
qdesigner_internal::PreviewConfiguration QDesignerActions::previewConfiguration()
{
qdesigner_internal::PreviewConfiguration pc;
- QDesignerSharedSettings settings(core());
+ qdesigner_internal::QDesignerSharedSettings settings(core());
if (settings.isCustomPreviewConfigurationEnabled())
pc = settings.customPreviewConfiguration();
return pc;
@@ -1265,11 +1217,8 @@ void QDesignerActions::savePreviewImage()
const QString filter = tr("Image files (*.%1)").arg(extension);
QString suggestion = fw->fileName();
- if (!suggestion.isEmpty()) {
- suggestion = QFileInfo(suggestion).baseName();
- suggestion += QLatin1Char('.');
- suggestion += extension;
- }
+ if (!suggestion.isEmpty())
+ suggestion = QFileInfo(suggestion).baseName() + u'.' + extension;
QFileDialog dialog(fw, tr("Save Image"), suggestion, filter);
dialog.setAcceptMode(QFileDialog::AcceptSave);
diff --git a/src/designer/src/designer/qdesigner_actions.h b/src/designer/src/designer/qdesigner_actions.h
index 4192a002b..e2efdfb52 100644
--- a/src/designer/src/designer/qdesigner_actions.h
+++ b/src/designer/src/designer/qdesigner_actions.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QDESIGNER_ACTIONS_H
#define QDESIGNER_ACTIONS_H
@@ -39,7 +14,6 @@ QT_BEGIN_NAMESPACE
class QDesignerWorkbench;
-class QDir;
class QTimer;
class QAction;
class QActionGroup;
@@ -146,7 +120,6 @@ private:
void showHelp(const QString &help);
void closePreview();
QRect fixDialogRect(const QRect &rect) const;
- QString fixResourceFileBackupPath(QDesignerFormWindowInterface *fwi, const QDir& backupDir);
void showStatusBarMessage(const QString &message) const;
QActionGroup *createHelpActions();
bool ensureBackupDirectories();
@@ -209,6 +182,8 @@ private:
QPrinter *m_printer = nullptr;
qdesigner_internal::PreviewManager *m_previewManager = nullptr;
+
+ std::unique_ptr<QMenu> m_recentMenu;
};
QT_END_NAMESPACE
diff --git a/src/designer/src/designer/qdesigner_appearanceoptions.cpp b/src/designer/src/designer/qdesigner_appearanceoptions.cpp
index 2c4437777..a4e062145 100644
--- a/src/designer/src/designer/qdesigner_appearanceoptions.cpp
+++ b/src/designer/src/designer/qdesigner_appearanceoptions.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_appearanceoptions.h"
#include "ui_qdesigner_appearanceoptions.h"
@@ -39,11 +14,6 @@
QT_BEGIN_NAMESPACE
// ---------------- AppearanceOptions
-bool AppearanceOptions::equals(const AppearanceOptions &rhs) const
-{
- return uiMode == rhs.uiMode && toolWindowFontSettings == rhs.toolWindowFontSettings;
-}
-
void AppearanceOptions::toSettings(QDesignerSettings &settings) const
{
settings.setUiMode(uiMode);
@@ -59,7 +29,7 @@ void AppearanceOptions::fromSettings(const QDesignerSettings &settings)
// ---------------- QDesignerAppearanceOptionsWidget
QDesignerAppearanceOptionsWidget::QDesignerAppearanceOptionsWidget(QWidget *parent) :
QWidget(parent),
- m_ui(new Ui::AppearanceOptionsWidget)
+ m_ui(new QT_PREPEND_NAMESPACE(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 b0b87c796..1b37750c6 100644
--- a/src/designer/src/designer/qdesigner_appearanceoptions.h
+++ b/src/designer/src/designer/qdesigner_appearanceoptions.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QDESIGNER_APPEARANCEOPTIONS_H
#define QDESIGNER_APPEARANCEOPTIONS_H
@@ -34,6 +9,7 @@
#include <QtDesigner/abstractoptionspage.h>
+#include <QtCore/qcompare.h>
#include <QtCore/qobject.h>
#include <QtCore/qpointer.h>
#include <QtWidgets/qwidget.h>
@@ -48,24 +24,22 @@ namespace Ui {
}
/* AppearanceOptions data */
-struct AppearanceOptions {
- bool equals(const AppearanceOptions&) const;
+struct AppearanceOptions
+{
void toSettings(QDesignerSettings &) const;
void fromSettings(const QDesignerSettings &);
UIMode uiMode{DockedMode};
ToolWindowFontSettings toolWindowFontSettings;
-};
-
-inline bool operator==(const AppearanceOptions &ao1, const AppearanceOptions &ao2)
-{
- return ao1.equals(ao2);
-}
-inline bool operator!=(const AppearanceOptions &ao1, const AppearanceOptions &ao2)
-{
- return !ao1.equals(ao2);
-}
+ friend bool comparesEqual(const AppearanceOptions &lhs,
+ const AppearanceOptions &rhs) noexcept
+ {
+ return lhs.uiMode == rhs.uiMode
+ && lhs.toolWindowFontSettings == rhs.toolWindowFontSettings;
+ }
+ Q_DECLARE_EQUALITY_COMPARABLE(AppearanceOptions)
+};
/* QDesignerAppearanceOptionsWidget: Let the user edit AppearanceOptions */
class QDesignerAppearanceOptionsWidget : public QWidget
diff --git a/src/designer/src/designer/qdesigner_formwindow.cpp b/src/designer/src/designer/qdesigner_formwindow.cpp
index 4ac104450..44db4df03 100644
--- a/src/designer/src/designer/qdesigner_formwindow.cpp
+++ b/src/designer/src/designer/qdesigner_formwindow.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_formwindow.h"
#include "qdesigner_workbench.h"
@@ -53,13 +28,13 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
QDesignerFormWindow::QDesignerFormWindow(QDesignerFormWindowInterface *editor, QDesignerWorkbench *workbench, QWidget *parent, Qt::WindowFlags flags)
: QWidget(parent, flags),
m_editor(editor),
m_workbench(workbench),
- m_action(new QAction(this)),
- m_initialized(false),
- m_windowTitleInitialized(false)
+ m_action(new QAction(this))
{
Q_ASSERT(workbench);
@@ -98,7 +73,7 @@ void QDesignerFormWindow::changeEvent(QEvent *e)
{
switch (e->type()) {
case QEvent::WindowTitleChange:
- m_action->setText(windowTitle().remove(QStringLiteral("[*]")));
+ m_action->setText(windowTitle().remove("[*]"_L1));
break;
case QEvent::WindowIconChange:
m_action->setIcon(windowIcon());
@@ -163,7 +138,7 @@ int QDesignerFormWindow::getNumberOfUntitledWindows() const
// Find the number of untitled windows excluding ourselves.
// Do not fall for 'untitled.ui', match with modified place holder.
// This will cause some problems with i18n, but for now I need the string to be "static"
- static const QRegularExpression rx(QStringLiteral("untitled( (\\d+))?\\[\\*\\]$"));
+ static const QRegularExpression rx(u"untitled( (\\d+))?\\[\\*\\]$"_s);
Q_ASSERT(rx.isValid());
for (int i = 0; i < totalWindows; ++i) {
QDesignerFormWindow *fw = m_workbench->formWindow(i);
@@ -195,10 +170,9 @@ void QDesignerFormWindow::updateWindowTitle(const QString &fileName)
QString fileNameTitle;
if (fileName.isEmpty()) {
- fileNameTitle = QStringLiteral("untitled");
+ fileNameTitle += "untitled"_L1;
if (const int maxUntitled = getNumberOfUntitledWindows()) {
- fileNameTitle += QLatin1Char(' ');
- fileNameTitle += QString::number(maxUntitled + 1);
+ fileNameTitle += u' ' + QString::number(maxUntitled + 1);
}
} else {
fileNameTitle = QFileInfo(fileName).fileName();
@@ -270,7 +244,7 @@ void QDesignerFormWindow::slotGeometryChanged()
QObject *object = core->propertyEditor()->object();
if (object == nullptr || !object->isWidgetType())
return;
- static const QString geometryProperty = QStringLiteral("geometry");
+ static const QString geometryProperty = u"geometry"_s;
const QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), object);
const int geometryIndex = sheet->indexOf(geometryProperty);
if (geometryIndex == -1)
diff --git a/src/designer/src/designer/qdesigner_formwindow.h b/src/designer/src/designer/qdesigner_formwindow.h
index da82f2495..6e509fcdd 100644
--- a/src/designer/src/designer/qdesigner_formwindow.h
+++ b/src/designer/src/designer/qdesigner_formwindow.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QDESIGNER_FORMWINDOW_H
#define QDESIGNER_FORMWINDOW_H
@@ -75,8 +50,8 @@ private:
QPointer<QDesignerFormWindowInterface> m_editor;
QPointer<QDesignerWorkbench> m_workbench;
QAction *m_action;
- bool m_initialized;
- bool m_windowTitleInitialized;
+ bool m_initialized = false;
+ bool m_windowTitleInitialized = false;
};
QT_END_NAMESPACE
diff --git a/src/designer/src/designer/qdesigner_pch.h b/src/designer/src/designer/qdesigner_pch.h
index 3615232c7..da4e03ddb 100644
--- a/src/designer/src/designer/qdesigner_pch.h
+++ b/src/designer/src/designer/qdesigner_pch.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#if defined __cplusplus
#include <QtCore/qobject.h>
diff --git a/src/designer/src/designer/qdesigner_server.cpp b/src/designer/src/designer/qdesigner_server.cpp
index e223f0b2c..5fd5c63ba 100644
--- a/src/designer/src/designer/qdesigner_server.cpp
+++ b/src/designer/src/designer/qdesigner_server.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/qfileinfo.h>
#include <QtCore/qstringlist.h>
@@ -40,12 +15,13 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
// ### review
QDesignerServer::QDesignerServer(QObject *parent)
: QObject(parent)
{
- m_socket = nullptr;
m_server = new QTcpServer(this);
if (m_server->listen(QHostAddress::LocalHost, 0)) {
connect(m_server, &QTcpServer::newConnection,
@@ -81,8 +57,8 @@ void QDesignerServer::readFromClient()
while (m_socket->canReadLine()) {
QString file = QString::fromUtf8(m_socket->readLine());
if (!file.isNull()) {
- file.remove(QLatin1Char('\n'));
- file.remove(QLatin1Char('\r'));
+ file.remove(u'\n');
+ file.remove(u'\r');
qDesigner->postEvent(qDesigner, new QFileOpenEvent(file));
}
}
@@ -127,8 +103,8 @@ void QDesignerClient::readFromSocket()
while (m_socket->canReadLine()) {
QString file = QString::fromUtf8(m_socket->readLine());
if (!file.isNull()) {
- file.remove(QLatin1Char('\n'));
- file.remove(QLatin1Char('\r'));
+ file.remove(u'\n');
+ file.remove(u'\r');
if (QFile::exists(file))
qDesigner->postEvent(qDesigner, new QFileOpenEvent(file));
}
diff --git a/src/designer/src/designer/qdesigner_server.h b/src/designer/src/designer/qdesigner_server.h
index 28eec7887..d45345599 100644
--- a/src/designer/src/designer/qdesigner_server.h
+++ b/src/designer/src/designer/qdesigner_server.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QDESIGNER_SERVER_H
#define QDESIGNER_SERVER_H
@@ -54,7 +29,7 @@ private slots:
private:
QTcpServer *m_server;
- QTcpSocket *m_socket;
+ QTcpSocket *m_socket = nullptr;
};
class QDesignerClient: public QObject
diff --git a/src/designer/src/designer/qdesigner_settings.cpp b/src/designer/src/designer/qdesigner_settings.cpp
index e8ac4be54..9a3010323 100644
--- a/src/designer/src/designer/qdesigner_settings.cpp
+++ b/src/designer/src/designer/qdesigner_settings.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner.h"
#include "qdesigner_settings.h"
@@ -49,15 +24,17 @@ enum { debugSettings = 0 };
QT_BEGIN_NAMESPACE
-static const char *newFormShowKey = "newFormDialog/ShowOnStartup";
+using namespace Qt::StringLiterals;
+
+static constexpr auto newFormShowKey = "newFormDialog/ShowOnStartup"_L1;
// Change the version whenever the arrangement changes significantly.
-static const char *mainWindowStateKey = "MainWindowState45";
-static const char *toolBarsStateKey = "ToolBarsState45";
+static constexpr auto mainWindowStateKey = "MainWindowState45"_L1;
+static constexpr auto toolBarsStateKey = "ToolBarsState45"_L1;
-static const char *backupOrgListKey = "backup/fileListOrg";
-static const char *backupBakListKey = "backup/fileListBak";
-static const char *recentFilesListKey = "recentFilesList";
+static constexpr auto backupOrgListKey = "backup/fileListOrg"_L1;
+static constexpr auto backupBakListKey = "backup/fileListBak"_L1;
+static constexpr auto recentFilesListKey = "recentFilesList"_L1;
QDesignerSettings::QDesignerSettings(QDesignerFormEditorInterface *core) :
qdesigner_internal::QDesignerSharedSettings(core)
@@ -87,8 +64,8 @@ void QDesignerSettings::saveGeometryFor(const QWidget *w)
if (debugSettings)
qDebug() << Q_FUNC_INFO << w << "visible=" << visible;
s->beginGroup(w->objectName());
- s->setValue(QStringLiteral("visible"), visible);
- s->setValue(QStringLiteral("geometry"), w->saveGeometry());
+ s->setValue(u"visible"_s, visible);
+ s->setValue(u"geometry"_s, w->saveGeometry());
s->endGroup();
}
@@ -96,8 +73,8 @@ void QDesignerSettings::restoreGeometry(QWidget *w, QRect fallBack) const
{
Q_ASSERT(w && !w->objectName().isEmpty());
const QString key = w->objectName();
- const QByteArray ba(settings()->value(key + QStringLiteral("/geometry")).toByteArray());
- const bool visible = settings()->value(key + QStringLiteral("/visible"), true).toBool();
+ const QByteArray ba(settings()->value(key + "/geometry"_L1).toByteArray());
+ const bool visible = settings()->value(key + "/visible"_L1, true).toBool();
if (debugSettings)
qDebug() << Q_FUNC_INFO << w << fallBack << "visible=" << visible;
@@ -121,44 +98,44 @@ void QDesignerSettings::restoreGeometry(QWidget *w, QRect fallBack) const
QStringList QDesignerSettings::recentFilesList() const
{
- return settings()->value(QLatin1String(recentFilesListKey)).toStringList();
+ return settings()->value(recentFilesListKey).toStringList();
}
void QDesignerSettings::setRecentFilesList(const QStringList &sl)
{
- settings()->setValue(QLatin1String(recentFilesListKey), sl);
+ settings()->setValue(recentFilesListKey, sl);
}
void QDesignerSettings::setShowNewFormOnStartup(bool showIt)
{
- settings()->setValue(QLatin1String(newFormShowKey), showIt);
+ settings()->setValue(newFormShowKey, showIt);
}
bool QDesignerSettings::showNewFormOnStartup() const
{
- return settings()->value(QLatin1String(newFormShowKey), true).toBool();
+ return settings()->value(newFormShowKey, true).toBool();
}
QByteArray QDesignerSettings::mainWindowState(UIMode mode) const
{
- return settings()->value(QLatin1String(mainWindowStateKey) + modeChar(mode)).toByteArray();
+ return settings()->value(mainWindowStateKey + modeChar(mode)).toByteArray();
}
void QDesignerSettings::setMainWindowState(UIMode mode, const QByteArray &mainWindowState)
{
- settings()->setValue(QLatin1String(mainWindowStateKey) + modeChar(mode), mainWindowState);
+ settings()->setValue(mainWindowStateKey + modeChar(mode), mainWindowState);
}
QByteArray QDesignerSettings::toolBarsState(UIMode mode) const
{
- QString key = QLatin1String(toolBarsStateKey);
+ QString key = toolBarsStateKey;
key += modeChar(mode);
return settings()->value(key).toByteArray();
}
void QDesignerSettings::setToolBarsState(UIMode mode, const QByteArray &toolBarsState)
{
- QString key = QLatin1String(toolBarsStateKey);
+ QString key = toolBarsStateKey;
key += modeChar(mode);
settings()->setValue(key, toolBarsState);
}
@@ -166,8 +143,8 @@ void QDesignerSettings::setToolBarsState(UIMode mode, const QByteArray &toolBars
void QDesignerSettings::clearBackup()
{
QDesignerSettingsInterface *s = settings();
- s->remove(QLatin1String(backupOrgListKey));
- s->remove(QLatin1String(backupBakListKey));
+ s->remove(backupOrgListKey);
+ s->remove(backupBakListKey);
}
void QDesignerSettings::setBackup(const QMap<QString, QString> &map)
@@ -176,18 +153,18 @@ void QDesignerSettings::setBackup(const QMap<QString, QString> &map)
const QStringList bak = map.values();
QDesignerSettingsInterface *s = settings();
- s->setValue(QLatin1String(backupOrgListKey), org);
- s->setValue(QLatin1String(backupBakListKey), bak);
+ s->setValue(backupOrgListKey, org);
+ s->setValue(backupBakListKey, bak);
}
QMap<QString, QString> QDesignerSettings::backup() const
{
- const QStringList org = settings()->value(QLatin1String(backupOrgListKey), QStringList()).toStringList();
- const QStringList bak = settings()->value(QLatin1String(backupBakListKey), QStringList()).toStringList();
+ const QStringList org = settings()->value(backupOrgListKey, QStringList()).toStringList();
+ const QStringList bak = settings()->value(backupBakListKey, QStringList()).toStringList();
QMap<QString, QString> map;
- const int orgCount = org.count();
- for (int i = 0; i < orgCount; ++i)
+ const qsizetype orgCount = org.size();
+ for (qsizetype i = 0; i < orgCount; ++i)
map.insert(org.at(i), bak.at(i));
return map;
@@ -196,8 +173,8 @@ QMap<QString, QString> QDesignerSettings::backup() const
void QDesignerSettings::setUiMode(UIMode mode)
{
QDesignerSettingsInterface *s = settings();
- s->beginGroup(QStringLiteral("UI"));
- s->setValue(QStringLiteral("currentMode"), mode);
+ s->beginGroup(u"UI"_s);
+ s->setValue(u"currentMode"_s, mode);
s->endGroup();
}
@@ -208,17 +185,17 @@ UIMode QDesignerSettings::uiMode() const
#else
const UIMode defaultMode = DockedMode;
#endif
- UIMode uiMode = static_cast<UIMode>(value(QStringLiteral("UI/currentMode"), defaultMode).toInt());
+ UIMode uiMode = static_cast<UIMode>(value(u"UI/currentMode"_s, defaultMode).toInt());
return uiMode;
}
void QDesignerSettings::setToolWindowFont(const ToolWindowFontSettings &fontSettings)
{
QDesignerSettingsInterface *s = settings();
- s->beginGroup(QStringLiteral("UI"));
- s->setValue(QStringLiteral("font"), fontSettings.m_font);
- s->setValue(QStringLiteral("useFont"), fontSettings.m_useFont);
- s->setValue(QStringLiteral("writingSystem"), fontSettings.m_writingSystem);
+ s->beginGroup(u"UI"_s);
+ s->setValue(u"font"_s, fontSettings.m_font);
+ s->setValue(u"useFont"_s, fontSettings.m_useFont);
+ s->setValue(u"writingSystem"_s, fontSettings.m_writingSystem);
s->endGroup();
}
@@ -226,11 +203,11 @@ ToolWindowFontSettings QDesignerSettings::toolWindowFont() const
{
ToolWindowFontSettings fontSettings;
fontSettings.m_writingSystem =
- static_cast<QFontDatabase::WritingSystem>(value(QStringLiteral("UI/writingSystem"),
+ static_cast<QFontDatabase::WritingSystem>(value(u"UI/writingSystem"_s,
QFontDatabase::Any).toInt());
- fontSettings.m_font = qvariant_cast<QFont>(value(QStringLiteral("UI/font")));
+ fontSettings.m_font = qvariant_cast<QFont>(value(u"UI/font"_s));
fontSettings.m_useFont =
- settings()->value(QStringLiteral("UI/useFont"), QVariant(false)).toBool();
+ settings()->value(u"UI/useFont"_s, QVariant(false)).toBool();
return fontSettings;
}
diff --git a/src/designer/src/designer/qdesigner_settings.h b/src/designer/src/designer/qdesigner_settings.h
index 52ef46b85..72895a52d 100644
--- a/src/designer/src/designer/qdesigner_settings.h
+++ b/src/designer/src/designer/qdesigner_settings.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QDESIGNER_SETTINGS_H
#define QDESIGNER_SETTINGS_H
diff --git a/src/designer/src/designer/qdesigner_toolwindow.cpp b/src/designer/src/designer/qdesigner_toolwindow.cpp
index 2a003bb25..3583a55e9 100644
--- a/src/designer/src/designer/qdesigner_toolwindow.cpp
+++ b/src/designer/src/designer/qdesigner_toolwindow.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner.h"
#include "qdesigner_toolwindow.h"
@@ -43,17 +18,13 @@
#include <QtCore/qdebug.h>
-enum { debugToolWindow = 0 };
+static constexpr bool debugToolWindow = false;
QT_BEGIN_NAMESPACE
-// ---------------- QDesignerToolWindowFontSettings
-bool ToolWindowFontSettings::equals(const ToolWindowFontSettings &rhs) const
-{
- return m_useFont == rhs.m_useFont &&
- m_writingSystem == rhs.m_writingSystem &&
- m_font == rhs.m_font;
-}
+using namespace Qt::StringLiterals;
+
+static constexpr int margin = 20;
// ---------------- QDesignerToolWindow
QDesignerToolWindow::QDesignerToolWindow(QDesignerWorkbench *workbench,
@@ -134,16 +105,6 @@ QDesignerWorkbench *QDesignerToolWindow::workbench() const
return m_workbench;
}
-QRect QDesignerToolWindow::geometryHint() const
-{
- return QRect();
-}
-
-QRect QDesignerToolWindow::availableToolWindowGeometry() const
-{
- return m_workbench->availableGeometry();
-}
-
// ---------------------- PropertyEditorToolWindow
static inline QWidget *createPropertyEditor(QDesignerFormEditorInterface *core, QWidget *parent = nullptr)
@@ -158,7 +119,7 @@ class PropertyEditorToolWindow : public QDesignerToolWindow
public:
explicit PropertyEditorToolWindow(QDesignerWorkbench *workbench);
- QRect geometryHint() const override;
+ QRect geometryHint(const QRect &) const override;
protected:
void showEvent(QShowEvent *event) override;
@@ -167,19 +128,17 @@ protected:
PropertyEditorToolWindow::PropertyEditorToolWindow(QDesignerWorkbench *workbench) :
QDesignerToolWindow(workbench,
createPropertyEditor(workbench->core()),
- QStringLiteral("qt_designer_propertyeditor"),
+ u"qt_designer_propertyeditor"_s,
QDesignerToolWindow::tr("Property Editor"),
- QStringLiteral("__qt_property_editor_action"),
+ u"__qt_property_editor_action"_s,
Qt::RightDockWidgetArea)
{
action()->setShortcut(Qt::CTRL | Qt::Key_I);
}
-QRect PropertyEditorToolWindow::geometryHint() const
+QRect PropertyEditorToolWindow::geometryHint(const QRect &g) const
{
- const QRect g = availableToolWindowGeometry();
- const int margin = workbench()->marginHint();
const int spacing = 40;
const QSize sz(g.width() * 1/4, g.height() * 4/6);
@@ -215,24 +174,21 @@ class ActionEditorToolWindow: public QDesignerToolWindow
public:
explicit ActionEditorToolWindow(QDesignerWorkbench *workbench);
- QRect geometryHint() const override;
+ QRect geometryHint(const QRect &g) const override;
};
ActionEditorToolWindow::ActionEditorToolWindow(QDesignerWorkbench *workbench) :
QDesignerToolWindow(workbench,
createActionEditor(workbench->core()),
- QStringLiteral("qt_designer_actioneditor"),
+ u"qt_designer_actioneditor"_s,
QDesignerToolWindow::tr("Action Editor"),
- QStringLiteral("__qt_action_editor_tool_action"),
+ u"__qt_action_editor_tool_action"_s,
Qt::RightDockWidgetArea)
{
}
-QRect ActionEditorToolWindow::geometryHint() const
+QRect ActionEditorToolWindow::geometryHint(const QRect &g) const
{
- const QRect g = availableToolWindowGeometry();
- const int margin = workbench()->marginHint();
-
const QSize sz(g.width() * 1/4, g.height() * 1/6);
const QRect rc = QRect((g.right() + 1 - sz.width() - margin),
@@ -257,24 +213,21 @@ class ObjectInspectorToolWindow: public QDesignerToolWindow
public:
explicit ObjectInspectorToolWindow(QDesignerWorkbench *workbench);
- QRect geometryHint() const override;
+ QRect geometryHint(const QRect &g) const override;
};
ObjectInspectorToolWindow::ObjectInspectorToolWindow(QDesignerWorkbench *workbench) :
QDesignerToolWindow(workbench,
createObjectInspector(workbench->core()),
- QStringLiteral("qt_designer_objectinspector"),
+ u"qt_designer_objectinspector"_s,
QDesignerToolWindow::tr("Object Inspector"),
- QStringLiteral("__qt_object_inspector_tool_action"),
+ u"__qt_object_inspector_tool_action"_s,
Qt::RightDockWidgetArea)
{
}
-QRect ObjectInspectorToolWindow::geometryHint() const
+QRect ObjectInspectorToolWindow::geometryHint(const QRect &g) const
{
- const QRect g = availableToolWindowGeometry();
- const int margin = workbench()->marginHint();
-
const QSize sz(g.width() * 1/4, g.height() * 1/6);
const QRect rc = QRect((g.right() + 1 - sz.width() - margin),
@@ -292,24 +245,21 @@ class ResourceEditorToolWindow: public QDesignerToolWindow
public:
explicit ResourceEditorToolWindow(QDesignerWorkbench *workbench);
- QRect geometryHint() const override;
+ QRect geometryHint(const QRect &g) const override;
};
ResourceEditorToolWindow::ResourceEditorToolWindow(QDesignerWorkbench *workbench) :
QDesignerToolWindow(workbench,
QDesignerComponents::createResourceEditor(workbench->core(), nullptr),
- QStringLiteral("qt_designer_resourceeditor"),
+ u"qt_designer_resourceeditor"_s,
QDesignerToolWindow::tr("Resource Browser"),
- QStringLiteral("__qt_resource_editor_tool_action"),
+ u"__qt_resource_editor_tool_action"_s,
Qt::RightDockWidgetArea)
{
}
-QRect ResourceEditorToolWindow::geometryHint() const
+QRect ResourceEditorToolWindow::geometryHint(const QRect &g) const
{
- const QRect g = availableToolWindowGeometry();
- const int margin = workbench()->marginHint();
-
const QSize sz(g.width() * 1/3, g.height() * 1/6);
QRect r(QPoint(0, 0), sz);
r.moveCenter(g.center());
@@ -326,24 +276,21 @@ class SignalSlotEditorToolWindow: public QDesignerToolWindow
public:
explicit SignalSlotEditorToolWindow(QDesignerWorkbench *workbench);
- QRect geometryHint() const override;
+ QRect geometryHint(const QRect &g) const override;
};
SignalSlotEditorToolWindow::SignalSlotEditorToolWindow(QDesignerWorkbench *workbench) :
QDesignerToolWindow(workbench,
QDesignerComponents::createSignalSlotEditor(workbench->core(), nullptr),
- QStringLiteral("qt_designer_signalsloteditor"),
+ u"qt_designer_signalsloteditor"_s,
QDesignerToolWindow::tr("Signal/Slot Editor"),
- QStringLiteral("__qt_signal_slot_editor_tool_action"),
+ u"__qt_signal_slot_editor_tool_action"_s,
Qt::RightDockWidgetArea)
{
}
-QRect SignalSlotEditorToolWindow::geometryHint() const
+QRect SignalSlotEditorToolWindow::geometryHint(const QRect &g) const
{
- const QRect g = availableToolWindowGeometry();
- const int margin = workbench()->marginHint();
-
const QSize sz(g.width() * 1/3, g.height() * 1/6);
QRect r(QPoint(0, 0), sz);
r.moveCenter(g.center());
@@ -367,23 +314,21 @@ class WidgetBoxToolWindow: public QDesignerToolWindow
public:
explicit WidgetBoxToolWindow(QDesignerWorkbench *workbench);
- QRect geometryHint() const override;
+ QRect geometryHint(const QRect &g) const override;
};
WidgetBoxToolWindow::WidgetBoxToolWindow(QDesignerWorkbench *workbench) :
QDesignerToolWindow(workbench,
createWidgetBox(workbench->core()),
- QStringLiteral("qt_designer_widgetbox"),
+ u"qt_designer_widgetbox"_s,
QDesignerToolWindow::tr("Widget Box"),
- QStringLiteral("__qt_widget_box_tool_action"),
+ u"__qt_widget_box_tool_action"_s,
Qt::LeftDockWidgetArea)
{
}
-QRect WidgetBoxToolWindow::geometryHint() const
+QRect WidgetBoxToolWindow::geometryHint(const QRect &g) const
{
- const QRect g = availableToolWindowGeometry();
- const int margin = workbench()->marginHint();
const QRect rc = QRect(g.left() + margin,
g.top() + margin,
g.width() * 1/4, g.height() * 5/6);
diff --git a/src/designer/src/designer/qdesigner_toolwindow.h b/src/designer/src/designer/qdesigner_toolwindow.h
index 88ea6bb00..7fec13981 100644
--- a/src/designer/src/designer/qdesigner_toolwindow.h
+++ b/src/designer/src/designer/qdesigner_toolwindow.h
@@ -1,59 +1,33 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QDESIGNER_TOOLWINDOW_H
#define QDESIGNER_TOOLWINDOW_H
#include "mainwindow.h"
+#include <QtCore/qcompare.h>
#include <QtCore/qpointer.h>
#include <QtGui/qfontdatabase.h>
#include <QtWidgets/qmainwindow.h>
QT_BEGIN_NAMESPACE
-struct ToolWindowFontSettings {
- bool equals(const ToolWindowFontSettings &) const;
-
+struct ToolWindowFontSettings
+{
QFont m_font;
QFontDatabase::WritingSystem m_writingSystem{QFontDatabase::Any};
bool m_useFont{false};
-};
-
-inline bool operator==(const ToolWindowFontSettings &tw1, const ToolWindowFontSettings &tw2)
-{
- return tw1.equals(tw2);
-}
-inline bool operator!=(const ToolWindowFontSettings &tw1, const ToolWindowFontSettings &tw2)
-{
- return !tw1.equals(tw2);
-}
+ friend bool comparesEqual(const ToolWindowFontSettings &lhs,
+ const ToolWindowFontSettings &rhs) noexcept
+ {
+ return lhs.m_useFont == rhs.m_useFont
+ && lhs.m_writingSystem == rhs.m_writingSystem
+ && lhs.m_font == rhs.m_font;
+ }
+ Q_DECLARE_EQUALITY_COMPARABLE(ToolWindowFontSettings)
+};
class QDesignerWorkbench;
@@ -86,7 +60,7 @@ public:
QAction *action() const;
Qt::DockWidgetArea dockWidgetAreaHint() const { return m_dockAreaHint; }
- virtual QRect geometryHint() const;
+ virtual QRect geometryHint(const QRect &availableGeometry) const = 0;
private slots:
void showMe(bool);
@@ -96,8 +70,6 @@ protected:
void hideEvent(QHideEvent *e) override;
void changeEvent(QEvent *e) override;
- QRect availableToolWindowGeometry() const;
-
private:
const Qt::DockWidgetArea m_dockAreaHint;
QDesignerWorkbench *m_workbench;
diff --git a/src/designer/src/designer/qdesigner_workbench.cpp b/src/designer/src/designer/qdesigner_workbench.cpp
index f94aa98bd..ff1b37030 100644
--- a/src/designer/src/designer/qdesigner_workbench.cpp
+++ b/src/designer/src/designer/qdesigner_workbench.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_workbench.h"
#include "qdesigner.h"
@@ -59,8 +34,10 @@
#include <QtWidgets/qlayout.h>
#include <QtGui/qactiongroup.h>
+#include <QtGui/qcursor.h>
#include <QtGui/qevent.h>
#include <QtGui/qscreen.h>
+#include <QtGui/qwindow.h>
#include <QtCore/qdir.h>
#include <QtCore/qfile.h>
@@ -71,13 +48,15 @@
QT_BEGIN_NAMESPACE
-static const char *appFontPrefixC = "AppFonts";
+using namespace Qt::StringLiterals;
+
+static constexpr auto appFontPrefixC = "AppFonts"_L1;
using ActionList = QList<QAction *>;
static QMdiSubWindow *mdiSubWindowOf(const QWidget *w)
{
- QMdiSubWindow *rc = qobject_cast<QMdiSubWindow *>(w->parentWidget());
+ auto *rc = qobject_cast<QMdiSubWindow *>(w->parentWidget());
Q_ASSERT(rc);
return rc;
}
@@ -85,7 +64,7 @@ static QMdiSubWindow *mdiSubWindowOf(const QWidget *w)
static QDockWidget *dockWidgetOf(const QWidget *w)
{
for (QWidget *parentWidget = w->parentWidget(); parentWidget ; parentWidget = parentWidget->parentWidget()) {
- if (QDockWidget *dw = qobject_cast<QDockWidget *>(parentWidget)) {
+ if (auto *dw = qobject_cast<QDockWidget *>(parentWidget)) {
return dw;
}
}
@@ -94,9 +73,9 @@ static QDockWidget *dockWidgetOf(const QWidget *w)
}
// ------------ QDesignerWorkbench::Position
-QDesignerWorkbench::Position::Position(const QMdiSubWindow *mdiSubWindow, const QPoint &mdiAreaOffset) :
+QDesignerWorkbench::Position::Position(const QMdiSubWindow *mdiSubWindow) :
m_minimized(mdiSubWindow->isShaded()),
- m_position(mdiSubWindow->pos() + mdiAreaOffset)
+ m_position(mdiSubWindow->pos() + mdiSubWindow->mdiArea()->pos())
{
}
@@ -106,12 +85,12 @@ QDesignerWorkbench::Position::Position(const QDockWidget *dockWidget) :
{
}
-QDesignerWorkbench::Position::Position(const QWidget *topLevelWindow, const QPoint &desktopTopLeft)
+QDesignerWorkbench::Position::Position(const QWidget *topLevelWindow)
{
- const QWidget *window =topLevelWindow->window ();
+ const QWidget *window = topLevelWindow->window();
Q_ASSERT(window);
m_minimized = window->isMinimized();
- m_position = window->pos() - desktopTopLeft;
+ m_position = window->pos() - window->screen()->availableGeometry().topLeft();
}
void QDesignerWorkbench::Position::applyTo(QMdiSubWindow *mdiSubWindow,
@@ -150,9 +129,8 @@ void QDesignerWorkbench::Position::applyTo(QDockWidget *dockWidget) const
static inline void addActionsToMenu(QMenu *m, const ActionList &al)
{
- const ActionList::const_iterator cend = al.constEnd();
- for (ActionList::const_iterator it = al.constBegin(); it != cend; ++it)
- m->addAction(*it);
+ for (auto *a : al)
+ m->addAction(a);
}
static inline QMenu *addMenu(QMenuBar *mb, const QString &title, const ActionList &al)
@@ -164,8 +142,8 @@ static inline QMenu *addMenu(QMenuBar *mb, const QString &title, const ActionLis
// -------- QDesignerWorkbench
-QDesignerWorkbench::QDesignerWorkbench() :
- m_core(QDesignerComponents::createFormEditor(this)),
+QDesignerWorkbench::QDesignerWorkbench(const QStringList &pluginPaths) :
+ m_core(QDesignerComponents::createFormEditorWithPluginPaths(pluginPaths, this)),
m_windowActions(new QActionGroup(this)),
m_globalMenuBar(new QMenuBar)
{
@@ -189,7 +167,7 @@ QDesignerWorkbench::QDesignerWorkbench() :
addActionsToMenu(editMenu, m_actionManager->toolActions()->actions());
QMenu *formMenu = addMenu(m_globalMenuBar, tr("F&orm"), m_actionManager->formActions()->actions());
- QMenu *previewSubMenu = new QMenu(tr("Preview in"), formMenu);
+ auto *previewSubMenu = new QMenu(tr("Preview in"), formMenu);
formMenu->insertMenu(m_actionManager->previewFormAction(), previewSubMenu);
addActionsToMenu(previewSubMenu, m_actionManager->styleActions()->actions());
@@ -202,7 +180,7 @@ QDesignerWorkbench::QDesignerWorkbench() :
addMenu(m_globalMenuBar, tr("&Help"), m_actionManager->helpActions()->actions());
// Add the tools in view menu order
- QActionGroup *viewActions = new QActionGroup(this);
+ auto *viewActions = new QActionGroup(this);
viewActions->setExclusive(false);
for (int i = 0; i < QDesignerToolWindow::StandardToolWindowCount; i++) {
@@ -242,7 +220,7 @@ QDesignerWorkbench::QDesignerWorkbench() :
}
restoreUISettings();
- AppFontWidget::restore(m_core->settingsManager(), QLatin1String(appFontPrefixC));
+ AppFontWidget::restore(m_core->settingsManager(), appFontPrefixC);
m_state = StateUp;
}
@@ -257,6 +235,9 @@ QDesignerWorkbench::~QDesignerWorkbench()
delete widgetBoxToolWindow();
break;
}
+ delete m_globalMenuBar;
+ m_windowMenu = nullptr;
+ delete m_dockedMainWindow;
}
void QDesignerWorkbench::saveGeometriesForModeChange()
@@ -266,19 +247,17 @@ void QDesignerWorkbench::saveGeometriesForModeChange()
case NeutralMode:
break;
case TopLevelMode: {
- const QPoint desktopOffset = QGuiApplication::primaryScreen()->availableGeometry().topLeft();
- for (QDesignerToolWindow *tw : qAsConst(m_toolWindows))
- m_Positions.insert(tw, Position(tw, desktopOffset));
- for (QDesignerFormWindow *fw : qAsConst(m_formWindows))
- m_Positions.insert(fw, Position(fw, desktopOffset));
+ for (QDesignerToolWindow *tw : std::as_const(m_toolWindows))
+ m_Positions.insert(tw, Position(tw));
+ for (QDesignerFormWindow *fw : std::as_const(m_formWindows))
+ m_Positions.insert(fw, Position(fw));
}
break;
case DockedMode: {
- const QPoint mdiAreaOffset = m_dockedMainWindow->mdiArea()->pos();
- for (QDesignerToolWindow *tw : qAsConst(m_toolWindows))
+ for (QDesignerToolWindow *tw : std::as_const(m_toolWindows))
m_Positions.insert(tw, Position(dockWidgetOf(tw)));
- for (QDesignerFormWindow *fw : qAsConst(m_formWindows))
- m_Positions.insert(fw, Position(mdiSubWindowOf(fw), mdiAreaOffset));
+ for (QDesignerFormWindow *fw : std::as_const(m_formWindows))
+ m_Positions.insert(fw, Position(mdiSubWindowOf(fw)));
}
break;
}
@@ -346,11 +325,12 @@ QWidget *QDesignerWorkbench::magicalParent(const QWidget *w) const
case DockedMode:
return m_dockedMainWindow->mdiArea();
case NeutralMode:
- return nullptr;
+ break;
default:
- Q_ASSERT(0);
- return 0;
+ Q_ASSERT(false);
+ break;
}
+ return nullptr;
}
void QDesignerWorkbench::switchToNeutralMode()
@@ -368,14 +348,23 @@ void QDesignerWorkbench::switchToNeutralMode()
m_mode = NeutralMode;
- for (QDesignerToolWindow *tw : qAsConst(m_toolWindows)) {
+ for (QDesignerToolWindow *tw : std::as_const(m_toolWindows)) {
tw->setCloseEventPolicy(MainWindowBase::AcceptCloseEvents);
tw->setParent(nullptr);
+ // Prevent unneeded native children when switching to docked
+ if (auto *handle = tw->windowHandle())
+ handle->destroy();
}
- for (QDesignerFormWindow *fw : qAsConst(m_formWindows)) {
+ if (m_dockedMainWindow != nullptr) // Prevent assert
+ m_dockedMainWindow->mdiArea()->setActiveSubWindow(nullptr);
+
+ for (QDesignerFormWindow *fw : std::as_const(m_formWindows)) {
fw->setParent(nullptr);
fw->setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
+ // Prevent unneeded native children when switching to docked
+ if (auto *handle = fw->windowHandle())
+ handle->destroy();
}
#ifndef Q_OS_MACOS
@@ -386,7 +375,6 @@ void QDesignerWorkbench::switchToNeutralMode()
qDesigner->setMainWindow(nullptr);
delete m_dockedMainWindow;
- m_dockedMainWindow = nullptr;
}
void QDesignerWorkbench::switchToDockedMode()
@@ -416,7 +404,9 @@ void QDesignerWorkbench::switchToDockedMode()
this, &QDesignerWorkbench::slotFileDropped);
connect(m_dockedMainWindow, &DockedMainWindow::formWindowActivated,
this, &QDesignerWorkbench::slotFormWindowActivated);
- m_dockedMainWindow->restoreSettings(settings, m_dockedMainWindow->addToolWindows(m_toolWindows), desktopGeometry());
+ m_dockedMainWindow->restoreSettings(settings,
+ m_dockedMainWindow->addToolWindows(m_toolWindows),
+ screen()->availableGeometry());
m_core->setTopLevel(m_dockedMainWindow);
@@ -426,7 +416,7 @@ void QDesignerWorkbench::switchToDockedMode()
#endif
qDesigner->setMainWindow(m_dockedMainWindow);
- for (QDesignerFormWindow *fw : qAsConst(m_formWindows)) {
+ for (QDesignerFormWindow *fw : std::as_const(m_formWindows)) {
QMdiSubWindow *subwin = m_dockedMainWindow->createMdiSubWindow(fw, magicalWindowFlags(fw),
m_actionManager->closeFormAction()->shortcut());
subwin->hide();
@@ -446,13 +436,22 @@ void QDesignerWorkbench::adjustMDIFormPositions()
{
const QPoint mdiAreaOffset = m_dockedMainWindow->mdiArea()->pos();
- for (QDesignerFormWindow *fw : qAsConst(m_formWindows)) {
- const PositionMap::const_iterator pit = m_Positions.constFind(fw);
+ for (QDesignerFormWindow *fw : std::as_const(m_formWindows)) {
+ const auto pit = m_Positions.constFind(fw);
if (pit != m_Positions.constEnd())
pit->applyTo(mdiSubWindowOf(fw), mdiAreaOffset);
}
}
+static QScreen *screenUnderMouse()
+{
+ const auto &screens = QGuiApplication::screens();
+ const auto pos = QCursor::pos();
+ auto pred = [pos](const QScreen *s) { return s->geometry().contains(pos); };
+ auto it = std::find_if(screens.cbegin(), screens.cend(), pred);
+ return it != screens.cend() ? *it : QGuiApplication::primaryScreen();
+}
+
void QDesignerWorkbench::switchToTopLevelMode()
{
if (m_mode == TopLevelMode)
@@ -463,8 +462,13 @@ void QDesignerWorkbench::switchToTopLevelMode()
Q_ASSERT(widgetBoxWrapper);
switchToNeutralMode();
- const QPoint desktopOffset = desktopGeometry().topLeft();
- m_mode = TopLevelMode;
+ m_mode = TopLevelMode; // Set new mode before calling screen()
+ const QDesignerSettings settings(m_core);
+ const QByteArray mainWindowState = settings.mainWindowState(m_mode);
+ // Open on screen where the mouse is when no settings exist
+ const auto *currentScreen = mainWindowState.isEmpty() ? screenUnderMouse() : screen();
+ const QRect availableGeometry = currentScreen->availableGeometry();
+ const QPoint desktopOffset = availableGeometry.topLeft();
// The widget box is special, it gets the menubar and gets to be the main widget.
@@ -485,37 +489,36 @@ void QDesignerWorkbench::switchToTopLevelMode()
widgetBoxWrapper->setWindowTitle(MainWindowBase::mainWindowTitle());
#endif // !Q_OS_MACOS
- const QDesignerSettings settings(m_core);
m_topLevelData.toolbars = MainWindowBase::createToolBars(m_actionManager, false);
m_topLevelData.toolbarManager = new ToolBarManager(widgetBoxWrapper, widgetBoxWrapper,
m_toolbarMenu, m_actionManager,
m_topLevelData.toolbars, m_toolWindows);
- const int toolBarCount = m_topLevelData.toolbars.size();
- for (int i = 0; i < toolBarCount; i++) {
+ const qsizetype toolBarCount = m_topLevelData.toolbars.size();
+ for (qsizetype i = 0; i < toolBarCount; ++i) {
widgetBoxWrapper->addToolBar(m_topLevelData.toolbars.at(i));
if (i == 3)
widgetBoxWrapper->insertToolBarBreak(m_topLevelData.toolbars.at(i));
}
m_topLevelData.toolbarManager->restoreState(settings.toolBarsState(m_mode), MainWindowBase::settingsVersion());
- widgetBoxWrapper->restoreState(settings.mainWindowState(m_mode), MainWindowBase::settingsVersion());
+ widgetBoxWrapper->restoreState(mainWindowState, MainWindowBase::settingsVersion());
bool found_visible_window = false;
- for (QDesignerToolWindow *tw : qAsConst(m_toolWindows)) {
+ for (QDesignerToolWindow *tw : std::as_const(m_toolWindows)) {
tw->setParent(magicalParent(tw), magicalWindowFlags(tw));
- settings.restoreGeometry(tw, tw->geometryHint());
+ settings.restoreGeometry(tw, tw->geometryHint(availableGeometry));
tw->action()->setChecked(tw->isVisible());
found_visible_window |= tw->isVisible();
}
if (!m_toolWindows.isEmpty() && !found_visible_window)
- m_toolWindows.first()->show();
+ m_toolWindows.constFirst()->show();
m_actionManager->setBringAllToFrontVisible(true);
- for (QDesignerFormWindow *fw : qAsConst(m_formWindows)) {
+ for (QDesignerFormWindow *fw : std::as_const(m_formWindows)) {
fw->setParent(magicalParent(fw), magicalWindowFlags(fw));
fw->setAttribute(Qt::WA_DeleteOnClose, true);
- const PositionMap::const_iterator pit = m_Positions.constFind(fw);
+ const auto pit = m_Positions.constFind(fw);
if (pit != m_Positions.constEnd()) pit->applyTo(fw, desktopOffset);
// Force an activate in order to refresh minimumSize, otherwise it will not be respected
if (QLayout *layout = fw->layout())
@@ -537,7 +540,7 @@ QDesignerFormEditorInterface *QDesignerWorkbench::core() const
int QDesignerWorkbench::toolWindowCount() const
{
- return m_toolWindows.count();
+ return m_toolWindows.size();
}
QDesignerToolWindow *QDesignerWorkbench::toolWindow(int index) const
@@ -547,7 +550,7 @@ QDesignerToolWindow *QDesignerWorkbench::toolWindow(int index) const
int QDesignerWorkbench::formWindowCount() const
{
- return m_formWindows.count();
+ return m_formWindows.size();
}
QDesignerFormWindow *QDesignerWorkbench::formWindow(int index) const
@@ -555,36 +558,20 @@ QDesignerFormWindow *QDesignerWorkbench::formWindow(int index) const
return m_formWindows.at(index);
}
-QRect QDesignerWorkbench::desktopGeometry() const
+QScreen *QDesignerWorkbench::screen() const
{
- // Return geometry of the desktop designer is running in.
- QWidget *widget = nullptr;
- switch (m_mode) {
- case DockedMode:
- widget = m_dockedMainWindow;
- break;
- case TopLevelMode:
- widget = widgetBoxToolWindow();
- break;
- case NeutralMode:
- break;
- }
- const auto screen = widget ? widget->screen() : QGuiApplication::primaryScreen();
- return screen ? screen->availableGeometry()
- : QGuiApplication::primaryScreen()->availableGeometry();
+ auto *widget = m_mode == DockedMode
+ ? static_cast<QWidget *>(m_dockedMainWindow.data())
+ : static_cast<QWidget *>(widgetBoxToolWindow());
+ return widget != nullptr
+ ? widget->screen() : QGuiApplication::primaryScreen();
}
-QRect QDesignerWorkbench::availableGeometry() const
+QRect QDesignerWorkbench::availableFormGeometry() const
{
- if (m_mode == DockedMode)
- return m_dockedMainWindow->mdiArea()->geometry();
-
- const auto screen = widgetBoxToolWindow()->screen();
- return screen ? screen->availableGeometry() : QGuiApplication::primaryScreen()->availableGeometry() ;
-}
-
-int QDesignerWorkbench::marginHint() const
-{ return 20;
+ // Return available geometry for forms
+ return m_mode == DockedMode
+ ? m_dockedMainWindow->mdiArea()->geometry() : screen()->availableGeometry();
}
void QDesignerWorkbench::slotFormWindowActivated(QDesignerFormWindow* fw)
@@ -604,25 +591,30 @@ void QDesignerWorkbench::removeFormWindow(QDesignerFormWindow *formWindow)
if (QAction *action = formWindow->action()) {
m_windowActions->removeAction(action);
- m_windowMenu->removeAction(action);
+ if (m_windowMenu)
+ m_windowMenu->removeAction(action);
}
if (m_formWindows.isEmpty()) {
m_actionManager->setWindowListSeparatorVisible(false);
// Show up new form dialog unless closing
- if (loadOk && m_state == StateUp
- && QDesignerSettings(m_core).showNewFormOnStartup()) {
- QTimer::singleShot(200, m_actionManager, &QDesignerActions::createForm);
- }
+ if (loadOk && m_state == StateUp)
+ showNewForm();
}
}
+void QDesignerWorkbench::showNewForm()
+{
+ if (!m_suppressNewFormShow && QDesignerSettings(m_core).showNewFormOnStartup())
+ QTimer::singleShot(100, m_actionManager, &QDesignerActions::createForm);
+}
+
void QDesignerWorkbench::initializeCorePlugins()
{
QObjectList plugins = QPluginLoader::staticInstances();
plugins += core()->pluginManager()->instances();
- for (QObject *plugin : qAsConst(plugins)) {
+ for (QObject *plugin : std::as_const(plugins)) {
if (QDesignerFormEditorPluginInterface *formEditorPlugin = qobject_cast<QDesignerFormEditorPluginInterface*>(plugin)) {
if (!formEditorPlugin->isInitialized())
formEditorPlugin->initialize(core());
@@ -635,7 +627,7 @@ void QDesignerWorkbench::saveSettings() const
QDesignerSettings settings(m_core);
settings.clearBackup();
saveGeometries(settings);
- AppFontWidget::save(m_core->settingsManager(), QLatin1String(appFontPrefixC));
+ AppFontWidget::save(m_core->settingsManager(), appFontPrefixC);
}
void QDesignerWorkbench::saveGeometries(QDesignerSettings &settings) const
@@ -689,12 +681,12 @@ bool QDesignerWorkbench::handleClose()
{
m_state = StateClosing;
QList<QDesignerFormWindow *> dirtyForms;
- for (QDesignerFormWindow *w : qAsConst(m_formWindows)) {
+ for (QDesignerFormWindow *w : std::as_const(m_formWindows)) {
if (w->editor()->isDirty())
dirtyForms << w;
}
- const int count = dirtyForms.size();
+ const auto count = dirtyForms.size();
if (count == 1) {
if (!dirtyForms.at(0)->close()) {
m_state = StateUp;
@@ -707,7 +699,7 @@ bool QDesignerWorkbench::handleClose()
QMessageBox::Cancel | QMessageBox::Discard | QMessageBox::Save);
box.setInformativeText(tr("If you do not review your documents, all your changes will be lost."));
box.button(QMessageBox::Discard)->setText(tr("Discard Changes"));
- QPushButton *save = static_cast<QPushButton *>(box.button(QMessageBox::Save));
+ auto *save = static_cast<QPushButton *>(box.button(QMessageBox::Save));
save->setText(tr("Review Changes"));
box.setDefaultButton(save);
switch (box.exec()) {
@@ -715,7 +707,7 @@ bool QDesignerWorkbench::handleClose()
m_state = StateUp;
return false;
case QMessageBox::Save:
- for (QDesignerFormWindow *fw : qAsConst(dirtyForms)) {
+ for (QDesignerFormWindow *fw : std::as_const(dirtyForms)) {
fw->show();
fw->raise();
if (!fw->close()) {
@@ -725,7 +717,7 @@ bool QDesignerWorkbench::handleClose()
}
break;
case QMessageBox::Discard:
- for (QDesignerFormWindow *fw : qAsConst(dirtyForms)) {
+ for (QDesignerFormWindow *fw : std::as_const(dirtyForms)) {
fw->editor()->setDirty(false);
fw->setWindowModified(false);
}
@@ -733,7 +725,7 @@ bool QDesignerWorkbench::handleClose()
}
}
- for (QDesignerFormWindow *fw : qAsConst(m_formWindows))
+ for (QDesignerFormWindow *fw : std::as_const(m_formWindows))
fw->close();
saveSettings();
@@ -764,20 +756,20 @@ void QDesignerWorkbench::updateWindowMenu(QDesignerFormWindowInterface *fwi)
m_actionManager->minimizeAction()->setEnabled(minimizeEnabled);
m_actionManager->minimizeAction()->setChecked(minimizeChecked);
- for (QDesignerFormWindow *fw : qAsConst(m_formWindows))
+ for (QDesignerFormWindow *fw : std::as_const(m_formWindows))
fw->action()->setChecked(fw == activeFormWindow);
}
void QDesignerWorkbench::formWindowActionTriggered(QAction *a)
{
- QDesignerFormWindow *fw = qobject_cast<QDesignerFormWindow *>(a->parentWidget());
+ auto *fw = qobject_cast<QDesignerFormWindow *>(a->parent());
Q_ASSERT(fw);
if (isFormWindowMinimized(fw))
setFormWindowMinimized(fw, false);
if (m_mode == DockedMode) {
- if (QMdiSubWindow *subWindow = qobject_cast<QMdiSubWindow *>(fw->parent())) {
+ if (auto *subWindow = qobject_cast<QMdiSubWindow *>(fw->parent())) {
m_dockedMainWindow->mdiArea()->setActiveSubWindow(subWindow);
}
} else {
@@ -788,7 +780,7 @@ void QDesignerWorkbench::formWindowActionTriggered(QAction *a)
void QDesignerWorkbench::closeAllToolWindows()
{
- for (QDesignerToolWindow *tw : qAsConst(m_toolWindows))
+ for (QDesignerToolWindow *tw : std::as_const(m_toolWindows))
tw->hide();
}
@@ -806,7 +798,7 @@ bool QDesignerWorkbench::readInBackup()
if (answer == QMessageBox::No)
return false;
- const QString modifiedPlaceHolder = QStringLiteral("[*]");
+ const auto modifiedPlaceHolder = "[*]"_L1;
for (auto it = backupFileMap.cbegin(), end = backupFileMap.cend(); it != end; ++it) {
QString fileName = it.key();
fileName.remove(modifiedPlaceHolder);
@@ -842,9 +834,9 @@ void QDesignerWorkbench::bringAllToFront()
{
if (m_mode != TopLevelMode)
return;
- for (QDesignerToolWindow *tw : qAsConst(m_toolWindows))
+ for (QDesignerToolWindow *tw : std::as_const(m_toolWindows))
raiseWindow(tw);
- for (QDesignerFormWindow *dfw : qAsConst(m_formWindows))
+ for (QDesignerFormWindow *dfw : std::as_const(m_formWindows))
raiseWindow(dfw);
}
@@ -863,7 +855,7 @@ void QDesignerWorkbench::resizeForm(QDesignerFormWindow *fw, const QWidget *main
return;
}
// get decorations and resize MDI
- QMdiSubWindow *mdiSubWindow = qobject_cast<QMdiSubWindow *>(fw->parent());
+ auto *mdiSubWindow = qobject_cast<QMdiSubWindow *>(fw->parent());
Q_ASSERT(mdiSubWindow);
const QSize decorationSize = mdiSubWindow->geometry().size() - mdiSubWindow->contentsRect().size();
mdiSubWindow->resize(containerSize + decorationSize);
@@ -896,8 +888,8 @@ QDesignerFormWindow * QDesignerWorkbench::loadForm(const QString &fileName,
const QString text = QString::fromUtf8(file.readLine());
file.close();
- const int lf = text.indexOf(QLatin1Char('\n'));
- if (lf > 0 && text.at(lf-1) == QLatin1Char('\r')) {
+ const auto lf = text.indexOf(u'\n');
+ if (lf > 0 && text.at(lf - 1) == u'\r') {
mode = qdesigner_internal::FormWindowBase::CRLFLineTerminator;
} else if (lf >= 0) {
mode = qdesigner_internal::FormWindowBase::LFLineTerminator;
@@ -913,7 +905,7 @@ QDesignerFormWindow * QDesignerWorkbench::loadForm(const QString &fileName,
// Create a form
QDesignerFormWindowManagerInterface *formWindowManager = m_core->formWindowManager();
- QDesignerFormWindow *formWindow = new QDesignerFormWindow(/*formWindow=*/ nullptr, this);
+ auto *formWindow = new QDesignerFormWindow(/*formWindow=*/ nullptr, this);
addFormWindow(formWindow);
QDesignerFormWindowInterface *editor = formWindow->editor();
Q_ASSERT(editor);
@@ -946,7 +938,7 @@ QDesignerFormWindow * QDesignerWorkbench::loadForm(const QString &fileName,
formWindow->setAttribute(Qt::WA_DeleteOnClose, true);
formWindow->setParent(magicalParent(formWindow), magicalWindowFlags(formWindow));
formWindow->resize(formWindowGeometryHint.size());
- formWindow->move(availableGeometry().center() - formWindowGeometryHint.center());
+ formWindow->move(availableFormGeometry().center() - formWindowGeometryHint.center());
}
break;
case NeutralMode:
@@ -1081,7 +1073,7 @@ void QDesignerWorkbench::restoreUISettings()
if (font == m_toolWindows.constFirst()->font())
return;
- for (QDesignerToolWindow *tw : qAsConst(m_toolWindows))
+ for (QDesignerToolWindow *tw : std::as_const(m_toolWindows))
tw->setFont(font);
}
diff --git a/src/designer/src/designer/qdesigner_workbench.h b/src/designer/src/designer/qdesigner_workbench.h
index e3435b915..171c5b6fe 100644
--- a/src/designer/src/designer/qdesigner_workbench.h
+++ b/src/designer/src/designer/qdesigner_workbench.h
@@ -1,41 +1,17 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QDESIGNER_WORKBENCH_H
#define QDESIGNER_WORKBENCH_H
#include "designer_enums.h"
-#include <QtCore/qobject.h>
#include <QtCore/qhash.h>
#include <QtCore/qlist.h>
-#include <QtCore/qset.h>
+#include <QtCore/qobject.h>
+#include <QtCore/qpointer.h>
#include <QtCore/qrect.h>
+#include <QtCore/qset.h>
QT_BEGIN_NAMESPACE
@@ -50,13 +26,10 @@ class QActionGroup;
class QDockWidget;
class QMenu;
class QMenuBar;
-class QMainWindow;
class QToolBar;
-class QMdiArea;
class QMdiSubWindow;
class QCloseEvent;
-class QFont;
-class QtToolBarManager;
+class QScreen;
class ToolBarManager;
class QDesignerFormEditorInterface;
@@ -69,7 +42,7 @@ class QDesignerWorkbench: public QObject
Q_OBJECT
public:
- QDesignerWorkbench();
+ explicit QDesignerWorkbench(const QStringList &pluginPaths);
~QDesignerWorkbench() override;
UIMode mode() const;
@@ -92,11 +65,6 @@ public:
QActionGroup *modeActionGroup() const;
- QRect availableGeometry() const;
- QRect desktopGeometry() const;
-
- int marginHint() const;
-
bool readInForm(const QString &fileName) const;
bool writeOutForm(QDesignerFormWindowInterface *formWindow, const QString &fileName) const;
bool saveForm(QDesignerFormWindowInterface *fw);
@@ -105,6 +73,9 @@ public:
void updateBackup(QDesignerFormWindowInterface* fwi);
void applyUiSettings();
+ bool suppressNewFormShow() const { return m_suppressNewFormShow; }
+ void setSuppressNewFormShow(bool v) { m_suppressNewFormShow = v; }
+
signals:
void modeChanged(UIMode mode);
void initialized();
@@ -114,6 +85,7 @@ public slots:
void removeFormWindow(QDesignerFormWindow *formWindow);
void bringAllToFront();
void toggleFormMinimizationState();
+ void showNewForm();
private slots:
void switchToNeutralMode();
@@ -132,6 +104,8 @@ private slots:
void slotFileDropped(const QString &f);
private:
+ QScreen *screen() const;
+ QRect availableFormGeometry() const;
QWidget *magicalParent(const QWidget *w) const;
Qt::WindowFlags magicalWindowFlags(const QWidget *widgetForFlags) const;
QDesignerFormWindowManagerInterface *formWindowManager() const;
@@ -154,7 +128,7 @@ private:
QMenu *m_windowMenu;
- QMenuBar *m_globalMenuBar;
+ QPointer<QMenuBar> m_globalMenuBar;
struct TopLevelData {
ToolBarManager *toolbarManager;
@@ -163,7 +137,7 @@ private:
TopLevelData m_topLevelData;
UIMode m_mode = NeutralMode;
- DockedMainWindow *m_dockedMainWindow = nullptr;
+ QPointer<DockedMainWindow> m_dockedMainWindow;
QList<QDesignerToolWindow *> m_toolWindows;
QList<QDesignerFormWindow *> m_formWindows;
@@ -174,9 +148,9 @@ private:
// interface modes.
class Position {
public:
- Position(const QDockWidget *dockWidget);
- Position(const QMdiSubWindow *mdiSubWindow, const QPoint &mdiAreaOffset);
- Position(const QWidget *topLevelWindow, const QPoint &desktopTopLeft);
+ explicit Position(const QDockWidget *dockWidget);
+ explicit Position(const QMdiSubWindow *mdiSubWindow);
+ explicit Position(const QWidget *topLevelWindow);
void applyTo(QMdiSubWindow *mdiSubWindow, const QPoint &mdiAreaOffset) const;
void applyTo(QWidget *topLevelWindow, const QPoint &desktopTopLeft) const;
@@ -195,6 +169,7 @@ private:
enum State { StateInitializing, StateUp, StateClosing };
State m_state = StateInitializing;
bool m_uiSettingsChanged = false; // UI mode changed in preference dialog, trigger delayed slot.
+ bool m_suppressNewFormShow = false;
};
QT_END_NAMESPACE
diff --git a/src/designer/src/designer/saveformastemplate.cpp b/src/designer/src/designer/saveformastemplate.cpp
index 15930aa63..e8bc64477 100644
--- a/src/designer/src/designer/saveformastemplate.cpp
+++ b/src/designer/src/designer/saveformastemplate.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "saveformastemplate.h"
#include "qdesigner_settings.h"
@@ -39,6 +14,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
SaveFormAsTemplate::SaveFormAsTemplate(QDesignerFormEditorInterface *core,
QDesignerFormWindowInterface *formWindow,
QWidget *parent)
@@ -47,7 +24,6 @@ SaveFormAsTemplate::SaveFormAsTemplate(QDesignerFormEditorInterface *core,
m_formWindow(formWindow)
{
ui.setupUi(this);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
ui.templateNameEdit->setText(formWindow->mainContainer()->objectName());
ui.templateNameEdit->selectAll();
@@ -68,11 +44,9 @@ SaveFormAsTemplate::~SaveFormAsTemplate() = default;
void SaveFormAsTemplate::accept()
{
- QString templateFileName = ui.categoryCombo->currentText();
- templateFileName += QLatin1Char('/');
const QString name = ui.templateNameEdit->text();
- templateFileName += name;
- const QString extension = QStringLiteral(".ui");
+ QString templateFileName = ui.categoryCombo->currentText() + u'/' + name;
+ const auto extension = ".ui"_L1;
if (!templateFileName.endsWith(extension))
templateFileName.append(extension);
QFile file(templateFileName);
diff --git a/src/designer/src/designer/saveformastemplate.h b/src/designer/src/designer/saveformastemplate.h
index 7b8f8b8da..2a76306d8 100644
--- a/src/designer/src/designer/saveformastemplate.h
+++ b/src/designer/src/designer/saveformastemplate.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef SAVEFORMASTEMPLATE_H
#define SAVEFORMASTEMPLATE_H
diff --git a/src/designer/src/designer/saveformastemplate.ui b/src/designer/src/designer/saveformastemplate.ui
index 37ade8544..e77e4c246 100644
--- a/src/designer/src/designer/saveformastemplate.ui
+++ b/src/designer/src/designer/saveformastemplate.ui
@@ -1,31 +1,8 @@
<ui version="4.0" >
- <comment>*********************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-*********************************************************************</comment>
+<comment>
+* Copyright (C) 2016 The Qt Company Ltd.
+* SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+</comment>
<class>SaveFormAsTemplate</class>
<widget class="QDialog" name="SaveFormAsTemplate" >
<property name="windowTitle" >
diff --git a/src/designer/src/designer/versiondialog.cpp b/src/designer/src/designer/versiondialog.cpp
index d5df28563..7660de46c 100644
--- a/src/designer/src/designer/versiondialog.cpp
+++ b/src/designer/src/designer/versiondialog.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/qlist.h>
@@ -42,6 +17,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
class VersionLabel : public QLabel
{
Q_OBJECT
@@ -67,7 +44,9 @@ private:
VersionLabel::VersionLabel(QWidget *parent)
: QLabel(parent)
{
- setPixmap(QPixmap(QStringLiteral(":/qt-project.org/designer/images/designer.png")));
+ QPixmap pixmap(u":/qt-project.org/designer/images/designer.png"_s);
+ pixmap.setDevicePixelRatio(devicePixelRatioF());
+ setPixmap(pixmap);
hitPoints.append(QPoint(56, 25));
hitPoints.append(QPoint(29, 55));
hitPoints.append(QPoint(56, 87));
@@ -103,14 +82,14 @@ void VersionLabel::mouseReleaseEvent(QMouseEvent *me)
if (!secondStage) {
m_path.lineTo(me->pos());
bool gotIt = true;
- for (const QPoint &pt : qAsConst(hitPoints)) {
+ for (const QPoint &pt : std::as_const(hitPoints)) {
if (!m_path.contains(pt)) {
gotIt = false;
break;
}
}
if (gotIt) {
- for (const QPoint &pt : qAsConst(missPoints)) {
+ for (const QPoint &pt : std::as_const(missPoints)) {
if (m_path.contains(pt)) {
gotIt = false;
break;
@@ -153,22 +132,22 @@ VersionDialog::VersionDialog(QWidget *parent)
#endif
)
{
- setWindowFlags((windowFlags() & ~Qt::WindowContextHelpButtonHint) | Qt::MSWindowsFixedSizeDialogHint);
+ setWindowFlag(Qt::MSWindowsFixedSizeDialogHint, true);
QGridLayout *layout = new QGridLayout(this);
- VersionLabel *label = new VersionLabel;
- QLabel *lbl = new QLabel;
+ VersionLabel *label = new VersionLabel(this);
+ QLabel *lbl = new QLabel(this);
QString version = tr("<h3>%1</h3><br/><br/>Version %2");
- version = version.arg(tr("Qt Designer")).arg(QLatin1String(QT_VERSION_STR));
- version.append(tr("<br/>Qt Designer is a graphical user interface designer for Qt applications.<br/>"));
+ version = version.arg(tr("Qt Widgets Designer")).arg(QLatin1StringView(QT_VERSION_STR));
+ version.append(tr("<br/>Qt Widgets Designer is a graphical user interface designer for Qt applications.<br/>"));
lbl->setText(tr("%1"
"<br/>Copyright (C) %2 The Qt Company Ltd."
- ).arg(version, QStringLiteral("2021")));
+ ).arg(version, QString()));
lbl->setWordWrap(true);
lbl->setOpenExternalLinks(true);
- QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
+ QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this);
connect(buttonBox , &QDialogButtonBox::rejected, this, &QDialog::reject);
connect(label, &VersionLabel::triggered, this, &QDialog::accept);
layout->addWidget(label, 0, 0, 1, 1);
diff --git a/src/designer/src/designer/versiondialog.h b/src/designer/src/designer/versiondialog.h
index ff26da292..4f7f8e4c3 100644
--- a/src/designer/src/designer/versiondialog.h
+++ b/src/designer/src/designer/versiondialog.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef VERSIONDIALOG_H
#define VERSIONDIALOG_H
diff --git a/src/designer/src/lib/CMakeLists.txt b/src/designer/src/lib/CMakeLists.txt
index 45a6a4969..43a1964d9 100644
--- a/src/designer/src/lib/CMakeLists.txt
+++ b/src/designer/src/lib/CMakeLists.txt
@@ -1,4 +1,6 @@
-# Generated from lib.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
#####################################################################
## Designer Module:
@@ -24,6 +26,7 @@ qt_internal_add_module(Designer
../../../shared/qtgradienteditor/qtgradientviewdialog.cpp ../../../shared/qtgradienteditor/qtgradientviewdialog.h
../../../shared/qtgradienteditor/qtgradientwidget.cpp ../../../shared/qtgradienteditor/qtgradientwidget.h
extension/default_extensionfactory.cpp extension/default_extensionfactory.h
+ extension/extension_global.h
extension/extension.cpp extension/extension.h
extension/qextensionmanager.cpp extension/qextensionmanager.h
sdk/abstractactioneditor.cpp sdk/abstractactioneditor.h
@@ -55,7 +58,8 @@ qt_internal_add_module(Designer
sdk/layoutdecoration.h
sdk/membersheet.h
sdk/propertysheet.h
- sdk/taskmenu.h
+ sdk/sdk_global.h
+ sdk/taskmenu.cpp sdk/taskmenu.h
shared/actioneditor.cpp shared/actioneditor_p.h
shared/actionprovider_p.h
shared/actionrepository.cpp shared/actionrepository_p.h
@@ -135,6 +139,7 @@ qt_internal_add_module(Designer
shared/widgetdatabase.cpp shared/widgetdatabase_p.h
shared/widgetfactory.cpp shared/widgetfactory_p.h
shared/zoomwidget.cpp shared/zoomwidget_p.h
+ uilib/uilib_global.h
uilib/abstractformbuilder.cpp uilib/abstractformbuilder.h
uilib/formbuilder.cpp uilib/formbuilder.h
uilib/formbuilderextra.cpp uilib/formbuilderextra_p.h
@@ -142,6 +147,13 @@ qt_internal_add_module(Designer
uilib/resourcebuilder.cpp uilib/resourcebuilder_p.h
uilib/textbuilder.cpp uilib/textbuilder_p.h
uilib/ui4.cpp uilib/ui4_p.h
+ components/qdesigner_components.h
+ components/qdesigner_components_global.h
+ NO_UNITY_BUILD_SOURCES
+ shared/qdesigner_command.cpp # redefinition of 'QMetaTypeId<QList<QWidget *>>' (from morphmenu.cpp)
+ # and recursiveUpdate (from formwindowbase.cpp)
+ uilib/abstractformbuilder.cpp # using namespace QFormInternal/redefinition of 'QMetaTypeId<QList<QWidget *>>' (from morphmenu.cpp)
+ uilib/ui4.cpp # using namespace QFormInternal
DEFINES
QDESIGNER_EXTENSION_LIBRARY
QDESIGNER_SDK_LIBRARY
@@ -176,6 +188,7 @@ qt_internal_add_module(Designer
uic
PRECOMPILED_HEADER
"lib_pch.h"
+ NO_GENERATE_CPP_EXPORTS
)
set(ui_sources
@@ -348,6 +361,7 @@ qt_internal_add_resource(Designer "qtgradienteditor"
)
set(shared_resource_files
"shared/defaultgradients.xml"
+ "shared/icon-naming-spec.txt"
"shared/templates/forms/240x320/Dialog_with_Buttons_Bottom.ui"
"shared/templates/forms/240x320/Dialog_with_Buttons_Right.ui"
"shared/templates/forms/320x240/Dialog_with_Buttons_Bottom.ui"
@@ -372,8 +386,6 @@ qt_internal_add_resource(Designer "shared"
${shared_resource_files}
)
-
-#### Keys ignored in scope 1:.:.:lib.pro:<TRUE>:
# MODULE = "designer"
## Scopes:
@@ -400,6 +412,30 @@ qt_internal_extend_target(Designer CONDITION NOT QT_BUILD_SHARED_LIBS
../../../shared/qtpropertybrowser
)
+if(TARGET zstd::libzstd)
+ qt_internal_disable_find_package_global_promotion(zstd::libzstd)
+endif()
+if(TARGET zstd::libzstd_shared)
+ qt_internal_disable_find_package_global_promotion(zstd::libzstd_shared)
+endif()
+if(TARGET zstd::libzstd_static)
+ qt_internal_disable_find_package_global_promotion(zstd::libzstd_static)
+endif()
+if(NOT TARGET WrapZSTD::WrapZSTD)
+ qt_find_package(WrapZSTD 1.3
+ PROVIDED_TARGETS
+ WrapZSTD::WrapZSTD
+ zstd::libzstd
+ zstd::libzstd_static
+ zstd::libzstd_shared
+ )
+endif()
+
+qt_internal_extend_target(Designer CONDITION QT_FEATURE_zstd
+ LIBRARIES
+ WrapZSTD::WrapZSTD
+)
+
if(NOT QT_BUILD_SHARED_LIBS)
# Resources:
set(qtpropertybrowser_resource_files
@@ -444,3 +480,6 @@ qt_internal_extend_target(Designer CONDITION QT_FEATURE_opengl
LIBRARIES
Qt::OpenGL
)
+
+# UiPlugin module generates deprecated header files for Designer.
+qt_internal_add_sync_header_dependencies(Designer UiPlugin)
diff --git a/src/designer/src/lib/components/qdesigner_components.h b/src/designer/src/lib/components/qdesigner_components.h
index bc716acdf..33ee90d20 100644
--- a/src/designer/src/lib/components/qdesigner_components.h
+++ b/src/designer/src/lib/components/qdesigner_components.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QDESIGNER_COMPONENTS_H
#define QDESIGNER_COMPONENTS_H
@@ -50,6 +25,9 @@ public:
static void initializePlugins(QDesignerFormEditorInterface *core);
static QDesignerFormEditorInterface *createFormEditor(QObject *parent);
+ static QDesignerFormEditorInterface *
+ createFormEditorWithPluginPaths(const QStringList &pluginPaths,
+ QObject *parent);
static QDesignerWidgetBoxInterface *createWidgetBox(QDesignerFormEditorInterface *core, QWidget *parent);
static QDesignerPropertyEditorInterface *createPropertyEditor(QDesignerFormEditorInterface *core, QWidget *parent);
static QDesignerObjectInspectorInterface *createObjectInspector(QDesignerFormEditorInterface *core, QWidget *parent);
@@ -58,6 +36,8 @@ public:
static QObject *createTaskMenu(QDesignerFormEditorInterface *core, QObject *parent);
static QWidget *createResourceEditor(QDesignerFormEditorInterface *core, QWidget *parent);
static QWidget *createSignalSlotEditor(QDesignerFormEditorInterface *core, QWidget *parent);
+
+ static QStringList defaultPluginPaths();
};
QT_END_NAMESPACE
diff --git a/src/designer/src/lib/components/qdesigner_components_global.h b/src/designer/src/lib/components/qdesigner_components_global.h
index bc647a4f1..ced3bd14a 100644
--- a/src/designer/src/lib/components/qdesigner_components_global.h
+++ b/src/designer/src/lib/components/qdesigner_components_global.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QDESIGNER_COMPONENTS_GLOBAL_H
#define QDESIGNER_COMPONENTS_GLOBAL_H
diff --git a/src/designer/src/lib/extension/default_extensionfactory.cpp b/src/designer/src/lib/extension/default_extensionfactory.cpp
index af1fe6f21..87a8d1520 100644
--- a/src/designer/src/lib/extension/default_extensionfactory.cpp
+++ b/src/designer/src/lib/extension/default_extensionfactory.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "default_extensionfactory.h"
#include "qextensionmanager.h"
@@ -49,7 +24,7 @@ QT_BEGIN_NAMESPACE
{QExtensionManager}{extension manager}.
The QExtensionManager class provides extension management
- facilities for Qt Designer. When an extension is required, Qt
+ facilities for \QD. When an extension is required, Qt
Designer's \l {QExtensionManager}{extension manager} will run
through all its registered factories calling
QExtensionFactory::createExtension() for each until the first one
@@ -57,7 +32,7 @@ QT_BEGIN_NAMESPACE
object, is found. This factory will then make an instance of the
extension.
- There are four available types of extensions in Qt Designer:
+ There are four available types of extensions in \QD:
QDesignerContainerExtension , QDesignerMemberSheetExtension,
QDesignerPropertySheetExtension and QDesignerTaskMenuExtension. Qt
Designer's behavior is the same whether the requested extension is
@@ -78,8 +53,8 @@ QT_BEGIN_NAMESPACE
For a complete example using the QExtensionFactory class, see the
\l {taskmenuextension}{Task Menu Extension example}. The
example shows how to create a custom widget plugin for Qt
- Designer, and how to to use the QDesignerTaskMenuExtension class
- to add custom items to Qt Designer's task menu.
+ Designer, and how to use the QDesignerTaskMenuExtension class
+ to add custom items to \QD's task menu.
\sa QExtensionManager, QAbstractExtensionFactory
*/
@@ -102,9 +77,9 @@ QObject *QExtensionFactory::extension(QObject *object, const QString &iid) const
{
if (!object)
return nullptr;
- const IdObjectKey key = qMakePair(iid, object);
+ const auto key = std::make_pair(iid, object);
- ExtensionMap::iterator it = m_extensions.find(key);
+ auto it = m_extensions.find(key);
if (it == m_extensions.end()) {
if (QObject *ext = createExtension(object, iid, const_cast<QExtensionFactory*>(this))) {
connect(ext, &QObject::destroyed, this, &QExtensionFactory::objectDestroyed);
diff --git a/src/designer/src/lib/extension/default_extensionfactory.h b/src/designer/src/lib/extension/default_extensionfactory.h
index f14c33361..825b9d5a1 100644
--- a/src/designer/src/lib/extension/default_extensionfactory.h
+++ b/src/designer/src/lib/extension/default_extensionfactory.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef DEFAULT_EXTENSIONFACTORY_H
#define DEFAULT_EXTENSIONFACTORY_H
@@ -57,11 +32,9 @@ protected:
virtual QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const;
private:
- typedef QPair<QString,QObject*> IdObjectKey;
- typedef QMap< IdObjectKey, QObject*> ExtensionMap;
- mutable ExtensionMap m_extensions;
- typedef QHash<QObject*, bool> ExtendedSet;
- mutable ExtendedSet m_extended;
+ mutable QMap<std::pair<QString, QObject *>, QObject *> m_extensions;
+ // ### FIXME Qt 7: Use QSet, add out of line destructor.
+ mutable QHash<QObject*, bool> m_extended;
};
QT_END_NAMESPACE
diff --git a/src/designer/src/lib/extension/extension.cpp b/src/designer/src/lib/extension/extension.cpp
index f5d4059d1..d51b3917c 100644
--- a/src/designer/src/lib/extension/extension.cpp
+++ b/src/designer/src/lib/extension/extension.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtDesigner/extension.h>
@@ -34,7 +9,7 @@ QT_BEGIN_NAMESPACE
\class QAbstractExtensionFactory
\brief The QAbstractExtensionFactory class provides an interface
- for extension factories in Qt Designer.
+ for extension factories in \QD.
\inmodule QtDesigner
@@ -59,10 +34,10 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QAbstractExtensionFactory::~QAbstractExtensionFactory()
-
Destroys the extension factory.
*/
+QAbstractExtensionFactory::~QAbstractExtensionFactory()
+ = default;
/*!
\fn QObject *QAbstractExtensionFactory::extension(QObject *object, const QString &iid) const
@@ -75,7 +50,7 @@ QT_BEGIN_NAMESPACE
\class QAbstractExtensionManager
\brief The QAbstractExtensionManager class provides an interface
- for extension managers in Qt Designer.
+ for extension managers in \QD.
\inmodule QtDesigner
@@ -99,10 +74,10 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QAbstractExtensionManager::~QAbstractExtensionManager()
-
Destroys the extension manager.
*/
+QAbstractExtensionManager::~QAbstractExtensionManager()
+ = default;
/*!
\fn void QAbstractExtensionManager::registerExtensions(QAbstractExtensionFactory *factory, const QString &iid)
diff --git a/src/designer/src/lib/extension/extension.h b/src/designer/src/lib/extension/extension.h
index 7d9244287..e9c9e24bd 100644
--- a/src/designer/src/lib/extension/extension.h
+++ b/src/designer/src/lib/extension/extension.h
@@ -1,54 +1,31 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef EXTENSION_H
#define EXTENSION_H
+#include <QtDesigner/extension_global.h>
+
#include <QtCore/qstring.h>
#include <QtCore/qobject.h>
QT_BEGIN_NAMESPACE
-#define Q_TYPEID(IFace) QLatin1String(IFace##_iid)
+#define Q_TYPEID(IFace) QLatin1StringView(IFace##_iid)
-class QAbstractExtensionFactory
+class QDESIGNER_EXTENSION_EXPORT QAbstractExtensionFactory
{
public:
- virtual ~QAbstractExtensionFactory() {}
+ virtual ~QAbstractExtensionFactory();
virtual QObject *extension(QObject *object, const QString &iid) const = 0;
};
Q_DECLARE_INTERFACE(QAbstractExtensionFactory, "org.qt-project.Qt.QAbstractExtensionFactory")
-class QAbstractExtensionManager
+class QDESIGNER_EXTENSION_EXPORT QAbstractExtensionManager
{
public:
- virtual ~QAbstractExtensionManager() {}
+ virtual ~QAbstractExtensionManager();
virtual void registerExtensions(QAbstractExtensionFactory *factory, const QString &iid) = 0;
virtual void unregisterExtensions(QAbstractExtensionFactory *factory, const QString &iid) = 0;
diff --git a/src/designer/src/lib/extension/extension_global.h b/src/designer/src/lib/extension/extension_global.h
index 87127087a..781974f6a 100644
--- a/src/designer/src/lib/extension/extension_global.h
+++ b/src/designer/src/lib/extension/extension_global.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef EXTENSION_GLOBAL_H
#define EXTENSION_GLOBAL_H
diff --git a/src/designer/src/lib/extension/qextensionmanager.cpp b/src/designer/src/lib/extension/qextensionmanager.cpp
index e6e0451c2..2d974c63a 100644
--- a/src/designer/src/lib/extension/qextensionmanager.cpp
+++ b/src/designer/src/lib/extension/qextensionmanager.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qextensionmanager.h"
@@ -34,7 +9,7 @@ QT_BEGIN_NAMESPACE
\class QExtensionManager
\brief The QExtensionManager class provides extension management
- facilities for Qt Designer.
+ facilities for \QD.
\inmodule QtDesigner
@@ -75,7 +50,7 @@ QT_BEGIN_NAMESPACE
For a complete example using the QExtensionManager class, see the
\l {taskmenuextension}{Task Menu Extension example}. The
example shows how to create a custom widget plugin for Qt
- Designer, and how to to use the QDesignerTaskMenuExtension class
+ Designer, and how to use the QDesignerTaskMenuExtension class
to add custom items to \QD's task menu.
\sa QExtensionFactory, QAbstractExtensionManager
@@ -106,7 +81,7 @@ void QExtensionManager::registerExtensions(QAbstractExtensionFactory *factory, c
return;
}
- FactoryMap::iterator it = m_extensions.find(iid);
+ auto it = m_extensions.find(iid);
if (it == m_extensions.end())
it = m_extensions.insert(iid, FactoryList());
@@ -124,7 +99,7 @@ void QExtensionManager::unregisterExtensions(QAbstractExtensionFactory *factory,
return;
}
- const FactoryMap::iterator it = m_extensions.find(iid);
+ const auto it = m_extensions.find(iid);
if (it == m_extensions.end())
return;
@@ -141,17 +116,18 @@ void QExtensionManager::unregisterExtensions(QAbstractExtensionFactory *factory,
*/
QObject *QExtensionManager::extension(QObject *object, const QString &iid) const
{
- const FactoryMap::const_iterator it = m_extensions.constFind(iid);
+ const auto it = m_extensions.constFind(iid);
if (it != m_extensions.constEnd()) {
- const FactoryList::const_iterator fcend = it.value().constEnd();
- for (FactoryList::const_iterator fit = it.value().constBegin(); fit != fcend; ++fit)
- if (QObject *ext = (*fit)->extension(object, iid))
+ for (const auto &f : it.value()) {
+ if (QObject *ext = f->extension(object, iid))
return ext;
+ }
}
- const FactoryList::const_iterator gfcend = m_globalExtension.constEnd();
- for (FactoryList::const_iterator git = m_globalExtension.constBegin(); git != gfcend; ++git)
- if (QObject *ext = (*git)->extension(object, iid))
+
+ for (const auto &gf : m_globalExtension) {
+ if (QObject *ext = gf->extension(object, iid))
return ext;
+ }
return nullptr;
}
diff --git a/src/designer/src/lib/extension/qextensionmanager.h b/src/designer/src/lib/extension/qextensionmanager.h
index 49dd56224..0fb2bcd9e 100644
--- a/src/designer/src/lib/extension/qextensionmanager.h
+++ b/src/designer/src/lib/extension/qextensionmanager.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QEXTENSIONMANAGER_H
#define QEXTENSIONMANAGER_H
@@ -52,8 +27,7 @@ public:
private:
using FactoryList = QList<QAbstractExtensionFactory *>;
- typedef QHash<QString, FactoryList> FactoryMap;
- FactoryMap m_extensions;
+ QHash<QString, FactoryList> m_extensions;
FactoryList m_globalExtension;
};
diff --git a/src/designer/src/lib/lib_pch.h b/src/designer/src/lib/lib_pch.h
index a40183535..f8dfc9947 100644
--- a/src/designer/src/lib/lib_pch.h
+++ b/src/designer/src/lib/lib_pch.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifdef __cplusplus
#include "shared_global_p.h"
diff --git a/src/designer/src/lib/sdk/abstractactioneditor.cpp b/src/designer/src/lib/sdk/abstractactioneditor.cpp
index badce0062..5b50a941b 100644
--- a/src/designer/src/lib/sdk/abstractactioneditor.cpp
+++ b/src/designer/src/lib/sdk/abstractactioneditor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "abstractactioneditor.h"
@@ -34,7 +9,7 @@ QT_BEGIN_NAMESPACE
\class QDesignerActionEditorInterface
\brief The QDesignerActionEditorInterface class allows you to
- change the focus of Qt Designer's action editor.
+ change the focus of \QD's action editor.
\inmodule QtDesigner
diff --git a/src/designer/src/lib/sdk/abstractactioneditor.h b/src/designer/src/lib/sdk/abstractactioneditor.h
index abdc2397a..5ca6b2c38 100644
--- a/src/designer/src/lib/sdk/abstractactioneditor.h
+++ b/src/designer/src/lib/sdk/abstractactioneditor.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ABSTRACTACTIONEDITOR_H
#define ABSTRACTACTIONEDITOR_H
diff --git a/src/designer/src/lib/sdk/abstractdialoggui.cpp b/src/designer/src/lib/sdk/abstractdialoggui.cpp
index 5907999e7..6c1eb6d99 100644
--- a/src/designer/src/lib/sdk/abstractdialoggui.cpp
+++ b/src/designer/src/lib/sdk/abstractdialoggui.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "abstractdialoggui_p.h"
diff --git a/src/designer/src/lib/sdk/abstractdialoggui_p.h b/src/designer/src/lib/sdk/abstractdialoggui_p.h
index d8f47dc8b..b230a5be0 100644
--- a/src/designer/src/lib/sdk/abstractdialoggui_p.h
+++ b/src/designer/src/lib/sdk/abstractdialoggui_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/sdk/abstractdnditem.h b/src/designer/src/lib/sdk/abstractdnditem.h
index 24fc3a977..44d1da16b 100644
--- a/src/designer/src/lib/sdk/abstractdnditem.h
+++ b/src/designer/src/lib/sdk/abstractdnditem.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ABSTRACTDNDITEM_H
#define ABSTRACTDNDITEM_H
diff --git a/src/designer/src/lib/sdk/abstractdnditem.qdoc b/src/designer/src/lib/sdk/abstractdnditem.qdoc
index 47f2e9d9d..b3dd3d3ed 100644
--- a/src/designer/src/lib/sdk/abstractdnditem.qdoc
+++ b/src/designer/src/lib/sdk/abstractdnditem.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\class QDesignerDnDItemInterface
diff --git a/src/designer/src/lib/sdk/abstractformeditor.cpp b/src/designer/src/lib/sdk/abstractformeditor.cpp
index 2d4b20812..d66872ea7 100644
--- a/src/designer/src/lib/sdk/abstractformeditor.cpp
+++ b/src/designer/src/lib/sdk/abstractformeditor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "abstractformeditor.h"
#include "abstractdialoggui_p.h"
@@ -72,6 +47,8 @@ static void initResources()
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
class QDesignerFormEditorInterfacePrivate {
public:
QDesignerFormEditorInterfacePrivate();
@@ -116,7 +93,7 @@ QDesignerFormEditorInterfacePrivate::~QDesignerFormEditorInterfacePrivate()
\class QDesignerFormEditorInterface
\brief The QDesignerFormEditorInterface class allows you to access
- Qt Designer's various components.
+ Qt Widgets Designer's various components.
\inmodule QtDesigner
@@ -128,7 +105,7 @@ QDesignerFormEditorInterfacePrivate::~QDesignerFormEditorInterfacePrivate()
these components. They are typically used to query (and
manipulate) the respective component. For example:
- \snippet lib/tools_designer_src_lib_sdk_abstractformeditor.cpp 0
+ \snippet lib/tools_designer_src_lib_sdk_abstractobjectinspector.cpp 0
QDesignerFormEditorInterface is not intended to be instantiated
directly. A pointer to \QD's current QDesignerFormEditorInterface
@@ -536,9 +513,9 @@ void QDesignerFormEditorInterface::setIntrospection(QDesignerIntrospectionInterf
QString QDesignerFormEditorInterface::resourceLocation() const
{
#ifdef Q_OS_MACOS
- return QStringLiteral(":/qt-project.org/formeditor/images/mac");
+ return u":/qt-project.org/formeditor/images/mac"_s;
#else
- return QStringLiteral(":/qt-project.org/formeditor/images/win");
+ return u":/qt-project.org/formeditor/images/win"_s;
#endif
}
diff --git a/src/designer/src/lib/sdk/abstractformeditor.h b/src/designer/src/lib/sdk/abstractformeditor.h
index 39f5054cc..6512f7c04 100644
--- a/src/designer/src/lib/sdk/abstractformeditor.h
+++ b/src/designer/src/lib/sdk/abstractformeditor.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ABSTRACTFORMEDITOR_H
#define ABSTRACTFORMEDITOR_H
diff --git a/src/designer/src/lib/sdk/abstractformeditorplugin.cpp b/src/designer/src/lib/sdk/abstractformeditorplugin.cpp
index 7e55cb8c4..af4f49ecf 100644
--- a/src/designer/src/lib/sdk/abstractformeditorplugin.cpp
+++ b/src/designer/src/lib/sdk/abstractformeditorplugin.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtDesigner/abstractformeditorplugin.h>
@@ -34,7 +9,7 @@ QT_BEGIN_NAMESPACE
\internal
\class QDesignerFormEditorPluginInterface
\brief The QDesignerFormEditorPluginInterface class provides an interface that is used to
- manage plugins for Qt Designer's form editor component.
+ manage plugins for \QD's form editor component.
\inmodule QtDesigner
\sa QDesignerFormEditorInterface
diff --git a/src/designer/src/lib/sdk/abstractformeditorplugin.h b/src/designer/src/lib/sdk/abstractformeditorplugin.h
index 008270f56..eab46768a 100644
--- a/src/designer/src/lib/sdk/abstractformeditorplugin.h
+++ b/src/designer/src/lib/sdk/abstractformeditorplugin.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ABSTRACTFORMEDITORPLUGIN_H
#define ABSTRACTFORMEDITORPLUGIN_H
diff --git a/src/designer/src/lib/sdk/abstractformwindow.cpp b/src/designer/src/lib/sdk/abstractformwindow.cpp
index 0b24920aa..1835f81ea 100644
--- a/src/designer/src/lib/sdk/abstractformwindow.cpp
+++ b/src/designer/src/lib/sdk/abstractformwindow.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "abstractformwindow.h"
#include "qtresourcemodel_p.h"
@@ -48,7 +23,7 @@ QT_BEGIN_NAMESPACE
\class QDesignerFormWindowInterface
\brief The QDesignerFormWindowInterface class allows you to query
- and manipulate form windows appearing in Qt Designer's workspace.
+ and manipulate form windows appearing in \QD's workspace.
\inmodule QtDesigner
@@ -437,7 +412,7 @@ void QDesignerFormWindowInterface::activateResourceFilePaths(const QStringList &
displayed in the window. The export macro is used when the form
is compiled to create a widget plugin.
- \sa {Creating Custom Widgets for Qt Designer}
+ \sa {Creating Custom Widgets for Qt Widgets Designer}
*/
/*!
@@ -747,7 +722,7 @@ void QDesignerFormWindowInterface::activateResourceFilePaths(const QStringList &
Switches the form window into editing mode.
- \sa {Qt Designer's Form Editing Mode}
+ \sa {Qt Widgets Designer's Form Editing Mode}
\internal
*/
diff --git a/src/designer/src/lib/sdk/abstractformwindow.h b/src/designer/src/lib/sdk/abstractformwindow.h
index 63aeaada8..441ae3ab6 100644
--- a/src/designer/src/lib/sdk/abstractformwindow.h
+++ b/src/designer/src/lib/sdk/abstractformwindow.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ABSTRACTFORMWINDOW_H
#define ABSTRACTFORMWINDOW_H
diff --git a/src/designer/src/lib/sdk/abstractformwindowcursor.cpp b/src/designer/src/lib/sdk/abstractformwindowcursor.cpp
index 246cbea0b..9c4c135d0 100644
--- a/src/designer/src/lib/sdk/abstractformwindowcursor.cpp
+++ b/src/designer/src/lib/sdk/abstractformwindowcursor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "abstractformwindowcursor.h"
diff --git a/src/designer/src/lib/sdk/abstractformwindowcursor.h b/src/designer/src/lib/sdk/abstractformwindowcursor.h
index 0ef900db1..c2afee8bc 100644
--- a/src/designer/src/lib/sdk/abstractformwindowcursor.h
+++ b/src/designer/src/lib/sdk/abstractformwindowcursor.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ABSTRACTFORMWINDOWCURSOR_H
#define ABSTRACTFORMWINDOWCURSOR_H
diff --git a/src/designer/src/lib/sdk/abstractformwindowmanager.cpp b/src/designer/src/lib/sdk/abstractformwindowmanager.cpp
index c85fb0fb3..9e8494ca4 100644
--- a/src/designer/src/lib/sdk/abstractformwindowmanager.cpp
+++ b/src/designer/src/lib/sdk/abstractformwindowmanager.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "abstractformwindowmanager.h"
@@ -36,8 +11,8 @@ QT_BEGIN_NAMESPACE
\class QDesignerFormWindowManagerInterface
\brief The QDesignerFormWindowManagerInterface class allows you to
- manipulate the collection of form windows in Qt Designer, and
- control Qt Designer's form editing actions.
+ manipulate the collection of form windows in \QD, and
+ control \QD's form editing actions.
\inmodule QtDesigner
@@ -55,7 +30,7 @@ QT_BEGIN_NAMESPACE
example above) is provided by the
QDesignerCustomWidgetInterface::initialize() function's parameter.
You must subclass the QDesignerCustomWidgetInterface to expose
- your plugin to Qt Designer.
+ your plugin to \QD.
The form window manager interface provides the createFormWindow()
function that enables you to create a new form window which you
diff --git a/src/designer/src/lib/sdk/abstractformwindowmanager.h b/src/designer/src/lib/sdk/abstractformwindowmanager.h
index 2f93fbde8..08e07f0cf 100644
--- a/src/designer/src/lib/sdk/abstractformwindowmanager.h
+++ b/src/designer/src/lib/sdk/abstractformwindowmanager.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ABSTRACTFORMWINDOWMANAGER_H
#define ABSTRACTFORMWINDOWMANAGER_H
diff --git a/src/designer/src/lib/sdk/abstractformwindowtool.cpp b/src/designer/src/lib/sdk/abstractformwindowtool.cpp
index 62ca42375..4bb7db8ee 100644
--- a/src/designer/src/lib/sdk/abstractformwindowtool.cpp
+++ b/src/designer/src/lib/sdk/abstractformwindowtool.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "abstractformwindowtool.h"
diff --git a/src/designer/src/lib/sdk/abstractformwindowtool.h b/src/designer/src/lib/sdk/abstractformwindowtool.h
index d6fecf63a..93dee157d 100644
--- a/src/designer/src/lib/sdk/abstractformwindowtool.h
+++ b/src/designer/src/lib/sdk/abstractformwindowtool.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ABSTRACTFORMWINDOWTOOL_H
#define ABSTRACTFORMWINDOWTOOL_H
diff --git a/src/designer/src/lib/sdk/abstractintegration.cpp b/src/designer/src/lib/sdk/abstractintegration.cpp
index aca3511d2..ee0ff7f45 100644
--- a/src/designer/src/lib/sdk/abstractintegration.cpp
+++ b/src/designer/src/lib/sdk/abstractintegration.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "abstractintegration.h"
#include "abstractformwindow.h"
@@ -60,6 +35,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
/*!
\class QDesignerIntegrationInterface
@@ -304,8 +281,6 @@ public:
void updateSelection();
void updateCustomWidgetPlugins();
- void updatePropertyPrivate(const QString &name, const QVariant &value);
-
void initialize();
void getSelection(qdesigner_internal::Selection &s);
QObject *propertyEditorObject();
@@ -321,7 +296,7 @@ public:
QDesignerIntegrationPrivate::QDesignerIntegrationPrivate(QDesignerIntegration *qq) :
q(qq),
- headerSuffix(QStringLiteral(".h")),
+ headerSuffix(u".h"_s),
headerLowercase(true),
m_features(QDesignerIntegrationInterface::DefaultFeature),
m_resourceFileWatcherBehaviour(QDesignerIntegrationInterface::PromptToReloadResourceFile),
@@ -343,12 +318,9 @@ void QDesignerIntegrationPrivate::initialize()
QObject::connect(designerPropertyEditor, &QDesignerPropertyEditor::resetProperty,
q, &QDesignerIntegration::resetProperty);
QObject::connect(designerPropertyEditor, &QDesignerPropertyEditor::addDynamicProperty,
- q, &QDesignerIntegration::addDynamicProperty);
+ q, &QDesignerIntegration::addDynamicProperty);
QObject::connect(designerPropertyEditor, &QDesignerPropertyEditor::removeDynamicProperty,
- q, &QDesignerIntegration::removeDynamicProperty);
- } else {
- QObject::connect(core->propertyEditor(), SIGNAL(propertyChanged(QString,QVariant)),
- q, SLOT(updatePropertyPrivate(QString,QVariant))); // ### fixme: VS Integration leftover?
+ q, &QDesignerIntegration::removeDynamicProperty);
}
QObject::connect(core->formWindowManager(), &QDesignerFormWindowManagerInterface::formWindowAdded,
@@ -360,7 +332,7 @@ void QDesignerIntegrationPrivate::initialize()
m_gradientManager = new QtGradientManager(q);
core->setGradientManager(m_gradientManager);
- const QString gradientsFile = u"/gradients.xml"_qs;
+ const QString gradientsFile = u"/gradients.xml"_s;
m_gradientsPath = dataDirectory() + gradientsFile;
// Migrate from legacy to standard data directory in Qt 7
@@ -377,7 +349,7 @@ void QDesignerIntegrationPrivate::initialize()
QtGradientUtils::restoreState(m_gradientManager, QString::fromLatin1(f.readAll()));
f.close();
} else {
- QFile defaultGradients(QStringLiteral(":/qt-project.org/designer/defaultgradients.xml"));
+ QFile defaultGradients(u":/qt-project.org/designer/defaultgradients.xml"_s);
if (defaultGradients.open(QIODevice::ReadOnly)) {
QtGradientUtils::restoreState(m_gradientManager, QString::fromLatin1(defaultGradients.readAll()));
defaultGradients.close();
@@ -593,12 +565,12 @@ void QDesignerIntegrationPrivate::updateCustomWidgetPlugins()
static QString fixHelpClassName(const QString &className)
{
// ### generalize using the Widget Data Base
- if (className == QStringLiteral("Line"))
- return QStringLiteral("QFrame");
- if (className == QStringLiteral("Spacer"))
- return QStringLiteral("QSpacerItem");
- if (className == QStringLiteral("QLayoutWidget"))
- return QStringLiteral("QLayout");
+ if (className == "Line"_L1)
+ return u"QFrame"_s;
+ if (className == "Spacer"_L1)
+ return u"QSpacerItem"_s;
+ if (className == "QLayoutWidget"_L1)
+ return u"QLayout"_s;
return className;
}
@@ -632,7 +604,7 @@ QString QDesignerIntegrationPrivate::contextHelpId() const
}
QString helpId = fixHelpClassName(className);
if (!currentPropertyName.isEmpty()) {
- helpId += QStringLiteral("::");
+ helpId += "::"_L1;
helpId += currentPropertyName;
}
return helpId;
diff --git a/src/designer/src/lib/sdk/abstractintegration.h b/src/designer/src/lib/sdk/abstractintegration.h
index c47e1f8cf..5e3e297c1 100644
--- a/src/designer/src/lib/sdk/abstractintegration.h
+++ b/src/designer/src/lib/sdk/abstractintegration.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ABSTRACTINTEGRATION_H
#define ABSTRACTINTEGRATION_H
diff --git a/src/designer/src/lib/sdk/abstractintrospection.cpp b/src/designer/src/lib/sdk/abstractintrospection.cpp
index 14bc2a5f2..6fc112f36 100644
--- a/src/designer/src/lib/sdk/abstractintrospection.cpp
+++ b/src/designer/src/lib/sdk/abstractintrospection.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "abstractintrospection_p.h"
diff --git a/src/designer/src/lib/sdk/abstractintrospection_p.h b/src/designer/src/lib/sdk/abstractintrospection_p.h
index fedf5538c..8add3a4ec 100644
--- a/src/designer/src/lib/sdk/abstractintrospection_p.h
+++ b/src/designer/src/lib/sdk/abstractintrospection_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -59,6 +34,7 @@ public:
virtual int keyToValue(const QString &key) const = 0;
virtual int keysToValue(const QString &keys) const = 0;
virtual QString name() const = 0;
+ virtual QString enumName() const = 0;
virtual QString scope() const = 0;
virtual QString separator() const = 0;
virtual int value(int index) const = 0;
diff --git a/src/designer/src/lib/sdk/abstractlanguage.h b/src/designer/src/lib/sdk/abstractlanguage.h
index 1ac58261f..0e0c4f60e 100644
--- a/src/designer/src/lib/sdk/abstractlanguage.h
+++ b/src/designer/src/lib/sdk/abstractlanguage.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/sdk/abstractmetadatabase.cpp b/src/designer/src/lib/sdk/abstractmetadatabase.cpp
index 3ba2d5804..46b0d967c 100644
--- a/src/designer/src/lib/sdk/abstractmetadatabase.cpp
+++ b/src/designer/src/lib/sdk/abstractmetadatabase.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
// sdk
#include "abstractmetadatabase.h"
@@ -33,7 +8,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QDesignerMetaDataBaseInterface
- \brief The QDesignerMetaDataBaseInterface class provides an interface to Qt Designer's
+ \brief The QDesignerMetaDataBaseInterface class provides an interface to Qt Widgets Designer's
object meta database.
\inmodule QtDesigner
\internal
@@ -88,7 +63,7 @@ QDesignerMetaDataBaseInterface::~QDesignerMetaDataBaseInterface() = default;
/*!
\class QDesignerMetaDataBaseItemInterface
\brief The QDesignerMetaDataBaseItemInterface class provides an interface to individual
- items in Qt Designer's meta database.
+ items in \QD's meta database.
\inmodule QtDesigner
\internal
diff --git a/src/designer/src/lib/sdk/abstractmetadatabase.h b/src/designer/src/lib/sdk/abstractmetadatabase.h
index adeb6c7ee..46728ea66 100644
--- a/src/designer/src/lib/sdk/abstractmetadatabase.h
+++ b/src/designer/src/lib/sdk/abstractmetadatabase.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ABSTRACTMETADATABASE_H
#define ABSTRACTMETADATABASE_H
diff --git a/src/designer/src/lib/sdk/abstractnewformwidget.cpp b/src/designer/src/lib/sdk/abstractnewformwidget.cpp
index 404c0c595..e4b0e7dc0 100644
--- a/src/designer/src/lib/sdk/abstractnewformwidget.cpp
+++ b/src/designer/src/lib/sdk/abstractnewformwidget.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "abstractnewformwidget.h"
#include <newformwidget_p.h>
diff --git a/src/designer/src/lib/sdk/abstractnewformwidget.h b/src/designer/src/lib/sdk/abstractnewformwidget.h
index b34d5ff0a..c63bcf38c 100644
--- a/src/designer/src/lib/sdk/abstractnewformwidget.h
+++ b/src/designer/src/lib/sdk/abstractnewformwidget.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ABSTRACTNEWFORMWIDGET_H
#define ABSTRACTNEWFORMWIDGET_H
diff --git a/src/designer/src/lib/sdk/abstractobjectinspector.cpp b/src/designer/src/lib/sdk/abstractobjectinspector.cpp
index 61fbb6e25..fed91fe5d 100644
--- a/src/designer/src/lib/sdk/abstractobjectinspector.cpp
+++ b/src/designer/src/lib/sdk/abstractobjectinspector.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "abstractobjectinspector.h"
@@ -34,7 +9,7 @@ QT_BEGIN_NAMESPACE
\class QDesignerObjectInspectorInterface
\brief The QDesignerObjectInspectorInterface class allows you to
- change the focus of Qt Designer's object inspector.
+ change the focus of \QD's object inspector.
\inmodule QtDesigner
diff --git a/src/designer/src/lib/sdk/abstractobjectinspector.h b/src/designer/src/lib/sdk/abstractobjectinspector.h
index a71c2bfdd..1d7748c9a 100644
--- a/src/designer/src/lib/sdk/abstractobjectinspector.h
+++ b/src/designer/src/lib/sdk/abstractobjectinspector.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ABSTRACTOBJECTINSPECTOR_H
#define ABSTRACTOBJECTINSPECTOR_H
diff --git a/src/designer/src/lib/sdk/abstractoptionspage.h b/src/designer/src/lib/sdk/abstractoptionspage.h
index 80607ffd0..f0ff5327b 100644
--- a/src/designer/src/lib/sdk/abstractoptionspage.h
+++ b/src/designer/src/lib/sdk/abstractoptionspage.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ABSTRACTOPTIONSPAGE_P_H
#define ABSTRACTOPTIONSPAGE_P_H
diff --git a/src/designer/src/lib/sdk/abstractoptionspage.qdoc b/src/designer/src/lib/sdk/abstractoptionspage.qdoc
index 9fe94c1a4..75214edae 100644
--- a/src/designer/src/lib/sdk/abstractoptionspage.qdoc
+++ b/src/designer/src/lib/sdk/abstractoptionspage.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\class QDesignerOptionsPageInterface
diff --git a/src/designer/src/lib/sdk/abstractpromotioninterface.cpp b/src/designer/src/lib/sdk/abstractpromotioninterface.cpp
index a8e8ecdb6..d279145f9 100644
--- a/src/designer/src/lib/sdk/abstractpromotioninterface.cpp
+++ b/src/designer/src/lib/sdk/abstractpromotioninterface.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "abstractpromotioninterface.h"
diff --git a/src/designer/src/lib/sdk/abstractpromotioninterface.h b/src/designer/src/lib/sdk/abstractpromotioninterface.h
index 3ec2a3038..752d36bc7 100644
--- a/src/designer/src/lib/sdk/abstractpromotioninterface.h
+++ b/src/designer/src/lib/sdk/abstractpromotioninterface.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ABSTRACTPROMOTIONINTERFACE_H
#define ABSTRACTPROMOTIONINTERFACE_H
diff --git a/src/designer/src/lib/sdk/abstractpropertyeditor.cpp b/src/designer/src/lib/sdk/abstractpropertyeditor.cpp
index b9cdeca63..c9e011e15 100644
--- a/src/designer/src/lib/sdk/abstractpropertyeditor.cpp
+++ b/src/designer/src/lib/sdk/abstractpropertyeditor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "abstractpropertyeditor.h"
@@ -34,7 +9,7 @@ QT_BEGIN_NAMESPACE
\class QDesignerPropertyEditorInterface
\brief The QDesignerPropertyEditorInterface class allows you to
- query and manipulate the current state of Qt Designer's property
+ query and manipulate the current state of Qt Widgets Designer's property
editor.
\inmodule QtDesigner
diff --git a/src/designer/src/lib/sdk/abstractpropertyeditor.h b/src/designer/src/lib/sdk/abstractpropertyeditor.h
index 1da6227d5..8fe5d1cd9 100644
--- a/src/designer/src/lib/sdk/abstractpropertyeditor.h
+++ b/src/designer/src/lib/sdk/abstractpropertyeditor.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ABSTRACTPROPERTYEDITOR_H
#define ABSTRACTPROPERTYEDITOR_H
diff --git a/src/designer/src/lib/sdk/abstractresourcebrowser.cpp b/src/designer/src/lib/sdk/abstractresourcebrowser.cpp
index 26a5b8dc3..516cc903f 100644
--- a/src/designer/src/lib/sdk/abstractresourcebrowser.cpp
+++ b/src/designer/src/lib/sdk/abstractresourcebrowser.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "abstractresourcebrowser.h"
diff --git a/src/designer/src/lib/sdk/abstractresourcebrowser.h b/src/designer/src/lib/sdk/abstractresourcebrowser.h
index d3b97e5ad..a0c9f62dd 100644
--- a/src/designer/src/lib/sdk/abstractresourcebrowser.h
+++ b/src/designer/src/lib/sdk/abstractresourcebrowser.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ABSTRACTRESOURCEBROWSER_H
#define ABSTRACTRESOURCEBROWSER_H
diff --git a/src/designer/src/lib/sdk/abstractsettings.h b/src/designer/src/lib/sdk/abstractsettings.h
index 4540ef145..3f5b92a0a 100644
--- a/src/designer/src/lib/sdk/abstractsettings.h
+++ b/src/designer/src/lib/sdk/abstractsettings.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ABSTRACTSETTINGS_P_H
#define ABSTRACTSETTINGS_P_H
diff --git a/src/designer/src/lib/sdk/abstractsettings.qdoc b/src/designer/src/lib/sdk/abstractsettings.qdoc
index 407048657..6a0ac2b04 100644
--- a/src/designer/src/lib/sdk/abstractsettings.qdoc
+++ b/src/designer/src/lib/sdk/abstractsettings.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\class QDesignerSettingsInterface
diff --git a/src/designer/src/lib/sdk/abstractwidgetbox.cpp b/src/designer/src/lib/sdk/abstractwidgetbox.cpp
index 9bdef3c5b..db559bdcc 100644
--- a/src/designer/src/lib/sdk/abstractwidgetbox.cpp
+++ b/src/designer/src/lib/sdk/abstractwidgetbox.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "abstractwidgetbox.h"
@@ -34,7 +9,7 @@ QT_BEGIN_NAMESPACE
\class QDesignerWidgetBoxInterface
\brief The QDesignerWidgetBoxInterface class allows you to control
- the contents of Qt Designer's widget box.
+ the contents of \QD's widget box.
\inmodule QtDesigner
@@ -207,7 +182,7 @@ int QDesignerWidgetBoxInterface::findOrInsertCategory(const QString &categoryNam
\class QDesignerWidgetBoxInterface::Widget
- \brief The Widget class specified a widget in Qt Designer's widget
+ \brief The Widget class specified a widget in \QD's widget
box component.
*/
@@ -261,7 +236,7 @@ int QDesignerWidgetBoxInterface::findOrInsertCategory(const QString &categoryNam
/*!
\class QDesignerWidgetBoxInterface::Category
- \brief The Category class specifies a category in Qt Designer's widget box component.
+ \brief The Category class specifies a category in \QD's widget box component.
\internal
*/
diff --git a/src/designer/src/lib/sdk/abstractwidgetbox.h b/src/designer/src/lib/sdk/abstractwidgetbox.h
index 6d038fc6a..6f6d9f495 100644
--- a/src/designer/src/lib/sdk/abstractwidgetbox.h
+++ b/src/designer/src/lib/sdk/abstractwidgetbox.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ABSTRACTWIDGETBOX_H
#define ABSTRACTWIDGETBOX_H
@@ -84,7 +59,7 @@ public:
QString name() const { return m_name; }
void setName(const QString &aname) { m_name = aname; }
- int widgetCount() const { return m_widget_list.size(); }
+ int widgetCount() const { return int(m_widget_list.size()); }
Widget widget(int idx) const { return m_widget_list.at(idx); }
void removeWidget(int idx) { m_widget_list.removeAt(idx); }
void addWidget(const Widget &awidget) { m_widget_list.append(awidget); }
diff --git a/src/designer/src/lib/sdk/abstractwidgetdatabase.cpp b/src/designer/src/lib/sdk/abstractwidgetdatabase.cpp
index a348580ea..2147afeca 100644
--- a/src/designer/src/lib/sdk/abstractwidgetdatabase.cpp
+++ b/src/designer/src/lib/sdk/abstractwidgetdatabase.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "abstractwidgetdatabase.h"
#include <QtCore/qdebug.h>
@@ -32,14 +7,12 @@
QT_BEGIN_NAMESPACE
-namespace {
- enum { debugWidgetDataBase = 0 };
-}
+enum { debugAbstractWidgetDataBase = 0 };
/*!
\class QDesignerWidgetDataBaseInterface
\brief The QDesignerWidgetDataBaseInterface class provides an interface that is used to
- access and modify Qt Designer's widget database.
+ access and modify \QD's widget database.
\inmodule QtDesigner
\internal
*/
@@ -65,7 +38,7 @@ QDesignerWidgetDataBaseInterface::~QDesignerWidgetDataBaseInterface()
*/
int QDesignerWidgetDataBaseInterface::count() const
{
- return m_items.count();
+ return m_items.size();
}
/*!
@@ -86,7 +59,7 @@ int QDesignerWidgetDataBaseInterface::indexOf(QDesignerWidgetDataBaseItemInterfa
*/
void QDesignerWidgetDataBaseInterface::insert(int index, QDesignerWidgetDataBaseItemInterface *item)
{
- if (debugWidgetDataBase)
+ if (debugAbstractWidgetDataBase)
qDebug() << "insert at " << index << ' ' << item->name() << " derived from " << item->extends();
m_items.insert(index, item);
@@ -96,7 +69,7 @@ void QDesignerWidgetDataBaseInterface::insert(int index, QDesignerWidgetDataBase
*/
void QDesignerWidgetDataBaseInterface::append(QDesignerWidgetDataBaseItemInterface *item)
{
- if (debugWidgetDataBase)
+ if (debugAbstractWidgetDataBase)
qDebug() << "append " << item->name() << " derived from " << item->extends();
m_items.append(item);
}
@@ -163,7 +136,7 @@ bool QDesignerWidgetDataBaseInterface::isCustom(QObject *object, bool resolveNam
/*!
\class QDesignerWidgetDataBaseItemInterface
\brief The QDesignerWidgetDataBaseItemInterface class provides an interface that is used to
- access individual items in Qt Designer's widget database.
+ access individual items in \QD's widget database.
\inmodule QtDesigner
\internal
diff --git a/src/designer/src/lib/sdk/abstractwidgetdatabase.h b/src/designer/src/lib/sdk/abstractwidgetdatabase.h
index c162039fc..fbf88e7e2 100644
--- a/src/designer/src/lib/sdk/abstractwidgetdatabase.h
+++ b/src/designer/src/lib/sdk/abstractwidgetdatabase.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ABSTRACTWIDGETDATABASE_H
#define ABSTRACTWIDGETDATABASE_H
diff --git a/src/designer/src/lib/sdk/abstractwidgetfactory.cpp b/src/designer/src/lib/sdk/abstractwidgetfactory.cpp
index 9b4f70680..52c41b6a7 100644
--- a/src/designer/src/lib/sdk/abstractwidgetfactory.cpp
+++ b/src/designer/src/lib/sdk/abstractwidgetfactory.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtDesigner/abstractwidgetfactory.h>
#include "abstractformeditor.h"
@@ -35,7 +10,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QDesignerWidgetFactoryInterface
\brief The QDesignerWidgetFactoryInterface class provides an interface that is used to control
- the widget factory used by Qt Designer.
+ the widget factory used by \QD.
\inmodule QtDesigner
\internal
*/
diff --git a/src/designer/src/lib/sdk/abstractwidgetfactory.h b/src/designer/src/lib/sdk/abstractwidgetfactory.h
index 2bec8ba3d..a8c5cd23c 100644
--- a/src/designer/src/lib/sdk/abstractwidgetfactory.h
+++ b/src/designer/src/lib/sdk/abstractwidgetfactory.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ABSTRACTWIDGETFACTORY_H
#define ABSTRACTWIDGETFACTORY_H
diff --git a/src/designer/src/lib/sdk/container.h b/src/designer/src/lib/sdk/container.h
index f1100c8b1..079e4d5c2 100644
--- a/src/designer/src/lib/sdk/container.h
+++ b/src/designer/src/lib/sdk/container.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef CONTAINER_H
#define CONTAINER_H
diff --git a/src/designer/src/lib/sdk/container.qdoc b/src/designer/src/lib/sdk/container.qdoc
index da45ab388..be3723cb3 100644
--- a/src/designer/src/lib/sdk/container.qdoc
+++ b/src/designer/src/lib/sdk/container.qdoc
@@ -1,37 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\class QDesignerContainerExtension
\brief The QDesignerContainerExtension class allows you to add pages to
- a custom multi-page container in Qt Designer's workspace.
+ a custom multi-page container in \QD's workspace.
\inmodule QtDesigner
- \image containerextension-example.png
+ \image containerextension-example.webp
QDesignerContainerExtension provide an interface for creating
custom container extensions. A container extension consists of a
diff --git a/src/designer/src/lib/sdk/dynamicpropertysheet.h b/src/designer/src/lib/sdk/dynamicpropertysheet.h
index 9c8cebf1a..9046d2e22 100644
--- a/src/designer/src/lib/sdk/dynamicpropertysheet.h
+++ b/src/designer/src/lib/sdk/dynamicpropertysheet.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/sdk/dynamicpropertysheet.qdoc b/src/designer/src/lib/sdk/dynamicpropertysheet.qdoc
index 4d34a1bb4..df457a450 100644
--- a/src/designer/src/lib/sdk/dynamicpropertysheet.qdoc
+++ b/src/designer/src/lib/sdk/dynamicpropertysheet.qdoc
@@ -1,35 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\class QDesignerDynamicPropertySheetExtension
\brief The QDesignerDynamicPropertySheetExtension class allows you to
- manipulate a widget's dynamic properties in Qt Designer's property editor.
+ manipulate a widget's dynamic properties in \QD's property editor.
\sa QDesignerPropertySheetExtension, {QObject#Dynamic Properties}{Dynamic Properties}
diff --git a/src/designer/src/lib/sdk/extrainfo.cpp b/src/designer/src/lib/sdk/extrainfo.cpp
index c276dc9f4..1b161c3b9 100644
--- a/src/designer/src/lib/sdk/extrainfo.cpp
+++ b/src/designer/src/lib/sdk/extrainfo.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "extrainfo.h"
@@ -33,7 +8,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QDesignerExtraInfoExtension
\brief The QDesignerExtraInfoExtension class provides extra information about a widget in
- Qt Designer.
+ Qt Widgets Designer.
\inmodule QtDesigner
\internal
*/
diff --git a/src/designer/src/lib/sdk/extrainfo.h b/src/designer/src/lib/sdk/extrainfo.h
index 1b06c0347..0ce315e17 100644
--- a/src/designer/src/lib/sdk/extrainfo.h
+++ b/src/designer/src/lib/sdk/extrainfo.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef EXTRAINFO_H
#define EXTRAINFO_H
diff --git a/src/designer/src/lib/sdk/layoutdecoration.h b/src/designer/src/lib/sdk/layoutdecoration.h
index e893d1947..3808c5d61 100644
--- a/src/designer/src/lib/sdk/layoutdecoration.h
+++ b/src/designer/src/lib/sdk/layoutdecoration.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef LAYOUTDECORATION_H
#define LAYOUTDECORATION_H
diff --git a/src/designer/src/lib/sdk/layoutdecoration.qdoc b/src/designer/src/lib/sdk/layoutdecoration.qdoc
index 04beec341..8f98af168 100644
--- a/src/designer/src/lib/sdk/layoutdecoration.qdoc
+++ b/src/designer/src/lib/sdk/layoutdecoration.qdoc
@@ -1,29 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+// ### FIXME Qt 7: std::pair in QDesignerLayoutDecorationExtension (QTBUG-115841)
/*!
\class QDesignerLayoutDecorationExtension
diff --git a/src/designer/src/lib/sdk/membersheet.h b/src/designer/src/lib/sdk/membersheet.h
index a3a927538..06b773a93 100644
--- a/src/designer/src/lib/sdk/membersheet.h
+++ b/src/designer/src/lib/sdk/membersheet.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef MEMBERSHEET_H
#define MEMBERSHEET_H
diff --git a/src/designer/src/lib/sdk/membersheet.qdoc b/src/designer/src/lib/sdk/membersheet.qdoc
index 39fc0caa0..65e56cda1 100644
--- a/src/designer/src/lib/sdk/membersheet.qdoc
+++ b/src/designer/src/lib/sdk/membersheet.qdoc
@@ -1,36 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\class QDesignerMemberSheetExtension
\brief The QDesignerMemberSheetExtension class allows you to
manipulate a widget's member functions which is displayed when
- configuring connections using Qt Designer's mode for editing
+ configuring connections using \QD's mode for editing
signals and slots.
\inmodule QtDesigner
@@ -112,7 +88,7 @@
For a complete example using an extension class, see \l
{taskmenuextension}{Task Menu Extension example}. The
example shows how to create a custom widget plugin for Qt
- Designer, and how to to use the QDesignerTaskMenuExtension class
+ Designer, and how to use the QDesignerTaskMenuExtension class
to add custom items to \QD's task menu.
\sa QExtensionFactory, QExtensionManager, {Creating Custom Widget
diff --git a/src/designer/src/lib/sdk/propertysheet.h b/src/designer/src/lib/sdk/propertysheet.h
index 1f3a78d05..9aa49b8eb 100644
--- a/src/designer/src/lib/sdk/propertysheet.h
+++ b/src/designer/src/lib/sdk/propertysheet.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef PROPERTYSHEET_H
#define PROPERTYSHEET_H
diff --git a/src/designer/src/lib/sdk/propertysheet.qdoc b/src/designer/src/lib/sdk/propertysheet.qdoc
index e5ab420f4..5804ecb1b 100644
--- a/src/designer/src/lib/sdk/propertysheet.qdoc
+++ b/src/designer/src/lib/sdk/propertysheet.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\class QDesignerPropertySheetExtension
@@ -129,7 +105,7 @@
Or you can use an existing factory, expanding the
QExtensionFactory::createExtension() function to make the factory
- able to create a property sheet extension extension as well. For
+ able to create a property sheet extension as well. For
example:
\snippet plugins/doc_src_qtdesigner.cpp 18
@@ -137,7 +113,7 @@
For a complete example using an extension class, see the \l
{taskmenuextension}{Task Menu Extension example}. The
example shows how to create a custom widget plugin for Qt
- Designer, and how to to use the QDesignerTaskMenuExtension class
+ Designer, and how to use the QDesignerTaskMenuExtension class
to add custom items to \QD's task menu.
\sa QExtensionFactory, QExtensionManager, {Creating Custom Widget
diff --git a/src/designer/src/lib/sdk/sdk_global.h b/src/designer/src/lib/sdk/sdk_global.h
index b24ae76ef..b3ab7e1bc 100644
--- a/src/designer/src/lib/sdk/sdk_global.h
+++ b/src/designer/src/lib/sdk/sdk_global.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef SDK_GLOBAL_H
#define SDK_GLOBAL_H
diff --git a/src/designer/src/lib/sdk/taskmenu.cpp b/src/designer/src/lib/sdk/taskmenu.cpp
new file mode 100644
index 000000000..3e41f43b7
--- /dev/null
+++ b/src/designer/src/lib/sdk/taskmenu.cpp
@@ -0,0 +1,13 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+#include "taskmenu.h"
+
+QT_BEGIN_NAMESPACE
+
+QDesignerTaskMenuExtension::~QDesignerTaskMenuExtension() = default;
+
+QAction *QDesignerTaskMenuExtension::preferredEditAction() const
+{ return nullptr; }
+
+QT_END_NAMESPACE
diff --git a/src/designer/src/lib/sdk/taskmenu.h b/src/designer/src/lib/sdk/taskmenu.h
index fd588baf1..355e11deb 100644
--- a/src/designer/src/lib/sdk/taskmenu.h
+++ b/src/designer/src/lib/sdk/taskmenu.h
@@ -1,47 +1,23 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef TASKMENU_H
#define TASKMENU_H
+#include <QtDesigner/sdk_global.h>
#include <QtDesigner/extension.h>
QT_BEGIN_NAMESPACE
class QAction;
-class QDesignerTaskMenuExtension
+class QDESIGNER_SDK_EXPORT QDesignerTaskMenuExtension
{
public:
Q_DISABLE_COPY_MOVE(QDesignerTaskMenuExtension)
QDesignerTaskMenuExtension() = default;
- virtual ~QDesignerTaskMenuExtension() = default;
+ virtual ~QDesignerTaskMenuExtension();
virtual QAction *preferredEditAction() const;
@@ -49,10 +25,6 @@ public:
};
Q_DECLARE_EXTENSION_INTERFACE(QDesignerTaskMenuExtension, "org.qt-project.Qt.Designer.TaskMenu")
-
-inline QAction *QDesignerTaskMenuExtension::preferredEditAction() const
-{ return nullptr; }
-
QT_END_NAMESPACE
#endif // TASKMENU_H
diff --git a/src/designer/src/lib/sdk/taskmenu.qdoc b/src/designer/src/lib/sdk/taskmenu.qdoc
index b768fc5b2..78e76d9f1 100644
--- a/src/designer/src/lib/sdk/taskmenu.qdoc
+++ b/src/designer/src/lib/sdk/taskmenu.qdoc
@@ -1,34 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\class QDesignerTaskMenuExtension
\brief The QDesignerTaskMenuExtension class allows you to add custom
- menu entries to Qt Designer's task menu.
+ menu entries to \QD's task menu.
\inmodule QtDesigner
QDesignerTaskMenuExtension provides an interface for creating
@@ -39,7 +15,7 @@
menu. Whenever a task menu is requested, \QD will query
for the selected widget's task menu extension.
- \image taskmenuextension-example-faded.png
+ \image taskmenuextension-example.webp
A task menu extension is a collection of QActions. The actions
appear as entries in the task menu when the plugin with the
@@ -105,7 +81,7 @@
For a complete example using the QDesignerTaskMenuExtension class,
see the \l {taskmenuextension}{Task Menu Extension
example}. The example shows how to create a custom widget plugin
- for \QD, and how to to use the QDesignerTaskMenuExtension
+ for \QD, and how to use the QDesignerTaskMenuExtension
class to add custom items to \QD's task menu.
\sa QExtensionFactory, QExtensionManager, {Creating Custom Widget
diff --git a/src/designer/src/lib/shared/actioneditor.cpp b/src/designer/src/lib/shared/actioneditor.cpp
index d1ce9804e..b6f3c778c 100644
--- a/src/designer/src/lib/shared/actioneditor.cpp
+++ b/src/designer/src/lib/shared/actioneditor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "actioneditor_p.h"
#include "actionrepository_p.h"
@@ -70,18 +45,19 @@
#include <QtCore/qdebug.h>
#include <QtCore/qbuffer.h>
-Q_DECLARE_METATYPE(QAction*)
-
QT_BEGIN_NAMESPACE
-static const char *actionEditorViewModeKey = "ActionEditorViewMode";
+using namespace Qt::StringLiterals;
+
+static constexpr auto actionEditorViewModeKey = "ActionEditorViewMode"_L1;
-static const char *iconPropertyC = "icon";
-static const char *shortcutPropertyC = "shortcut";
-static const char *toolTipPropertyC = "toolTip";
-static const char *checkablePropertyC = "checkable";
-static const char *objectNamePropertyC = "objectName";
-static const char *textPropertyC = "text";
+static constexpr auto iconPropertyC = "icon"_L1;
+static constexpr auto shortcutPropertyC = "shortcut"_L1;
+static constexpr auto menuRolePropertyC = "menuRole"_L1;
+static constexpr auto toolTipPropertyC = "toolTip"_L1;
+static constexpr auto checkablePropertyC = "checkable"_L1;
+static constexpr auto objectNamePropertyC = "objectName"_L1;
+static constexpr auto textPropertyC = "text"_L1;
namespace qdesigner_internal {
//-------- ActionGroupDelegate
@@ -138,7 +114,8 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent,
toolbar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
l->addWidget(toolbar);
// edit actions
- QIcon documentNewIcon = QIcon::fromTheme(QStringLiteral("document-new"), createIconSet(QStringLiteral("filenew.png")));
+ QIcon documentNewIcon = createIconSet(QIcon::ThemeIcon::DocumentNew,
+ "filenew.png"_L1);
m_actionNew->setIcon(documentNewIcon);
m_actionNew->setEnabled(false);
connect(m_actionNew, &QAction::triggered, this, &ActionEditor::slotNewAction);
@@ -149,17 +126,20 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent,
#if QT_CONFIG(clipboard)
m_actionCut->setEnabled(false);
connect(m_actionCut, &QAction::triggered, this, &ActionEditor::slotCut);
- QIcon editCutIcon = QIcon::fromTheme(QStringLiteral("edit-cut"), createIconSet(QStringLiteral("editcut.png")));
+ QIcon editCutIcon = createIconSet(QIcon::ThemeIcon::EditCut,
+ "editcut.png"_L1);
m_actionCut->setIcon(editCutIcon);
m_actionCopy->setEnabled(false);
connect(m_actionCopy, &QAction::triggered, this, &ActionEditor::slotCopy);
- QIcon editCopyIcon = QIcon::fromTheme(QStringLiteral("edit-copy"), createIconSet(QStringLiteral("editcopy.png")));
+ QIcon editCopyIcon = createIconSet(QIcon::ThemeIcon::EditCopy,
+ "editcopy.png"_L1);
m_actionCopy->setIcon(editCopyIcon);
toolbar->addAction(m_actionCopy);
connect(m_actionPaste, &QAction::triggered, this, &ActionEditor::slotPaste);
- QIcon editPasteIcon = QIcon::fromTheme(QStringLiteral("edit-paste"), createIconSet(QStringLiteral("editpaste.png")));
+ QIcon editPasteIcon = createIconSet(QIcon::ThemeIcon::EditPaste,
+ "editpaste.png"_L1);
m_actionPaste->setIcon(editPasteIcon);
toolbar->addAction(m_actionPaste);
#endif
@@ -169,7 +149,8 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent,
connect(m_actionNavigateToSlot, &QAction::triggered, this, &ActionEditor::navigateToSlotCurrentAction);
- QIcon editDeleteIcon = QIcon::fromTheme(QStringLiteral("edit-delete"), createIconSet(QStringLiteral("editdelete.png")));
+ QIcon editDeleteIcon = createIconSet(QIcon::ThemeIcon::EditDelete,
+ "editdelete.png"_L1);
m_actionDelete->setIcon(editDeleteIcon);
m_actionDelete->setEnabled(false);
connect(m_actionDelete, &QAction::triggered, this, &ActionEditor::slotDelete);
@@ -248,9 +229,10 @@ QToolButton *ActionEditor::createConfigureMenuButton(const QString &t, QMenu **p
{
QToolButton *configureButton = new QToolButton;
QAction *configureAction = new QAction(t, configureButton);
- QIcon configureIcon = QIcon::fromTheme(QStringLiteral("document-properties"), createIconSet(QStringLiteral("configure.png")));
+ QIcon configureIcon = QIcon::fromTheme(QIcon::ThemeIcon::DocumentProperties,
+ createIconSet("configure.png"_L1));
configureAction->setIcon(configureIcon);
- QMenu *configureMenu = new QMenu;
+ QMenu *configureMenu = new QMenu(configureButton);
configureAction->setMenu(configureMenu);
configureButton->setDefaultAction(configureAction);
configureButton->setPopupMode(QToolButton::InstantPopup);
@@ -351,7 +333,13 @@ void ActionEditor::slotCurrentItemChanged(QAction *action)
QDesignerObjectInspector *oi = qobject_cast<QDesignerObjectInspector *>(core()->objectInspector());
- if (action->associatedWidgets().isEmpty()) {
+ // Check if we have at least one associated QWidget:
+ const auto associatedObjects = action->associatedObjects();
+ auto it = std::find_if(associatedObjects.cbegin(), associatedObjects.cend(),
+ [](QObject *obj) {
+ return qobject_cast<QWidget *>(obj) != nullptr;
+ });
+ if (it == associatedObjects.cend()) {
// Special case: action not in object tree. Deselect all and set in property editor
fw->clearSelection(false);
if (oi)
@@ -400,7 +388,7 @@ void ActionEditor::setFilter(const QString &f)
// Set changed state of icon property, reset when icon is cleared
static void refreshIconPropertyChanged(const QAction *action, QDesignerPropertySheetExtension *sheet)
{
- sheet->setChanged(sheet->indexOf(QLatin1String(iconPropertyC)), !action->icon().isNull());
+ sheet->setChanged(sheet->indexOf(iconPropertyC), !action->icon().isNull());
}
void ActionEditor::manageAction(QAction *action)
@@ -412,8 +400,8 @@ void ActionEditor::manageAction(QAction *action)
return;
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), action);
- sheet->setChanged(sheet->indexOf(QLatin1String(objectNamePropertyC)), true);
- sheet->setChanged(sheet->indexOf(QLatin1String(textPropertyC)), true);
+ sheet->setChanged(sheet->indexOf(objectNamePropertyC), true);
+ sheet->setChanged(sheet->indexOf(textPropertyC), true);
refreshIconPropertyChanged(action, sheet);
m_actionView->setCurrentIndex(m_actionView->model()->addAction(action));
@@ -456,15 +444,17 @@ void ActionEditor::slotNewAction()
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), action);
if (!actionData.toolTip.isEmpty())
- setInitialProperty(sheet, QLatin1String(toolTipPropertyC), actionData.toolTip);
+ setInitialProperty(sheet, toolTipPropertyC, actionData.toolTip);
if (actionData.checkable)
- setInitialProperty(sheet, QLatin1String(checkablePropertyC), QVariant(true));
+ setInitialProperty(sheet, checkablePropertyC, QVariant(true));
if (!actionData.keysequence.value().isEmpty())
- setInitialProperty(sheet, QLatin1String(shortcutPropertyC), QVariant::fromValue(actionData.keysequence));
+ setInitialProperty(sheet, shortcutPropertyC, QVariant::fromValue(actionData.keysequence));
+
+ sheet->setProperty(sheet->indexOf(iconPropertyC), QVariant::fromValue(actionData.icon));
- sheet->setProperty(sheet->indexOf(QLatin1String(iconPropertyC)), QVariant::fromValue(actionData.icon));
+ setInitialProperty(sheet, menuRolePropertyC, QVariant::fromValue(actionData.menuRole));
AddActionCommand *cmd = new AddActionCommand(formWindow());
cmd->init(action);
@@ -477,7 +467,7 @@ void ActionEditor::slotNewAction()
static QDesignerFormWindowCommand *setIconPropertyCommand(const PropertySheetIconValue &newIcon, QAction *action, QDesignerFormWindowInterface *fw)
{
- const QString iconProperty = QLatin1String(iconPropertyC);
+ const QString iconProperty = iconPropertyC;
if (newIcon.isEmpty()) {
ResetPropertyCommand *cmd = new ResetPropertyCommand(fw);
cmd->init(action, iconProperty);
@@ -493,7 +483,7 @@ static QDesignerFormWindowCommand *setIconPropertyCommand(const PropertySheetIco
static QDesignerFormWindowCommand *setKeySequencePropertyCommand(const PropertySheetKeySequenceValue &ks, QAction *action, QDesignerFormWindowInterface *fw)
{
- const QString shortcutProperty = QLatin1String(shortcutPropertyC);
+ const QString shortcutProperty = shortcutPropertyC;
if (ks.value().isEmpty()) {
ResetPropertyCommand *cmd = new ResetPropertyCommand(fw);
cmd->init(action, shortcutProperty);
@@ -542,10 +532,11 @@ void ActionEditor::editAction(QAction *action, int column)
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), action);
oldActionData.name = action->objectName();
oldActionData.text = action->text();
- oldActionData.toolTip = textPropertyValue(sheet, QLatin1String(toolTipPropertyC));
- oldActionData.icon = qvariant_cast<PropertySheetIconValue>(sheet->property(sheet->indexOf(QLatin1String(iconPropertyC))));
+ oldActionData.toolTip = textPropertyValue(sheet, toolTipPropertyC);
+ oldActionData.icon = qvariant_cast<PropertySheetIconValue>(sheet->property(sheet->indexOf(iconPropertyC)));
oldActionData.keysequence = ActionModel::actionShortCut(sheet);
oldActionData.checkable = action->isCheckable();
+ oldActionData.menuRole.value = action->menuRole();
dlg.setActionData(oldActionData);
switch (column) {
@@ -564,6 +555,9 @@ void ActionEditor::editAction(QAction *action, int column)
case qdesigner_internal::ActionModel::ToolTipColumn:
dlg.focusTooltip();
break;
+ case qdesigner_internal::ActionModel::MenuRoleColumn:
+ dlg.focusMenuRole();
+ break;
}
if (!dlg.exec())
@@ -577,31 +571,35 @@ void ActionEditor::editAction(QAction *action, int column)
const bool severalChanges = (changeMask != ActionData::TextChanged) && (changeMask != ActionData::NameChanged)
&& (changeMask != ActionData::ToolTipChanged) && (changeMask != ActionData::IconChanged)
- && (changeMask != ActionData::CheckableChanged) && (changeMask != ActionData::KeysequenceChanged);
+ && (changeMask != ActionData::CheckableChanged) && (changeMask != ActionData::KeysequenceChanged)
+ && (changeMask != ActionData::MenuRoleChanged);
QDesignerFormWindowInterface *fw = formWindow();
QUndoStack *undoStack = fw->commandHistory();
if (severalChanges)
- fw->beginCommand(QStringLiteral("Edit action"));
+ fw->beginCommand(u"Edit action"_s);
if (changeMask & ActionData::NameChanged)
- undoStack->push(createTextPropertyCommand(QLatin1String(objectNamePropertyC), newActionData.name, action, fw));
+ undoStack->push(createTextPropertyCommand(objectNamePropertyC, newActionData.name, action, fw));
if (changeMask & ActionData::TextChanged)
- undoStack->push(createTextPropertyCommand(QLatin1String(textPropertyC), newActionData.text, action, fw));
+ undoStack->push(createTextPropertyCommand(textPropertyC, newActionData.text, action, fw));
if (changeMask & ActionData::ToolTipChanged)
- undoStack->push(createTextPropertyCommand(QLatin1String(toolTipPropertyC), newActionData.toolTip, action, fw));
+ undoStack->push(createTextPropertyCommand(toolTipPropertyC, newActionData.toolTip, action, fw));
if (changeMask & ActionData::IconChanged)
undoStack->push(setIconPropertyCommand(newActionData.icon, action, fw));
if (changeMask & ActionData::CheckableChanged)
- undoStack->push(setPropertyCommand(QLatin1String(checkablePropertyC), newActionData.checkable, false, action, fw));
+ undoStack->push(setPropertyCommand(checkablePropertyC, newActionData.checkable, false, action, fw));
if (changeMask & ActionData::KeysequenceChanged)
undoStack->push(setKeySequencePropertyCommand(newActionData.keysequence, action, fw));
+ if (changeMask & ActionData::MenuRoleChanged)
+ undoStack->push(setPropertyCommand(menuRolePropertyC, static_cast<QAction::MenuRole>(newActionData.menuRole.value), QAction::NoRole, action, fw));
+
if (severalChanges)
fw->endCommand();
}
@@ -615,7 +613,7 @@ void ActionEditor::editCurrentAction()
void ActionEditor::navigateToSlotCurrentAction()
{
if (QAction *a = m_actionView->currentAction())
- QDesignerTaskMenu::navigateToSlot(m_core, a, QStringLiteral("triggered()"));
+ QDesignerTaskMenu::navigateToSlot(m_core, a, u"triggered()"_s);
}
void ActionEditor::deleteActions(QDesignerFormWindowInterface *fw, const ActionList &actions)
@@ -674,14 +672,13 @@ void ActionEditor::slotDelete()
// UnderScore: "Open file" -> actionOpen_file
static QString underscore(QString text)
{
- const QString underscore = QString(QLatin1Char('_'));
- static const QRegularExpression nonAsciiPattern(QStringLiteral("[^a-zA-Z_0-9]"));
+ static const QRegularExpression nonAsciiPattern(u"[^a-zA-Z_0-9]"_s);
Q_ASSERT(nonAsciiPattern.isValid());
- text.replace(nonAsciiPattern, underscore);
- static const QRegularExpression multipleSpacePattern(QStringLiteral("__*"));
+ text.replace(nonAsciiPattern, "_"_L1);
+ static const QRegularExpression multipleSpacePattern(u"__*"_s);
Q_ASSERT(multipleSpacePattern.isValid());
- text.replace(multipleSpacePattern, underscore);
- if (text.endsWith(underscore.at(0)))
+ text.replace(multipleSpacePattern, "_"_L1);
+ if (text.endsWith(u'_'))
text.chop(1);
return text;
}
@@ -736,7 +733,7 @@ void ActionEditor::resourceImageDropped(const QString &path, QAction *action)
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), action);
const PropertySheetIconValue oldIcon =
- qvariant_cast<PropertySheetIconValue>(sheet->property(sheet->indexOf(QLatin1String(iconPropertyC))));
+ qvariant_cast<PropertySheetIconValue>(sheet->property(sheet->indexOf(iconPropertyC)));
PropertySheetIconValue newIcon;
newIcon.setPixmap(QIcon::Normal, QIcon::Off, PropertySheetPixmapValue(path));
if (newIcon.paths().isEmpty() || newIcon.paths() == oldIcon.paths())
@@ -793,14 +790,14 @@ void ActionEditor::slotSelectAssociatedWidget(QWidget *w)
void ActionEditor::restoreSettings()
{
QDesignerSettingsInterface *settings = m_core->settingsManager();
- m_actionView->setViewMode(settings->value(QLatin1String(actionEditorViewModeKey), 0).toInt());
+ m_actionView->setViewMode(settings->value(actionEditorViewModeKey, 0).toInt());
updateViewModeActions();
}
void ActionEditor::saveSettings()
{
QDesignerSettingsInterface *settings = m_core->settingsManager();
- settings->setValue(QLatin1String(actionEditorViewModeKey), m_actionView->viewMode());
+ settings->setValue(actionEditorViewModeKey, m_actionView->viewMode());
}
void ActionEditor::updateViewModeActions()
diff --git a/src/designer/src/lib/shared/actioneditor_p.h b/src/designer/src/lib/shared/actioneditor_p.h
index 911289c8f..471d12d04 100644
--- a/src/designer/src/lib/shared/actioneditor_p.h
+++ b/src/designer/src/lib/shared/actioneditor_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -88,7 +63,7 @@ public:
static void setObjectNamingMode(ObjectNamingMode n) { m_objectNamingMode = n; }
static QString actionTextToName(const QString &text,
- const QString &prefix = QLatin1String("action"));
+ const QString &prefix = QLatin1StringView("action"));
// Utility to create a configure button with menu for usage on toolbars
static QToolButton *createConfigureMenuButton(const QString &t, QMenu **ptrToMenu);
diff --git a/src/designer/src/lib/shared/actionprovider_p.h b/src/designer/src/lib/shared/actionprovider_p.h
index 63d902951..16f987da9 100644
--- a/src/designer/src/lib/shared/actionprovider_p.h
+++ b/src/designer/src/lib/shared/actionprovider_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ACTIONPROVIDER_H
#define ACTIONPROVIDER_H
@@ -67,15 +42,14 @@ template <class Widget>
int actionIndexAt(const Widget *w, const QPoint &pos, Qt::Orientation orientation)
{
const auto actions = w->actions();
- const int actionCount = actions.count();
- if (actionCount == 0)
+ if (actions.isEmpty())
return -1;
// actionGeometry() can be wrong sometimes; it returns a geometry that
// stretches to the end of the toolbar/menu bar. So, check from the beginning
// in the case of a horizontal right-to-left orientation.
const bool checkTopRight = orientation == Qt::Horizontal && w->layoutDirection() == Qt::RightToLeft;
const QPoint topRight = QPoint(w->rect().width(), 0);
- for (int index = 0; index < actionCount; ++index) {
+ for (qsizetype index = 0, actionCount = actions.size(); index < actionCount; ++index) {
QRect g = w->actionGeometry(actions.at(index));
if (checkTopRight)
g.setTopRight(topRight);
@@ -83,7 +57,7 @@ template <class Widget>
g.setTopLeft(QPoint(0, 0));
if (g.contains(pos))
- return index;
+ return int(index);
}
return -1;
}
diff --git a/src/designer/src/lib/shared/actionrepository.cpp b/src/designer/src/lib/shared/actionrepository.cpp
index b9f60cdb6..59d8fc6b7 100644
--- a/src/designer/src/lib/shared/actionrepository.cpp
+++ b/src/designer/src/lib/shared/actionrepository.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "actionrepository_p.h"
#include "qtresourceview_p.h"
@@ -48,17 +23,18 @@
#include <QtCore/qset.h>
#include <QtCore/qdebug.h>
-
-Q_DECLARE_METATYPE(QAction*)
+#include <QtCore/qmetaobject.h>
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace {
enum { listModeIconSize = 16, iconModeIconSize = 24 };
}
-static const char *actionMimeType = "action-repository/actions";
-static const char *plainTextMimeType = "text/plain";
+static constexpr auto actionMimeType = "action-repository/actions"_L1;
+static constexpr auto plainTextMimeType = "text/plain"_L1;
static inline QAction *actionOfItem(const QStandardItem* item)
{
@@ -79,6 +55,7 @@ ActionModel::ActionModel(QWidget *parent ) :
headers += tr("Shortcut");
headers += tr("Checkable");
headers += tr("ToolTip");
+ headers += tr("MenuRole");
Q_ASSERT(NumColumns == headers.size());
setHorizontalHeaderLabels(headers);
}
@@ -139,14 +116,16 @@ QModelIndex ActionModel::addAction(QAction *action)
// Find the associated menus and toolbars, ignore toolbuttons
QWidgetList ActionModel::associatedWidgets(const QAction *action)
{
- QWidgetList rc = action->associatedWidgets();
- for (QWidgetList::iterator it = rc.begin(); it != rc.end(); )
- if (qobject_cast<const QMenu *>(*it) || qobject_cast<const QToolBar *>(*it)) {
- ++it;
- } else {
- it = rc.erase(it);
+ const QObjectList rc = action->associatedObjects();
+ QWidgetList result;
+ result.reserve(rc.size());
+ for (QObject *obj : rc) {
+ if (QWidget *w = qobject_cast<QWidget *>(obj)) {
+ if (qobject_cast<const QMenu *>(w) || qobject_cast<const QToolBar *>(w))
+ result.push_back(w);
}
- return rc;
+ }
+ return result;
}
// shortcut is a fake property, need to retrieve it via property sheet.
@@ -160,7 +139,7 @@ PropertySheetKeySequenceValue ActionModel::actionShortCut(QDesignerFormEditorInt
PropertySheetKeySequenceValue ActionModel::actionShortCut(const QDesignerPropertySheetExtension *sheet)
{
- const int index = sheet->indexOf(QStringLiteral("shortcut"));
+ const int index = sheet->indexOf(u"shortcut"_s);
if (index == -1)
return PropertySheetKeySequenceValue();
return qvariant_cast<PropertySheetKeySequenceValue>(sheet->property(index));
@@ -174,10 +153,8 @@ void ActionModel::setItems(QDesignerFormEditorInterface *core, QAction *action,
// Tooltip, mostly for icon view mode
QString firstTooltip = action->objectName();
const QString text = action->text();
- if (!text.isEmpty()) {
- firstTooltip += QLatin1Char('\n');
- firstTooltip += text;
- }
+ if (!text.isEmpty())
+ firstTooltip += u'\n' + text;
Q_ASSERT(sl.size() == NumColumns);
@@ -196,7 +173,7 @@ void ActionModel::setItems(QDesignerFormEditorInterface *core, QAction *action,
item->setCheckState(used ? Qt::Checked : Qt::Unchecked);
if (used) {
QString usedToolTip;
- const QString separator = QStringLiteral(", ");
+ const auto separator = ", "_L1;
const int count = associatedDesignerWidgets.size();
for (int i = 0; i < count; i++) {
if (i)
@@ -222,7 +199,11 @@ void ActionModel::setItems(QDesignerFormEditorInterface *core, QAction *action,
QString toolTip = action->toolTip();
item = sl[ToolTipColumn];
item->setToolTip(toolTip);
- item->setText(toolTip.replace(QLatin1Char('\n'), QLatin1Char(' ')));
+ item->setText(toolTip.replace(u'\n', u' '));
+ // menuRole
+ const auto menuRole = action->menuRole();
+ item = sl[MenuRoleColumn];
+ item->setText(QLatin1StringView(QMetaEnum::fromType<QAction::MenuRole>().valueToKey(menuRole)));
}
QMimeData *ActionModel::mimeData(const QModelIndexList &indexes ) const
@@ -240,7 +221,7 @@ QMimeData *ActionModel::mimeData(const QModelIndexList &indexes ) const
// Resource images are plain text. The drag needs to be restricted, however.
QStringList ActionModel::mimeTypes() const
{
- return QStringList(QLatin1String(plainTextMimeType));
+ return QStringList(plainTextMimeType);
}
QString ActionModel::actionName(int row) const
@@ -632,7 +613,7 @@ ActionRepositoryMimeData::ActionRepositoryMimeData(const ActionList &al, Qt::Dro
QStringList ActionRepositoryMimeData::formats() const
{
- return QStringList(QLatin1String(actionMimeType));
+ return QStringList(actionMimeType);
}
QPixmap ActionRepositoryMimeData::actionDragPixmap(const QAction *action)
@@ -643,9 +624,9 @@ QPixmap ActionRepositoryMimeData::actionDragPixmap(const QAction *action)
if (!icon.isNull())
return icon.pixmap(QSize(22, 22));
- const QWidgetList &associatedWidgets = action->associatedWidgets();
- for (QWidget *w : associatedWidgets) {
- if (QToolButton *tb = qobject_cast<QToolButton *>(w))
+ const QObjectList associatedObjects = action->associatedObjects();
+ for (QObject *o : associatedObjects) {
+ if (QToolButton *tb = qobject_cast<QToolButton *>(o))
return tb->grab(QRect(0, 0, -1, -1));
}
diff --git a/src/designer/src/lib/shared/actionrepository_p.h b/src/designer/src/lib/shared/actionrepository_p.h
index e84dd8acf..bc31ccd55 100644
--- a/src/designer/src/lib/shared/actionrepository_p.h
+++ b/src/designer/src/lib/shared/actionrepository_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -64,7 +39,7 @@ class QDESIGNER_SHARED_EXPORT ActionModel: public QStandardItemModel
{
Q_OBJECT
public:
- enum Columns { NameColumn, UsedColumn, TextColumn, ShortCutColumn, CheckedColumn, ToolTipColumn, NumColumns };
+ enum Columns { NameColumn, UsedColumn, TextColumn, ShortCutColumn, CheckedColumn, ToolTipColumn, MenuRoleColumn, NumColumns };
enum { ActionRole = Qt::UserRole + 1000 };
explicit ActionModel(QWidget *parent = nullptr);
diff --git a/src/designer/src/lib/shared/codedialog.cpp b/src/designer/src/lib/shared/codedialog.cpp
index 34bc56196..f11a2ac9b 100644
--- a/src/designer/src/lib/shared/codedialog.cpp
+++ b/src/designer/src/lib/shared/codedialog.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "codedialog_p.h"
#include "qdesigner_utils_p.h"
@@ -46,6 +21,8 @@
#include <QtGui/qaction.h>
#include <QtGui/qevent.h>
+#include <QtGui/qfontdatabase.h>
+#include <QtGui/qfontmetrics.h>
#include <QtGui/qicon.h>
#include <QtCore/qdebug.h>
@@ -55,6 +32,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
// ----------------- CodeDialogPrivate
struct CodeDialog::CodeDialogPrivate {
@@ -77,18 +56,19 @@ CodeDialog::CodeDialog(QWidget *parent) :
QDialog(parent),
m_impl(new CodeDialogPrivate)
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QVBoxLayout *vBoxLayout = new QVBoxLayout;
// Edit tool bar
QToolBar *toolBar = new QToolBar;
- const QIcon saveIcon = createIconSet(QStringLiteral("filesave.png"));
+ const QIcon saveIcon = createIconSet(QIcon::ThemeIcon::DocumentSave,
+ "filesave.png"_L1);
QAction *saveAction = toolBar->addAction(saveIcon, tr("Save..."));
connect(saveAction, &QAction::triggered, this, &CodeDialog::slotSaveAs);
#if QT_CONFIG(clipboard)
- const QIcon copyIcon = createIconSet(QStringLiteral("editcopy.png"));
+ const QIcon copyIcon = createIconSet(QIcon::ThemeIcon::EditCopy,
+ "editcopy.png"_L1);
QAction *copyAction = toolBar->addAction(copyIcon, tr("Copy All"));
connect(copyAction, &QAction::triggered, this, &CodeDialog::copyAll);
#endif
@@ -99,8 +79,11 @@ CodeDialog::CodeDialog(QWidget *parent) :
// Edit
m_impl->m_textEdit->setReadOnly(true);
+ const auto font = QFontDatabase::systemFont(QFontDatabase::SystemFont::FixedFont);
+ const int editorWidth = QFontMetrics(font, this).averageCharWidth() * 100;
+ m_impl->m_textEdit->setFont(font);
m_impl->m_textEdit->setMinimumSize(QSize(
- m_impl->m_findWidget->minimumSize().width(),
+ qMax(editorWidth, m_impl->m_findWidget->minimumSize().width()),
500));
vBoxLayout->addWidget(m_impl->m_textEdit);
@@ -162,11 +145,11 @@ bool CodeDialog::generateCode(const QDesignerFormWindowInterface *fw,
tempPattern += QDir::separator();
const QString fileName = fw->fileName();
if (fileName.isEmpty()) {
- tempPattern += QStringLiteral("designer");
+ tempPattern += "designer"_L1;
} else {
tempPattern += QFileInfo(fileName).baseName();
}
- tempPattern += QStringLiteral("XXXXXX.ui");
+ tempPattern += "XXXXXX.ui"_L1;
// Write to temp file
QTemporaryFile tempFormFile(tempPattern);
@@ -204,15 +187,15 @@ bool CodeDialog::showCodeDialog(const QDesignerFormWindowInterface *fw,
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setCode(code);
dialog->setFormFileName(fw->fileName());
- QString languageName;
+ QLatin1StringView languageName;
switch (language) {
case UicLanguage::Cpp:
- languageName = QLatin1String("C++");
- dialog->setMimeType(QLatin1String("text/x-chdr"));
+ languageName = "C++"_L1;
+ dialog->setMimeType(u"text/x-chdr"_s);
break;
case UicLanguage::Python:
- languageName = QLatin1String("Python");
- dialog->setMimeType(QLatin1String("text/x-python"));
+ languageName = "Python"_L1;
+ dialog->setMimeType(u"text/x-python"_s);
break;
}
dialog->setWindowTitle(tr("%1 - [%2 Code]").
@@ -236,8 +219,8 @@ void CodeDialog::slotSaveAs()
if (!uiFile.isEmpty()) {
QFileInfo uiFi(uiFile);
fileDialog.setDirectory(uiFi.absolutePath());
- fileDialog.selectFile(QLatin1String("ui_") + uiFi.baseName()
- + QLatin1Char('.') + suffix);
+ fileDialog.selectFile("ui_"_L1 + uiFi.baseName()
+ + '.'_L1 + suffix);
}
while (true) {
diff --git a/src/designer/src/lib/shared/codedialog_p.h b/src/designer/src/lib/shared/codedialog_p.h
index 37f798c4f..e68f48a24 100644
--- a/src/designer/src/lib/shared/codedialog_p.h
+++ b/src/designer/src/lib/shared/codedialog_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/connectionedit.cpp b/src/designer/src/lib/shared/connectionedit.cpp
index 2382e154a..d92ca00e2 100644
--- a/src/designer/src/lib/shared/connectionedit.cpp
+++ b/src/designer/src/lib/shared/connectionedit.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "connectionedit_p.h"
@@ -205,7 +180,7 @@ DeleteConnectionsCommand::DeleteConnectionsCommand(ConnectionEdit *edit,
void DeleteConnectionsCommand::redo()
{
- for (Connection *con : qAsConst(m_con_list)) {
+ for (Connection *con : std::as_const(m_con_list)) {
const int idx = edit()->indexOfConnection(con);
emit edit()->aboutToRemoveConnection(con);
Q_ASSERT(edit()->m_con_list.contains(con));
@@ -219,7 +194,7 @@ void DeleteConnectionsCommand::redo()
void DeleteConnectionsCommand::undo()
{
- for (Connection *con : qAsConst(m_con_list)) {
+ for (Connection *con : std::as_const(m_con_list)) {
Q_ASSERT(!edit()->m_con_list.contains(con));
emit edit()->aboutToAddConnection(edit()->m_con_list.size());
edit()->m_con_list.append(con);
@@ -633,7 +608,7 @@ void Connection::trimLine()
{
if (m_source == nullptr || m_source_pos == QPoint(-1, -1) || m_target_pos == QPoint(-1, -1))
return;
- int cnt = m_knee_list.size();
+ auto cnt = m_knee_list.size();
if (cnt < 2)
return;
@@ -722,7 +697,7 @@ QRegion Connection::region() const
{
QRegion result;
- for (int i = 0; i < m_knee_list.size() - 1; ++i)
+ for (qsizetype i = 0; i < m_knee_list.size() - 1; ++i)
result = result.united(lineRect(m_knee_list.at(i), m_knee_list.at(i + 1)));
if (!m_arrow_head.isEmpty()) {
@@ -755,7 +730,7 @@ void Connection::update(bool update_widgets) const
void Connection::paint(QPainter *p) const
{
- for (int i = 0; i < m_knee_list.size() - 1; ++i)
+ for (qsizetype i = 0; i < m_knee_list.size() - 1; ++i)
p->drawLine(m_knee_list.at(i), m_knee_list.at(i + 1));
if (!m_arrow_head.isEmpty()) {
@@ -787,7 +762,7 @@ QRect Connection::endPointRect(EndPoint::Type type) const
CETypes::LineDir Connection::labelDir(EndPoint::Type type) const
{
- const int cnt = m_knee_list.size();
+ const auto cnt = m_knee_list.size();
if (cnt < 2)
return RightDir;
@@ -807,7 +782,7 @@ CETypes::LineDir Connection::labelDir(EndPoint::Type type) const
QRect Connection::labelRect(EndPoint::Type type) const
{
- const int cnt = m_knee_list.size();
+ const auto cnt = m_knee_list.size();
if (cnt < 2)
return QRect();
const QString text = label(type);
@@ -985,7 +960,7 @@ void ConnectionEdit::updateBackground()
if (!m_enable_update_background)
return;
- for (Connection *c : qAsConst(m_con_list))
+ for (Connection *c : std::as_const(m_con_list))
c->updateVisibility();
updateLines();
@@ -1063,7 +1038,7 @@ void ConnectionEdit::paintEvent(QPaintEvent *e)
WidgetSet heavy_highlight_set, light_highlight_set;
- for (Connection *con : qAsConst(m_con_list)) {
+ for (Connection *con : std::as_const(m_con_list)) {
if (!con->isVisible())
continue;
@@ -1081,7 +1056,7 @@ void ConnectionEdit::paintEvent(QPaintEvent *e)
c.setAlpha(BG_ALPHA);
p.setBrush(c);
- for (QWidget *w : qAsConst(heavy_highlight_set)) {
+ for (QWidget *w : std::as_const(heavy_highlight_set)) {
p.drawRect(fixRect(widgetRect(w)));
light_highlight_set.remove(w);
}
@@ -1091,12 +1066,12 @@ void ConnectionEdit::paintEvent(QPaintEvent *e)
c.setAlpha(BG_ALPHA);
p.setBrush(c);
- for (QWidget *w : qAsConst(light_highlight_set))
+ for (QWidget *w : std::as_const(light_highlight_set))
p.drawRect(fixRect(widgetRect(w)));
p.setBrush(palette().color(QPalette::Base));
p.setPen(palette().color(QPalette::Text));
- for (Connection *con : qAsConst(m_con_list)) {
+ for (Connection *con : std::as_const(m_con_list)) {
if (con->isVisible()) {
paintLabel(&p, EndPoint::Source, con);
paintLabel(&p, EndPoint::Target, con);
@@ -1106,7 +1081,7 @@ void ConnectionEdit::paintEvent(QPaintEvent *e)
p.setPen(m_active_color);
p.setBrush(m_active_color);
- for (Connection *con : qAsConst(m_con_list)) {
+ for (Connection *con : std::as_const(m_con_list)) {
if (!selected(con) || !con->isVisible())
continue;
@@ -1358,9 +1333,9 @@ static ConnectionEdit::ConnectionSet findConnectionsOf(const ConnectionEdit::Con
{
ConnectionEdit::ConnectionSet rc;
- const ConnectionEdit::ConnectionList::const_iterator ccend = cl.constEnd();
+ const auto ccend = cl.cend();
for ( ; oi1 != oi2; ++oi1) {
- for (ConnectionEdit::ConnectionList::const_iterator cit = cl.constBegin(); cit != ccend; ++cit) {
+ for (auto cit = cl.constBegin(); cit != ccend; ++cit) {
Connection *con = *cit;
if (con->object(ConnectionEdit::EndPoint::Source) == *oi1 || con->object(ConnectionEdit::EndPoint::Target) == *oi1)
rc.insert(con, con);
@@ -1427,7 +1402,7 @@ bool ConnectionEdit::selected(const Connection *con) const
void ConnectionEdit::selectNone()
{
- for (Connection *con : qAsConst(m_sel_con_set))
+ for (Connection *con : std::as_const(m_sel_con_set))
con->update();
m_sel_con_set.clear();
@@ -1437,7 +1412,7 @@ void ConnectionEdit::selectAll()
{
if (m_sel_con_set.size() == m_con_list.size())
return;
- for (Connection *con : qAsConst(m_con_list))
+ for (Connection *con : std::as_const(m_con_list))
setSelected(con, true);
}
@@ -1516,7 +1491,7 @@ void ConnectionEdit::addConnection(Connection *con)
void ConnectionEdit::updateLines()
{
- for (Connection *con : qAsConst(m_con_list))
+ for (Connection *con : std::as_const(m_con_list))
con->checkWidgets();
}
diff --git a/src/designer/src/lib/shared/connectionedit_p.h b/src/designer/src/lib/shared/connectionedit_p.h
index ca4560fda..3cfce754b 100644
--- a/src/designer/src/lib/shared/connectionedit_p.h
+++ b/src/designer/src/lib/shared/connectionedit_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/csshighlighter.cpp b/src/designer/src/lib/shared/csshighlighter.cpp
index 115b77c17..d34e7e4de 100644
--- a/src/designer/src/lib/shared/csshighlighter.cpp
+++ b/src/designer/src/lib/shared/csshighlighter.cpp
@@ -1,39 +1,17 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "csshighlighter_p.h"
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
-CssHighlighter::CssHighlighter(QTextDocument *document)
-: QSyntaxHighlighter(document)
+CssHighlighter::CssHighlighter(const CssHighlightColors &colors,
+ QTextDocument *document)
+ : QSyntaxHighlighter(document), m_colors(colors)
{
}
@@ -53,7 +31,7 @@ void CssHighlighter::highlightBlock(const QString& text)
{ Comment, Comment, Comment, Comment, Comment, Comment, Comment, -1, MaybeCommentEnd } // MaybeCommentEnd
};
- int lastIndex = 0;
+ qsizetype lastIndex = 0;
bool lastWasSlash = false;
int state = previousBlockState(), save_state;
if (state == -1) {
@@ -65,8 +43,8 @@ void CssHighlighter::highlightBlock(const QString& text)
// The initial state is based on the precense of a : and the absense of a {.
// This is because Qt style sheets support both a full stylesheet as well as
// an inline form with just properties.
- state = save_state = (text.indexOf(QLatin1Char(':')) > -1 &&
- text.indexOf(QLatin1Char('{')) == -1) ? Property : Selector;
+ state = save_state = (text.indexOf(u':') > -1 &&
+ text.indexOf(u'{') == -1) ? Property : Selector;
} else {
save_state = state>>16;
state &= 0x00ff;
@@ -78,7 +56,7 @@ void CssHighlighter::highlightBlock(const QString& text)
state = save_state;
}
- for (int i = 0; i < text.length(); i++) {
+ for (qsizetype i = 0; i < text.size(); ++i) {
int token = ALNUM;
const QChar c = text.at(i);
const char a = c.toLatin1();
@@ -130,39 +108,39 @@ void CssHighlighter::highlightBlock(const QString& text)
}
}
- highlight(text, lastIndex, text.length() - lastIndex, state);
+ highlight(text, lastIndex, text.size() - lastIndex, state);
setCurrentBlockState(state + (save_state<<16));
}
void CssHighlighter::highlight(const QString &text, int start, int length, int state)
{
- if (start >= text.length() || length <= 0)
+ if (start >= text.size() || length <= 0)
return;
QTextCharFormat format;
switch (state) {
case Selector:
- setFormat(start, length, Qt::darkRed);
+ setFormat(start, length, m_colors.selector);
break;
case Property:
- setFormat(start, length, Qt::blue);
+ setFormat(start, length, m_colors.property);
break;
case Value:
- setFormat(start, length, Qt::black);
+ setFormat(start, length, m_colors.value);
break;
case Pseudo1:
- setFormat(start, length, Qt::darkRed);
+ setFormat(start, length, m_colors.pseudo1);
break;
case Pseudo2:
- setFormat(start, length, Qt::darkRed);
+ setFormat(start, length, m_colors.pseudo2);
break;
case Quote:
- setFormat(start, length, Qt::darkMagenta);
+ setFormat(start, length, m_colors.quote);
break;
case Comment:
case MaybeCommentEnd:
- format.setForeground(Qt::darkGreen);
+ format.setForeground(m_colors.comment);
setFormat(start, length, format);
break;
default:
diff --git a/src/designer/src/lib/shared/csshighlighter_p.h b/src/designer/src/lib/shared/csshighlighter_p.h
index 8af8cd337..bad7e9f7d 100644
--- a/src/designer/src/lib/shared/csshighlighter_p.h
+++ b/src/designer/src/lib/shared/csshighlighter_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -41,17 +16,30 @@
#define CSSHIGHLIGHTER_H
#include <QtGui/qsyntaxhighlighter.h>
+#include <QtGui/qcolor.h>
#include "shared_global_p.h"
QT_BEGIN_NAMESPACE
namespace qdesigner_internal {
+struct CssHighlightColors
+{
+ QColor selector;
+ QColor property;
+ QColor value;
+ QColor pseudo1;
+ QColor pseudo2;
+ QColor quote;
+ QColor comment;
+};
+
class QDESIGNER_SHARED_EXPORT CssHighlighter : public QSyntaxHighlighter
{
Q_OBJECT
public:
- explicit CssHighlighter(QTextDocument *document);
+ explicit CssHighlighter(const CssHighlightColors &colors,
+ QTextDocument *document);
protected:
void highlightBlock(const QString&) override;
@@ -60,6 +48,8 @@ protected:
private:
enum State { Selector, Property, Value, Pseudo, Pseudo1, Pseudo2, Quote,
MaybeComment, Comment, MaybeCommentEnd };
+
+ const CssHighlightColors m_colors;
};
} // namespace qdesigner_internal
diff --git a/src/designer/src/lib/shared/deviceprofile.cpp b/src/designer/src/lib/shared/deviceprofile.cpp
index fbe65abaf..25148b526 100644
--- a/src/designer/src/lib/shared/deviceprofile.cpp
+++ b/src/designer/src/lib/shared/deviceprofile.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "deviceprofile_p.h"
@@ -46,18 +21,24 @@
#include <QtCore/qxmlstream.h>
-static const char *dpiXPropertyC = "_q_customDpiX";
-static const char *dpiYPropertyC = "_q_customDpiY";
+static const char dpiXPropertyC[] = "_q_customDpiX";
+static const char dpiYPropertyC[] = "_q_customDpiY";
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+namespace qdesigner_internal {
// XML serialization
static const char *xmlVersionC="1.0";
static const char *rootElementC="deviceprofile";
-static const char *nameElementC = "name";
-static const char *fontFamilyElementC = "fontfamily";
-static const char *fontPointSizeElementC = "fontpointsize";
-static const char *dPIXElementC = "dpix";
-static const char *dPIYElementC = "dpiy";
-static const char *styleElementC = "style";
+static constexpr auto nameElementC = "name"_L1;
+static constexpr auto fontFamilyElementC = "fontfamily"_L1;
+static constexpr auto fontPointSizeElementC = "fontpointsize"_L1;
+static constexpr auto dPIXElementC = "dpix"_L1;
+static constexpr auto dPIYElementC = "dpiy"_L1;
+static constexpr auto styleElementC = "style"_L1;
/* DeviceProfile:
* For preview purposes (preview, widget box, new form dialog), the
@@ -69,10 +50,6 @@ static const char *styleElementC = "style";
* In addition, the widgetfactory maintains the system settings style
* and applies it when creating widgets. */
-QT_BEGIN_NAMESPACE
-
-namespace qdesigner_internal {
-
// ---------------- DeviceProfileData
class DeviceProfileData : public QSharedData {
public:
@@ -286,9 +263,9 @@ void DeviceProfile::apply(const QDesignerFormEditorInterface *core, QWidget *wid
}
}
-bool DeviceProfile::equals(const DeviceProfile& rhs) const
+bool comparesEqual(const DeviceProfile &lhs, const DeviceProfile &rhs) noexcept
{
- const DeviceProfileData &d = *m_d;
+ const DeviceProfileData &d = *lhs.m_d;
const DeviceProfileData &rhs_d = *rhs.m_d;
return d.m_fontPointSize == rhs_d.m_fontPointSize &&
d.m_dpiX == rhs_d.m_dpiX && d.m_dpiY == rhs_d.m_dpiY && d.m_fontFamily == rhs_d.m_fontFamily &&
@@ -307,20 +284,20 @@ QString DeviceProfile::toXml() const
const DeviceProfileData &d = *m_d;
QString rc;
QXmlStreamWriter writer(&rc);
- writer.writeStartDocument(QLatin1String(xmlVersionC));
- writer.writeStartElement(QLatin1String(rootElementC));
- writeElement(writer, QLatin1String(nameElementC), d.m_name);
+ writer.writeStartDocument(QLatin1StringView(xmlVersionC));
+ writer.writeStartElement(QLatin1StringView(rootElementC));
+ writeElement(writer, nameElementC, d.m_name);
if (!d.m_fontFamily.isEmpty())
- writeElement(writer, QLatin1String(fontFamilyElementC), d.m_fontFamily);
+ writeElement(writer, fontFamilyElementC, d.m_fontFamily);
if (d.m_fontPointSize >= 0)
- writeElement(writer, QLatin1String(fontPointSizeElementC), QString::number(d.m_fontPointSize));
+ writeElement(writer, fontPointSizeElementC, QString::number(d.m_fontPointSize));
if (d.m_dpiX > 0)
- writeElement(writer, QLatin1String(dPIXElementC), QString::number(d.m_dpiX));
+ writeElement(writer, dPIXElementC, QString::number(d.m_dpiX));
if (d.m_dpiY > 0)
- writeElement(writer, QLatin1String(dPIYElementC), QString::number(d.m_dpiY));
+ writeElement(writer, dPIYElementC, QString::number(d.m_dpiY));
if (!d.m_style.isEmpty())
- writeElement(writer, QLatin1String(styleElementC), d.m_style);
+ writeElement(writer, styleElementC, d.m_style);
writer.writeEndElement();
writer.writeEndDocument();
@@ -336,7 +313,7 @@ static ParseStage nextStage(ParseStage currentStage, QStringView startElement)
{
switch (currentStage) {
case ParseBeginning:
- if (startElement == QLatin1String(rootElementC))
+ if (startElement == QLatin1StringView(rootElementC))
return ParseWithinRoot;
break;
case ParseWithinRoot:
@@ -346,17 +323,17 @@ static ParseStage nextStage(ParseStage currentStage, QStringView startElement)
case ParseDPIX:
case ParseDPIY:
case ParseStyle:
- if (startElement == QLatin1String(nameElementC))
+ if (startElement == nameElementC)
return ParseName;
- if (startElement == QLatin1String(fontFamilyElementC))
+ if (startElement == fontFamilyElementC)
return ParseFontFamily;
- if (startElement == QLatin1String(fontPointSizeElementC))
+ if (startElement == fontPointSizeElementC)
return ParseFontPointSize;
- if (startElement == QLatin1String(dPIXElementC))
+ if (startElement == dPIXElementC)
return ParseDPIX;
- if (startElement == QLatin1String(dPIYElementC))
+ if (startElement == dPIYElementC)
return ParseDPIY;
- if (startElement == QLatin1String(styleElementC))
+ if (startElement == styleElementC)
return ParseStyle;
break;
case ParseError:
diff --git a/src/designer/src/lib/shared/deviceprofile_p.h b/src/designer/src/lib/shared/deviceprofile_p.h
index 60b9518c5..273a1a1a2 100644
--- a/src/designer/src/lib/shared/deviceprofile_p.h
+++ b/src/designer/src/lib/shared/deviceprofile_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -42,6 +17,7 @@
#include "shared_global_p.h"
+#include <QtCore/qcompare.h>
#include <QtCore/qstring.h>
#include <QtCore/qshareddata.h>
@@ -101,8 +77,6 @@ public:
static void systemResolution(int *dpiX, int *dpiY);
static void widgetResolution(const QWidget *w, int *dpiX, int *dpiY);
- bool equals(const DeviceProfile& rhs) const;
-
// Apply to form/preview (using font inheritance)
enum ApplyMode {
/* Pre-Apply to parent widget of form being edited: Apply font
@@ -123,16 +97,14 @@ public:
bool fromXml(const QString &xml, QString *errorMessage);
private:
+ friend QDESIGNER_SHARED_EXPORT bool comparesEqual(const DeviceProfile &lhs,
+ const DeviceProfile &rhs) noexcept;
+ Q_DECLARE_EQUALITY_COMPARABLE(DeviceProfile)
+
QSharedDataPointer<DeviceProfileData> m_d;
};
-inline bool operator==(const DeviceProfile &s1, const DeviceProfile &s2)
- { return s1.equals(s2); }
-inline bool operator!=(const DeviceProfile &s1, const DeviceProfile &s2)
- { return !s1.equals(s2); }
-
-}
-
+} // namespace qdesigner_internal
QT_END_NAMESPACE
diff --git a/src/designer/src/lib/shared/dialoggui.cpp b/src/designer/src/lib/shared/dialoggui.cpp
index 613a42143..168462ad3 100644
--- a/src/designer/src/lib/shared/dialoggui.cpp
+++ b/src/designer/src/lib/shared/dialoggui.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "dialoggui_p.h"
diff --git a/src/designer/src/lib/shared/dialoggui_p.h b/src/designer/src/lib/shared/dialoggui_p.h
index 4b5f2829f..a60c90494 100644
--- a/src/designer/src/lib/shared/dialoggui_p.h
+++ b/src/designer/src/lib/shared/dialoggui_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef DIALOGGUI
#define DIALOGGUI
diff --git a/src/designer/src/lib/shared/extensionfactory_p.h b/src/designer/src/lib/shared/extensionfactory_p.h
index b1afaf66a..7c34728b6 100644
--- a/src/designer/src/lib/shared/extensionfactory_p.h
+++ b/src/designer/src/lib/shared/extensionfactory_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/formlayoutmenu.cpp b/src/designer/src/lib/shared/formlayoutmenu.cpp
index f4b9255ff..0c7313770 100644
--- a/src/designer/src/lib/shared/formlayoutmenu.cpp
+++ b/src/designer/src/lib/shared/formlayoutmenu.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "formlayoutmenu_p.h"
#include "layoutinfo_p.h"
@@ -56,14 +31,16 @@
#include <QtCore/qhash.h>
#include <QtCore/qdebug.h>
-static const char *buddyPropertyC = "buddy";
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+static constexpr auto buddyPropertyC = "buddy"_L1;
static const char *fieldWidgetBaseClasses[] = {
"QLineEdit", "QComboBox", "QSpinBox", "QDoubleSpinBox", "QCheckBox",
"QDateEdit", "QTimeEdit", "QDateTimeEdit", "QDial", "QWidget"
};
-QT_BEGIN_NAMESPACE
-
namespace qdesigner_internal {
// Struct that describes a row of controls (descriptive label and control) to
@@ -118,7 +95,7 @@ private:
// Check for buddy marker in string
const QRegularExpression m_buddyMarkerRegexp;
- Ui::FormLayoutRowDialog m_ui;
+ QT_PREPEND_NAMESPACE(Ui)::FormLayoutRowDialog m_ui;
bool m_labelNameEdited;
bool m_fieldNameEdited;
bool m_buddyClicked;
@@ -127,19 +104,18 @@ private:
FormLayoutRowDialog::FormLayoutRowDialog(QDesignerFormEditorInterface *core,
QWidget *parent) :
QDialog(parent),
- m_buddyMarkerRegexp(QStringLiteral("\\&[^&]")),
+ m_buddyMarkerRegexp(u"\\&[^&]"_s),
m_labelNameEdited(false),
m_fieldNameEdited(false),
m_buddyClicked(false)
{
Q_ASSERT(m_buddyMarkerRegexp.isValid());
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setModal(true);
m_ui.setupUi(this);
connect(m_ui.labelTextLineEdit, &QLineEdit::textEdited, this, &FormLayoutRowDialog::labelTextEdited);
- QRegularExpressionValidator *nameValidator = new QRegularExpressionValidator(QRegularExpression(QStringLiteral("^[a-zA-Z0-9_]+$")), this);
+ auto *nameValidator = new QRegularExpressionValidator(QRegularExpression(u"^[a-zA-Z0-9_]+$"_s), this);
Q_ASSERT(nameValidator->regularExpression().isValid());
m_ui.labelNameLineEdit->setValidator(nameValidator);
@@ -240,11 +216,11 @@ void FormLayoutRowDialog::labelTextEdited(const QString &text)
// "namespace::QLineEdit"->"LineEdit"
static inline QString postFixFromClassName(QString className)
{
- const int index = className.lastIndexOf(QStringLiteral("::"));
+ const int index = className.lastIndexOf("::"_L1);
if (index != -1)
className.remove(0, index + 2);
if (className.size() > 2)
- if (className.at(0) == QLatin1Char('Q') || className.at(0) == QLatin1Char('K'))
+ if (className.at(0) == u'Q' || className.at(0) == u'K')
if (className.at(1).isUpper())
className.remove(0, 1);
return className;
@@ -290,10 +266,8 @@ static inline PrefixCharacterKind prefixCharacterKind(const QChar &c)
static QString prefixFromLabel(const QString &prefix)
{
QString rc;
- const int length = prefix.size();
bool lastWasAcceptable = false;
- for (int i = 0 ; i < length; i++) {
- const QChar c = prefix.at(i);
+ for (const QChar &c : prefix) {
const PrefixCharacterKind kind = prefixCharacterKind(c);
const bool acceptable = kind != PC_Invalid;
if (acceptable) {
@@ -323,7 +297,7 @@ void FormLayoutRowDialog::updateObjectNames(bool updateLabel, bool updateField)
const QString prefix = prefixFromLabel(labelText());
// Set names
if (doUpdateLabel)
- m_ui.labelNameLineEdit->setText(prefix + QStringLiteral("Label"));
+ m_ui.labelNameLineEdit->setText(prefix + "Label"_L1);
if (doUpdateField)
m_ui.fieldNameLineEdit->setText(prefix + postFixFromClassName(fieldClass()));
}
@@ -356,19 +330,16 @@ void FormLayoutRowDialog::buddyClicked()
* from them ("QLineEdit", "CustomLineEdit", "QComboBox"...). */
QStringList FormLayoutRowDialog::fieldWidgetClasses(QDesignerFormEditorInterface *core)
{
- // Base class -> custom widgets map
- typedef QMultiHash<QString, QString> ClassMap;
-
static QStringList rc;
if (rc.isEmpty()) {
// Turn known base classes into list
QStringList baseClasses;
for (auto fw : fieldWidgetBaseClasses)
- baseClasses.append(QLatin1String(fw));
+ baseClasses.append(QLatin1StringView(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;
+ QMultiHash<QString, QString> customClassMap; // Base class -> custom widgets map
if (qt_extension<QDesignerLanguageExtension *>(core->extensionManager(), core) == nullptr) {
const QDesignerWidgetDataBaseInterface *wdb = core->widgetDataBase();
const int wdbCount = wdb->count();
@@ -405,23 +376,23 @@ static QFormLayout *managedFormLayout(const QDesignerFormEditorInterface *core,
// Create the widgets of a control row and apply text properties contained
// in the struct, called by addFormLayoutRow()
-static QPair<QWidget *,QWidget *>
+static std::pair<QWidget *,QWidget *>
createWidgets(const FormLayoutRow &row, QWidget *parent,
QDesignerFormWindowInterface *formWindow)
{
QDesignerFormEditorInterface *core = formWindow->core();
QDesignerWidgetFactoryInterface *wf = core->widgetFactory();
- QPair<QWidget *,QWidget *> rc = QPair<QWidget *,QWidget *>(wf->createWidget(QStringLiteral("QLabel"), parent),
- wf->createWidget(row.fieldClassName, parent));
+ std::pair<QWidget *,QWidget *> rc{wf->createWidget(u"QLabel"_s, parent),
+ wf->createWidget(row.fieldClassName, parent)};
// Set up properties of the label
- const QString objectNameProperty = QStringLiteral("objectName");
+ const QString objectNameProperty = u"objectName"_s;
QDesignerPropertySheetExtension *labelSheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), rc.first);
int nameIndex = labelSheet->indexOf(objectNameProperty);
labelSheet->setProperty(nameIndex, QVariant::fromValue(PropertySheetStringValue(row.labelName)));
labelSheet->setChanged(nameIndex, true);
formWindow->ensureUniqueObjectName(rc.first);
- const int textIndex = labelSheet->indexOf(QStringLiteral("text"));
+ const int textIndex = labelSheet->indexOf(u"text"_s);
labelSheet->setProperty(textIndex, QVariant::fromValue(PropertySheetStringValue(row.labelText)));
labelSheet->setChanged(textIndex, true);
// Set up properties of the control
@@ -445,7 +416,7 @@ static void addFormLayoutRow(const FormLayoutRow &formLayoutRow, int row, QWidge
undoStack->beginMacro(macroName);
// Create a list of widget insertion commands and pass them a cell position
- const QPair<QWidget *,QWidget *> widgetPair = createWidgets(formLayoutRow, w, formWindow);
+ const auto widgetPair = createWidgets(formLayoutRow, w, formWindow);
InsertWidgetCommand *labelCmd = new InsertWidgetCommand(formWindow);
labelCmd->init(widgetPair.first, false, row, 0);
@@ -455,7 +426,7 @@ static void addFormLayoutRow(const FormLayoutRow &formLayoutRow, int row, QWidge
undoStack->push(controlCmd);
if (formLayoutRow.buddy) {
SetPropertyCommand *buddyCommand = new SetPropertyCommand(formWindow);
- buddyCommand->init(widgetPair.first, QLatin1String(buddyPropertyC), widgetPair.second->objectName());
+ buddyCommand->init(widgetPair.first, buddyPropertyC, widgetPair.second->objectName());
undoStack->push(buddyCommand);
}
undoStack->endMacro();
diff --git a/src/designer/src/lib/shared/formlayoutmenu_p.h b/src/designer/src/lib/shared/formlayoutmenu_p.h
index d4b56ac96..3f4bac070 100644
--- a/src/designer/src/lib/shared/formlayoutmenu_p.h
+++ b/src/designer/src/lib/shared/formlayoutmenu_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef FORMLAYOUTMENU
#define FORMLAYOUTMENU
diff --git a/src/designer/src/lib/shared/formwindowbase.cpp b/src/designer/src/lib/shared/formwindowbase.cpp
index 8a126c1a1..17dde0409 100644
--- a/src/designer/src/lib/shared/formwindowbase.cpp
+++ b/src/designer/src/lib/shared/formwindowbase.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "formwindowbase_p.h"
#include "connectionedit_p.h"
@@ -60,12 +35,15 @@
#include <QtGui/qaction.h>
#include <QtCore/qdebug.h>
+#include <QtCore/qhash.h>
#include <QtCore/qlist.h>
#include <QtCore/qset.h>
#include <QtCore/qtimer.h>
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
class FormWindowBasePrivate {
@@ -80,8 +58,8 @@ public:
DesignerPixmapCache *m_pixmapCache;
DesignerIconCache *m_iconCache;
QtResourceSet *m_resourceSet;
- QMap<QDesignerPropertySheet *, QMap<int, bool> > m_reloadableResources; // bool is dummy, QMap used as QSet
- QMap<QDesignerPropertySheet *, QObject *> m_reloadablePropertySheets;
+ QHash<QDesignerPropertySheet *, QSet<int>> m_reloadableResources;
+ QHash<QDesignerPropertySheet *, QObject *> m_reloadablePropertySheets;
const DeviceProfile m_deviceProfile;
FormWindowBase::LineTerminatorMode m_lineTerminatorMode;
FormWindowBase::ResourceFileSaveMode m_saveResourcesBehaviour;
@@ -157,13 +135,13 @@ void FormWindowBase::setResourceSet(QtResourceSet *resourceSet)
void FormWindowBase::addReloadableProperty(QDesignerPropertySheet *sheet, int index)
{
connectSheet(sheet);
- m_d->m_reloadableResources[sheet][index] = true;
+ m_d->m_reloadableResources[sheet].insert(index);
}
void FormWindowBase::removeReloadableProperty(QDesignerPropertySheet *sheet, int index)
{
m_d->m_reloadableResources[sheet].remove(index);
- if (!m_d->m_reloadableResources[sheet].count()) {
+ if (m_d->m_reloadableResources[sheet].isEmpty()) {
m_d->m_reloadableResources.remove(sheet);
disconnectSheet(sheet);
}
@@ -229,14 +207,13 @@ void FormWindowBase::reloadProperties()
iconCache()->clear();
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();
+ for (int index : it.value()) {
const QVariant newValue = sheet->property(index);
- if (qobject_cast<QLabel *>(sheet->object()) && sheet->propertyName(index) == QStringLiteral("text")) {
+ if (qobject_cast<QLabel *>(sheet->object()) && sheet->propertyName(index) == "text"_L1) {
const PropertySheetStringValue newString = qvariant_cast<PropertySheetStringValue>(newValue);
// optimize a bit, reset only if the text value might contain a reference to qt resources
// (however reloading of icons other than taken from resources might not work here)
- if (newString.value().contains(QStringLiteral(":/"))) {
+ if (newString.value().contains(":/"_L1)) {
const QVariant resetValue = QVariant::fromValue(PropertySheetStringValue());
sheet->setProperty(index, resetValue);
}
@@ -246,7 +223,7 @@ void FormWindowBase::reloadProperties()
if (QTabWidget *tabWidget = qobject_cast<QTabWidget *>(sheet->object())) {
const int count = tabWidget->count();
const int current = tabWidget->currentIndex();
- const QString currentTabIcon = QStringLiteral("currentTabIcon");
+ const QString currentTabIcon = u"currentTabIcon"_s;
for (int i = 0; i < count; i++) {
tabWidget->setCurrentIndex(i);
const int index = sheet->indexOf(currentTabIcon);
@@ -256,7 +233,7 @@ void FormWindowBase::reloadProperties()
} else if (QToolBox *toolBox = qobject_cast<QToolBox *>(sheet->object())) {
const int count = toolBox->count();
const int current = toolBox->currentIndex();
- const QString currentItemIcon = QStringLiteral("currentItemIcon");
+ const QString currentItemIcon = u"currentItemIcon"_s;
for (int i = 0; i < count; i++) {
toolBox->setCurrentIndex(i);
const int index = sheet->indexOf(currentItemIcon);
@@ -265,7 +242,7 @@ void FormWindowBase::reloadProperties()
toolBox->setCurrentIndex(current);
}
}
- for (QObject *object : qAsConst(m_d->m_reloadablePropertySheets)) {
+ for (QObject *object : std::as_const(m_d->m_reloadablePropertySheets)) {
reloadIconResources(iconCache(), object);
}
}
@@ -317,10 +294,8 @@ static void recursiveUpdate(QWidget *w)
{
w->update();
- const QObjectList &l = w->children();
- const QObjectList::const_iterator cend = l.constEnd();
- for (QObjectList::const_iterator it = l.constBegin(); it != cend; ++it) {
- if (QWidget *w = qobject_cast<QWidget*>(*it))
+ for (auto *child : w->children()) {
+ if (QWidget *w = qobject_cast<QWidget*>(child))
recursiveUpdate(w);
}
}
@@ -451,7 +426,7 @@ void FormWindowBase::deleteWidgetList(const QWidgetList &widget_list)
tr("Delete '%1'").arg(widget_list.constFirst()->objectName()) : tr("Delete");
commandHistory()->beginMacro(description);
- for (QWidget *w : qAsConst(widget_list)) {
+ for (QWidget *w : std::as_const(widget_list)) {
emit widgetRemoved(w);
DeleteWidgetCommand *cmd = new DeleteWidgetCommand(this);
cmd->init(w);
@@ -468,7 +443,7 @@ QMenu *FormWindowBase::createExtensionTaskMenu(QDesignerFormWindowInterface *fw,
QExtensionManager *em = fw->core()->extensionManager();
if (const QDesignerTaskMenuExtension *extTaskMenu = qt_extension<QDesignerTaskMenuExtension*>(em, o))
actions += extTaskMenu->taskActions();
- if (const QDesignerTaskMenuExtension *intTaskMenu = qobject_cast<QDesignerTaskMenuExtension *>(em->extension(o, QStringLiteral("QDesignerInternalTaskMenuExtension")))) {
+ if (const auto *intTaskMenu = qobject_cast<QDesignerTaskMenuExtension *>(em->extension(o, u"QDesignerInternalTaskMenuExtension"_s))) {
if (!actions.isEmpty()) {
QAction *a = new QAction(fw);
a->setSeparator(true);
@@ -484,9 +459,8 @@ QMenu *FormWindowBase::createExtensionTaskMenu(QDesignerFormWindowInterface *fw,
actions.push_back(a);
}
QMenu *rc = new QMenu;
- const ActionList::const_iterator cend = actions.constEnd();
- for (ActionList::const_iterator it = actions.constBegin(); it != cend; ++it)
- rc->addAction(*it);
+ for (auto *a : std::as_const(actions))
+ rc->addAction(a);
return rc;
}
diff --git a/src/designer/src/lib/shared/formwindowbase_p.h b/src/designer/src/lib/shared/formwindowbase_p.h
index b240aa521..77fd7b8c8 100644
--- a/src/designer/src/lib/shared/formwindowbase_p.h
+++ b/src/designer/src/lib/shared/formwindowbase_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/grid.cpp b/src/designer/src/lib/shared/grid.cpp
index 9f9ff7d65..f4906a113 100644
--- a/src/designer/src/lib/shared/grid.cpp
+++ b/src/designer/src/lib/shared/grid.cpp
@@ -1,35 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "grid_p.h"
#include <QtCore/qlist.h>
#include <QtCore/qstring.h>
+#include <QtCore/qvariant.h>
+#include <QtCore/qmap.h>
#include <QtGui/qevent.h>
#include <QtGui/qpainter.h>
@@ -57,7 +34,7 @@ template <class T>
// Obtain a value form QVariantMap
template <class T>
static inline bool valueFromVariantMap(const QVariantMap &v, const QString &key, T &value) {
- const QVariantMap::const_iterator it = v.constFind(key);
+ const auto it = v.constFind(key);
const bool found = it != v.constEnd();
if (found)
value = qvariant_cast<T>(it.value());
@@ -79,11 +56,11 @@ Grid::Grid() :
bool Grid::fromVariantMap(const QVariantMap& vm)
{
Grid grid;
- bool anyData = valueFromVariantMap(vm, QLatin1String(KEY_VISIBLE), grid.m_visible);
- anyData |= valueFromVariantMap(vm, QLatin1String(KEY_SNAPX), grid.m_snapX);
- anyData |= valueFromVariantMap(vm, QLatin1String(KEY_SNAPY), grid.m_snapY);
- anyData |= valueFromVariantMap(vm, QLatin1String(KEY_DELTAX), grid.m_deltaX);
- anyData |= valueFromVariantMap(vm, QLatin1String(KEY_DELTAY), grid.m_deltaY);
+ bool anyData = valueFromVariantMap(vm, QLatin1StringView(KEY_VISIBLE), grid.m_visible);
+ anyData |= valueFromVariantMap(vm, QLatin1StringView(KEY_SNAPX), grid.m_snapX);
+ anyData |= valueFromVariantMap(vm, QLatin1StringView(KEY_SNAPY), grid.m_snapY);
+ anyData |= valueFromVariantMap(vm, QLatin1StringView(KEY_DELTAX), grid.m_deltaX);
+ anyData |= valueFromVariantMap(vm, QLatin1StringView(KEY_DELTAY), grid.m_deltaY);
if (!anyData)
return false;
if (grid.m_deltaX == 0 || grid.m_deltaY == 0) {
@@ -103,11 +80,11 @@ QVariantMap Grid::toVariantMap(bool forceKeys) const
void Grid::addToVariantMap(QVariantMap& vm, bool forceKeys) const
{
- valueToVariantMap(m_visible, defaultVisible, QLatin1String(KEY_VISIBLE), vm, forceKeys);
- valueToVariantMap(m_snapX, defaultSnap, QLatin1String(KEY_SNAPX), vm, forceKeys);
- valueToVariantMap(m_snapY, defaultSnap, QLatin1String(KEY_SNAPY), vm, forceKeys);
- valueToVariantMap(m_deltaX, DEFAULT_GRID, QLatin1String(KEY_DELTAX), vm, forceKeys);
- valueToVariantMap(m_deltaY, DEFAULT_GRID, QLatin1String(KEY_DELTAY), vm, forceKeys);
+ valueToVariantMap(m_visible, defaultVisible, QLatin1StringView(KEY_VISIBLE), vm, forceKeys);
+ valueToVariantMap(m_snapX, defaultSnap, QLatin1StringView(KEY_SNAPX), vm, forceKeys);
+ valueToVariantMap(m_snapY, defaultSnap, QLatin1StringView(KEY_SNAPY), vm, forceKeys);
+ valueToVariantMap(m_deltaX, DEFAULT_GRID, QLatin1StringView(KEY_DELTAX), vm, forceKeys);
+ valueToVariantMap(m_deltaY, DEFAULT_GRID, QLatin1StringView(KEY_DELTAY), vm, forceKeys);
}
void Grid::paint(QWidget *widget, QPaintEvent *e) const
@@ -135,7 +112,7 @@ void Grid::paint(QPainter &p, const QWidget *widget, QPaintEvent *e) const
points.reserve((yend - ystart) / m_deltaY + 1);
for (int y = ystart; y <= yend; y += m_deltaY)
points.push_back(QPointF(x, y));
- p.drawPoints( &(*points.begin()), points.count());
+ p.drawPoints( &(*points.begin()), points.size());
points.clear();
}
}
@@ -170,14 +147,6 @@ int Grid::widgetHandleAdjustY(int y) const
return m_snapY ? (y / m_deltaY) * m_deltaY + 1 : y;
}
-bool Grid::equals(const Grid &rhs) const
-{
- return m_visible == rhs.m_visible &&
- m_snapX == rhs.m_snapX &&
- m_snapY == rhs.m_snapY &&
- m_deltaX == rhs.m_deltaX &&
- m_deltaY == rhs.m_deltaY;
-}
}
QT_END_NAMESPACE
diff --git a/src/designer/src/lib/shared/grid_p.h b/src/designer/src/lib/shared/grid_p.h
index ca80eba03..606732884 100644
--- a/src/designer/src/lib/shared/grid_p.h
+++ b/src/designer/src/lib/shared/grid_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -42,6 +17,7 @@
#include "shared_global_p.h"
+#include <QtCore/qcompare.h>
#include <QtCore/qvariant.h>
QT_BEGIN_NAMESPACE
@@ -86,11 +62,15 @@ public:
int widgetHandleAdjustX(int x) const;
int widgetHandleAdjustY(int y) const;
- inline bool operator==(const Grid &rhs) const { return equals(rhs); }
- inline bool operator!=(const Grid &rhs) const { return !equals(rhs); }
-
private:
- bool equals(const Grid &rhs) const;
+ friend bool comparesEqual(const Grid &lhs, const Grid &rhs) noexcept
+ {
+ return lhs.m_visible == rhs.m_visible
+ && lhs.m_snapX == rhs.m_snapX && lhs.m_snapY == rhs.m_snapY
+ && lhs.m_deltaX == rhs.m_deltaX && lhs.m_deltaY == rhs.m_deltaY;
+ }
+ Q_DECLARE_EQUALITY_COMPARABLE(Grid)
+
int snapValue(int value, int grid) const;
bool m_visible;
bool m_snapX;
diff --git a/src/designer/src/lib/shared/gridpanel.cpp b/src/designer/src/lib/shared/gridpanel.cpp
index 80485d0bc..a5f6ae654 100644
--- a/src/designer/src/lib/shared/gridpanel.cpp
+++ b/src/designer/src/lib/shared/gridpanel.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "gridpanel_p.h"
#include "ui_gridpanel.h"
@@ -37,7 +12,7 @@ namespace qdesigner_internal {
GridPanel::GridPanel(QWidget *parentWidget) :
QWidget(parentWidget)
{
- m_ui = new Ui::GridPanel;
+ m_ui = new QT_PREPEND_NAMESPACE(qdesigner_internal)::Ui::GridPanel;
m_ui->setupUi(this);
connect(m_ui->m_resetButton, &QAbstractButton::clicked, this, &GridPanel::reset);
diff --git a/src/designer/src/lib/shared/gridpanel_p.h b/src/designer/src/lib/shared/gridpanel_p.h
index c468caaf8..000a250ad 100644
--- a/src/designer/src/lib/shared/gridpanel_p.h
+++ b/src/designer/src/lib/shared/gridpanel_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/htmlhighlighter.cpp b/src/designer/src/lib/shared/htmlhighlighter.cpp
index a3b7b3391..59e2a5efa 100644
--- a/src/designer/src/lib/shared/htmlhighlighter.cpp
+++ b/src/designer/src/lib/shared/htmlhighlighter.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/qtextstream.h>
#include <QtWidgets/qtextedit.h>
@@ -33,6 +8,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
HtmlHighlighter::HtmlHighlighter(QTextEdit *textEdit)
@@ -71,23 +48,13 @@ void HtmlHighlighter::setFormatFor(Construct construct,
void HtmlHighlighter::highlightBlock(const QString &text)
{
- static const QLatin1Char tab = QLatin1Char('\t');
- static const QLatin1Char space = QLatin1Char(' ');
- static const QLatin1Char amp = QLatin1Char('&');
- static const QLatin1Char startTag = QLatin1Char('<');
- static const QLatin1Char endTag = QLatin1Char('>');
- static const QLatin1Char quot = QLatin1Char('"');
- static const QLatin1Char apos = QLatin1Char('\'');
- static const QLatin1Char semicolon = QLatin1Char(';');
- static const QLatin1Char equals = QLatin1Char('=');
- static const QLatin1String startComment("<!--");
- static const QLatin1String endComment("-->");
- static const QLatin1String endElement("/>");
+ static const QChar tab = u'\t';
+ static const QChar space = u' ';
int state = previousBlockState();
- int len = text.length();
- int start = 0;
- int pos = 0;
+ qsizetype len = text.size();
+ qsizetype start = 0;
+ qsizetype pos = 0;
while (pos < len) {
switch (state) {
@@ -95,18 +62,19 @@ void HtmlHighlighter::highlightBlock(const QString &text)
default:
while (pos < len) {
QChar ch = text.at(pos);
- if (ch == startTag) {
- if (text.mid(pos, 4) == startComment) {
+ if (ch == u'<') {
+ if (QStringView{text}.sliced(pos).startsWith("<!--"_L1)) {
state = InComment;
} else {
state = InTag;
start = pos;
while (pos < len && text.at(pos) != space
- && text.at(pos) != endTag
+ && text.at(pos) != u'>'
&& text.at(pos) != tab
- && text.mid(pos, 2) != endElement)
+ && !QStringView{text}.sliced(pos).startsWith("/>"_L1)) {
++pos;
- if (text.mid(pos, 2) == endElement)
+ }
+ if (QStringView{text}.sliced(pos).startsWith("/>"_L1))
++pos;
setFormat(start, pos - start,
m_formats[Tag]);
@@ -114,9 +82,9 @@ void HtmlHighlighter::highlightBlock(const QString &text)
}
break;
}
- if (ch == amp) {
+ if (ch == u'&') {
start = pos;
- while (pos < len && text.at(pos++) != semicolon)
+ while (pos < len && text.at(pos++) != u';')
;
setFormat(start, pos - start,
m_formats[Entity]);
@@ -129,7 +97,7 @@ void HtmlHighlighter::highlightBlock(const QString &text)
case InComment:
start = pos;
for ( ; pos < len; ++pos) {
- if (text.mid(pos, 3) == endComment) {
+ if (QStringView{text}.sliced(pos).startsWith("-->"_L1)) {
pos += 3;
state = NormalState;
break;
@@ -143,14 +111,14 @@ void HtmlHighlighter::highlightBlock(const QString &text)
QChar ch = text.at(pos);
if (quote.isNull()) {
start = pos;
- if (ch == apos || ch == quot) {
+ if (ch == '\''_L1 || ch == u'"') {
quote = ch;
- } else if (ch == endTag) {
+ } else if (ch == u'>') {
++pos;
setFormat(start, pos - start, m_formats[Tag]);
state = NormalState;
break;
- } else if (text.mid(pos, 2) == endElement) {
+ } else if (QStringView{text}.sliced(pos).startsWith("/>"_L1)) {
pos += 2;
setFormat(start, pos - start, m_formats[Tag]);
state = NormalState;
@@ -161,7 +129,7 @@ void HtmlHighlighter::highlightBlock(const QString &text)
++pos;
while (pos < len && text.at(pos) != space
&& text.at(pos) != tab
- && text.at(pos) != equals)
+ && text.at(pos) != u'=')
++pos;
setFormat(start, pos - start, m_formats[Attribute]);
start = pos;
diff --git a/src/designer/src/lib/shared/htmlhighlighter_p.h b/src/designer/src/lib/shared/htmlhighlighter_p.h
index e63186166..e86bfce97 100644
--- a/src/designer/src/lib/shared/htmlhighlighter_p.h
+++ b/src/designer/src/lib/shared/htmlhighlighter_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/icon-naming-spec.txt b/src/designer/src/lib/shared/icon-naming-spec.txt
new file mode 100644
index 000000000..e9b854769
--- /dev/null
+++ b/src/designer/src/lib/shared/icon-naming-spec.txt
@@ -0,0 +1,309 @@
+# https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
+
+# Table 2. Standard Action Icons
+address-book-new
+application-exit
+appointment-new
+call-start
+call-stop
+contact-new
+document-new
+document-open
+document-open-recent
+document-page-setup
+document-print
+document-print-preview
+document-properties
+document-revert
+document-save
+document-save-as
+document-send
+edit-clear
+edit-copy
+edit-cut
+edit-delete
+edit-find
+edit-find-replace
+edit-paste
+edit-redo
+edit-select-all
+edit-undo
+folder-new
+format-indent-less
+format-indent-more
+format-justify-center
+format-justify-fill
+format-justify-left
+format-justify-right
+format-text-direction-ltr
+format-text-direction-rtl
+format-text-bold
+format-text-italic
+format-text-underline
+format-text-strikethrough
+go-bottom
+go-down
+go-first
+go-home
+go-jump
+go-last
+go-next
+go-previous
+go-top
+go-up
+help-about
+help-contents
+help-faq
+insert-image
+insert-link
+insert-object
+insert-text
+list-add
+list-remove
+mail-forward
+mail-mark-important
+mail-mark-junk
+mail-mark-notjunk
+mail-mark-read
+mail-mark-unread
+mail-message-new
+mail-reply-all
+mail-reply-sender
+mail-send
+mail-send-receive
+media-eject
+media-playback-pause
+media-playback-start
+media-playback-stop
+media-record
+media-seek-backward
+media-seek-forward
+media-skip-backward
+media-skip-forward
+object-flip-horizontal
+object-flip-vertical
+object-rotate-left
+object-rotate-right
+process-stop
+system-lock-screen
+system-log-out
+system-run
+system-search
+system-reboot
+system-shutdown
+tools-check-spelling
+view-fullscreen
+view-refresh
+view-restore
+view-sort-ascending
+view-sort-descending
+window-close
+window-new
+zoom-fit-best
+zoom-in
+zoom-original
+zoom-out
+
+# Table 3. Standard Animation Icons
+process-working
+
+# Table 4. Standard Application Icons
+accessories-calculator
+accessories-character-map
+accessories-dictionary
+accessories-text-editor
+help-browser
+multimedia-volume-control
+preferences-desktop-accessibility
+preferences-desktop-font
+preferences-desktop-keyboard
+preferences-desktop-locale
+preferences-desktop-multimedia
+preferences-desktop-screensaver
+preferences-desktop-theme
+preferences-desktop-wallpaper
+system-file-manager
+system-software-install
+system-software-update
+utilities-system-monitor
+utilities-terminal
+
+# Table 5. Standard Category Icons
+applications-accessories
+applications-development
+applications-engineering
+applications-games
+applications-graphics
+applications-internet
+applications-multimedia
+applications-office
+applications-other
+applications-science
+applications-system
+applications-utilities
+preferences-desktop
+preferences-desktop-peripherals
+preferences-desktop-personal
+preferences-other
+preferences-system
+preferences-system-network
+system-help
+
+# Table 6. Standard Device Icons
+audio-card
+audio-input-microphone
+battery
+camera-photo
+camera-video
+camera-web
+computer
+drive-harddisk
+drive-optical
+drive-removable-media
+input-gaming
+input-keyboard
+input-mouse
+input-tablet
+media-flash
+media-floppy
+media-optical
+media-tape
+modem
+multimedia-player
+network-wired
+network-wireless
+pda
+phone
+printer
+scanner
+video-display
+
+# Table 7. Standard Emblem Icons
+emblem-default
+emblem-documents
+emblem-downloads
+emblem-favorite
+emblem-important
+emblem-mail
+emblem-photos
+emblem-readonly
+emblem-shared
+emblem-symbolic-link
+emblem-synchronized
+emblem-system
+emblem-unreadable
+
+# Table 8. Standard Emotion Icons
+face-angel
+face-angry
+face-cool
+face-crying
+face-devilish
+face-embarrassed
+face-kiss
+face-laugh
+face-monkey
+face-plain
+face-raspberry
+face-sad
+face-sick
+face-smile
+face-smile-big
+face-smirk
+face-surprise
+face-tired
+face-uncertain
+face-wink
+face-worried
+
+# Table 9. Standard International Icons
+flag-aa
+
+# Table 10. Standard MIME Type Icons
+application-x-executable
+audio-x-generic
+font-x-generic
+image-x-generic
+package-x-generic
+text-html
+text-x-generic
+text-x-generic-template
+text-x-script
+video-x-generic
+x-office-address-book
+x-office-calendar
+x-office-document
+x-office-presentation
+x-office-spreadsheet
+
+# Table 11. Standard Place Icons
+folder
+folder-remote
+network-server
+network-workgroup
+start-here
+user-bookmarks
+user-desktop
+user-home
+user-trash
+
+# Table 12. Standard Status Icons
+appointment-missed
+appointment-soon
+audio-volume-high
+audio-volume-low
+audio-volume-medium
+audio-volume-muted
+battery-caution
+battery-low
+dialog-error
+dialog-information
+dialog-password
+dialog-question
+dialog-warning
+folder-drag-accept
+folder-open
+folder-visiting
+image-loading
+image-missing
+mail-attachment
+mail-unread
+mail-read
+mail-replied
+mail-signed
+mail-signed-verified
+media-playlist-repeat
+media-playlist-shuffle
+network-error
+network-idle
+network-offline
+network-receive
+network-transmit
+network-transmit-receive
+printer-error
+printer-printing
+security-high
+security-medium
+security-low
+software-update-available
+software-update-urgent
+sync-error
+sync-synchronizing
+task-due
+task-past-due
+user-available
+user-away
+user-idle
+user-offline
+user-trash-full
+weather-clear
+weather-clear-night
+weather-few-clouds
+weather-few-clouds-night
+weather-fog
+weather-overcast
+weather-severe-alert
+weather-showers
+weather-showers-scattered
+weather-snow
+weather-storm
diff --git a/src/designer/src/lib/shared/iconloader.cpp b/src/designer/src/lib/shared/iconloader.cpp
index 13c9ad4f7..ecb97ba2b 100644
--- a/src/designer/src/lib/shared/iconloader.cpp
+++ b/src/designer/src/lib/shared/iconloader.cpp
@@ -1,63 +1,62 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "iconloader_p.h"
#include <QtCore/qfile.h>
+#include <QtCore/qoperatingsystemversion.h>
#include <QtGui/qicon.h>
#include <QtGui/qpixmap.h>
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
-QDESIGNER_SHARED_EXPORT QIcon createIconSet(const QString &name)
+QDESIGNER_SHARED_EXPORT QIcon createIconSet(QIcon::ThemeIcon themeIcon,
+ QLatin1StringView name)
{
- const QStringList candidates = QStringList()
- << (QString::fromUtf8(":/qt-project.org/formeditor/images/") + name)
+ return QOperatingSystemVersion::currentType() != QOperatingSystemVersion::MacOS
+ && QIcon::hasThemeIcon(themeIcon)
+ ? QIcon::fromTheme(themeIcon) : createIconSet(name);
+}
+
+template <class StringView>
+static inline QIcon createIconSetHelper(StringView name)
+{
+ constexpr QLatin1StringView prefixes[] = {
+ ":/qt-project.org/formeditor/images/"_L1,
#ifdef Q_OS_MACOS
- << (QString::fromUtf8(":/qt-project.org/formeditor/images/mac/") + name)
+ ":/qt-project.org/formeditor/images/mac/"_L1,
#else
- << (QString::fromUtf8(":/qt-project.org/formeditor/images/win/") + name)
+ ":/qt-project.org/formeditor/images/win/"_L1,
#endif
- << (QString::fromUtf8(":/qt-project.org/formeditor/images/designer_") + name);
+ ":/qt-project.org/formeditor/images/designer_"_L1
+ };
- for (const QString &f : candidates) {
+ for (QLatin1StringView prefix : prefixes) {
+ const QString f = prefix + name;
if (QFile::exists(f))
return QIcon(f);
}
- return QIcon();
+ return {};
+}
+
+QDESIGNER_SHARED_EXPORT QIcon createIconSet(QStringView name)
+{
+ return createIconSetHelper(name);
+}
+
+QDESIGNER_SHARED_EXPORT QIcon createIconSet(QLatin1StringView name)
+{
+ return createIconSetHelper(name);
}
QDESIGNER_SHARED_EXPORT QIcon emptyIcon()
{
- return QIcon(QStringLiteral(":/qt-project.org/formeditor/images/emptyicon.png"));
+ return QIcon(u":/qt-project.org/formeditor/images/emptyicon.png"_s);
}
static QIcon buildIcon(const QString &prefix, const int *sizes, size_t sizeCount)
@@ -65,7 +64,7 @@ static QIcon buildIcon(const QString &prefix, const int *sizes, size_t sizeCount
QIcon result;
for (size_t i = 0; i < sizeCount; ++i) {
const QString size = QString::number(sizes[i]);
- const QPixmap pixmap(prefix + size + QLatin1Char('x') + size + QStringLiteral(".png"));
+ const QPixmap pixmap(prefix + size + 'x'_L1 + size + ".png"_L1);
Q_ASSERT(!pixmap.size().isEmpty());
result.addPixmap(pixmap);
}
@@ -74,9 +73,9 @@ static QIcon buildIcon(const QString &prefix, const int *sizes, size_t sizeCount
QDESIGNER_SHARED_EXPORT QIcon qtLogoIcon()
{
- static const int sizes[] = {16, 24, 32, 64};
+ static const int sizes[] = {16, 24, 32, 64, 128};
static const QIcon result =
- buildIcon(QStringLiteral(":/qt-project.org/formeditor/images/qtlogo"),
+ buildIcon(u":/qt-project.org/formeditor/images/qtlogo"_s,
sizes, sizeof(sizes) / sizeof(sizes[0]));
return result;
}
diff --git a/src/designer/src/lib/shared/iconloader_p.h b/src/designer/src/lib/shared/iconloader_p.h
index 5932a18c1..c054d677c 100644
--- a/src/designer/src/lib/shared/iconloader_p.h
+++ b/src/designer/src/lib/shared/iconloader_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -42,6 +17,8 @@
#include "shared_global_p.h"
+#include <QtGui/qicon.h>
+
QT_BEGIN_NAMESPACE
class QString;
@@ -49,7 +26,10 @@ class QIcon;
namespace qdesigner_internal {
-QDESIGNER_SHARED_EXPORT QIcon createIconSet(const QString &name);
+QDESIGNER_SHARED_EXPORT QIcon createIconSet(QStringView name);
+QDESIGNER_SHARED_EXPORT QIcon createIconSet(QLatin1StringView name);
+QDESIGNER_SHARED_EXPORT QIcon createIconSet(QIcon::ThemeIcon themeIcon,
+ QLatin1StringView name);
QDESIGNER_SHARED_EXPORT QIcon emptyIcon();
QDESIGNER_SHARED_EXPORT QIcon qtLogoIcon();
diff --git a/src/designer/src/lib/shared/iconselector.cpp b/src/designer/src/lib/shared/iconselector.cpp
index 7b3c7a6b0..60c404423 100644
--- a/src/designer/src/lib/shared/iconselector.cpp
+++ b/src/designer/src/lib/shared/iconselector.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "iconselector_p.h"
#include "qdesigner_utils_p.h"
@@ -39,7 +14,9 @@
#include <QtDesigner/abstractlanguage.h>
#include <QtDesigner/abstractintegration.h>
#include <QtDesigner/qextensionmanager.h>
+#include <QtDesigner/private/resourcebuilder_p.h>
+#include <QtWidgets/qabstractitemview.h>
#include <QtWidgets/qtoolbutton.h>
#include <QtWidgets/qcombobox.h>
#include <QtWidgets/qdialogbuttonbox.h>
@@ -59,10 +36,53 @@
#include <QtCore/qdebug.h>
#include <QtCore/qlist.h>
+#include <utility>
+
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
+using ThemeIconEnumEntry = std::pair<QString, QIcon>;
+
+static const QList<ThemeIconEnumEntry> &themeEnumIcons()
+{
+ static QList<ThemeIconEnumEntry> result;
+ if (result.isEmpty()) {
+ const QStringList &names = QResourceBuilder::themeIconNames();
+ result.reserve(names.size());
+ for (qsizetype i = 0, size = names.size(); i < size; ++i)
+ result.append({names.at(i), QIcon::fromTheme(QIcon::ThemeIcon(i))});
+ }
+ return result;
+}
+
+static void initThemeCombo(QComboBox *cb)
+{
+ cb->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+
+ for (const auto &te : themeEnumIcons())
+ cb->addItem(te.second, te.first);
+
+ cb->setCurrentIndex(-1);
+}
+
+// Validator for theme line edit, accepts empty or non-blank strings.
+class BlankSuppressingValidator : public QValidator {
+public:
+ explicit BlankSuppressingValidator(QObject * parent = nullptr) : QValidator(parent) {}
+ State validate(QString &input, int &pos) const override
+ {
+ const auto blankPos = input.indexOf(u' ');
+ if (blankPos != -1) {
+ pos = blankPos;
+ return Invalid;
+ }
+ return Acceptable;
+ }
+};
+
// -------------------- LanguageResourceDialogPrivate
class LanguageResourceDialogPrivate {
LanguageResourceDialog *q_ptr;
@@ -100,13 +120,14 @@ void LanguageResourceDialogPrivate::init(LanguageResourceDialog *p)
QLayout *layout = new QVBoxLayout(p);
layout->addWidget(m_browser);
layout->addWidget(m_dialogButtonBox);
- QObject::connect(m_dialogButtonBox, SIGNAL(accepted()), p, SLOT(slotAccepted()));
+ QObject::connect(m_dialogButtonBox, &QDialogButtonBox::accepted, p, [this] { slotAccepted(); });
QObject::connect(m_dialogButtonBox, &QDialogButtonBox::rejected, p, &QDialog::reject);
- QObject::connect(m_browser, SIGNAL(currentPathChanged(QString)), p, SLOT(slotPathChanged(QString)));
- QObject::connect(m_browser, SIGNAL(pathActivated(QString)), p, SLOT(slotAccepted()));
+ QObject::connect(m_browser, &QDesignerResourceBrowserInterface::currentPathChanged,
+ p, [this](const QString &fileName) { slotPathChanged(fileName); });
+ QObject::connect(m_browser, &QDesignerResourceBrowserInterface::pathActivated,
+ p, [this] { slotAccepted(); });
p->setModal(true);
p->setWindowTitle(LanguageResourceDialog::tr("Choose Resource"));
- p->setWindowFlags(p->windowFlags() & ~Qt::WindowContextHelpButtonHint);
setOkButtonEnabled(false);
}
@@ -169,12 +190,24 @@ LanguageResourceDialog* LanguageResourceDialog::create(QDesignerFormEditorInterf
// ------------ IconSelectorPrivate
-static inline QPixmap emptyPixmap()
+struct QIconStateName
{
- QImage img(16, 16, QImage::Format_ARGB32_Premultiplied);
- img.fill(0);
- return QPixmap::fromImage(img);
-}
+ std::pair<QIcon::Mode, QIcon::State> state;
+ const char *name;
+};
+
+constexpr QIconStateName stateToName[] = {
+ {{QIcon::Normal, QIcon::Off}, QT_TRANSLATE_NOOP("IconSelector", "Normal Off")},
+ {{QIcon::Normal, QIcon::On}, QT_TRANSLATE_NOOP("IconSelector", "Normal On")},
+ {{QIcon::Disabled, QIcon::Off}, QT_TRANSLATE_NOOP("IconSelector", "Disabled Off")},
+ {{QIcon::Disabled, QIcon::On}, QT_TRANSLATE_NOOP("IconSelector", "Disabled On")},
+ {{QIcon::Active, QIcon::Off}, QT_TRANSLATE_NOOP("IconSelector", "Active Off")},
+ {{QIcon::Active, QIcon::On}, QT_TRANSLATE_NOOP("IconSelector", "Active On")},
+ {{QIcon::Selected, QIcon::Off}, QT_TRANSLATE_NOOP("IconSelector", "Selected Off")},
+ {{QIcon::Selected, QIcon::On}, QT_TRANSLATE_NOOP("IconSelector", "Selected On")}
+};
+
+constexpr int stateToNameSize = int(sizeof(stateToName) / sizeof(stateToName[0]));
class IconSelectorPrivate
{
@@ -191,10 +224,12 @@ public:
void slotResetAllActivated();
void slotUpdate();
- QList<QPair<QPair<QIcon::Mode, QIcon::State>, QString> > m_stateToName; // could be static map
-
- QMap<QPair<QIcon::Mode, QIcon::State>, int> m_stateToIndex;
- QMap<int, QPair<QIcon::Mode, QIcon::State> > m_indexToState;
+ std::pair<QIcon::Mode, QIcon::State> currentState() const
+ {
+ const int i = m_stateComboBox->currentIndex();
+ return i >= 0 && i < stateToNameSize
+ ? stateToName[i].state : std::pair<QIcon::Mode, QIcon::State>{};
+ }
const QIcon m_emptyIcon;
QComboBox *m_stateComboBox = nullptr;
@@ -214,12 +249,10 @@ void IconSelectorPrivate::slotUpdate()
if (m_iconCache)
icon = m_iconCache->icon(m_icon);
- QMap<QPair<QIcon::Mode, QIcon::State>, PropertySheetPixmapValue> paths = m_icon.paths();
- for (auto itIndex = m_stateToIndex.cbegin(), end = m_stateToIndex.cend(); itIndex != end; ++itIndex) {
- const QPair<QIcon::Mode, QIcon::State> state = itIndex.key();
+ const auto &paths = m_icon.paths();
+ for (int index = 0; index < stateToNameSize; ++index) {
+ const auto &state = stateToName[index].state;
const PropertySheetPixmapValue pixmap = paths.value(state);
- const int index = itIndex.value();
-
QIcon pixmapIcon = QIcon(icon.pixmap(16, 16, state.first, state.second));
if (pixmapIcon.isNull())
pixmapIcon = m_emptyIcon;
@@ -230,8 +263,7 @@ void IconSelectorPrivate::slotUpdate()
m_stateComboBox->setItemData(index, font, Qt::FontRole);
}
- QPair<QIcon::Mode, QIcon::State> state = m_indexToState.value(m_stateComboBox->currentIndex());
- PropertySheetPixmapValue currentPixmap = paths.value(state);
+ PropertySheetPixmapValue currentPixmap = paths.value(currentState());
m_resetAction->setEnabled(!currentPixmap.path().isEmpty());
m_resetAllAction->setEnabled(!paths.isEmpty());
m_stateComboBox->update();
@@ -244,7 +276,7 @@ void IconSelectorPrivate::slotStateActivated()
void IconSelectorPrivate::slotSetActivated()
{
- QPair<QIcon::Mode, QIcon::State> state = m_indexToState.value(m_stateComboBox->currentIndex());
+ const auto state = currentState();
const PropertySheetPixmapValue pixmap = m_icon.pixmap(state.first, state.second);
// Default to resource
const PropertySheetPixmapValue::PixmapSource ps = pixmap.path().isEmpty() ? PropertySheetPixmapValue::ResourcePixmap : pixmap.pixmapSource(m_core);
@@ -283,7 +315,7 @@ QString IconSelector::choosePixmapResource(QDesignerFormEditorInterface *core, Q
void IconSelectorPrivate::slotSetResourceActivated()
{
- const QPair<QIcon::Mode, QIcon::State> state = m_indexToState.value(m_stateComboBox->currentIndex());
+ const auto state = currentState();
PropertySheetPixmapValue pixmap = m_icon.pixmap(state.first, state.second);
const QString oldPath = pixmap.path();
@@ -332,19 +364,18 @@ static QString imageFilter()
{
QString filter = QApplication::translate("IconSelector", "All Pixmaps (");
const auto supportedImageFormats = QImageReader::supportedImageFormats();
- const QString jpeg = QStringLiteral("JPEG");
- const int count = supportedImageFormats.count();
- for (int i = 0; i< count; ++i) {
+ const qsizetype count = supportedImageFormats.size();
+ for (qsizetype i = 0; i < count; ++i) {
if (i)
- filter += QLatin1Char(' ');
- filter += QStringLiteral("*.");
+ filter += u' ';
+ filter += "*."_L1;
const QString outputFormat = QString::fromUtf8(supportedImageFormats.at(i));
- if (outputFormat != jpeg)
+ if (outputFormat != "JPEG"_L1)
filter += outputFormat.toLower();
else
- filter += QStringLiteral("jpg *.jpeg");
+ filter += "jpg *.jpeg"_L1;
}
- filter += QLatin1Char(')');
+ filter += u')';
return filter;
}
@@ -368,7 +399,7 @@ QString IconSelector::choosePixmapFile(const QString &directory, QDesignerDialog
void IconSelectorPrivate::slotSetFileActivated()
{
- QPair<QIcon::Mode, QIcon::State> state = m_indexToState.value(m_stateComboBox->currentIndex());
+ const auto state = currentState();
PropertySheetPixmapValue pixmap = m_icon.pixmap(state.first, state.second);
const QString newPath = IconSelector::choosePixmapFile(pixmap.path(), m_core->dialogGui(), q_ptr);
@@ -384,7 +415,7 @@ void IconSelectorPrivate::slotSetFileActivated()
void IconSelectorPrivate::slotResetActivated()
{
- QPair<QIcon::Mode, QIcon::State> state = m_indexToState.value(m_stateComboBox->currentIndex());
+ const auto state = currentState();
PropertySheetPixmapValue pixmap = m_icon.pixmap(state.first, state.second);
const PropertySheetPixmapValue newPixmap;
@@ -421,15 +452,6 @@ IconSelector::IconSelector(QWidget *parent) :
l->addWidget(d_ptr->m_iconButton);
l->setContentsMargins(QMargins());
- d_ptr->m_stateToName << qMakePair(qMakePair(QIcon::Normal, QIcon::Off), tr("Normal Off") );
- d_ptr->m_stateToName << qMakePair(qMakePair(QIcon::Normal, QIcon::On), tr("Normal On") );
- d_ptr->m_stateToName << qMakePair(qMakePair(QIcon::Disabled, QIcon::Off), tr("Disabled Off") );
- d_ptr->m_stateToName << qMakePair(qMakePair(QIcon::Disabled, QIcon::On), tr("Disabled On") );
- d_ptr->m_stateToName << qMakePair(qMakePair(QIcon::Active, QIcon::Off), tr("Active Off") );
- d_ptr->m_stateToName << qMakePair(qMakePair(QIcon::Active, QIcon::On), tr("Active On") );
- d_ptr->m_stateToName << qMakePair(qMakePair(QIcon::Selected, QIcon::Off), tr("Selected Off") );
- d_ptr->m_stateToName << qMakePair(qMakePair(QIcon::Selected, QIcon::On), tr("Selected On") );
-
QMenu *setMenu = new QMenu(this);
QAction *setResourceAction = new QAction(tr("Choose Resource..."), this);
@@ -438,7 +460,7 @@ IconSelector::IconSelector(QWidget *parent) :
d_ptr->m_resetAllAction = new QAction(tr("Reset All"), this);
d_ptr->m_resetAction->setEnabled(false);
d_ptr->m_resetAllAction->setEnabled(false);
- //d_ptr->m_resetAction->setIcon(createIconSet(QString::fromUtf8("resetproperty.png")));
+ //d_ptr->m_resetAction->setIcon(createIconSet("resetproperty.png"_L1));
setMenu->addAction(setResourceAction);
setMenu->addAction(setFileAction);
@@ -446,28 +468,23 @@ IconSelector::IconSelector(QWidget *parent) :
setMenu->addAction(d_ptr->m_resetAction);
setMenu->addAction(d_ptr->m_resetAllAction);
- int index = 0;
- QStringList items;
- for (const auto &item : qAsConst(d_ptr->m_stateToName)) {
- const QPair<QIcon::Mode, QIcon::State> state = item.first;
- const QString name = item.second;
-
- items.append(name);
- d_ptr->m_stateToIndex[state] = index;
- d_ptr->m_indexToState[index] = state;
- index++;
- }
- d_ptr->m_stateComboBox->addItems(items);
+ for (const auto &item : stateToName)
+ d_ptr->m_stateComboBox->addItem(tr(item.name));
d_ptr->m_iconButton->setMenu(setMenu);
- connect(d_ptr->m_stateComboBox, SIGNAL(activated(int)), this, SLOT(slotStateActivated()));
- connect(d_ptr->m_iconButton, SIGNAL(clicked()), this, SLOT(slotSetActivated()));
- connect(setResourceAction, SIGNAL(triggered()), this, SLOT(slotSetResourceActivated()));
- connect(setFileAction, SIGNAL(triggered()), this, SLOT(slotSetFileActivated()));
- connect(d_ptr->m_resetAction, SIGNAL(triggered()), this, SLOT(slotResetActivated()));
- connect(d_ptr->m_resetAllAction, SIGNAL(triggered()), this, SLOT(slotResetAllActivated()));
-
+ connect(d_ptr->m_stateComboBox, &QComboBox::activated,
+ this, [this] { d_ptr->slotStateActivated(); });
+ connect(d_ptr->m_iconButton, &QAbstractButton::clicked,
+ this, [this] { d_ptr->slotSetActivated(); });
+ connect(setResourceAction, &QAction::triggered,
+ this, [this] { d_ptr->slotSetResourceActivated(); });
+ connect(setFileAction, &QAction::triggered,
+ this, [this] { d_ptr->slotSetFileActivated(); });
+ connect(d_ptr->m_resetAction, &QAction::triggered,
+ this, [this] { d_ptr->slotResetActivated(); });
+ connect(d_ptr->m_resetAllAction, &QAction::triggered,
+ this, [this] { d_ptr->slotResetAllActivated(); });
d_ptr->slotUpdate();
}
@@ -497,117 +514,134 @@ void IconSelector::setFormEditor(QDesignerFormEditorInterface *core)
void IconSelector::setIconCache(DesignerIconCache *iconCache)
{
d_ptr->m_iconCache = iconCache;
- connect(iconCache, SIGNAL(reloaded()), this, SLOT(slotUpdate()));
+ connect(iconCache, &DesignerIconCache::reloaded, this, [this] { d_ptr->slotUpdate(); });
d_ptr->slotUpdate();
}
void IconSelector::setPixmapCache(DesignerPixmapCache *pixmapCache)
{
d_ptr->m_pixmapCache = pixmapCache;
- connect(pixmapCache, SIGNAL(reloaded()), this, SLOT(slotUpdate()));
+ connect(pixmapCache, &DesignerPixmapCache::reloaded, this, [this] { d_ptr->slotUpdate(); });
d_ptr->slotUpdate();
}
// --- IconThemeEditor
-// Validator for theme line edit, accepts empty or non-blank strings.
-class BlankSuppressingValidator : public QValidator {
-public:
- explicit BlankSuppressingValidator(QObject * parent = nullptr) : QValidator(parent) {}
-
- State validate(QString &input, int &pos) const override
- {
- const int blankPos = input.indexOf(QLatin1Char(' '));
- if (blankPos != -1) {
- pos = blankPos;
- return Invalid;
- }
- return Acceptable;
- }
-};
+static const QMap<QString, QIcon> &themeIcons()
+{
+ static QMap<QString, QIcon> result;
+ if (result.isEmpty()) {
+ QFile file(u":/qt-project.org/designer/icon-naming-spec.txt"_s);
+ if (file.open(QIODevice::ReadOnly)) {
+ while (!file.atEnd()) {
+ const auto line = file.readLine().trimmed();
+ if (line.isEmpty() || line.startsWith('#'))
+ continue;
+ const auto iconName = QString::fromUtf8(line);
+ result.insert(iconName, QIcon::fromTheme(iconName));
+ }
+ file.close();
+ }
+ }
+ return result;
+}
struct IconThemeEditorPrivate {
- IconThemeEditorPrivate();
+ void create(QWidget *topLevel, bool wantResetButton);
- const QPixmap m_emptyPixmap;
- QLineEdit *m_themeLineEdit;
- QLabel *m_themeLabel;
+ QComboBox *m_themeComboBox{};
+ QToolButton *m_themeResetButton{};
};
-IconThemeEditorPrivate::IconThemeEditorPrivate() :
- m_emptyPixmap(emptyPixmap()),
- m_themeLineEdit(new QLineEdit),
- m_themeLabel(new QLabel)
+void IconThemeEditorPrivate::create(QWidget *topLevel, bool wantResetButton)
{
+ m_themeComboBox = new QComboBox();
+ QHBoxLayout *mainHLayout = new QHBoxLayout(topLevel);
+ mainHLayout->setContentsMargins({});
+ mainHLayout->addWidget(m_themeComboBox);
+ if (wantResetButton) {
+ m_themeResetButton = new QToolButton;
+ m_themeResetButton->setIcon(createIconSet("resetproperty.png"_L1));
+ mainHLayout->addWidget(m_themeResetButton);
+ }
+ topLevel->setFocusProxy(m_themeComboBox);
}
IconThemeEditor::IconThemeEditor(QWidget *parent, bool wantResetButton) :
QWidget (parent), d(new IconThemeEditorPrivate)
{
- QHBoxLayout *mainHLayout = new QHBoxLayout;
- mainHLayout->setContentsMargins(QMargins());
+ d->create(this, wantResetButton);
+ d->m_themeComboBox->setEditable(true);
+
+ const auto icons = themeIcons();
+ for (auto i = icons.constBegin(); i != icons.constEnd(); ++i)
+ d->m_themeComboBox->addItem(i.value(), i.key());
+ d->m_themeComboBox->setCurrentIndex(-1);
+ d->m_themeComboBox->lineEdit()->setValidator(new BlankSuppressingValidator(this));
+ connect(d->m_themeComboBox, &QComboBox::currentTextChanged, this, &IconThemeEditor::edited);
+ if (wantResetButton)
+ connect(d->m_themeResetButton, &QAbstractButton::clicked, this, &IconThemeEditor::reset);
+}
+
+IconThemeEditor::~IconThemeEditor() = default;
- // Vertically center theme preview label
- d->m_themeLabel->setPixmap(d->m_emptyPixmap);
+void IconThemeEditor::reset()
+{
+ d->m_themeComboBox->setCurrentIndex(-1);
+ emit edited(QString());
+}
- QVBoxLayout *themeLabelVLayout = new QVBoxLayout;
- d->m_themeLabel->setMargin(1);
- themeLabelVLayout->setContentsMargins(QMargins());
- themeLabelVLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding));
- themeLabelVLayout->addWidget(d->m_themeLabel);
- themeLabelVLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding));
- mainHLayout->addLayout(themeLabelVLayout);
+QString IconThemeEditor::theme() const
+{
+ return d->m_themeComboBox->currentText();
+}
- d->m_themeLineEdit = new QLineEdit;
- d->m_themeLineEdit->setValidator(new BlankSuppressingValidator(d->m_themeLineEdit));
- connect(d->m_themeLineEdit, &QLineEdit::textChanged, this, &IconThemeEditor::slotChanged);
- connect(d->m_themeLineEdit, &QLineEdit::textEdited, this, &IconThemeEditor::edited);
- mainHLayout->addWidget(d->m_themeLineEdit);
+void IconThemeEditor::setTheme(const QString &t)
+{
+ d->m_themeComboBox->setCurrentText(t);
+}
- if (wantResetButton) {
- QToolButton *themeResetButton = new QToolButton;
- themeResetButton->setIcon(createIconSet(QStringLiteral("resetproperty.png")));
- connect(themeResetButton, &QAbstractButton::clicked, this, &IconThemeEditor::reset);
- mainHLayout->addWidget(themeResetButton);
- }
+IconThemeEnumEditor::IconThemeEnumEditor(QWidget *parent, bool wantResetButton) :
+ QWidget (parent), d(new IconThemeEditorPrivate)
+{
+ d->create(this, wantResetButton);
+ initThemeCombo(d->m_themeComboBox);
- setLayout(mainHLayout);
- setFocusProxy(d->m_themeLineEdit);
+ connect(d->m_themeComboBox, &QComboBox::currentIndexChanged,
+ this, &IconThemeEnumEditor::edited);
+ if (wantResetButton)
+ connect(d->m_themeResetButton, &QAbstractButton::clicked, this, &IconThemeEnumEditor::reset);
}
-IconThemeEditor::~IconThemeEditor() = default;
+IconThemeEnumEditor::~IconThemeEnumEditor() = default;
-void IconThemeEditor::reset()
+void IconThemeEnumEditor::reset()
{
- d->m_themeLineEdit->clear();
- emit edited(QString());
+ d->m_themeComboBox->setCurrentIndex(-1);
+ emit edited(-1);
}
-void IconThemeEditor::slotChanged(const QString &theme)
+int IconThemeEnumEditor::themeEnum() const
{
- updatePreview(theme);
+ return d->m_themeComboBox->currentIndex();
}
-void IconThemeEditor::updatePreview(const QString &t)
+void IconThemeEnumEditor::setThemeEnum(int t)
{
- // Update preview label with icon.
- if (t.isEmpty() || !QIcon::hasThemeIcon(t)) { // Empty
- if (d->m_themeLabel->pixmap(Qt::ReturnByValue).cacheKey() != d->m_emptyPixmap.cacheKey())
- d->m_themeLabel->setPixmap(d->m_emptyPixmap);
- } else {
- const QIcon icon = QIcon::fromTheme(t);
- d->m_themeLabel->setPixmap(icon.pixmap(d->m_emptyPixmap.size()));
- }
+ Q_ASSERT(t >= -1 && t < int(QIcon::ThemeIcon::NThemeIcons));
+ d->m_themeComboBox->setCurrentIndex(t);
}
-QString IconThemeEditor::theme() const
+QString IconThemeEnumEditor::iconName(int e)
{
- return d->m_themeLineEdit->text();
+ return QResourceBuilder::themeIconNames().value(e);
}
-void IconThemeEditor::setTheme(const QString &t)
+QComboBox *IconThemeEnumEditor::createComboBox(QWidget *parent)
{
- d->m_themeLineEdit->setText(t);
+ auto *result = new QComboBox(parent);
+ initThemeCombo(result);
+ return result;
}
} // qdesigner_internal
diff --git a/src/designer/src/lib/shared/iconselector_p.h b/src/designer/src/lib/shared/iconselector_p.h
index 40e38acdd..4a4238e66 100644
--- a/src/designer/src/lib/shared/iconselector_p.h
+++ b/src/designer/src/lib/shared/iconselector_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -50,6 +25,8 @@
QT_BEGIN_NAMESPACE
+class QComboBox;
+
class QtResourceModel;
class QDesignerFormEditorInterface;
class QDesignerDialogGuiInterface;
@@ -81,8 +58,6 @@ private:
QScopedPointer<class LanguageResourceDialogPrivate> d_ptr;
Q_DECLARE_PRIVATE(LanguageResourceDialog)
Q_DISABLE_COPY_MOVE(LanguageResourceDialog)
- Q_PRIVATE_SLOT(d_func(), void slotAccepted())
- Q_PRIVATE_SLOT(d_func(), void slotPathChanged(QString))
};
@@ -114,14 +89,6 @@ private:
QScopedPointer<class IconSelectorPrivate> d_ptr;
Q_DECLARE_PRIVATE(IconSelector)
Q_DISABLE_COPY_MOVE(IconSelector)
-
- Q_PRIVATE_SLOT(d_func(), void slotStateActivated())
- Q_PRIVATE_SLOT(d_func(), void slotSetActivated())
- Q_PRIVATE_SLOT(d_func(), void slotSetResourceActivated())
- Q_PRIVATE_SLOT(d_func(), void slotSetFileActivated())
- Q_PRIVATE_SLOT(d_func(), void slotResetActivated())
- Q_PRIVATE_SLOT(d_func(), void slotResetAllActivated())
- Q_PRIVATE_SLOT(d_func(), void slotUpdate())
};
// IconThemeEditor: Let's the user input theme icon names and shows a preview label.
@@ -142,12 +109,32 @@ signals:
public slots:
void reset();
-private slots:
- void slotChanged(const QString &);
-
private:
- void updatePreview(const QString &);
+ QScopedPointer<IconThemeEditorPrivate> d;
+};
+
+// IconThemeEnumEditor: Let's the user input theme icon enum values
+// (QIcon::ThemeIcon) and shows a preview label. -1 means nothing selected.
+class QDESIGNER_SHARED_EXPORT IconThemeEnumEditor : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit IconThemeEnumEditor(QWidget *parent = nullptr, bool wantResetButton = true);
+ ~IconThemeEnumEditor() override;
+ int themeEnum() const;
+ void setThemeEnum(int);
+
+ static QString iconName(int e);
+ static QComboBox *createComboBox(QWidget *parent = nullptr);
+
+signals:
+ void edited(int);
+
+public slots:
+ void reset();
+
+private:
QScopedPointer<IconThemeEditorPrivate> d;
};
diff --git a/src/designer/src/lib/shared/invisible_widget.cpp b/src/designer/src/lib/shared/invisible_widget.cpp
index 78d8c77d6..7fec394ba 100644
--- a/src/designer/src/lib/shared/invisible_widget.cpp
+++ b/src/designer/src/lib/shared/invisible_widget.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "invisible_widget_p.h"
diff --git a/src/designer/src/lib/shared/invisible_widget_p.h b/src/designer/src/lib/shared/invisible_widget_p.h
index 423e5d293..30a7970d4 100644
--- a/src/designer/src/lib/shared/invisible_widget_p.h
+++ b/src/designer/src/lib/shared/invisible_widget_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/layout.cpp b/src/designer/src/lib/shared/layout.cpp
index ce2351d65..b35361a38 100644
--- a/src/designer/src/lib/shared/layout.cpp
+++ b/src/designer/src/lib/shared/layout.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "layout_p.h"
#include "layoutdecoration.h"
@@ -43,6 +18,7 @@
#include <QtDesigner/qextensionmanager.h>
#include <QtCore/qdebug.h>
+#include <QtCore/qhash.h>
#include <QtCore/qlist.h>
#include <QtCore/qset.h>
@@ -63,7 +39,7 @@
QT_BEGIN_NAMESPACE
-enum { FormLayoutColumns = 2 };
+using namespace Qt::StringLiterals;
namespace qdesigner_internal {
@@ -140,7 +116,7 @@ void Layout::setup()
// Widgets which are already laid out are thrown away here too
QMultiMap<QWidget*, QWidget*> lists;
- for (QWidget *w : qAsConst(m_widgets)) {
+ for (QWidget *w : std::as_const(m_widgets)) {
QWidget *p = w->parentWidget();
if (p && LayoutInfo::layoutType(m_formWindow->core(), p) != LayoutInfo::NoLayout
@@ -153,7 +129,7 @@ void Layout::setup()
QWidgetList lastList;
const QWidgetList &parents = lists.keys();
for (QWidget *p : parents) {
- if (lists.count(p) > lastList.count())
+ if (lists.count(p) > lastList.size())
lastList = lists.values(p);
}
@@ -162,7 +138,7 @@ void Layout::setup()
// best list has only one entry and we do not layout a container,
// we leave here.
QDesignerWidgetDataBaseInterface *widgetDataBase = m_formWindow->core()->widgetDataBase();
- if (lastList.count() < 2 &&
+ if (lastList.size() < 2 &&
(!m_layoutBase ||
(!widgetDataBase->isContainer(m_layoutBase, false) &&
m_layoutBase != m_formWindow->mainContainer()))
@@ -184,7 +160,7 @@ void Layout::setup()
// be placed and connect to widgetDestroyed() signals of the
// widgets to get informed if one gets deleted to be able to
// handle that and do not crash in this case
- for (QWidget *w : qAsConst(m_widgets)) {
+ for (QWidget *w : std::as_const(m_widgets)) {
connect(w, &QObject::destroyed, this, &Layout::widgetDestroyed);
m_startPoint = QPoint(qMin(m_startPoint.x(), w->x()), qMin(m_startPoint.y(), w->y()));
const QRect rc(w->geometry());
@@ -209,7 +185,7 @@ void Layout::widgetDestroyed()
bool Layout::prepareLayout(bool &needMove, bool &needReparent)
{
- for (QWidget *widget : qAsConst(m_widgets))
+ for (QWidget *widget : std::as_const(m_widgets))
widget->raise();
needMove = !m_layoutBase;
@@ -220,10 +196,10 @@ bool Layout::prepareLayout(bool &needMove, bool &needReparent)
if (m_layoutBase == nullptr) {
const bool useSplitter = m_layoutType == LayoutInfo::HSplitter || m_layoutType == LayoutInfo::VSplitter;
- const QString baseWidgetClassName = useSplitter ? QLatin1String("QSplitter") : QLatin1String("QLayoutWidget");
+ const QString baseWidgetClassName = useSplitter ? u"QSplitter"_s : u"QLayoutWidget"_s;
m_layoutBase = widgetFactory->createWidget(baseWidgetClassName, widgetFactory->containerOfWidget(m_parentWidget));
if (useSplitter) {
- m_layoutBase->setObjectName(QStringLiteral("splitter"));
+ m_layoutBase->setObjectName(u"splitter"_s);
m_formWindow->ensureUniqueObjectName(m_layoutBase);
}
} else {
@@ -319,7 +295,7 @@ void Layout::finishLayout(bool needMove, QLayout *layout)
void Layout::undoLayout()
{
- if (!m_widgets.count())
+ if (m_widgets.isEmpty())
return;
m_formWindow->selectWidget(m_layoutBase, false);
@@ -365,14 +341,13 @@ void Layout::undoLayout()
void Layout::breakLayout()
{
- typedef QMap<QWidget *, QRect> WidgetRectMap;
- WidgetRectMap rects;
+ QHash<QWidget *, QRect> rects;
/* Store the geometry of the widgets. The idea is to give the user space
* to rearrange them, so, we do a adjustSize() on them, unless they want
* to grow (expanding widgets like QTextEdit), in which the geometry is
* preserved. Note that historically, geometries were re-applied
* only after breaking splitters. */
- for (QWidget *w : qAsConst(m_widgets)) {
+ for (QWidget *w : std::as_const(m_widgets)) {
const QRect geom = w->geometry();
const QSize sizeHint = w->sizeHint();
const bool restoreGeometry = sizeHint.isEmpty() || sizeHint.width() > geom.width() || sizeHint.height() > geom.height();
@@ -427,11 +402,11 @@ static QString suggestLayoutName(const char *className)
{
// Legacy
if (!qstrcmp(className, "QHBoxLayout"))
- return QStringLiteral("horizontalLayout");
+ return u"horizontalLayout"_s;
if (!qstrcmp(className, "QVBoxLayout"))
- return QStringLiteral("verticalLayout");
+ return u"verticalLayout"_s;
if (!qstrcmp(className, "QGridLayout"))
- return QStringLiteral("gridLayout");
+ return u"gridLayout"_s;
return qtify(QString::fromUtf8(className));
}
@@ -445,10 +420,10 @@ QLayout *Layout::createLayout(int type)
// QLayoutWidget
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(m_formWindow->core()->extensionManager(), layout);
if (sheet && qobject_cast<QLayoutWidget*>(m_layoutBase)) {
- sheet->setProperty(sheet->indexOf(QStringLiteral("leftMargin")), 0);
- sheet->setProperty(sheet->indexOf(QStringLiteral("topMargin")), 0);
- sheet->setProperty(sheet->indexOf(QStringLiteral("rightMargin")), 0);
- sheet->setProperty(sheet->indexOf(QStringLiteral("bottomMargin")), 0);
+ sheet->setProperty(sheet->indexOf(u"leftMargin"_s), 0);
+ sheet->setProperty(sheet->indexOf(u"topMargin"_s), 0);
+ sheet->setProperty(sheet->indexOf(u"rightMargin"_s), 0);
+ sheet->setProperty(sheet->indexOf(u"bottomMargin"_s), 0);
}
return layout;
}
@@ -512,9 +487,7 @@ void BoxLayout::doLayout()
QDesignerWidgetItemInstaller wii; // Make sure we use QDesignerWidgetItem.
- const QWidgetList::const_iterator cend = widgets().constEnd();
- for (QWidgetList::const_iterator it = widgets().constBegin(); it != cend; ++it) {
- QWidget *w = *it;
+ for (auto *w : widgets()) {
if (needReparent)
reparentToLayoutBase(w);
@@ -564,10 +537,7 @@ void SplitterLayout::doLayout()
QSplitter *splitter = qobject_cast<QSplitter*>(layoutBaseWidget());
Q_ASSERT(splitter != nullptr);
-
- const QWidgetList::const_iterator cend = widgets().constEnd();
- for (QWidgetList::const_iterator it = widgets().constBegin(); it != cend; ++it) {
- QWidget *w = *it;
+ for (auto *w : widgets()) {
if (needReparent)
reparentToLayoutBase(w);
splitter->addWidget(w);
@@ -580,19 +550,21 @@ void SplitterLayout::doLayout()
// ---------- Grid: Helper for laying out grids
-class Grid
+class GridHelper
{
- Q_DISABLE_COPY_MOVE(Grid);
+ Q_DISABLE_COPY_MOVE(GridHelper);
public:
+ enum { FormLayoutColumns = 2 };
+
enum Mode {
GridLayout, // Arbitrary size/supports span
FormLayout // 2-column/no span
};
- Grid(Mode mode);
+ GridHelper(Mode mode);
void resize(int nrows, int ncols);
- ~Grid();
+ ~GridHelper();
QWidget* cell(int row, int col) const { return m_cells[ row * m_ncols + col]; }
@@ -631,7 +603,7 @@ private:
QWidget** m_cells; // widget matrix w11, w12, w21...
};
-Grid::Grid(Mode mode) :
+GridHelper::GridHelper(Mode mode) :
m_mode(mode),
m_nrows(0),
m_ncols(0),
@@ -639,12 +611,12 @@ Grid::Grid(Mode mode) :
{
}
-Grid::~Grid()
+GridHelper::~GridHelper()
{
delete [] m_cells;
}
-void Grid::resize(int nrows, int ncols)
+void GridHelper::resize(int nrows, int ncols)
{
delete [] m_cells;
m_cells = nullptr;
@@ -656,7 +628,7 @@ void Grid::resize(int nrows, int ncols)
}
}
-void Grid::setCells(const QRect &c, QWidget* w)
+void GridHelper::setCells(const QRect &c, QWidget* w)
{
const int bottom = c.top() + c.height();
const int width = c.width();
@@ -667,7 +639,7 @@ void Grid::setCells(const QRect &c, QWidget* w)
}
}
-int Grid::countRow(int r, int c) const
+int GridHelper::countRow(int r, int c) const
{
QWidget* w = cell(r, c);
int i = c + 1;
@@ -676,7 +648,7 @@ int Grid::countRow(int r, int c) const
return i - c;
}
-int Grid::countCol(int r, int c) const
+int GridHelper::countCol(int r, int c) const
{
QWidget* w = cell(r, c);
int i = r + 1;
@@ -685,19 +657,19 @@ int Grid::countCol(int r, int c) const
return i - r;
}
-void Grid::setCol(int r, int c, QWidget* w, int count)
+void GridHelper::setCol(int r, int c, QWidget* w, int count)
{
for (int i = 0; i < count; i++)
setCell(r + i, c, w);
}
-void Grid::setRow(int r, int c, QWidget* w, int count)
+void GridHelper::setRow(int r, int c, QWidget* w, int count)
{
for (int i = 0; i < count; i++)
setCell(r, c + i, w);
}
-bool Grid::isWidgetStartCol(int c) const
+bool GridHelper::isWidgetStartCol(int c) const
{
for (int r = 0; r < m_nrows; r++) {
if (cell(r, c) && ((c==0) || (cell(r, c) != cell(r, c-1)))) {
@@ -707,7 +679,7 @@ bool Grid::isWidgetStartCol(int c) const
return false;
}
-bool Grid::isWidgetEndCol(int c) const
+bool GridHelper::isWidgetEndCol(int c) const
{
for (int r = 0; r < m_nrows; r++) {
if (cell(r, c) && ((c == m_ncols-1) || (cell(r, c) != cell(r, c+1))))
@@ -716,7 +688,7 @@ bool Grid::isWidgetEndCol(int c) const
return false;
}
-bool Grid::isWidgetStartRow(int r) const
+bool GridHelper::isWidgetStartRow(int r) const
{
for ( int c = 0; c < m_ncols; c++) {
if (cell(r, c) && ((r==0) || (cell(r, c) != cell(r-1, c))))
@@ -725,7 +697,7 @@ bool Grid::isWidgetStartRow(int r) const
return false;
}
-bool Grid::isWidgetEndRow(int r) const
+bool GridHelper::isWidgetEndRow(int r) const
{
for (int c = 0; c < m_ncols; c++) {
if (cell(r, c) && ((r == m_nrows-1) || (cell(r, c) != cell(r+1, c))))
@@ -735,7 +707,7 @@ bool Grid::isWidgetEndRow(int r) const
}
-bool Grid::isWidgetTopLeft(int r, int c) const
+bool GridHelper::isWidgetTopLeft(int r, int c) const
{
QWidget* w = cell(r, c);
if (!w)
@@ -743,7 +715,7 @@ bool Grid::isWidgetTopLeft(int r, int c) const
return (!r || cell(r-1, c) != w) && (!c || cell(r, c-1) != w);
}
-void Grid::extendLeft()
+void GridHelper::extendLeft()
{
for (int c = 1; c < m_ncols; c++) {
for (int r = 0; r < m_nrows; r++) {
@@ -774,7 +746,7 @@ void Grid::extendLeft()
}
-void Grid::extendRight()
+void GridHelper::extendRight()
{
for (int c = m_ncols - 2; c >= 0; c--) {
for (int r = 0; r < m_nrows; r++) {
@@ -804,7 +776,7 @@ void Grid::extendRight()
}
-void Grid::extendUp()
+void GridHelper::extendUp()
{
for (int r = 1; r < m_nrows; r++) {
for (int c = 0; c < m_ncols; c++) {
@@ -833,7 +805,7 @@ void Grid::extendUp()
}
}
-void Grid::extendDown()
+void GridHelper::extendDown()
{
for (int r = m_nrows - 2; r >= 0; r--) {
for (int c = 0; c < m_ncols; c++) {
@@ -862,7 +834,7 @@ void Grid::extendDown()
}
}
-void Grid::simplify()
+void GridHelper::simplify()
{
switch (m_mode) {
case GridLayout:
@@ -892,7 +864,7 @@ void Grid::simplify()
}
-void Grid::shrink()
+void GridHelper::shrink()
{
// tick off the occupied cols/rows (bordering on widget edges)
QList<bool> columns(m_ncols, false);
@@ -928,7 +900,7 @@ void Grid::shrink()
m_ncols = simplifiedNCols;
}
-bool Grid::shrinkFormLayoutSpans()
+bool GridHelper::shrinkFormLayoutSpans()
{
bool shrunk = false;
using WidgetSet = QSet<QWidget *>;
@@ -940,9 +912,7 @@ bool Grid::shrinkFormLayoutSpans()
widgets.insert(w);
// Restrict the widget span: max horizontal span at column 0: 2, anything else: 1
const int maxRowSpan = 1;
- const WidgetSet::const_iterator cend = widgets.constEnd();
- for (WidgetSet::const_iterator it = widgets.constBegin(); it != cend ; ++it) {
- QWidget *w = *it;
+ for (auto *w : std::as_const(widgets)) {
int row, col, rowspan, colspan;
if (!locateWidget(w, row, col, rowspan, colspan)) {
qDebug("ooops, widget '%s' does not fit in layout", w->objectName().toUtf8().constData());
@@ -969,7 +939,7 @@ bool Grid::shrinkFormLayoutSpans()
return shrunk;
}
-void Grid::reallocFormLayout()
+void GridHelper::reallocFormLayout()
{
// Columns matching? -> happy!
if (m_ncols == FormLayoutColumns)
@@ -1033,7 +1003,7 @@ void Grid::reallocFormLayout()
m_ncols = FormLayoutColumns;
}
-bool Grid::locateWidget(QWidget *w, int &row, int &col, int &rowspan, int &colspan) const
+bool GridHelper::locateWidget(QWidget *w, int &row, int &col, int &rowspan, int &colspan) const
{
const int end = m_nrows * m_ncols;
const int startIndex = std::find(m_cells, m_cells + end, w) - m_cells;
@@ -1071,13 +1041,13 @@ public:
protected:
QWidgetList buildGrid(const QWidgetList &);
- Grid m_grid;
+ GridHelper m_grid;
};
template <class GridLikeLayout, int LayoutType, int GridMode>
GridLayout<GridLikeLayout, LayoutType, GridMode>::GridLayout(const QWidgetList &wl, QWidget *p, QDesignerFormWindowInterface *fw, QWidget *lb) :
Layout(wl, p, fw, lb, LayoutInfo::Grid),
- m_grid(static_cast<Grid::Mode>(GridMode))
+ m_grid(static_cast<GridHelper::Mode>(GridMode))
{
}
@@ -1095,9 +1065,7 @@ void GridLayout<GridLikeLayout, LayoutType, GridMode>::doLayout()
QDesignerWidgetItemInstaller wii; // Make sure we use QDesignerWidgetItem.
- const QWidgetList::const_iterator cend = widgets().constEnd();
- for (QWidgetList::const_iterator it = widgets().constBegin(); it != cend; ++it) {
- QWidget *w = *it;
+ for (auto *w : widgets()) {
int r = 0, c = 0, rs = 0, cs = 0;
if (m_grid.locateWidget(w, r, c, rs, cs)) {
@@ -1127,7 +1095,7 @@ void removeIntVecDuplicates(QList<int> &v)
if (v.size() < 2)
return;
- for (QList<int>::iterator current = v.begin() ; (current != v.end()) && ((current+1) != v.end()) ; )
+ for (auto current = v.begin() ; (current != v.end()) && ((current + 1) != v.end()) ; )
if ( *current == *(current+1) )
v.erase(current+1);
else
@@ -1153,14 +1121,14 @@ QWidgetList GridLayout<GridLikeLayout, LayoutType, GridMode>::buildGrid(const QW
// -----------------------------------------------------------------
// We need a list of both start and stop values for x- & y-axis
- const int widgetCount = widgetList.size();
+ const auto widgetCount = widgetList.size();
QList<int> x( widgetCount * 2 );
QList<int> y( widgetCount * 2 );
// Using push_back would look nicer, but operator[] is much faster
- int index = 0;
- for (int i = 0; i < widgetCount; ++i) {
- const QRect widgetPos = expandGeometry(widgetList.at(i)->geometry());
+ qsizetype index = 0;
+ for (const auto *w : widgetList) {
+ const QRect widgetPos = expandGeometry(w->geometry());
x[index] = widgetPos.left();
x[index+1] = widgetPos.right();
y[index] = widgetPos.top();
@@ -1179,9 +1147,7 @@ QWidgetList GridLayout<GridLikeLayout, LayoutType, GridMode>::buildGrid(const QW
// enough space
m_grid.resize(y.size(), x.size());
- const QWidgetList::const_iterator cend = widgetList.constEnd();
- for (QWidgetList::const_iterator it = widgetList.constBegin(); it != cend; ++it) {
- QWidget *w = *it;
+ for (auto *w : widgetList) {
// Mark the cells in the grid that contains a widget
const QRect widgetPos = expandGeometry(w->geometry());
QRect c(0, 0, 0, 0); // rect of columns/rows
@@ -1191,8 +1157,8 @@ QWidgetList GridLayout<GridLikeLayout, LayoutType, GridMode>::buildGrid(const QW
Q_ASSERT(leftIdx != -1);
c.setLeft(leftIdx);
c.setRight(leftIdx);
- for (int cw=leftIdx; cw<x.size(); cw++)
- if (x[cw] < widgetPos.right())
+ for (qsizetype cw = leftIdx; cw < x.size(); ++cw)
+ if (x.at(cw) < widgetPos.right())
c.setRight(cw);
else
break;
@@ -1201,8 +1167,8 @@ QWidgetList GridLayout<GridLikeLayout, LayoutType, GridMode>::buildGrid(const QW
Q_ASSERT(topIdx != -1);
c.setTop(topIdx);
c.setBottom(topIdx);
- for (int ch=topIdx; ch<y.size(); ch++)
- if (y[ch] < widgetPos.bottom())
+ for (qsizetype ch = topIdx; ch < y.size(); ++ch)
+ if (y.at(ch) < widgetPos.bottom())
c.setBottom(ch);
else
break;
@@ -1228,7 +1194,7 @@ Layout* Layout::createLayout(const QWidgetList &widgets, QWidget *parentWidget,
{
switch (layoutType) {
case LayoutInfo::Grid:
- return new GridLayout<QGridLayout, LayoutInfo::Grid, Grid::GridLayout>(widgets, parentWidget, fw, layoutBase);
+ return new GridLayout<QGridLayout, LayoutInfo::Grid, GridHelper::GridLayout>(widgets, parentWidget, fw, layoutBase);
case LayoutInfo::HBox:
case LayoutInfo::VBox: {
const Qt::Orientation orientation = layoutType == LayoutInfo::HBox ? Qt::Horizontal : Qt::Vertical;
@@ -1240,7 +1206,7 @@ Layout* Layout::createLayout(const QWidgetList &widgets, QWidget *parentWidget,
return new SplitterLayout(widgets, parentWidget, fw, layoutBase, orientation);
}
case LayoutInfo::Form:
- return new GridLayout<QFormLayout, LayoutInfo::Form, Grid::FormLayout>(widgets, parentWidget, fw, layoutBase);
+ return new GridLayout<QFormLayout, LayoutInfo::Form, GridHelper::FormLayout>(widgets, parentWidget, fw, layoutBase);
default:
break;
}
diff --git a/src/designer/src/lib/shared/layout_p.h b/src/designer/src/lib/shared/layout_p.h
index e6cd69a63..2dd8ee7e6 100644
--- a/src/designer/src/lib/shared/layout_p.h
+++ b/src/designer/src/lib/shared/layout_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -102,8 +77,7 @@ private slots:
private:
QWidgetList m_widgets;
QWidget *m_parentWidget;
- typedef QHash<QWidget *, QRect> WidgetGeometryHash;
- WidgetGeometryHash m_geometries;
+ QHash<QWidget *, QRect> m_geometries;
QWidget *m_layoutBase;
QDesignerFormWindowInterface *m_formWindow;
const LayoutInfo::Type m_layoutType;
diff --git a/src/designer/src/lib/shared/layoutinfo.cpp b/src/designer/src/lib/shared/layoutinfo.cpp
index 0374de582..182e42f37 100644
--- a/src/designer/src/lib/shared/layoutinfo.cpp
+++ b/src/designer/src/lib/shared/layoutinfo.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "layoutinfo_p.h"
@@ -42,6 +17,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
/*!
\overload
@@ -64,13 +41,12 @@ LayoutInfo::Type LayoutInfo::layoutType(const QDesignerFormEditorInterface *core
static const QHash<QString, LayoutInfo::Type> &layoutNameTypeMap()
{
- static QHash<QString, LayoutInfo::Type> nameTypeMap;
- if (nameTypeMap.isEmpty()) {
- nameTypeMap.insert(QStringLiteral("QVBoxLayout"), LayoutInfo::VBox);
- nameTypeMap.insert(QStringLiteral("QHBoxLayout"), LayoutInfo::HBox);
- nameTypeMap.insert(QStringLiteral("QGridLayout"), LayoutInfo::Grid);
- nameTypeMap.insert(QStringLiteral("QFormLayout"), LayoutInfo::Form);
- }
+ static const QHash<QString, LayoutInfo::Type> nameTypeMap = {
+ {u"QVBoxLayout"_s, LayoutInfo::VBox},
+ {u"QHBoxLayout"_s, LayoutInfo::HBox},
+ {u"QGridLayout"_s, LayoutInfo::Grid},
+ {u"QFormLayout"_s, LayoutInfo::Form}
+ };
return nameTypeMap;
}
diff --git a/src/designer/src/lib/shared/layoutinfo_p.h b/src/designer/src/lib/shared/layoutinfo_p.h
index e5326203a..7ddb2129f 100644
--- a/src/designer/src/lib/shared/layoutinfo_p.h
+++ b/src/designer/src/lib/shared/layoutinfo_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/metadatabase.cpp b/src/designer/src/lib/shared/metadatabase.cpp
index ed0de8dd6..77d6aa23c 100644
--- a/src/designer/src/lib/shared/metadatabase.cpp
+++ b/src/designer/src/lib/shared/metadatabase.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "metadatabase_p.h"
#include "widgetdatabase_p.h"
@@ -170,8 +145,7 @@ QObjectList MetaDataBase::objects() const
{
QObjectList result;
- ItemMap::const_iterator it = m_items.begin();
- for (; it != m_items.end(); ++it) {
+ for (auto it = m_items.cbegin(), cend = m_items.cend(); it != cend; ++it) {
if (it.value()->enabled())
result.append(it.key());
}
diff --git a/src/designer/src/lib/shared/metadatabase_p.h b/src/designer/src/lib/shared/metadatabase_p.h
index 48dee4086..2117f5975 100644
--- a/src/designer/src/lib/shared/metadatabase_p.h
+++ b/src/designer/src/lib/shared/metadatabase_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -106,8 +81,7 @@ private slots:
private:
QDesignerFormEditorInterface *m_core;
- typedef QHash<QObject *, MetaDataBaseItem*> ItemMap;
- ItemMap m_items;
+ QHash<QObject *, MetaDataBaseItem *> m_items;
};
// promotion convenience
diff --git a/src/designer/src/lib/shared/morphmenu.cpp b/src/designer/src/lib/shared/morphmenu.cpp
index 976a27ded..3e7c053ca 100644
--- a/src/designer/src/lib/shared/morphmenu.cpp
+++ b/src/designer/src/lib/shared/morphmenu.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "morphmenu_p.h"
#include "formwindowbase_p.h"
@@ -73,9 +48,11 @@ Q_DECLARE_METATYPE(QWidgetList)
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
// Helpers for the dynamic properties that store Z/Widget order
-static const char *widgetOrderPropertyC = "_q_widgetOrder";
-static const char *zOrderPropertyC = "_q_zOrder";
+static const char widgetOrderPropertyC[] = "_q_widgetOrder";
+static const char zOrderPropertyC[] = "_q_zOrder";
/* Morphing in Designer:
* It is possible to morph:
@@ -147,9 +124,8 @@ static MorphCategory category(const QWidget *w)
static QStringList classesOfCategory(MorphCategory cat)
{
- typedef QMap<MorphCategory, QStringList> CandidateCache;
- static CandidateCache candidateCache;
- CandidateCache::iterator it = candidateCache.find(cat);
+ static QMap<MorphCategory, QStringList> candidateCache;
+ auto it = candidateCache.find(cat);
if (it == candidateCache.end()) {
it = candidateCache.insert(cat, QStringList());
QStringList &l = it.value();
@@ -159,29 +135,29 @@ static QStringList classesOfCategory(MorphCategory cat)
case MorphSimpleContainer:
// Do not generally allow to morph into a layout.
// This can be risky in case of container pages,etc.
- l << QStringLiteral("QWidget") << QStringLiteral("QFrame") << QStringLiteral("QGroupBox");
+ l << u"QWidget"_s << u"QFrame"_s << u"QGroupBox"_s;
break;
case MorphPageContainer:
- l << QStringLiteral("QTabWidget") << QStringLiteral("QStackedWidget") << QStringLiteral("QToolBox");
+ l << u"QTabWidget"_s << u"QStackedWidget"_s << u"QToolBox"_s;
break;
case MorphItemView:
- l << QStringLiteral("QListView") << QStringLiteral("QListWidget")
- << QStringLiteral("QTreeView") << QStringLiteral("QTreeWidget")
- << QStringLiteral("QTableView") << QStringLiteral("QTableWidget")
- << QStringLiteral("QColumnView");
+ l << u"QListView"_s << u"QListWidget"_s
+ << u"QTreeView"_s << u"QTreeWidget"_s
+ << u"QTableView"_s << u"QTableWidget"_s
+ << u"QColumnView"_s;
break;
case MorphButton:
- l << QStringLiteral("QCheckBox") << QStringLiteral("QRadioButton")
- << QStringLiteral("QPushButton") << QStringLiteral("QToolButton")
- << QStringLiteral("QCommandLinkButton");
+ l << u"QCheckBox"_s << u"QRadioButton"_s
+ << u"QPushButton"_s << u"QToolButton"_s
+ << u"QCommandLinkButton"_s;
break;
case MorphSpinBox:
- l << QStringLiteral("QDateTimeEdit") << QStringLiteral("QDateEdit")
- << QStringLiteral("QTimeEdit")
- << QStringLiteral("QSpinBox") << QStringLiteral("QDoubleSpinBox");
+ l << u"QDateTimeEdit"_s << u"QDateEdit"_s
+ << u"QTimeEdit"_s
+ << u"QSpinBox"_s << u"QDoubleSpinBox"_s;
break;
case MorphTextEdit:
- l << QStringLiteral("QTextEdit") << QStringLiteral("QPlainTextEdit") << QStringLiteral("QTextBrowser");
+ l << u"QTextEdit"_s << u"QPlainTextEdit"_s << u"QTextBrowser"_s;
break;
}
}
@@ -211,9 +187,9 @@ static QString suggestObjectName(const QString &oldClassName, const QString &new
{
QString oldClassPart = oldClassName;
QString newClassPart = newClassName;
- if (oldClassPart.startsWith(QLatin1Char('Q')))
+ if (oldClassPart.startsWith(u'Q'))
oldClassPart.remove(0, 1);
- if (newClassPart.startsWith(QLatin1Char('Q')))
+ if (newClassPart.startsWith(u'Q'))
newClassPart.remove(0, 1);
QString newName = oldName;
@@ -301,7 +277,7 @@ bool MorphWidgetCommand::addMorphMacro(QDesignerFormWindowInterface *fw, QWidget
// restore buddy using the QByteArray name.
if (buddyLabel) {
SetPropertyCommand *buddyCmd = new SetPropertyCommand(fw);
- buddyCmd->init(buddyLabel, QStringLiteral("buddy"), QVariant(newWidgetName.toUtf8()));
+ buddyCmd->init(buddyLabel, u"buddy"_s, QVariant(newWidgetName.toUtf8()));
us->push(buddyCmd);
}
us->endMacro();
@@ -341,14 +317,13 @@ bool MorphWidgetCommand::init(QWidget *widget, const QString &newClassName)
// If the target has a container extension, we add enough new pages to take
// up the children of the before widget
if (QDesignerContainerExtension* c = qt_extension<QDesignerContainerExtension*>(core->extensionManager(), m_afterWidget)) {
- if (const int pageCount = childContainers(core, m_beforeWidget).size()) {
- const QString qWidget = QStringLiteral("QWidget");
+ if (const auto pageCount = childContainers(core, m_beforeWidget).size()) {
const QString containerName = m_afterWidget->objectName();
- for (int i = 0; i < pageCount; i++) {
+ for (qsizetype i = 0; i < pageCount; ++i) {
QString name = containerName;
- name += QStringLiteral("Page");
+ name += "Page"_L1;
name += QString::number(i + 1);
- QWidget *page = core->widgetFactory()->createWidget(qWidget);
+ QWidget *page = core->widgetFactory()->createWidget(u"QWidget"_s);
page->setObjectName(name);
fw->ensureUniqueObjectName(page);
c->addWidget(page);
@@ -360,12 +335,11 @@ bool MorphWidgetCommand::init(QWidget *widget, const QString &newClassName)
// Copy over applicable properties
const QDesignerPropertySheetExtension *beforeSheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), widget);
QDesignerPropertySheetExtension *afterSheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), m_afterWidget);
- const QString objectNameProperty = QStringLiteral("objectName");
const int count = beforeSheet->count();
for (int i = 0; i < count; i++)
if (beforeSheet->isVisible(i) && beforeSheet->isChanged(i)) {
const QString name = beforeSheet->propertyName(i);
- if (name != objectNameProperty) {
+ if (name != "objectName"_L1) {
const int afterIndex = afterSheet->indexOf(name);
if (afterIndex != -1 && afterSheet->isVisible(afterIndex) && afterSheet->propertyGroup(afterIndex) == beforeSheet->propertyGroup(i)) {
afterSheet->setProperty(i, beforeSheet->property(i));
@@ -406,8 +380,8 @@ void MorphWidgetCommand::morph(QWidget *before, QWidget *after)
QWidgetList beforeChildContainers = childContainers(fw->core(), before);
QWidgetList afterChildContainers = childContainers(fw->core(), after);
Q_ASSERT(beforeChildContainers.size() == afterChildContainers.size());
- const int childContainerCount = beforeChildContainers.size();
- for (int i = 0; i < childContainerCount; i++) {
+ const auto childContainerCount = beforeChildContainers.size();
+ for (qsizetype i = 0; i < childContainerCount; ++i) {
QWidget *beforeChildContainer = beforeChildContainers.at(i);
QWidget *afterChildContainer = afterChildContainers.at(i);
if (QLayout *childLayout = beforeChildContainer->layout()) {
@@ -507,11 +481,11 @@ bool MorphWidgetCommand::canMorph(QDesignerFormWindowInterface *fw, QWidget *w,
return true;
// Check children. All child containers must be non-laid-out or have managed layouts
const QWidgetList pages = childContainers(core, w);
- const int pageCount = pages.size();
+ const auto pageCount = pages.size();
if (ptrToChildContainerCount)
*ptrToChildContainerCount = pageCount;
if (pageCount) {
- for (int i = 0; i < pageCount; i++)
+ for (qsizetype i = 0; i < pageCount; ++i)
if (QLayout *cl = pages.at(i)->layout())
if (!core->metaDataBase()->item(cl))
return false;
@@ -598,10 +572,8 @@ bool MorphMenu::populateMenu(QWidget *w, QDesignerFormWindowInterface *fw)
}
// Add actions
- const QStringList::const_iterator cend = c.constEnd();
- for (QStringList::const_iterator it = c.constBegin(); it != cend; ++it) {
- if (*it != oldClassName) {
- const QString className = *it;
+ for (const auto &className : c) {
+ if (className != oldClassName) {
m_menu->addAction(className,
this, [this, className] { this->slotMorph(className); });
}
diff --git a/src/designer/src/lib/shared/morphmenu_p.h b/src/designer/src/lib/shared/morphmenu_p.h
index eba1bdf3a..dbd94f6ea 100644
--- a/src/designer/src/lib/shared/morphmenu_p.h
+++ b/src/designer/src/lib/shared/morphmenu_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/newactiondialog.cpp b/src/designer/src/lib/shared/newactiondialog.cpp
index d5380bfcb..5bbb5d725 100644
--- a/src/designer/src/lib/shared/newactiondialog.cpp
+++ b/src/designer/src/lib/shared/newactiondialog.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "newactiondialog_p.h"
#include "ui_newactiondialog.h"
@@ -37,10 +12,13 @@
#include <QtDesigner/abstractformwindow.h>
#include <QtDesigner/abstractformeditor.h>
+#include <QtCore/QMetaEnum>
#include <QtWidgets/qpushbutton.h>
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
// Returns a combination of ChangeMask flags
unsigned ActionData::compare(const ActionData &rhs) const
@@ -58,13 +36,15 @@ unsigned ActionData::compare(const ActionData &rhs) const
rc |= CheckableChanged;
if (keysequence != rhs.keysequence)
rc |= KeysequenceChanged ;
+ if (menuRole.value != rhs.menuRole.value)
+ rc |= MenuRoleChanged ;
return rc;
}
// -------------------- NewActionDialog
NewActionDialog::NewActionDialog(ActionEditor *parent) :
QDialog(parent, Qt::Sheet),
- m_ui(new Ui::NewActionDialog),
+ m_ui(new QT_PREPEND_NAMESPACE(qdesigner_internal)::Ui::NewActionDialog),
m_actionEditor(parent),
m_autoUpdateObjectName(true)
{
@@ -72,12 +52,36 @@ NewActionDialog::NewActionDialog(ActionEditor *parent) :
m_ui->tooltipEditor->setTextPropertyValidationMode(ValidationRichText);
connect(m_ui->toolTipToolButton, &QAbstractButton::clicked, this, &NewActionDialog::slotEditToolTip);
+ connect(m_ui->editActionText, &QLineEdit::textEdited,
+ this, &NewActionDialog::onEditActionTextTextEdited);
+ connect(m_ui->editObjectName, &QLineEdit::textEdited,
+ this, &NewActionDialog::onEditObjectNameTextEdited);
- m_ui->keysequenceResetToolButton->setIcon(createIconSet(QStringLiteral("resetproperty.png")));
+ m_ui->keysequenceResetToolButton->setIcon(createIconSet("resetproperty.png"_L1));
connect(m_ui->keysequenceResetToolButton, &QAbstractButton::clicked,
this, &NewActionDialog::slotResetKeySequence);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
+ // Clear XDG icon once a theme enum is chosen and vv.
+ auto *iconThemeEnumEditor = m_ui->iconThemeEnumEditor;
+ auto *iconThemeEditor = m_ui->iconThemeEditor;
+ connect(iconThemeEnumEditor, &IconThemeEnumEditor::edited,
+ this, [iconThemeEditor](int i) {
+ if (i >= 0)
+ iconThemeEditor->reset();
+ });
+ connect(iconThemeEditor, &IconThemeEditor::edited,
+ this, [iconThemeEnumEditor](const QString &t) {
+ if (!t.isEmpty())
+ iconThemeEnumEditor->reset();
+ });
+
+ const auto menuRoles = QMetaEnum::fromType<QAction::MenuRole>();
+ for (int i = 0; i < menuRoles.keyCount(); i++) {
+ const auto key = menuRoles.key(i);
+ const auto value = menuRoles.value(i);
+ m_ui->menuRole->addItem(QLatin1StringView(key), value);
+ }
+
focusText();
updateButtons();
@@ -121,6 +125,11 @@ void NewActionDialog::focusCheckable()
m_ui->checkableCheckBox->setFocus();
}
+void NewActionDialog::focusMenuRole()
+{
+ m_ui->menuRole->setFocus();
+}
+
QString NewActionDialog::actionText() const
{
return m_ui->editActionText->text();
@@ -138,9 +147,12 @@ ActionData NewActionDialog::actionData() const
rc.name = actionName();
rc.toolTip = m_ui->tooltipEditor->text();
rc.icon = m_ui->iconSelector->icon();
- rc.icon.setTheme(m_ui->iconThemeEditor->theme());
+ const int themeEnum = m_ui->iconThemeEnumEditor->themeEnum();
+ rc.icon.setThemeEnum(themeEnum);
+ rc.icon.setTheme(themeEnum == -1 ? m_ui->iconThemeEditor->theme() : QString{});
rc.checkable = m_ui->checkableCheckBox->checkState() == Qt::Checked;
rc.keysequence = PropertySheetKeySequenceValue(m_ui->keySequenceEdit->keySequence());
+ rc.menuRole.value = m_ui->menuRole->currentData().toInt();
return rc;
}
@@ -149,17 +161,19 @@ void NewActionDialog::setActionData(const ActionData &d)
m_ui->editActionText->setText(d.text);
m_ui->editObjectName->setText(d.name);
m_ui->iconSelector->setIcon(d.icon.unthemed());
+ m_ui->iconThemeEnumEditor->setThemeEnum(d.icon.themeEnum());
m_ui->iconThemeEditor->setTheme(d.icon.theme());
m_ui->tooltipEditor->setText(d.toolTip);
m_ui->keySequenceEdit->setKeySequence(d.keysequence.value());
m_ui->checkableCheckBox->setCheckState(d.checkable ? Qt::Checked : Qt::Unchecked);
+ m_ui->menuRole->setCurrentIndex(m_ui->menuRole->findData(d.menuRole.value));
// Suppress updating of the object name from the text for existing actions.
m_autoUpdateObjectName = d.name.isEmpty();
updateButtons();
}
-void NewActionDialog::on_editActionText_textEdited(const QString &text)
+void NewActionDialog::onEditActionTextTextEdited(const QString &text)
{
if (m_autoUpdateObjectName)
m_ui->editObjectName->setText(ActionEditor::actionTextToName(text));
@@ -167,7 +181,7 @@ void NewActionDialog::on_editActionText_textEdited(const QString &text)
updateButtons();
}
-void NewActionDialog::on_editObjectName_textEdited(const QString&)
+void NewActionDialog::onEditObjectNameTextEdited(const QString&)
{
updateButtons();
m_autoUpdateObjectName = false;
diff --git a/src/designer/src/lib/shared/newactiondialog.ui b/src/designer/src/lib/shared/newactiondialog.ui
index 005e6dc2d..7fd99842b 100644
--- a/src/designer/src/lib/shared/newactiondialog.ui
+++ b/src/designer/src/lib/shared/newactiondialog.ui
@@ -1,40 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <comment>*********************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-*********************************************************************</comment>
+ <comment>
+* Copyright (C) 2016 The Qt Company Ltd.
+* SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+</comment>
<class>qdesigner_internal::NewActionDialog</class>
<widget class="QDialog" name="qdesigner_internal::NewActionDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>366</width>
- <height>270</height>
+ <width>381</width>
+ <height>291</height>
</rect>
</property>
<property name="windowTitle">
@@ -110,20 +87,20 @@
</item>
</layout>
</item>
- <item row="3" column="0">
+ <item row="4" column="0">
<widget class="QLabel" name="iconThemeLabel">
<property name="text">
- <string>Icon th&amp;eme:</string>
+ <string>Icon &amp;XDG theme:</string>
</property>
<property name="buddy">
<cstring>iconThemeEditor</cstring>
</property>
</widget>
</item>
- <item row="3" column="1">
+ <item row="4" column="1">
<widget class="qdesigner_internal::IconThemeEditor" name="iconThemeEditor" native="true"/>
</item>
- <item row="4" column="0">
+ <item row="5" column="0">
<widget class="QLabel" name="iconLabel">
<property name="text">
<string>&amp;Icon:</string>
@@ -133,7 +110,7 @@
</property>
</widget>
</item>
- <item row="4" column="1">
+ <item row="5" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="qdesigner_internal::IconSelector" name="iconSelector" native="true"/>
@@ -153,14 +130,14 @@
</item>
</layout>
</item>
- <item row="5" column="1">
+ <item row="6" column="1">
<widget class="QCheckBox" name="checkableCheckBox">
<property name="text">
<string/>
</property>
</widget>
</item>
- <item row="5" column="0">
+ <item row="6" column="0">
<widget class="QLabel" name="checkableLabel">
<property name="text">
<string>&amp;Checkable:</string>
@@ -170,7 +147,7 @@
</property>
</widget>
</item>
- <item row="6" column="0">
+ <item row="7" column="0">
<widget class="QLabel" name="shortcutLabel">
<property name="text">
<string>&amp;Shortcut:</string>
@@ -180,10 +157,10 @@
</property>
</widget>
</item>
- <item row="6" column="1">
+ <item row="7" column="1">
<layout class="QHBoxLayout" name="keysequenceLayout">
<item>
- <widget class="QKeySequenceEdit" name="keySequenceEdit" native="true">
+ <widget class="QKeySequenceEdit" name="keySequenceEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -201,6 +178,32 @@
</item>
</layout>
</item>
+ <item row="8" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>&amp;Menu role:</string>
+ </property>
+ <property name="buddy">
+ <cstring>menuRole</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="1">
+ <widget class="QComboBox" name="menuRole"/>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="iconThemeEnumLabel">
+ <property name="text">
+ <string>Icon &amp;theme:</string>
+ </property>
+ <property name="buddy">
+ <cstring>iconThemeEnumEditor</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="qdesigner_internal::IconThemeEnumEditor" name="iconThemeEnumEditor" native="true"/>
+ </item>
</layout>
</item>
<item>
@@ -254,6 +257,12 @@
<header>iconselector_p.h</header>
<container>1</container>
</customwidget>
+ <customwidget>
+ <class>qdesigner_internal::IconThemeEnumEditor</class>
+ <extends>QWidget</extends>
+ <header>iconselector_p.h</header>
+ <container>1</container>
+ </customwidget>
</customwidgets>
<tabstops>
<tabstop>editActionText</tabstop>
diff --git a/src/designer/src/lib/shared/newactiondialog_p.h b/src/designer/src/lib/shared/newactiondialog_p.h
index f6e3b1dd7..de42d16f0 100644
--- a/src/designer/src/lib/shared/newactiondialog_p.h
+++ b/src/designer/src/lib/shared/newactiondialog_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef NEWACTIONDIALOG_P_H
#define NEWACTIONDIALOG_P_H
@@ -44,6 +19,7 @@
#include <QtWidgets/qdialog.h>
#include <QtGui/qkeysequence.h>
+#include <QtCore/qcompare.h>
QT_BEGIN_NAMESPACE
@@ -59,7 +35,8 @@ struct ActionData {
enum ChangeMask {
TextChanged = 0x1, NameChanged = 0x2, ToolTipChanged = 0x4,
- IconChanged = 0x8, CheckableChanged = 0x10, KeysequenceChanged = 0x20
+ IconChanged = 0x8, CheckableChanged = 0x10, KeysequenceChanged = 0x20,
+ MenuRoleChanged = 0x40
};
// Returns a combination of ChangeMask flags
@@ -71,10 +48,14 @@ struct ActionData {
PropertySheetIconValue icon;
bool checkable{false};
PropertySheetKeySequenceValue keysequence;
-};
+ PropertySheetFlagValue menuRole;
-inline bool operator==(const ActionData &a1, const ActionData &a2) { return a1.compare(a2) == 0u; }
-inline bool operator!=(const ActionData &a1, const ActionData &a2) { return a1.compare(a2) != 0u; }
+ friend bool comparesEqual(const ActionData &lhs, const ActionData &rhs) noexcept
+ {
+ return lhs.compare(rhs) == 0;
+ }
+ Q_DECLARE_EQUALITY_COMPARABLE(ActionData)
+};
class NewActionDialog: public QDialog
{
@@ -95,10 +76,12 @@ public slots:
void focusTooltip();
void focusShortcut();
void focusCheckable();
+ void focusMenuRole();
private slots:
- void on_editActionText_textEdited(const QString &text);
- void on_editObjectName_textEdited(const QString &text);
+ void onEditActionTextTextEdited(const QString &text);
+ void onEditObjectNameTextEdited(const QString &text);
+
void slotEditToolTip();
void slotResetKeySequence();
diff --git a/src/designer/src/lib/shared/newformwidget.cpp b/src/designer/src/lib/shared/newformwidget.cpp
index c4b659ed6..383b3fc5a 100644
--- a/src/designer/src/lib/shared/newformwidget.cpp
+++ b/src/designer/src/lib/shared/newformwidget.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "newformwidget_p.h"
#include "ui_newformwidget.h"
@@ -57,6 +32,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
enum { profileComboIndexOffset = 1 };
enum { debugNewFormWidget = 0 };
@@ -67,14 +44,14 @@ enum NewForm_CustomRole {
ClassNameRole = Qt::UserRole + 101
};
-static const char *newFormObjectNameC = "Form";
+static constexpr auto newFormObjectNameC = "Form"_L1;
// Create a form name for an arbitrary class. If it is Qt, qtify it,
// else return "Form".
static QString formName(const QString &className)
{
- if (!className.startsWith(QLatin1Char('Q')))
- return QLatin1String(newFormObjectNameC);
+ if (!className.startsWith(u'Q'))
+ return newFormObjectNameC;
QString rc = className;
rc.remove(0, 1);
return rc;
@@ -125,7 +102,7 @@ static const struct TemplateSize templateSizes[] =
NewFormWidget::NewFormWidget(QDesignerFormEditorInterface *core, QWidget *parentWidget) :
QDesignerNewFormWidgetInterface(parentWidget),
m_core(core),
- m_ui(new Ui::NewFormWidget),
+ m_ui(new QT_PREPEND_NAMESPACE(qdesigner_internal)::Ui::NewFormWidget),
m_currentItem(nullptr),
m_acceptedItem(nullptr)
{
@@ -139,14 +116,22 @@ NewFormWidget::NewFormWidget(QDesignerFormEditorInterface *core, QWidget *parent
m_ui->treeWidget->header()->hide();
m_ui->treeWidget->header()->setStretchLastSection(true);
m_ui->lblPreview->setBackgroundRole(QPalette::Base);
+
+ connect(m_ui->treeWidget, &QTreeWidget::itemActivated,
+ this, &NewFormWidget::treeWidgetItemActivated);
+ connect(m_ui->treeWidget, &QTreeWidget::currentItemChanged,
+ this, &NewFormWidget::treeWidgetCurrentItemChanged);
+ connect(m_ui->treeWidget, &QTreeWidget::itemPressed,
+ this, &NewFormWidget::treeWidgetItemPressed);
+
QDesignerSharedSettings settings(m_core);
- QString uiExtension = QStringLiteral("ui");
- QString templatePath = QStringLiteral(":/qt-project.org/designer/templates/forms");
+ QString uiExtension = u"ui"_s;
+ QString templatePath = u":/qt-project.org/designer/templates/forms"_s;
QDesignerLanguageExtension *lang = qt_extension<QDesignerLanguageExtension *>(core->extensionManager(), core);
if (lang) {
- templatePath = QStringLiteral(":/templates/forms");
+ templatePath = u":/templates/forms"_s;
uiExtension = lang->uiExtension();
}
@@ -156,9 +141,8 @@ NewFormWidget::NewFormWidget(QDesignerFormEditorInterface *core, QWidget *parent
loadFrom(templatePath, true, uiExtension, formTemplate, selectedItem);
// Additional template paths
const QStringList formTemplatePaths = settings.formTemplatePaths();
- const QStringList::const_iterator ftcend = formTemplatePaths.constEnd();
- for (QStringList::const_iterator it = formTemplatePaths.constBegin(); it != ftcend; ++it)
- loadFrom(*it, false, uiExtension, formTemplate, selectedItem);
+ for (const auto &ftp : formTemplatePaths)
+ loadFrom(ftp, false, uiExtension, formTemplate, selectedItem);
// Widgets/custom widgets
if (!lang) {
@@ -189,7 +173,7 @@ NewFormWidget::NewFormWidget(QDesignerFormEditorInterface *core, QWidget *parent
if (m_deviceProfiles.isEmpty()) {
m_ui->profileComboBox->setEnabled(false);
} else {
- for (const auto &deviceProfile : qAsConst(m_deviceProfiles))
+ for (const auto &deviceProfile : std::as_const(m_deviceProfiles))
m_ui->profileComboBox->addItem(deviceProfile.name());
const int ci = settings.currentDeviceProfileIndex();
if (ci >= 0)
@@ -215,7 +199,7 @@ NewFormWidget::~NewFormWidget()
delete m_ui;
}
-void NewFormWidget::on_treeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *)
+void NewFormWidget::treeWidgetCurrentItemChanged(QTreeWidgetItem *current)
{
if (debugNewFormWidget)
qDebug() << Q_FUNC_INFO << current;
@@ -246,7 +230,7 @@ bool NewFormWidget::showCurrentItemPixmap()
return rc;
}
-void NewFormWidget::on_treeWidget_itemActivated(QTreeWidgetItem *item)
+void NewFormWidget::treeWidgetItemActivated(QTreeWidgetItem *item)
{
if (debugNewFormWidget)
qDebug() << Q_FUNC_INFO << item;
@@ -259,7 +243,7 @@ QPixmap NewFormWidget::formPreviewPixmap(const QTreeWidgetItem *item)
{
// Cache pixmaps per item/device profile
const ItemPixmapCacheKey cacheKey(item, profileComboIndex());
- ItemPixmapCache::iterator it = m_itemPixmapCache.find(cacheKey);
+ auto it = m_itemPixmapCache.find(cacheKey);
if (it == m_itemPixmapCache.end()) {
// file or string?
const QVariant fileName = item->data(0, TemplateNameRole);
@@ -404,13 +388,13 @@ void NewFormWidget::loadFrom(const QString &path, bool resourceFile, const QStri
return;
// Iterate through the directory and add the templates
- const QFileInfoList list = dir.entryInfoList(QStringList(QStringLiteral("*.") + uiExtension),
+ const QFileInfoList list = dir.entryInfoList(QStringList{"*."_L1 + uiExtension},
QDir::Files);
if (list.isEmpty())
return;
- const QChar separator = resourceFile ? QChar(QLatin1Char('/'))
+ const QChar separator = resourceFile ? QChar(u'/')
: QDir::separator();
QTreeWidgetItem *root = new QTreeWidgetItem(m_ui->treeWidget);
root->setFlags(root->flags() & ~Qt::ItemIsSelectable);
@@ -426,22 +410,19 @@ void NewFormWidget::loadFrom(const QString &path, bool resourceFile, const QStri
visiblePath = QDir::toNativeSeparators(visiblePath);
}
- const QChar underscore = QLatin1Char('_');
- const QChar blank = QLatin1Char(' ');
- root->setText(0, visiblePath.replace(underscore, blank));
+ root->setText(0, visiblePath.replace(u'_', u' '));
root->setToolTip(0, path);
- const QFileInfoList::const_iterator lcend = list.constEnd();
- for (QFileInfoList::const_iterator it = list.constBegin(); it != lcend; ++it) {
- if (!it->isFile())
+ for (const auto &fi : list) {
+ if (!fi.isFile())
continue;
QTreeWidgetItem *item = new QTreeWidgetItem(root);
- const QString text = it->baseName().replace(underscore, blank);
+ const QString text = fi.baseName().replace(u'_', u' ');
if (selectedItemFound == nullptr && text == selectedItem)
selectedItemFound = item;
item->setText(0, text);
- item->setData(0, TemplateNameRole, it->absoluteFilePath());
+ item->setData(0, TemplateNameRole, fi.absoluteFilePath());
}
}
@@ -453,18 +434,16 @@ void NewFormWidget::loadFrom(const QString &title, const QStringList &nameList,
QTreeWidgetItem *root = new QTreeWidgetItem(m_ui->treeWidget);
root->setFlags(root->flags() & ~Qt::ItemIsSelectable);
root->setText(0, title);
- const QStringList::const_iterator cend = nameList.constEnd();
- for (QStringList::const_iterator it = nameList.constBegin(); it != cend; ++it) {
- const QString text = *it;
+ for (const auto &text : nameList) {
QTreeWidgetItem *item = new QTreeWidgetItem(root);
item->setText(0, text);
if (selectedItemFound == nullptr && text == selectedItem)
selectedItemFound = item;
- item->setData(0, ClassNameRole, *it);
+ item->setData(0, ClassNameRole, text);
}
}
-void NewFormWidget::on_treeWidget_itemPressed(QTreeWidgetItem *item)
+void NewFormWidget::treeWidgetItemPressed(QTreeWidgetItem *item)
{
if (item && !item->parent())
item->setExpanded(!item->isExpanded());
@@ -506,7 +485,7 @@ QString NewFormWidget::itemToTemplate(const QTreeWidgetItem *item, QString *erro
const QFileInfo fiBase(fileName);
QString sizeFileName;
QTextStream(&sizeFileName) << fiBase.path() << QDir::separator()
- << size.width() << QLatin1Char('x') << size.height() << QDir::separator()
+ << size.width() << 'x' << size.height() << QDir::separator()
<< fiBase.fileName();
if (QFileInfo(sizeFileName).isFile())
return readAll(sizeFileName, errorMessage);
diff --git a/src/designer/src/lib/shared/newformwidget.ui b/src/designer/src/lib/shared/newformwidget.ui
index c45e2c00a..8cf6f638b 100644
--- a/src/designer/src/lib/shared/newformwidget.ui
+++ b/src/designer/src/lib/shared/newformwidget.ui
@@ -1,32 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <comment>*********************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-*********************************************************************</comment>
+<comment>
+* Copyright (C) 2016 The Qt Company Ltd.
+* SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+</comment>
<class>qdesigner_internal::NewFormWidget</class>
<widget class="QWidget" name="qdesigner_internal::NewFormWidget">
<property name="geometry">
diff --git a/src/designer/src/lib/shared/newformwidget_p.h b/src/designer/src/lib/shared/newformwidget_p.h
index c7a5e2a08..d9acbd2a3 100644
--- a/src/designer/src/lib/shared/newformwidget_p.h
+++ b/src/designer/src/lib/shared/newformwidget_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef NEWFORMWIDGET_H
#define NEWFORMWIDGET_H
@@ -86,9 +61,9 @@ public:
const qdesigner_internal::DeviceProfile &dp);
private slots:
- void on_treeWidget_itemActivated(QTreeWidgetItem *item);
- void on_treeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *);
- void on_treeWidget_itemPressed(QTreeWidgetItem *item);
+ void treeWidgetItemActivated(QTreeWidgetItem *item);
+ void treeWidgetCurrentItemChanged(QTreeWidgetItem *current);
+ void treeWidgetItemPressed(QTreeWidgetItem *item);
void slotDeviceProfileIndexChanged(int idx);
private:
@@ -112,7 +87,7 @@ private:
bool showCurrentItemPixmap();
// Pixmap cache (item, profile combo index)
- using ItemPixmapCacheKey = QPair<const QTreeWidgetItem *, int>;
+ using ItemPixmapCacheKey = std::pair<const QTreeWidgetItem *, int>;
using ItemPixmapCache = QMap<ItemPixmapCacheKey, QPixmap>;
ItemPixmapCache m_itemPixmapCache;
diff --git a/src/designer/src/lib/shared/orderdialog.cpp b/src/designer/src/lib/shared/orderdialog.cpp
index 51389a974..faa13501a 100644
--- a/src/designer/src/lib/shared/orderdialog.cpp
+++ b/src/designer/src/lib/shared/orderdialog.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "orderdialog_p.h"
#include "iconloader_p.h"
@@ -38,19 +13,20 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
// OrderDialog: Used to reorder the pages of QStackedWidget and QToolBox.
// Provides up and down buttons as well as DnD via QAbstractItemView::InternalMove mode
namespace qdesigner_internal {
OrderDialog::OrderDialog(QWidget *parent) :
QDialog(parent),
- m_ui(new Ui::OrderDialog),
+ m_ui(new QT_PREPEND_NAMESPACE(qdesigner_internal)::Ui::OrderDialog),
m_format(PageOrderFormat)
{
m_ui->setupUi(this);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
- m_ui->upButton->setIcon(createIconSet(QString::fromUtf8("up.png")));
- m_ui->downButton->setIcon(createIconSet(QString::fromUtf8("down.png")));
+ m_ui->upButton->setIcon(createIconSet("up.png"_L1));
+ m_ui->downButton->setIcon(createIconSet("down.png"_L1));
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
connect(m_ui->buttonBox->button(QDialogButtonBox::Reset), &QAbstractButton::clicked,
this, &OrderDialog::slotReset);
@@ -59,6 +35,11 @@ OrderDialog::OrderDialog(QWidget *parent) :
connect(m_ui->pageList->model(), &QAbstractItemModel::rowsRemoved,
this, &OrderDialog::slotEnableButtonsAfterDnD);
+ connect(m_ui->upButton, &QAbstractButton::clicked, this, &OrderDialog::upButtonClicked);
+ connect(m_ui->downButton, &QAbstractButton::clicked, this, &OrderDialog::downButtonClicked);
+ connect(m_ui->pageList, &QListWidget::currentRowChanged,
+ this, &OrderDialog::pageListCurrentRowChanged);
+
m_ui->upButton->setEnabled(false);
m_ui->downButton->setEnabled(false);
}
@@ -79,17 +60,16 @@ void OrderDialog::setPageList(const QWidgetList &pages)
// The old index is set as user data on the item instead of the QWidget*
// because DnD is enabled which requires the user data to serializable
m_orderMap.clear();
- const int count = pages.count();
- for (int i=0; i < count; ++i)
- m_orderMap.insert(i, pages.at(i));
+ const qsizetype count = pages.size();
+ for (qsizetype i = 0; i < count; ++i)
+ m_orderMap.insert(int(i), pages.at(i));
buildList();
}
void OrderDialog::buildList()
{
m_ui->pageList->clear();
- const OrderMap::const_iterator cend = m_orderMap.constEnd();
- for (OrderMap::const_iterator it = m_orderMap.constBegin(); it != cend; ++it) {
+ for (auto it = m_orderMap.cbegin(), cend = m_orderMap.cend(); it != cend; ++it) {
QListWidgetItem *item = new QListWidgetItem();
const int index = it.key();
switch (m_format) {
@@ -124,7 +104,7 @@ QWidgetList OrderDialog::pageList() const
return rc;
}
-void OrderDialog::on_upButton_clicked()
+void OrderDialog::upButtonClicked()
{
const int row = m_ui->pageList->currentRow();
if (row <= 0)
@@ -134,7 +114,7 @@ void OrderDialog::on_upButton_clicked()
m_ui->pageList->setCurrentRow(row - 1);
}
-void OrderDialog::on_downButton_clicked()
+void OrderDialog::downButtonClicked()
{
const int row = m_ui->pageList->currentRow();
if (row == -1 || row == m_ui->pageList->count() - 1)
@@ -149,7 +129,7 @@ void OrderDialog::slotEnableButtonsAfterDnD()
enableButtons(m_ui->pageList->currentRow());
}
-void OrderDialog::on_pageList_currentRowChanged(int r)
+void OrderDialog::pageListCurrentRowChanged(int r)
{
enableButtons(r);
}
diff --git a/src/designer/src/lib/shared/orderdialog.ui b/src/designer/src/lib/shared/orderdialog.ui
index d56cb65cd..0af976dfe 100644
--- a/src/designer/src/lib/shared/orderdialog.ui
+++ b/src/designer/src/lib/shared/orderdialog.ui
@@ -1,31 +1,8 @@
<ui version="4.0" >
- <comment>*********************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-*********************************************************************</comment>
+<comment>
+* Copyright (C) 2016 The Qt Company Ltd.
+* SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+</comment>
<class>qdesigner_internal::OrderDialog</class>
<widget class="QDialog" name="qdesigner_internal::OrderDialog" >
<property name="geometry" >
diff --git a/src/designer/src/lib/shared/orderdialog_p.h b/src/designer/src/lib/shared/orderdialog_p.h
index 5c28be6e5..2fb506f07 100644
--- a/src/designer/src/lib/shared/orderdialog_p.h
+++ b/src/designer/src/lib/shared/orderdialog_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -78,9 +53,9 @@ public:
Format format() const { return m_format; }
private slots:
- void on_upButton_clicked();
- void on_downButton_clicked();
- void on_pageList_currentRowChanged(int row);
+ void upButtonClicked();
+ void downButtonClicked();
+ void pageListCurrentRowChanged(int row);
void slotEnableButtonsAfterDnD();
void slotReset();
@@ -88,8 +63,7 @@ private:
void buildList();
void enableButtons(int r);
- typedef QMap<int, QWidget*> OrderMap;
- OrderMap m_orderMap;
+ QMap<int, QWidget *> m_orderMap;
Ui::OrderDialog* m_ui;
Format m_format;
};
diff --git a/src/designer/src/lib/shared/plaintexteditor.cpp b/src/designer/src/lib/shared/plaintexteditor.cpp
index 91f842f62..ad6708c9f 100644
--- a/src/designer/src/lib/shared/plaintexteditor.cpp
+++ b/src/designer/src/lib/shared/plaintexteditor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "plaintexteditor_p.h"
@@ -38,9 +13,10 @@
QT_BEGIN_NAMESPACE
-static const char *PlainTextDialogC = "PlainTextDialog";
-static const char *Geometry = "Geometry";
+using namespace Qt::StringLiterals;
+static constexpr auto PlainTextDialogC = "PlainTextDialog"_L1;
+static constexpr auto PlainTextEditorGeometryC = "Geometry"_L1;
namespace qdesigner_internal {
@@ -50,7 +26,6 @@ PlainTextEditorDialog::PlainTextEditorDialog(QDesignerFormEditorInterface *core,
m_core(core)
{
setWindowTitle(tr("Edit text"));
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QVBoxLayout *vlayout = new QVBoxLayout(this);
vlayout->addWidget(m_editor);
@@ -63,10 +38,10 @@ PlainTextEditorDialog::PlainTextEditorDialog(QDesignerFormEditorInterface *core,
vlayout->addWidget(buttonBox);
QDesignerSettingsInterface *settings = core->settingsManager();
- settings->beginGroup(QLatin1String(PlainTextDialogC));
+ settings->beginGroup(PlainTextDialogC);
- if (settings->contains(QLatin1String(Geometry)))
- restoreGeometry(settings->value(QLatin1String(Geometry)).toByteArray());
+ if (settings->contains(PlainTextEditorGeometryC))
+ restoreGeometry(settings->value(PlainTextEditorGeometryC).toByteArray());
settings->endGroup();
}
@@ -74,9 +49,9 @@ PlainTextEditorDialog::PlainTextEditorDialog(QDesignerFormEditorInterface *core,
PlainTextEditorDialog::~PlainTextEditorDialog()
{
QDesignerSettingsInterface *settings = m_core->settingsManager();
- settings->beginGroup(QLatin1String(PlainTextDialogC));
+ settings->beginGroup(PlainTextDialogC);
- settings->setValue(QLatin1String(Geometry), saveGeometry());
+ settings->setValue(PlainTextEditorGeometryC, saveGeometry());
settings->endGroup();
}
diff --git a/src/designer/src/lib/shared/plaintexteditor_p.h b/src/designer/src/lib/shared/plaintexteditor_p.h
index b628b8c0d..988a5f5cb 100644
--- a/src/designer/src/lib/shared/plaintexteditor_p.h
+++ b/src/designer/src/lib/shared/plaintexteditor_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/plugindialog.cpp b/src/designer/src/lib/shared/plugindialog.cpp
index de96d55d2..fb4ec4e6a 100644
--- a/src/designer/src/lib/shared/plugindialog.cpp
+++ b/src/designer/src/lib/shared/plugindialog.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "plugindialog_p.h"
@@ -47,11 +22,14 @@
# include <QtGui/QClipboard>
#endif
+#include <QtCore/qdir.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qpluginloader.h>
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
enum { ErrorItemRole = Qt::UserRole + 1 };
namespace qdesigner_internal {
@@ -109,7 +87,7 @@ void PluginDialog::populateTreeWidget()
QPluginLoader loader(fileName);
const QFileInfo fileInfo(fileName);
- QTreeWidgetItem *pluginItem = setPluginItem(topLevelItem, fileInfo.fileName(), boldFont);
+ QTreeWidgetItem *pluginItem = setPluginItem(topLevelItem, fileInfo, boldFont);
if (QObject *plugin = loader.instance()) {
if (const QDesignerCustomWidgetCollectionInterface *c = qobject_cast<QDesignerCustomWidgetCollectionInterface*>(plugin)) {
@@ -130,10 +108,10 @@ void PluginDialog::populateTreeWidget()
const QFont boldFont = topLevelItem->font(0);
for (const QString &plugin : notLoadedPlugins) {
const QString failureReason = pluginManager->failureReason(plugin);
- const QString htmlFailureReason = QLatin1String("<html><head/><body><p>")
+ const QString htmlFailureReason = "<html><head/><body><p>"_L1
+ failureReason.toHtmlEscaped()
- + QLatin1String("</p></body></html>");
- QTreeWidgetItem *pluginItem = setPluginItem(topLevelItem, plugin, boldFont);
+ + "</p></body></html>"_L1;
+ QTreeWidgetItem *pluginItem = setPluginItem(topLevelItem, QFileInfo(plugin), boldFont);
auto errorItem = setItem(pluginItem, failureReason,
htmlFailureReason, QString(), QIcon());
errorItem->setData(0, ErrorItemRole, QVariant(true));
@@ -141,10 +119,10 @@ void PluginDialog::populateTreeWidget()
}
if (ui.treeWidget->topLevelItemCount() == 0) {
- ui.label->setText(tr("Qt Designer couldn't find any plugins"));
+ ui.label->setText(tr("Qt Widgets Designer couldn't find any plugins"));
ui.treeWidget->hide();
} else {
- ui.label->setText(tr("Qt Designer found the following plugins"));
+ ui.label->setText(tr("Qt Widgets Designer found the following plugins"));
}
}
@@ -163,11 +141,15 @@ QTreeWidgetItem* PluginDialog::setTopLevelItem(const QString &itemName)
}
QTreeWidgetItem* PluginDialog::setPluginItem(QTreeWidgetItem *topLevelItem,
- const QString &itemName, const QFont &font)
+ const QFileInfo &file, const QFont &font)
{
QTreeWidgetItem *pluginItem = new QTreeWidgetItem(topLevelItem);
+ QString toolTip = QDir::toNativeSeparators(file.absoluteFilePath());
+ if (file.exists())
+ toolTip += u'\n' + file.lastModified().toString();
pluginItem->setFont(0, font);
- pluginItem->setText(0, itemName);
+ pluginItem->setText(0, file.fileName());
+ pluginItem->setToolTip(0, toolTip);
pluginItem->setExpanded(true);
pluginItem->setIcon(0, style()->standardPixmap(QStyle::SP_DirOpenIcon));
diff --git a/src/designer/src/lib/shared/plugindialog.ui b/src/designer/src/lib/shared/plugindialog.ui
index a05199342..39cf22c8b 100644
--- a/src/designer/src/lib/shared/plugindialog.ui
+++ b/src/designer/src/lib/shared/plugindialog.ui
@@ -1,32 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <comment>*********************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-*********************************************************************</comment>
+<comment>
+* Copyright (C) 2016 The Qt Company Ltd.
+* SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+</comment>
<class>PluginDialog</class>
<widget class="QDialog" name="PluginDialog">
<property name="geometry">
diff --git a/src/designer/src/lib/shared/plugindialog_p.h b/src/designer/src/lib/shared/plugindialog_p.h
index 939ce68b1..cbdad6019 100644
--- a/src/designer/src/lib/shared/plugindialog_p.h
+++ b/src/designer/src/lib/shared/plugindialog_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef PLUGINDIALOG_H
#define PLUGINDIALOG_H
@@ -44,6 +19,8 @@
QT_BEGIN_NAMESPACE
+class QFileInfo;
+
class QDesignerFormEditorInterface;
namespace qdesigner_internal {
@@ -62,13 +39,13 @@ private:
void populateTreeWidget();
QTreeWidgetItem* setTopLevelItem(const QString &itemName);
QTreeWidgetItem* setPluginItem(QTreeWidgetItem *topLevelItem,
- const QString &itemName, const QFont &font);
+ const QFileInfo &file, const QFont &font);
QTreeWidgetItem *setItem(QTreeWidgetItem *pluginItem, const QString &name,
const QString &toolTip, const QString &whatsThis,
const QIcon &icon);
QDesignerFormEditorInterface *m_core;
- Ui::PluginDialog ui;
+ QT_PREPEND_NAMESPACE(Ui)::PluginDialog ui;
QIcon interfaceIcon;
QIcon featureIcon;
};
diff --git a/src/designer/src/lib/shared/pluginmanager.cpp b/src/designer/src/lib/shared/pluginmanager.cpp
index 6c39f8e88..cc520997c 100644
--- a/src/designer/src/lib/shared/pluginmanager.cpp
+++ b/src/designer/src/lib/shared/pluginmanager.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "pluginmanager_p.h"
#include "qdesigner_utils_p.h"
@@ -50,21 +25,23 @@
#include <QtCore/qxmlstream.h>
-static const char *uiElementC = "ui";
-static const char *languageAttributeC = "language";
-static const char *widgetElementC = "widget";
-static const char *displayNameAttributeC = "displayname";
-static const char *classAttributeC = "class";
-static const char *customwidgetElementC = "customwidget";
-static const char *extendsElementC = "extends";
-static const char *addPageMethodC = "addpagemethod";
-static const char *propertySpecsC = "propertyspecifications";
-static const char *stringPropertySpecC = "stringpropertyspecification";
-static const char propertyToolTipC[] = "tooltip";
-static const char *stringPropertyNameAttrC = "name";
-static const char *stringPropertyTypeAttrC = "type";
-static const char *stringPropertyNoTrAttrC = "notr";
-static const char *jambiLanguageC = "jambi";
+using namespace Qt::StringLiterals;
+
+static constexpr auto uiElementC = "ui"_L1;
+static constexpr auto languageAttributeC = "language"_L1;
+static constexpr auto widgetElementC = "widget"_L1;
+static constexpr auto displayNameAttributeC = "displayname"_L1;
+static constexpr auto classAttributeC = "class"_L1;
+static constexpr auto customwidgetElementC = "customwidget"_L1;
+static constexpr auto extendsElementC = "extends"_L1;
+static constexpr auto addPageMethodC = "addpagemethod"_L1;
+static constexpr auto propertySpecsC = "propertyspecifications"_L1;
+static constexpr auto stringPropertySpecC = "stringpropertyspecification"_L1;
+static constexpr auto propertyToolTipC = "tooltip"_L1;
+static constexpr auto stringPropertyNameAttrC = "name"_L1;
+static constexpr auto stringPropertyTypeAttrC = "type"_L1;
+static constexpr auto stringPropertyNoTrAttrC = "notr"_L1;
+static constexpr auto jambiLanguageC = "jambi"_L1;
enum { debugPluginManager = 0 };
@@ -99,9 +76,9 @@ QStringList QDesignerPluginManager::defaultPluginPaths()
const QStringList path_list = QCoreApplication::libraryPaths();
for (const QString &path : path_list)
- result.append(path + u"/designer"_qs);
+ result.append(path + "/designer"_L1);
- result.append(qdesigner_internal::dataDirectory() + u"/plugins"_qs);
+ result.append(qdesigner_internal::dataDirectory() + "/plugins"_L1);
return result;
}
@@ -111,11 +88,11 @@ QStringList QDesignerPluginManager::defaultPluginPaths()
static inline QString getDesignerLanguage(QDesignerFormEditorInterface *core)
{
if (QDesignerLanguageExtension *lang = qt_extension<QDesignerLanguageExtension *>(core->extensionManager(), core)) {
- if (lang->uiExtension() == QStringLiteral("jui"))
- return QLatin1String(jambiLanguageC);
- return QStringLiteral("unknown");
+ if (lang->uiExtension() == "jui"_L1)
+ return jambiLanguageC;
+ return u"unknown"_s;
}
- return QStringLiteral("c++");
+ return u"c++"_s;
}
// ---------------- QDesignerCustomWidgetSharedData
@@ -123,9 +100,7 @@ static inline QString getDesignerLanguage(QDesignerFormEditorInterface *core)
class QDesignerCustomWidgetSharedData : public QSharedData {
public:
// Type of a string property
- using StringPropertyType = QPair<qdesigner_internal::TextPropertyValidationMode, bool>;
- using StringPropertyTypeMap = QHash<QString, StringPropertyType>;
- using PropertyToolTipMap = QHash<QString, QString>;
+ using StringPropertyType = std::pair<qdesigner_internal::TextPropertyValidationMode, bool>;
explicit QDesignerCustomWidgetSharedData(const QString &thePluginPath) : pluginPath(thePluginPath) {}
void clearXML();
@@ -138,8 +113,8 @@ public:
QString xmlAddPageMethod;
QString xmlExtends;
- StringPropertyTypeMap xmlStringPropertyTypeMap;
- PropertyToolTipMap propertyToolTipMap;
+ QHash<QString, StringPropertyType> xmlStringPropertyTypeMap;
+ QHash<QString, QString> propertyToolTipMap;
};
void QDesignerCustomWidgetSharedData::clearXML()
@@ -211,7 +186,7 @@ QString QDesignerCustomWidgetData::pluginPath() const
bool QDesignerCustomWidgetData::xmlStringPropertyType(const QString &name, StringPropertyType *type) const
{
- QDesignerCustomWidgetSharedData::StringPropertyTypeMap::const_iterator it = m_d->xmlStringPropertyTypeMap.constFind(name);
+ const auto it = m_d->xmlStringPropertyTypeMap.constFind(name);
if (it == m_d->xmlStringPropertyTypeMap.constEnd()) {
*type = StringPropertyType(qdesigner_internal::ValidationRichText, true);
return false;
@@ -262,19 +237,19 @@ static inline QString msgAttributeMissing(const QString &name)
static qdesigner_internal::TextPropertyValidationMode typeStringToType(const QString &v, bool *ok)
{
*ok = true;
- if (v == QStringLiteral("multiline"))
+ if (v == "multiline"_L1)
return qdesigner_internal::ValidationMultiLine;
- if (v == QStringLiteral("richtext"))
+ if (v == "richtext"_L1)
return qdesigner_internal::ValidationRichText;
- if (v == QStringLiteral("stylesheet"))
+ if (v == "stylesheet"_L1)
return qdesigner_internal::ValidationStyleSheet;
- if (v == QStringLiteral("singleline"))
+ if (v == "singleline"_L1)
return qdesigner_internal::ValidationSingleLine;
- if (v == QStringLiteral("objectname"))
+ if (v == "objectname"_L1)
return qdesigner_internal::ValidationObjectName;
- if (v == QStringLiteral("objectnamescope"))
+ if (v == "objectnamescope"_L1)
return qdesigner_internal::ValidationObjectNameScope;
- if (v == QStringLiteral("url"))
+ if (v == "url"_L1)
return qdesigner_internal::ValidationURL;
*ok = false;
return qdesigner_internal::ValidationRichText;
@@ -284,12 +259,12 @@ static bool parsePropertySpecs(QXmlStreamReader &sr,
QDesignerCustomWidgetSharedData *data,
QString *errorMessage)
{
- const QString propertySpecs = QLatin1String(propertySpecsC);
- const QString stringPropertySpec = QLatin1String(stringPropertySpecC);
- const QString propertyToolTip = QLatin1String(propertyToolTipC);
- const QString stringPropertyTypeAttr = QLatin1String(stringPropertyTypeAttrC);
- const QString stringPropertyNoTrAttr = QLatin1String(stringPropertyNoTrAttrC);
- const QString stringPropertyNameAttr = QLatin1String(stringPropertyNameAttrC);
+ const QString propertySpecs = propertySpecsC;
+ const QString stringPropertySpec = stringPropertySpecC;
+ const QString propertyToolTip = propertyToolTipC;
+ const QString stringPropertyTypeAttr = stringPropertyTypeAttrC;
+ const QString stringPropertyNoTrAttr = stringPropertyNoTrAttrC;
+ const QString stringPropertyNameAttr = stringPropertyNameAttrC;
while (!sr.atEnd()) {
switch(sr.readNext()) {
@@ -309,7 +284,7 @@ static bool parsePropertySpecs(QXmlStreamReader &sr,
return false;
}
bool typeOk;
- const bool noTr = notrS == QStringLiteral("true") || notrS == QStringLiteral("1");
+ const bool noTr = notrS == "true"_L1 || notrS == "1"_L1;
QDesignerCustomWidgetSharedData::StringPropertyType v(typeStringToType(type, &typeOk), !noTr);
if (!typeOk) {
*errorMessage = QDesignerPluginManager::tr("'%1' is not a valid string property specification.").arg(type);
@@ -332,6 +307,7 @@ static bool parsePropertySpecs(QXmlStreamReader &sr,
case QXmlStreamReader::EndElement: // Outer </stringproperties>
if (sr.name() == propertySpecs)
return true;
+ break;
default:
break;
}
@@ -355,8 +331,8 @@ QDesignerCustomWidgetData::ParseResult
ParseResult rc = ParseOk;
// Parse for the (optional) <ui> or the first <widget> element
QStringList elements;
- elements.push_back(QLatin1String(uiElementC));
- elements.push_back(QLatin1String(widgetElementC));
+ elements.push_back(uiElementC);
+ elements.push_back(widgetElementC);
for (int i = 0; i < 2 && !foundWidget; i++) {
switch (findElement(elements, sr)) {
case FindError:
@@ -367,13 +343,13 @@ QDesignerCustomWidgetData::ParseResult
return ParseError;
case 0: { // <ui>
const QXmlStreamAttributes attributes = sr.attributes();
- data.xmlLanguage = attributes.value(QLatin1String(languageAttributeC)).toString();
- data.xmlDisplayName = attributes.value(QLatin1String(displayNameAttributeC)).toString();
+ data.xmlLanguage = attributes.value(languageAttributeC).toString();
+ data.xmlDisplayName = attributes.value(displayNameAttributeC).toString();
foundUI = true;
}
break;
case 1: // <widget>: Do some sanity checks
- data.xmlClassName = sr.attributes().value(QLatin1String(classAttributeC)).toString();
+ data.xmlClassName = sr.attributes().value(classAttributeC).toString();
if (data.xmlClassName.isEmpty()) {
*errorMessage = QDesignerPluginManager::tr("The class attribute for the class %1 is missing.").arg(name);
rc = ParseWarning;
@@ -391,7 +367,7 @@ QDesignerCustomWidgetData::ParseResult
if (!foundUI)
return rc;
elements.clear();
- elements.push_back(QLatin1String(customwidgetElementC));
+ elements.push_back(customwidgetElementC);
switch (findElement(elements, sr)) {
case FindError:
*errorMessage = msgXmlError(name, sr.errorString());
@@ -402,10 +378,7 @@ QDesignerCustomWidgetData::ParseResult
break;
}
// Find <extends>, <addPageMethod>, <stringproperties>
- elements.clear();
- elements.push_back(QLatin1String(extendsElementC));
- elements.push_back(QLatin1String(addPageMethodC));
- elements.push_back(QLatin1String(propertySpecsC));
+ elements = {extendsElementC, addPageMethodC, propertySpecsC};
while (true) {
switch (findElement(elements, sr)) {
case FindError:
@@ -442,7 +415,7 @@ QDesignerCustomWidgetData::ParseResult
class QDesignerPluginManagerPrivate {
public:
- using ClassNamePropertyNameKey = QPair<QString, QString>;
+ using ClassNamePropertyNameKey = std::pair<QString, QString>;
QDesignerPluginManagerPrivate(QDesignerFormEditorInterface *core);
@@ -460,8 +433,7 @@ class QDesignerPluginManagerPrivate {
// TODO: QPluginLoader also caches invalid plugins -> This seems to be dead code
QStringList m_disabledPlugins;
- typedef QMap<QString, QString> FailedPluginMap;
- FailedPluginMap m_failedPlugins;
+ QMap<QString, QString> m_failedPlugins;
// Synced lists of custom widgets and their data. Note that the list
// must be ordered for collections to appear in order.
@@ -544,12 +516,18 @@ void QDesignerPluginManagerPrivate::addCustomWidgets(QObject *o,
// As of 4.4, the header will be distributed with the Eclipse plugin.
QDesignerPluginManager::QDesignerPluginManager(QDesignerFormEditorInterface *core) :
+ QDesignerPluginManager(QStringList{}, core)
+{
+}
+
+QDesignerPluginManager::QDesignerPluginManager(const QStringList &pluginPaths,
+ QDesignerFormEditorInterface *core) :
QObject(core),
m_d(new QDesignerPluginManagerPrivate(core))
{
- m_d->m_pluginPaths = defaultPluginPaths();
+ m_d->m_pluginPaths = pluginPaths.isEmpty() ? defaultPluginPaths() : pluginPaths;
const QSettings settings(qApp->organizationName(), QDesignerQSettings::settingsApplicationName());
- m_d->m_disabledPlugins = unique(settings.value(QStringLiteral("PluginManager/DisabledPlugins")).toStringList());
+ m_d->m_disabledPlugins = unique(settings.value("PluginManager/DisabledPlugins").toStringList());
// Register plugins
updateRegisteredPlugins();
@@ -584,15 +562,14 @@ QStringList QDesignerPluginManager::findPlugins(const QString &path)
// Load symbolic links but make sure all file names are unique as not
// to fall for something like 'libplugin.so.1 -> libplugin.so'
QStringList result;
- const QFileInfoList::const_iterator icend = infoList.constEnd();
- for (QFileInfoList::const_iterator it = infoList.constBegin(); it != icend; ++it) {
+ for (const auto &fi : infoList) {
QString fileName;
- if (it->isSymLink()) {
- const QFileInfo linkTarget = QFileInfo(it->symLinkTarget());
+ if (fi.isSymLink()) {
+ const QFileInfo linkTarget = QFileInfo(fi.symLinkTarget());
if (linkTarget.exists() && linkTarget.isFile())
fileName = linkTarget.absoluteFilePath();
} else {
- fileName = it->absoluteFilePath();
+ fileName = fi.absoluteFilePath();
}
if (!fileName.isEmpty() && QLibrary::isLibrary(fileName) && !result.contains(fileName))
result += fileName;
@@ -651,7 +628,7 @@ void QDesignerPluginManager::updateRegisteredPlugins()
if (debugPluginManager)
qDebug() << Q_FUNC_INFO;
m_d->m_registeredPlugins.clear();
- for (const QString &path : qAsConst(m_d->m_pluginPaths))
+ for (const QString &path : std::as_const(m_d->m_pluginPaths))
registerPath(path);
}
@@ -661,7 +638,7 @@ bool QDesignerPluginManager::registerNewPlugins()
qDebug() << Q_FUNC_INFO;
const int before = m_d->m_registeredPlugins.size();
- for (const QString &path : qAsConst(m_d->m_pluginPaths))
+ for (const QString &path : std::as_const(m_d->m_pluginPaths))
registerPath(path);
const bool newPluginsFound = m_d->m_registeredPlugins.size() > before;
// We force a re-initialize as Jambi collection might return
@@ -693,7 +670,7 @@ void QDesignerPluginManager::registerPlugin(const QString &plugin)
QPluginLoader loader(plugin);
if (loader.isLoaded() || loader.load()) {
m_d->m_registeredPlugins += plugin;
- QDesignerPluginManagerPrivate::FailedPluginMap::iterator fit = m_d->m_failedPlugins.find(plugin);
+ const auto fit = m_d->m_failedPlugins.find(plugin);
if (fit != m_d->m_failedPlugins.end())
m_d->m_failedPlugins.erase(fit);
return;
@@ -708,8 +685,8 @@ void QDesignerPluginManager::registerPlugin(const QString &plugin)
bool QDesignerPluginManager::syncSettings()
{
QSettings settings(qApp->organizationName(), QDesignerQSettings::settingsApplicationName());
- settings.beginGroup(QStringLiteral("PluginManager"));
- settings.setValue(QStringLiteral("DisabledPlugins"), m_d->m_disabledPlugins);
+ settings.beginGroup("PluginManager");
+ settings.setValue("DisabledPlugins", m_d->m_disabledPlugins);
settings.endGroup();
return settings.status() == QSettings::NoError;
}
@@ -732,7 +709,7 @@ void QDesignerPluginManager::ensureInitialized()
for (QObject *o : staticPluginObjects)
m_d->addCustomWidgets(o, staticPluginPath, designerLanguage);
}
- for (const QString &plugin : qAsConst(m_d->m_registeredPlugins)) {
+ for (const QString &plugin : std::as_const(m_d->m_registeredPlugins)) {
if (QObject *o = instance(plugin))
m_d->addCustomWidgets(o, plugin, designerLanguage);
}
@@ -756,8 +733,7 @@ QDesignerCustomWidgetData QDesignerPluginManager::customWidgetData(QDesignerCust
QDesignerCustomWidgetData QDesignerPluginManager::customWidgetData(const QString &name) const
{
- const int count = m_d->m_customWidgets.size();
- for (int i = 0; i < count; i++)
+ for (qsizetype i = 0, count = m_d->m_customWidgets.size(); i < count; ++i)
if (m_d->m_customWidgets.at(i)->name() == name)
return m_d->m_customWidgetData.at(i);
return QDesignerCustomWidgetData();
diff --git a/src/designer/src/lib/shared/pluginmanager_p.h b/src/designer/src/lib/shared/pluginmanager_p.h
index 373d0fe51..be0f4bfd7 100644
--- a/src/designer/src/lib/shared/pluginmanager_p.h
+++ b/src/designer/src/lib/shared/pluginmanager_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -61,7 +36,7 @@ class QDesignerCustomWidgetSharedData;
class QDESIGNER_SHARED_EXPORT QDesignerCustomWidgetData {
public:
// StringPropertyType: validation mode and translatable flag.
- typedef QPair<qdesigner_internal::TextPropertyValidationMode, bool> StringPropertyType;
+ using StringPropertyType = std::pair<qdesigner_internal::TextPropertyValidationMode, bool>;
explicit QDesignerCustomWidgetData(const QString &pluginPath = QString());
@@ -102,6 +77,8 @@ public:
using CustomWidgetList = QList<QDesignerCustomWidgetInterface *>;
explicit QDesignerPluginManager(QDesignerFormEditorInterface *core);
+ explicit QDesignerPluginManager(const QStringList &pluginPaths,
+ QDesignerFormEditorInterface *core);
~QDesignerPluginManager() override;
QDesignerFormEditorInterface *core() const;
@@ -129,6 +106,8 @@ public:
bool registerNewPlugins();
+ static QStringList defaultPluginPaths();
+
public slots:
bool syncSettings();
void ensureInitialized();
@@ -139,8 +118,6 @@ private:
void registerPlugin(const QString &plugin);
private:
- static QStringList defaultPluginPaths();
-
QDesignerPluginManagerPrivate *m_d;
};
diff --git a/src/designer/src/lib/shared/previewconfigurationwidget.cpp b/src/designer/src/lib/shared/previewconfigurationwidget.cpp
index bf8d0b60e..49a654856 100644
--- a/src/designer/src/lib/shared/previewconfigurationwidget.cpp
+++ b/src/designer/src/lib/shared/previewconfigurationwidget.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "previewconfigurationwidget_p.h"
#include "ui_previewconfigurationwidget.h"
@@ -48,15 +23,15 @@
#include <QtCore/qfileinfo.h>
#include <QtCore/qshareddata.h>
-
-static const char *skinResourcePathC = ":/skins/";
-
QT_BEGIN_NAMESPACE
-static const char *skinExtensionC = "skin";
+using namespace Qt::StringLiterals;
+
+static constexpr auto skinResourcePathC = ":/skins/"_L1;
+static constexpr auto skinExtensionC = "skin"_L1;
// Pair of skin name, path
-typedef QPair<QString, QString> SkinNamePath;
+using SkinNamePath = std::pair<QString, QString>;
using Skins = QList<SkinNamePath>;
enum { SkinComboNoneIndex = 0 };
@@ -64,16 +39,12 @@ enum { SkinComboNoneIndex = 0 };
static const Skins &defaultSkins() {
static Skins rc;
if (rc.isEmpty()) {
- const QString skinPath = QLatin1String(skinResourcePathC);
- QString pattern = QStringLiteral("*.");
- pattern += QLatin1String(skinExtensionC);
- const QDir dir(skinPath, pattern);
+ const QDir dir(skinResourcePathC, "*."_L1 + skinExtensionC);
const QFileInfoList list = dir.entryInfoList(QDir::Dirs|QDir::NoDotAndDotDot, QDir::Name);
if (list.isEmpty())
return rc;
- const QFileInfoList::const_iterator lcend = list.constEnd();
- for (QFileInfoList::const_iterator it = list.constBegin(); it != lcend; ++it)
- rc.push_back(SkinNamePath(it->baseName(), it->filePath()));
+ for (const auto &fi : list)
+ rc.append(SkinNamePath(fi.baseName(), fi.filePath()));
}
return rc;
}
@@ -109,7 +80,7 @@ private:
const QString m_defaultStyle;
QGroupBox *m_parent;
- Ui::PreviewConfigurationWidget m_ui;
+ QT_PREPEND_NAMESPACE(Ui)::PreviewConfigurationWidget m_ui;
int m_firstUserSkinIndex;
int m_browseSkinIndex;
@@ -134,17 +105,18 @@ PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate::PreviewConfigurat
// sheet
m_ui.m_appStyleSheetLineEdit->setTextPropertyValidationMode(qdesigner_internal::ValidationStyleSheet);
- m_ui.m_appStyleSheetClearButton->setIcon(qdesigner_internal::createIconSet(QString::fromUtf8("resetproperty.png")));
+ m_ui.m_appStyleSheetClearButton->setIcon(qdesigner_internal::createIconSet("resetproperty.png"_L1));
QObject::connect(m_ui.m_appStyleSheetClearButton, &QAbstractButton::clicked,
m_ui.m_appStyleSheetLineEdit, &qdesigner_internal::TextPropertyEditor::clear);
- m_ui.m_skinRemoveButton->setIcon(qdesigner_internal::createIconSet(QString::fromUtf8("editdelete.png")));
+ m_ui.m_skinRemoveButton->setIcon(qdesigner_internal::createIconSet(QIcon::ThemeIcon::EditDelete,
+ "editdelete.png"_L1));
// skins: find default skins (resources)
m_ui.m_skinRemoveButton->setEnabled(false);
Skins skins = defaultSkins();
skins.push_front(SkinNamePath(PreviewConfigurationWidget::tr("None"), QString()));
- for (const auto &skin : qAsConst(skins))
+ for (const auto &skin : std::as_const(skins))
m_ui.m_skinCombo->addItem(skin.first, QVariant(skin.second));
m_browseSkinIndex = m_firstUserSkinIndex = skins.size();
m_ui.m_skinCombo->addItem(PreviewConfigurationWidget::tr("Browse..."), QString());
@@ -172,14 +144,12 @@ void PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate::addUserSkins
{
if (files.isEmpty())
return;
- const QStringList ::const_iterator fcend = files.constEnd();
- for (QStringList::const_iterator it = files.constBegin(); it != fcend; ++it) {
- const QFileInfo fi(*it);
- if (fi.isDir() && fi.isReadable()) {
- m_ui.m_skinCombo->insertItem(m_browseSkinIndex++, fi.baseName(), QVariant(*it));
- } else {
- qWarning() << "Unable to access the skin directory '" << *it << "'.";
- }
+ for (const auto &f : files) {
+ const QFileInfo fi(f);
+ if (fi.isDir() && fi.isReadable())
+ m_ui.m_skinCombo->insertItem(m_browseSkinIndex++, fi.baseName(), QVariant(f));
+ else
+ qWarning() << "Unable to access the skin directory '" << f << "'.";
}
}
@@ -268,7 +238,7 @@ int PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate::browseSkin()
dlg.setOption(QFileDialog::ShowDirsOnly);
const QString title = tr("Load Custom Device Skin");
dlg.setWindowTitle(title);
- dlg.setNameFilter(tr("All QVFB Skins (*.%1)").arg(QLatin1String(skinExtensionC)));
+ dlg.setNameFilter(tr("All QVFB Skins (*.%1)").arg(skinExtensionC));
int rc = m_lastSkinIndex;
do {
diff --git a/src/designer/src/lib/shared/previewconfigurationwidget_p.h b/src/designer/src/lib/shared/previewconfigurationwidget_p.h
index c469cef2d..ec5e2bed3 100644
--- a/src/designer/src/lib/shared/previewconfigurationwidget_p.h
+++ b/src/designer/src/lib/shared/previewconfigurationwidget_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/previewmanager.cpp b/src/designer/src/lib/shared/previewmanager.cpp
index 3d04346f3..ce9a58e72 100644
--- a/src/designer/src/lib/shared/previewmanager.cpp
+++ b/src/designer/src/lib/shared/previewmanager.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "formwindowbase_p.h"
#include "previewmanager_p.h"
@@ -58,10 +33,13 @@
#include <QtCore/qdebug.h>
#include <QtCore/qlist.h>
#include <QtCore/qmap.h>
+#include <QtCore/qpointer.h>
#include <QtCore/qshareddata.h>
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
static inline int compare(const qdesigner_internal::PreviewConfiguration &pc1, const qdesigner_internal::PreviewConfiguration &pc2)
{
int rc = pc1.style().compare(pc2.style());
@@ -73,7 +51,7 @@ static inline int compare(const qdesigner_internal::PreviewConfiguration &pc1, c
return pc1.deviceSkin().compare(pc2.deviceSkin());
}
-namespace {
+namespace qdesigner_internal {
// ------ PreviewData (data associated with a preview window)
struct PreviewData {
PreviewData(const QPointer<QWidget> &widget, const QDesignerFormWindowInterface *formWindow, const qdesigner_internal::PreviewConfiguration &pc);
@@ -90,9 +68,6 @@ namespace {
m_configuration(pc)
{
}
-}
-
-namespace qdesigner_internal {
/* In designer, we have the situation that laid-out maincontainers have
* a geometry set (which might differ from their sizeHint()). The QGraphicsItem
@@ -433,9 +408,9 @@ void ZoomablePreviewDeviceSkin::fitWidget(const QSize &size)
// ------------- PreviewConfiguration
-static const char *styleKey = "Style";
-static const char *appStyleSheetKey = "AppStyleSheet";
-static const char *skinKey = "Skin";
+static constexpr auto styleKey = "Style"_L1;
+static constexpr auto appStyleSheetKey = "AppStyleSheet"_L1;
+static constexpr auto skinKey = "Skin"_L1;
PreviewConfiguration::PreviewConfiguration() :
m_d(new PreviewConfigurationData)
@@ -503,30 +478,29 @@ void PreviewConfiguration::toSettings(const QString &prefix, QDesignerSettingsIn
{
const PreviewConfigurationData &d = *m_d;
settings->beginGroup(prefix);
- settings->setValue(QLatin1String(styleKey), d.m_style);
- settings->setValue(QLatin1String(appStyleSheetKey), d.m_applicationStyleSheet);
- settings->setValue(QLatin1String(skinKey), d.m_deviceSkin);
+ settings->setValue(styleKey, d.m_style);
+ settings->setValue(appStyleSheetKey, d.m_applicationStyleSheet);
+ settings->setValue(skinKey, d.m_deviceSkin);
settings->endGroup();
}
void PreviewConfiguration::fromSettings(const QString &prefix, const QDesignerSettingsInterface *settings)
{
clear();
- QString key = prefix;
- key += QLatin1Char('/');
- const int prefixSize = key.size();
+ QString key = prefix + u'/';
+ const auto prefixSize = key.size();
PreviewConfigurationData &d = *m_d;
const QVariant emptyString = QVariant(QString());
- key += QLatin1String(styleKey);
+ key += styleKey;
d.m_style = settings->value(key, emptyString).toString();
- key.replace(prefixSize, key.size() - prefixSize, QLatin1String(appStyleSheetKey));
+ key.replace(prefixSize, key.size() - prefixSize, appStyleSheetKey);
d.m_applicationStyleSheet = settings->value(key, emptyString).toString();
- key.replace(prefixSize, key.size() - prefixSize, QLatin1String(skinKey));
+ key.replace(prefixSize, key.size() - prefixSize, skinKey);
d.m_deviceSkin = settings->value(key, emptyString).toString();
}
@@ -559,8 +533,7 @@ public:
PreviewDataList m_previews;
- typedef QMap<QString, DeviceSkinParameters> DeviceSkinConfigCache;
- DeviceSkinConfigCache m_deviceSkinConfigCache;
+ QMap<QString, DeviceSkinParameters> m_deviceSkinConfigCache;
QDesignerFormEditorInterface *m_core;
bool m_updateBlocked;
@@ -703,7 +676,7 @@ QWidget *PreviewManager::createPreview(const QDesignerFormWindowInterface *fw,
return formWidget;
}
// Embed into skin. find config in cache
- PreviewManagerPrivate::DeviceSkinConfigCache::iterator it = d->m_deviceSkinConfigCache.find(deviceSkin);
+ auto it = d->m_deviceSkinConfigCache.find(deviceSkin);
if (it == d->m_deviceSkinConfigCache.end()) {
DeviceSkinParameters parameters;
if (!parameters.read(deviceSkin, DeviceSkinParameters::ReadAll, errorMessage)) {
@@ -796,15 +769,13 @@ QWidget *PreviewManager::showPreview(const QDesignerFormWindowInterface *fw,
QWidget *PreviewManager::raise(const QDesignerFormWindowInterface *fw, const PreviewConfiguration &pc)
{
- using PreviewDataList = PreviewManagerPrivate::PreviewDataList;
if (d->m_previews.isEmpty())
return nullptr;
// find matching window
- const PreviewDataList::const_iterator cend = d->m_previews.constEnd();
- for (PreviewDataList::const_iterator it = d->m_previews.constBegin(); it != cend ;++it) {
- QWidget * w = it->m_widget;
- if (w && it->m_formWindow == fw && it->m_configuration == pc) {
+ for (const auto &pd : std::as_const(d->m_previews)) {
+ QWidget *w = pd.m_widget;
+ if (w && pd.m_formWindow == fw && pd.m_configuration == pc) {
w->raise();
w->activateWindow();
return w;
@@ -818,9 +789,9 @@ void PreviewManager::closeAllPreviews()
if (!d->m_previews.isEmpty()) {
d->m_updateBlocked = true;
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();
+ for (const auto &pd : std::as_const(d->m_previews)) {
+ if (pd.m_widget)
+ pd.m_widget->close();
}
d->m_previews.clear();
d->m_updateBlocked = false;
@@ -830,11 +801,10 @@ void PreviewManager::closeAllPreviews()
void PreviewManager::updatePreviewClosed(QWidget *w)
{
- 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() ; ) {
+ for (auto it = d->m_previews.begin(); it != d->m_previews.end() ; ) {
QWidget *iw = it->m_widget; // Might be 0 when catching QEvent::Destroyed
if (iw == nullptr || iw == w) {
it = d->m_previews.erase(it);
diff --git a/src/designer/src/lib/shared/previewmanager_p.h b/src/designer/src/lib/shared/previewmanager_p.h
index 83c4ae7c0..aa17d384b 100644
--- a/src/designer/src/lib/shared/previewmanager_p.h
+++ b/src/designer/src/lib/shared/previewmanager_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/promotionmodel.cpp b/src/designer/src/lib/shared/promotionmodel.cpp
index 37136ced6..8d9851936 100644
--- a/src/designer/src/lib/shared/promotionmodel.cpp
+++ b/src/designer/src/lib/shared/promotionmodel.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "promotionmodel_p.h"
#include "widgetdatabase_p.h"
@@ -137,18 +112,18 @@ namespace qdesigner_internal {
QDesignerWidgetDataBaseItemInterface *baseClass = nullptr;
QStandardItem *baseItem = nullptr;
- const PromotedClasses::const_iterator bcend = promotedClasses.constEnd();
- for (PromotedClasses::const_iterator it = promotedClasses.constBegin(); it != bcend; ++it) {
+ for (auto &pi : promotedClasses) {
// Start a new base class?
- if (baseClass != it->baseItem) {
- baseClass = it->baseItem;
- const StandardItemList baseRow = baseModelRow(it->baseItem);
+ if (baseClass != pi.baseItem) {
+ baseClass = pi.baseItem;
+ const StandardItemList baseRow = baseModelRow(pi.baseItem);
baseItem = baseRow.constFirst();
appendRow(baseRow);
}
Q_ASSERT(baseItem);
// Append derived
- baseItem->appendRow(promotedModelRow(it->baseItem, it->promotedItem, usedPromotedClasses.contains(it->promotedItem->name())));
+ baseItem->appendRow(promotedModelRow(pi.baseItem, pi.promotedItem,
+ usedPromotedClasses.contains(pi.promotedItem->name())));
}
}
diff --git a/src/designer/src/lib/shared/promotionmodel_p.h b/src/designer/src/lib/shared/promotionmodel_p.h
index 3acd119ff..c92017b86 100644
--- a/src/designer/src/lib/shared/promotionmodel_p.h
+++ b/src/designer/src/lib/shared/promotionmodel_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/promotiontaskmenu.cpp b/src/designer/src/lib/shared/promotiontaskmenu.cpp
index c458d2604..7cedb226b 100644
--- a/src/designer/src/lib/shared/promotiontaskmenu.cpp
+++ b/src/designer/src/lib/shared/promotiontaskmenu.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "promotiontaskmenu_p.h"
#include "qdesigner_promotiondialog_p.h"
@@ -146,10 +121,9 @@ PromotionTaskMenu::PromotionState PromotionTaskMenu::createPromotionActions(QDe
QMenu *candidatesMenu = new QMenu();
// Create a sub menu
- const WidgetDataBaseItemList::const_iterator cend = candidates.constEnd();
// Set up actions and map class names
- for (WidgetDataBaseItemList::const_iterator it = candidates.constBegin(); it != cend; ++it) {
- const QString customClassName = (*it)->name();
+ for (auto *item : candidates) {
+ const QString customClassName = item->name();
candidatesMenu->addAction(customClassName,
this, [this, customClassName] { this->slotPromoteToCustomWidget(customClassName); });
}
@@ -169,7 +143,7 @@ void PromotionTaskMenu::addActions(QDesignerFormWindowInterface *fw, unsigned fl
ActionList &actionList)
{
Q_ASSERT(m_widget);
- const int previousSize = actionList.size();
+ const auto previousSize = actionList.size();
const PromotionState promotionState = createPromotionActions(fw);
// Promotion candidates/demote
@@ -290,9 +264,7 @@ PromotionTaskMenu::PromotionSelectionList PromotionTaskMenu::promotionSelectionL
designerObjectInspector->getSelection(s);
// Find objects of similar state
const QWidgetList &source = m_mode == ModeManagedMultiSelection ? s.managed : s.unmanaged;
- const QWidgetList::const_iterator cend = source.constEnd();
- for (QWidgetList::const_iterator it = source.constBegin(); it != cend; ++it) {
- QWidget *w = *it;
+ for (auto *w : source) {
if (w != m_widget) {
// Selection state mismatch
if (intro->metaObject(w)->className() != className || isPromoted(core, w) != promoted)
diff --git a/src/designer/src/lib/shared/promotiontaskmenu_p.h b/src/designer/src/lib/shared/promotiontaskmenu_p.h
index ee9f53db0..371d95d6d 100644
--- a/src/designer/src/lib/shared/promotiontaskmenu_p.h
+++ b/src/designer/src/lib/shared/promotiontaskmenu_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/propertylineedit.cpp b/src/designer/src/lib/shared/propertylineedit.cpp
index 6e5b68412..bea91010a 100644
--- a/src/designer/src/lib/shared/propertylineedit.cpp
+++ b/src/designer/src/lib/shared/propertylineedit.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "propertylineedit_p.h"
@@ -33,6 +8,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
PropertyLineEdit::PropertyLineEdit(QWidget *parent) :
QLineEdit(parent), m_wantNewLine(false)
@@ -55,14 +32,14 @@ namespace qdesigner_internal {
}
void PropertyLineEdit::insertNewLine() {
- insertText(QStringLiteral("\\n"));
+ insertText(u"\\n"_s);
}
void PropertyLineEdit::insertText(const QString &text) {
// position cursor after new text and grab focus
const int oldCursorPosition = cursorPosition ();
insert(text);
- setCursorPosition (oldCursorPosition + text.length());
+ setCursorPosition (oldCursorPosition + text.size());
setFocus(Qt::OtherFocusReason);
}
diff --git a/src/designer/src/lib/shared/propertylineedit_p.h b/src/designer/src/lib/shared/propertylineedit_p.h
index a408f8a9d..d1a1c9428 100644
--- a/src/designer/src/lib/shared/propertylineedit_p.h
+++ b/src/designer/src/lib/shared/propertylineedit_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/qdesigner_command.cpp b/src/designer/src/lib/shared/qdesigner_command.cpp
index d6a6416ae..2633224e6 100644
--- a/src/designer/src/lib/shared/qdesigner_command.cpp
+++ b/src/designer/src/lib/shared/qdesigner_command.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_command_p.h"
#include "qdesigner_propertycommand_p.h"
@@ -75,10 +50,12 @@ Q_DECLARE_METATYPE(QWidgetList)
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
static inline void setPropertySheetWindowTitle(const QDesignerFormEditorInterface *core, QObject *o, const QString &t)
{
if (QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), o)) {
- const int idx = sheet->indexOf(QStringLiteral("windowTitle"));
+ const int idx = sheet->indexOf(u"windowTitle"_s);
if (idx != -1) {
sheet->setProperty(idx, t);
sheet->setChanged(idx, true);
@@ -89,8 +66,8 @@ static inline void setPropertySheetWindowTitle(const QDesignerFormEditorInterfac
namespace qdesigner_internal {
// Helpers for the dynamic properties that store Z/Widget order
-static const char *widgetOrderPropertyC = "_q_widgetOrder";
-static const char *zOrderPropertyC = "_q_zOrder";
+static const char widgetOrderPropertyC[] = "_q_widgetOrder";
+static const char zOrderPropertyC[] = "_q_zOrder";
static void addToWidgetListDynamicProperty(QWidget *parentWidget, QWidget *widget, const char *name, int index = -1)
{
@@ -144,7 +121,7 @@ void InsertWidgetCommand::init(QWidget *widget, bool already_in_form, int layout
m_cell.first = layoutRow;
m_cell.second = layoutColumn;
} else {
- m_cell = deco ? deco->currentCell() : qMakePair(0, 0);
+ m_cell = deco ? deco->currentCell() : std::make_pair(0, 0);
}
m_widgetWasManaged = already_in_form;
}
@@ -153,10 +130,8 @@ static void recursiveUpdate(QWidget *w)
{
w->update();
- const QObjectList &l = w->children();
- const QObjectList::const_iterator cend = l.end();
- for ( QObjectList::const_iterator it = l.begin(); it != cend; ++it) {
- if (QWidget *w = qobject_cast<QWidget*>(*it))
+ for (auto *child : w->children()) {
+ if (QWidget *w = qobject_cast<QWidget*>(child))
recursiveUpdate(w);
}
}
@@ -236,7 +211,7 @@ void InsertWidgetCommand::refreshBuddyLabels()
if (label_list.isEmpty())
return;
- const QString buddyProperty = QStringLiteral("buddy");
+ const QString buddyProperty = u"buddy"_s;
const QByteArray objectNameU8 = m_widget->objectName().toUtf8();
// Re-set the buddy (The sheet locates the object by name and sets it)
for (QLabel *label : label_list) {
@@ -266,8 +241,8 @@ void ChangeZOrderCommand::init(QWidget *widget)
setText(QApplication::translate("Command", "Change Z-order of '%1'").arg(widget->objectName()));
m_oldParentZOrder = qvariant_cast<QWidgetList>(widget->parentWidget()->property("_q_zOrder"));
- const int index = m_oldParentZOrder.indexOf(m_widget);
- if (index != -1 && index + 1 < m_oldParentZOrder.count())
+ const qsizetype index = m_oldParentZOrder.indexOf(m_widget);
+ if (index != -1 && index + 1 < m_oldParentZOrder.size())
m_oldPreceding = m_oldParentZOrder.at(index + 1);
}
@@ -347,17 +322,14 @@ void ManageWidgetCommandHelper::init(const QDesignerFormWindowInterface *fw, QWi
m_managedChildren.clear();
const QWidgetList children = m_widget->findChildren<QWidget *>();
- if (children.isEmpty())
- return;
-
m_managedChildren.reserve(children.size());
- const QWidgetList::const_iterator lcend = children.constEnd();
- for (QWidgetList::const_iterator it = children.constBegin(); it != lcend; ++it)
- if (fw->isManaged(*it))
- m_managedChildren.push_back(*it);
+ for (auto *w : children) {
+ if (fw->isManaged(w))
+ m_managedChildren.push_back(w);
+ }
}
-void ManageWidgetCommandHelper::init(QWidget *widget, const WidgetVector &managedChildren)
+void ManageWidgetCommandHelper::init(QWidget *widget, const QWidgetList &managedChildren)
{
m_widget = widget;
m_managedChildren = managedChildren;
@@ -367,21 +339,15 @@ void ManageWidgetCommandHelper::manage(QDesignerFormWindowInterface *fw)
{
// Manage the managed children after parent
fw->manageWidget(m_widget);
- if (!m_managedChildren.isEmpty()) {
- const WidgetVector::const_iterator lcend = m_managedChildren.constEnd();
- for (WidgetVector::const_iterator it = m_managedChildren.constBegin(); it != lcend; ++it)
- fw->manageWidget(*it);
- }
+ for (auto *w : std::as_const(m_managedChildren))
+ fw->manageWidget(w);
}
void ManageWidgetCommandHelper::unmanage(QDesignerFormWindowInterface *fw)
{
// Unmanage the managed children first
- if (!m_managedChildren.isEmpty()) {
- const WidgetVector::const_iterator lcend = m_managedChildren.constEnd();
- for (WidgetVector::const_iterator it = m_managedChildren.constBegin(); it != lcend; ++it)
- fw->unmanageWidget(*it);
- }
+ for (auto *w : std::as_const(m_managedChildren))
+ fw->unmanageWidget(w);
fw->unmanageWidget(m_widget);
}
@@ -625,7 +591,7 @@ void PromoteToCustomWidgetCommand::init(const WidgetPointerList &widgets,const Q
void PromoteToCustomWidgetCommand::redo()
{
- for (QWidget *w : qAsConst(m_widgets)) {
+ for (QWidget *w : std::as_const(m_widgets)) {
if (w)
promoteWidget(core(), w, m_customClassName);
}
@@ -644,7 +610,7 @@ void PromoteToCustomWidgetCommand::updateSelection()
void PromoteToCustomWidgetCommand::undo()
{
- for (QWidget *w : qAsConst(m_widgets)) {
+ for (QWidget *w : std::as_const(m_widgets)) {
if (w)
demoteWidget(core(), w);
}
@@ -697,11 +663,10 @@ void CursorSelectionState::restore(QDesignerFormWindowInterface *formWindow) con
} else {
// Select current as last
formWindow->clearSelection(false);
- const WidgetPointerList::const_iterator cend = m_selection.constEnd();
- for (WidgetPointerList::const_iterator it = m_selection.constBegin(); it != cend; ++it)
- if (QWidget *w = *it)
- if (w != m_current)
- formWindow->selectWidget(*it, true);
+ for (const auto &wp : m_selection) {
+ if (!wp.isNull() && wp.data() != m_current)
+ formWindow->selectWidget(wp.data(), true);
+ }
if (m_current)
formWindow->selectWidget(m_current, true);
}
@@ -857,7 +822,7 @@ void BreakLayoutCommand::redo()
m_layout->breakLayout();
delete deco; // release the extension
- for (QWidget *widget : qAsConst(m_widgets)) {
+ for (QWidget *widget : std::as_const(m_widgets)) {
widget->resize(widget->size().expandedTo(QSize(16, 16)));
}
// Update unless we are in an intermediate state of morphing layout
@@ -994,7 +959,7 @@ void ToolBoxCommand::addPage()
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(formWindow()->core()->extensionManager(), m_toolBox);
if (sheet) {
qdesigner_internal::PropertySheetStringValue itemText(m_itemText);
- sheet->setProperty(sheet->indexOf(QStringLiteral("currentItemText")), QVariant::fromValue(itemText));
+ sheet->setProperty(sheet->indexOf(u"currentItemText"_s), QVariant::fromValue(itemText));
}
m_widget->show();
@@ -1085,7 +1050,7 @@ void AddToolBoxPageCommand::init(QToolBox *toolBox, InsertionMode mode)
m_widget = new QDesignerWidget(formWindow(), m_toolBox);
m_itemText = QApplication::translate("Command", "Page");
m_itemIcon = QIcon();
- m_widget->setObjectName(QStringLiteral("page"));
+ m_widget->setObjectName(u"page"_s);
formWindow()->ensureUniqueObjectName(m_widget);
setText(QApplication::translate("Command", "Insert Page"));
@@ -1146,7 +1111,8 @@ void TabWidgetCommand::addPage()
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(formWindow()->core()->extensionManager(), m_tabWidget);
if (sheet) {
qdesigner_internal::PropertySheetStringValue itemText(m_itemText);
- sheet->setProperty(sheet->indexOf(QStringLiteral("currentTabText")), QVariant::fromValue(itemText));
+ sheet->setProperty(sheet->indexOf(u"currentTabText"_s),
+ QVariant::fromValue(itemText));
}
formWindow()->clearSelection();
@@ -1202,7 +1168,7 @@ void AddTabPageCommand::init(QTabWidget *tabWidget, InsertionMode mode)
m_widget = new QDesignerWidget(formWindow(), m_tabWidget);
m_itemText = QApplication::translate("Command", "Page");
m_itemIcon = QIcon();
- m_widget->setObjectName(QStringLiteral("tab"));
+ m_widget->setObjectName(u"tab"_s);
formWindow()->ensureUniqueObjectName(m_widget);
setText(QApplication::translate("Command", "Insert Page"));
@@ -1378,7 +1344,7 @@ void AddStackedWidgetPageCommand::init(QStackedWidget *stackedWidget, InsertionM
if (mode == InsertAfter)
m_index++;
m_widget = new QDesignerWidget(formWindow(), m_stackedWidget);
- m_widget->setObjectName(QStringLiteral("page"));
+ m_widget->setObjectName(u"page"_s);
formWindow()->ensureUniqueObjectName(m_widget);
setText(QApplication::translate("Command", "Insert Page"));
@@ -1437,7 +1403,7 @@ void CreateMenuBarCommand::init(QMainWindow *mainWindow)
{
m_mainWindow = mainWindow;
QDesignerFormEditorInterface *core = formWindow()->core();
- m_menuBar = qobject_cast<QMenuBar*>(core->widgetFactory()->createWidget(QStringLiteral("QMenuBar"), m_mainWindow));
+ m_menuBar = qobject_cast<QMenuBar*>(core->widgetFactory()->createWidget(u"QMenuBar"_s, m_mainWindow));
core->widgetFactory()->initialize(m_menuBar);
}
@@ -1448,7 +1414,7 @@ void CreateMenuBarCommand::redo()
c = qt_extension<QDesignerContainerExtension*>(core->extensionManager(), m_mainWindow);
c->addWidget(m_menuBar);
- m_menuBar->setObjectName(QStringLiteral("menuBar"));
+ m_menuBar->setObjectName(u"menuBar"_s);
formWindow()->ensureUniqueObjectName(m_menuBar);
core->metaDataBase()->add(m_menuBar);
formWindow()->emitSelectionChanged();
@@ -1528,7 +1494,7 @@ void CreateStatusBarCommand::init(QMainWindow *mainWindow)
{
m_mainWindow = mainWindow;
QDesignerFormEditorInterface *core = formWindow()->core();
- m_statusBar = qobject_cast<QStatusBar*>(core->widgetFactory()->createWidget(QStringLiteral("QStatusBar"), m_mainWindow));
+ m_statusBar = qobject_cast<QStatusBar*>(core->widgetFactory()->createWidget(u"QStatusBar"_s, m_mainWindow));
core->widgetFactory()->initialize(m_statusBar);
}
@@ -1539,7 +1505,7 @@ void CreateStatusBarCommand::redo()
c = qt_extension<QDesignerContainerExtension*>(core->extensionManager(), m_mainWindow);
c->addWidget(m_statusBar);
- m_statusBar->setObjectName(QStringLiteral("statusBar"));
+ m_statusBar->setObjectName(u"statusBar"_s);
formWindow()->ensureUniqueObjectName(m_statusBar);
core->metaDataBase()->add(m_statusBar);
formWindow()->emitSelectionChanged();
@@ -1616,7 +1582,7 @@ void AddToolBarCommand::init(QMainWindow *mainWindow, Qt::ToolBarArea area)
m_mainWindow = mainWindow;
QDesignerWidgetFactoryInterface * wf = formWindow()->core()->widgetFactory();
// Pass on 0 parent first to avoid reparenting flicker.
- m_toolBar = qobject_cast<QToolBar*>(wf->createWidget(QStringLiteral("QToolBar"), nullptr));
+ m_toolBar = qobject_cast<QToolBar*>(wf->createWidget(u"QToolBar"_s, nullptr));
m_toolBar->setProperty("_q_desiredArea", QVariant(area));
wf->initialize(m_toolBar);
m_toolBar->hide();
@@ -1630,7 +1596,7 @@ void AddToolBarCommand::redo()
QDesignerContainerExtension *c = qt_extension<QDesignerContainerExtension*>(core->extensionManager(), m_mainWindow);
c->addWidget(m_toolBar);
- m_toolBar->setObjectName(QStringLiteral("toolBar"));
+ m_toolBar->setObjectName(u"toolBar"_s);
formWindow()->ensureUniqueObjectName(m_toolBar);
setPropertySheetWindowTitle(core, m_toolBar, m_toolBar->objectName());
formWindow()->emitSelectionChanged();
@@ -1679,7 +1645,7 @@ void AddDockWidgetCommand::init(QMainWindow *mainWindow)
{
m_mainWindow = mainWindow;
QDesignerFormEditorInterface *core = formWindow()->core();
- m_dockWidget = qobject_cast<QDockWidget*>(core->widgetFactory()->createWidget(QStringLiteral("QDockWidget"), m_mainWindow));
+ m_dockWidget = qobject_cast<QDockWidget*>(core->widgetFactory()->createWidget(u"QDockWidget"_s, m_mainWindow));
}
void AddDockWidgetCommand::redo()
@@ -1688,7 +1654,7 @@ void AddDockWidgetCommand::redo()
QDesignerContainerExtension *c = qt_extension<QDesignerContainerExtension*>(core->extensionManager(), m_mainWindow);
c->addWidget(m_dockWidget);
- m_dockWidget->setObjectName(QStringLiteral("dockWidget"));
+ m_dockWidget->setObjectName(u"dockWidget"_s);
formWindow()->ensureUniqueObjectName(m_dockWidget);
formWindow()->manageWidget(m_dockWidget);
formWindow()->emitSelectionChanged();
@@ -1769,7 +1735,7 @@ void AdjustWidgetSizeCommand::updatePropertyEditor() const
{
if (QDesignerPropertyEditorInterface *propertyEditor = formWindow()->core()->propertyEditor()) {
if (propertyEditor->object() == m_widget)
- propertyEditor->setPropertyValue(QStringLiteral("geometry"), m_widget->geometry(), true);
+ propertyEditor->setPropertyValue(u"geometry"_s, m_widget->geometry(), true);
}
}
// ------------ ChangeFormLayoutItemRoleCommand
@@ -2043,16 +2009,16 @@ void AddContainerWidgetPageCommand::init(QWidget *containerWidget, ContainerType
case PageContainer:
setText(QApplication::translate("Command", "Insert Page"));
m_widget = new QDesignerWidget(formWindow(), m_containerWidget);
- m_widget->setObjectName(QStringLiteral("page"));
+ m_widget->setObjectName(u"page"_s);
break;
case MdiContainer:
setText(QApplication::translate("Command", "Insert Subwindow"));
m_widget = new QDesignerWidget(formWindow(), m_containerWidget);
- m_widget->setObjectName(QStringLiteral("subwindow"));
+ m_widget->setObjectName(u"subwindow"_s);
setPropertySheetWindowTitle(core, m_widget, QApplication::translate("Command", "Subwindow"));
break;
case WizardContainer: // Apply style, don't manage
- m_widget = core->widgetFactory()->createWidget(QStringLiteral("QWizardPage"), nullptr);
+ m_widget = core->widgetFactory()->createWidget(u"QWizardPage"_s, nullptr);
break;
}
formWindow()->ensureUniqueObjectName(m_widget);
@@ -2145,9 +2111,7 @@ static void copyRolesFromItem(ItemData *id, const T *item, bool editor)
template<class T>
static void copyRolesToItem(const ItemData *id, T *item, DesignerIconCache *iconCache, bool editor)
{
- QHash<int, QVariant>::const_iterator it = id->m_properties.constBegin(),
- end = id->m_properties.constEnd();
- for (; it != end; ++it)
+ for (auto it = id->m_properties.cbegin(), end = id->m_properties.cend(); it != end; ++it) {
if (it.value().isValid()) {
if (!editor && it.key() == ItemFlagsShadowRole) {
item->setFlags((Qt::ItemFlags)it.value().toInt());
@@ -2173,6 +2137,7 @@ static void copyRolesToItem(const ItemData *id, T *item, DesignerIconCache *icon
}
}
}
+ }
if (editor)
item->setFlags(item->flags() | Qt::ItemIsEditable);
@@ -2221,8 +2186,7 @@ ItemData::ItemData(const QTreeWidgetItem *item, int column)
void ItemData::fillTreeItemColumn(QTreeWidgetItem *item, int column, DesignerIconCache *iconCache) const
{
- QHash<int, QVariant>::const_iterator it = m_properties.constBegin(), end = m_properties.constEnd();
- for (; it != end; ++it)
+ for (auto it = m_properties.cbegin(), end = m_properties.cend(); it != end; ++it) {
if (it.value().isValid()) {
item->setData(column, it.key(), it.value());
switch (it.key()) {
@@ -2244,6 +2208,7 @@ void ItemData::fillTreeItemColumn(QTreeWidgetItem *item, int column, DesignerIco
break;
}
}
+ }
}
ListContents::ListContents(const QTreeWidgetItem *item)
@@ -2420,19 +2385,19 @@ void TableWidgetContents::applyToTableWidget(QTableWidget *tableWidget, Designer
row++;
}
// items
- const TableItemMap::const_iterator icend = m_items.constEnd();
- for (TableItemMap::const_iterator it = m_items.constBegin(); it != icend; ++ it)
- tableWidget->setItem(it.key().first, it.key().second, it.value().createTableItem(iconCache, editor));
+ for (auto it = m_items.cbegin(), icend = m_items.cend(); it != icend; ++ it) {
+ tableWidget->setItem(it.key().first, it.key().second,
+ it.value().createTableItem(iconCache, editor));
+ }
}
-bool TableWidgetContents::operator==(const TableWidgetContents &rhs) const
+bool comparesEqual(const TableWidgetContents &lhs,
+ const TableWidgetContents &rhs) noexcept
{
- if (m_columnCount != rhs.m_columnCount || m_rowCount != rhs.m_rowCount)
- return false;
-
- return m_horizontalHeader.m_items == rhs.m_horizontalHeader.m_items &&
- m_verticalHeader.m_items == rhs.m_verticalHeader.m_items &&
- m_items == rhs.m_items;
+ return lhs.m_columnCount == rhs.m_columnCount && lhs.m_rowCount == rhs.m_rowCount &&
+ lhs.m_horizontalHeader.m_items == rhs.m_horizontalHeader.m_items &&
+ lhs.m_verticalHeader.m_items == rhs.m_verticalHeader.m_items &&
+ lhs.m_items == rhs.m_items;
}
// ---- ChangeTableContentsCommand ----
@@ -2502,12 +2467,11 @@ QTreeWidgetItem *TreeWidgetContents::ItemContents::createTreeItem(DesignerIconCa
return item;
}
-bool TreeWidgetContents::ItemContents::operator==(const TreeWidgetContents::ItemContents &rhs) const
+bool comparesEqual(const TreeWidgetContents::ItemContents &lhs,
+ const TreeWidgetContents::ItemContents &rhs) noexcept
{
- return
- m_itemFlags == rhs.m_itemFlags &&
- m_items == rhs.m_items &&
- m_children == rhs.m_children;
+ return lhs.m_itemFlags == rhs.m_itemFlags && lhs.m_items == rhs.m_items
+ && lhs.m_children == rhs.m_children;
}
void TreeWidgetContents::clear()
@@ -2528,20 +2492,13 @@ void TreeWidgetContents::applyToTreeWidget(QTreeWidget *treeWidget, DesignerIcon
{
treeWidget->clear();
- treeWidget->setColumnCount(m_headerItem.m_items.count());
+ treeWidget->setColumnCount(m_headerItem.m_items.size());
treeWidget->setHeaderItem(m_headerItem.createTreeItem(iconCache));
for (const ItemContents &ic : m_rootItems)
treeWidget->addTopLevelItem(ic.createTreeItem(iconCache, editor));
treeWidget->expandAll();
}
-bool TreeWidgetContents::operator==(const TreeWidgetContents &rhs) const
-{
- return
- m_headerItem == rhs.m_headerItem &&
- m_rootItems == rhs.m_rootItems;
-}
-
// ---- ChangeTreeContentsCommand ----
ChangeTreeContentsCommand::ChangeTreeContentsCommand(QDesignerFormWindowInterface *formWindow)
: QDesignerFormWindowCommand(QApplication::translate("Command", "Change Tree Contents"), formWindow),
@@ -2653,19 +2610,19 @@ static RemoveActionCommand::ActionData findActionIn(QAction *action)
{
RemoveActionCommand::ActionData result;
// We only want menus and toolbars, no toolbuttons.
- const QWidgetList &associatedWidgets = action->associatedWidgets();
- for (QWidget *widget : associatedWidgets) {
- if (qobject_cast<const QMenu *>(widget) || qobject_cast<const QToolBar *>(widget)) {
- const auto actionList = widget->actions();
- const int size = actionList.size();
- for (int i = 0; i < size; ++i) {
- if (actionList.at(i) == action) {
- QAction *before = nullptr;
- if (i + 1 < size)
- before = actionList.at(i + 1);
- result.append(RemoveActionCommand::ActionDataItem(before, widget));
- break;
- }
+ const QObjectList associatedObjects = action->associatedObjects();
+ for (QObject *obj : associatedObjects) {
+ if (!qobject_cast<const QMenu *>(obj) && !qobject_cast<const QToolBar *>(obj))
+ continue;
+ QWidget *widget = static_cast<QWidget *>(obj);
+ const auto actionList = widget->actions();
+ for (qsizetype i = 0, size = actionList.size(); i < size; ++i) {
+ if (actionList.at(i) == action) {
+ QAction *before = nullptr;
+ if (i + 1 < size)
+ before = actionList.at(i + 1);
+ result.append(RemoveActionCommand::ActionDataItem(before, widget));
+ break;
}
}
}
@@ -2683,7 +2640,7 @@ void RemoveActionCommand::init(QAction *action)
void RemoveActionCommand::redo()
{
QDesignerFormWindowInterface *fw = formWindow();
- for (const ActionDataItem &item : qAsConst(m_actionData)) {
+ for (const ActionDataItem &item : std::as_const(m_actionData)) {
item.widget->removeAction(m_action);
}
// Notify components (for example, signal slot editor)
@@ -2700,7 +2657,7 @@ void RemoveActionCommand::undo()
{
core()->actionEditor()->setFormWindow(formWindow());
core()->actionEditor()->manageAction(m_action);
- for (const ActionDataItem &item : qAsConst(m_actionData))
+ for (const ActionDataItem &item : std::as_const(m_actionData))
item.widget->insertAction(item.before, m_action);
if (!m_actionData.isEmpty())
core()->objectInspector()->setFormWindow(formWindow());
diff --git a/src/designer/src/lib/shared/qdesigner_command2.cpp b/src/designer/src/lib/shared/qdesigner_command2.cpp
index ac035f6ec..cc8cff4f6 100644
--- a/src/designer/src/lib/shared/qdesigner_command2.cpp
+++ b/src/designer/src/lib/shared/qdesigner_command2.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_command2_p.h"
#include "formwindowbase_p.h"
diff --git a/src/designer/src/lib/shared/qdesigner_command2_p.h b/src/designer/src/lib/shared/qdesigner_command2_p.h
index 6d5fd00b9..bfe32cdd4 100644
--- a/src/designer/src/lib/shared/qdesigner_command2_p.h
+++ b/src/designer/src/lib/shared/qdesigner_command2_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/qdesigner_command_p.h b/src/designer/src/lib/shared/qdesigner_command_p.h
index 0c1f5764c..e3239ce5c 100644
--- a/src/designer/src/lib/shared/qdesigner_command_p.h
+++ b/src/designer/src/lib/shared/qdesigner_command_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -51,12 +26,14 @@
#include <QtGui/qicon.h>
+#include <QtCore/qcompare.h>
#include <QtCore/qhash.h>
#include <QtCore/qlist.h>
#include <QtCore/qmap.h>
#include <QtCore/qobject.h>
#include <QtCore/qpair.h>
#include <QtCore/qpoint.h>
+#include <QtCore/qpointer.h>
#include <QtCore/qrect.h>
QT_BEGIN_NAMESPACE
@@ -107,7 +84,7 @@ private:
QPointer<QWidget> m_widget;
QDesignerLayoutDecorationExtension::InsertMode m_insertMode;
- QPair<int, int> m_cell;
+ std::pair<int, int> m_cell;
LayoutHelper* m_layoutHelper;
bool m_widgetWasManaged;
};
@@ -181,19 +158,17 @@ private:
// Helper to correctly unmanage a widget and its children for delete operations
class QDESIGNER_SHARED_EXPORT ManageWidgetCommandHelper {
public:
- using WidgetVector = QList<QWidget *>;
-
ManageWidgetCommandHelper();
void init(const QDesignerFormWindowInterface *fw, QWidget *widget);
- void init(QWidget *widget, const WidgetVector &managedChildren);
+ void init(QWidget *widget, const QWidgetList &managedChildren);
void manage(QDesignerFormWindowInterface *fw);
void unmanage(QDesignerFormWindowInterface *fw);
- const WidgetVector &managedChildren() const { return m_managedChildren; }
+ const QWidgetList &managedChildren() const { return m_managedChildren; }
private:
QWidget *m_widget = nullptr;
- WidgetVector m_managedChildren;
+ QWidgetList m_managedChildren;
};
class QDESIGNER_SHARED_EXPORT DeleteWidgetCommand: public QDesignerFormWindowCommand
@@ -853,10 +828,14 @@ struct QDESIGNER_SHARED_EXPORT ItemData {
void fillTreeItemColumn(QTreeWidgetItem *item, int column, DesignerIconCache *iconCache) const;
bool isValid() const { return !m_properties.isEmpty(); }
- bool operator==(const ItemData &rhs) const { return m_properties == rhs.m_properties; }
- bool operator!=(const ItemData &rhs) const { return m_properties != rhs.m_properties; }
QHash<int, QVariant> m_properties;
+
+ friend bool comparesEqual(const ItemData &lhs, const ItemData &rhs) noexcept
+ {
+ return lhs.m_properties == rhs.m_properties;
+ }
+ Q_DECLARE_EQUALITY_COMPARABLE(ItemData)
};
struct QDESIGNER_SHARED_EXPORT ListContents {
@@ -872,18 +851,20 @@ struct QDESIGNER_SHARED_EXPORT ListContents {
void createFromComboBox(const QComboBox *listWidget);
void applyToComboBox(QComboBox *listWidget, DesignerIconCache *iconCache) const;
- bool operator==(const ListContents &rhs) const { return m_items == rhs.m_items; }
- bool operator!=(const ListContents &rhs) const { return m_items != rhs.m_items; }
-
QList<ItemData> m_items;
+
+ friend bool comparesEqual(const ListContents &lhs, const ListContents &rhs) noexcept
+ {
+ return lhs.m_items == rhs.m_items;
+ }
+ Q_DECLARE_EQUALITY_COMPARABLE(ListContents)
};
// Data structure representing the contents of a QTableWidget with
// methods to retrieve and apply for ChangeTableContentsCommand
struct QDESIGNER_SHARED_EXPORT TableWidgetContents {
- using CellRowColumnAddress = QPair<int, int>;
- using TableItemMap = QMap<CellRowColumnAddress, ItemData>;
+ using CellRowColumnAddress = std::pair<int, int>;
TableWidgetContents();
void clear();
@@ -891,9 +872,6 @@ struct QDESIGNER_SHARED_EXPORT TableWidgetContents {
void fromTableWidget(const QTableWidget *tableWidget, bool editor);
void applyToTableWidget(QTableWidget *tableWidget, DesignerIconCache *iconCache, bool editor) const;
- bool operator==(const TableWidgetContents &rhs) const;
- bool operator!=(const TableWidgetContents &rhs) const { return !(*this == rhs); }
-
static bool nonEmpty(const QTableWidgetItem *item, int headerColumn);
static QString defaultHeaderText(int i);
static void insertHeaderItem(const QTableWidgetItem *item, int i, ListContents *header, bool editor);
@@ -902,7 +880,12 @@ struct QDESIGNER_SHARED_EXPORT TableWidgetContents {
int m_rowCount = 0;
ListContents m_horizontalHeader;
ListContents m_verticalHeader;
- TableItemMap m_items;
+ QMap<CellRowColumnAddress, ItemData> m_items;
+
+ friend QDESIGNER_SHARED_EXPORT
+ bool comparesEqual(const TableWidgetContents &lhs,
+ const TableWidgetContents &rhs) noexcept;
+ Q_DECLARE_EQUALITY_COMPARABLE(TableWidgetContents)
};
class QDESIGNER_SHARED_EXPORT ChangeTableContentsCommand: public QDesignerFormWindowCommand
@@ -930,14 +913,16 @@ struct QDESIGNER_SHARED_EXPORT TreeWidgetContents {
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 = -1;
//bool m_firstColumnSpanned:1;
//bool m_hidden:1;
//bool m_expanded:1;
QList<ItemContents> m_children;
+
+ friend QDESIGNER_SHARED_EXPORT
+ bool comparesEqual(const ItemContents &lhs,
+ const ItemContents &rhs) noexcept;
+ Q_DECLARE_EQUALITY_COMPARABLE(ItemContents)
};
void clear();
@@ -945,11 +930,15 @@ struct QDESIGNER_SHARED_EXPORT TreeWidgetContents {
void fromTreeWidget(const QTreeWidget *treeWidget, bool editor);
void applyToTreeWidget(QTreeWidget *treeWidget, DesignerIconCache *iconCache, bool editor) const;
- bool operator==(const TreeWidgetContents &rhs) const;
- bool operator!=(const TreeWidgetContents &rhs) const { return !(*this == rhs); }
-
ListContents m_headerItem;
QList<ItemContents> m_rootItems;
+
+ friend bool comparesEqual(const TreeWidgetContents &lhs,
+ const TreeWidgetContents &rhs) noexcept
+ {
+ return lhs.m_headerItem == rhs.m_headerItem && lhs.m_rootItems == rhs.m_rootItems;
+ }
+ Q_DECLARE_EQUALITY_COMPARABLE(TreeWidgetContents)
};
class QDESIGNER_SHARED_EXPORT ChangeTreeContentsCommand: public QDesignerFormWindowCommand
diff --git a/src/designer/src/lib/shared/qdesigner_dnditem.cpp b/src/designer/src/lib/shared/qdesigner_dnditem.cpp
index 4a7864372..d7875f55c 100644
--- a/src/designer/src/lib/shared/qdesigner_dnditem.cpp
+++ b/src/designer/src/lib/shared/qdesigner_dnditem.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_dnditem_p.h"
#include "formwindowbase_p.h"
@@ -146,8 +121,8 @@ QDesignerMimeData::QDesignerMimeData(const QDesignerDnDItems &items, QDrag *drag
break;
default: {
// determine size of drag decoration by uniting all geometries
- const QDesignerDnDItems::const_iterator cend = m_items.constEnd();
- QDesignerDnDItems::const_iterator it =m_items.constBegin();
+ const auto cend = m_items.cend();
+ auto it = m_items.cbegin();
QRect unitedGeometry = (*it)->decoration()->geometry();
const qreal devicePixelRatio = (*it)->decoration()->devicePixelRatioF();
for (++it; it != cend; ++it )
@@ -165,8 +140,8 @@ QDesignerMimeData::QDesignerMimeData(const QDesignerDnDItems &items, QDrag *drag
QPainter painter(&image);
QPainter maskPainter(&mask);
decorationTopLeft = unitedGeometry.topLeft();
- for (it = m_items.constBegin() ; it != cend; ++it ) {
- QWidget *w = (*it)->decoration();
+ for (auto *item : std::as_const(m_items)) {
+ QWidget *w = item->decoration();
const QPixmap wp = w->grab(QRect(0, 0, -1, -1));
const QPoint pos = w->pos() - decorationTopLeft;
painter.drawPixmap(pos, wp);
@@ -194,9 +169,7 @@ QDesignerMimeData::QDesignerMimeData(const QDesignerDnDItems &items, QDrag *drag
QDesignerMimeData::~QDesignerMimeData()
{
- const QDesignerDnDItems::const_iterator cend = m_items.constEnd();
- for (QDesignerDnDItems::const_iterator it = m_items.constBegin(); it != cend; ++it )
- delete *it;
+ qDeleteAll(m_items);
}
Qt::DropAction QDesignerMimeData::proposedDropAction() const
@@ -214,16 +187,17 @@ Qt::DropAction QDesignerMimeData::execDrag(const QDesignerDnDItems &items, QWidg
// Store pointers to widgets that are to be re-shown if a move operation is canceled
QWidgetList reshowWidgets;
- const QDesignerDnDItems::const_iterator cend = items.constEnd();
- for (QDesignerDnDItems::const_iterator it = items.constBegin(); it != cend; ++it )
- if (QWidget *w = (*it)->widget())
- if ((*it)->type() == QDesignerDnDItemInterface::MoveDrop)
+ for (auto *item : items) {
+ if (QWidget *w = item->widget()) {
+ if (item->type() == QDesignerDnDItemInterface::MoveDrop)
reshowWidgets.push_back(w);
+ }
+ }
const Qt::DropAction executedAction = drag->exec(Qt::CopyAction|Qt::MoveAction, mimeData->proposedDropAction());
if (executedAction == Qt::IgnoreAction) {
- for (QWidget *w : qAsConst(reshowWidgets))
+ for (QWidget *w : std::as_const(reshowWidgets))
w->show();
}
@@ -234,24 +208,24 @@ Qt::DropAction QDesignerMimeData::execDrag(const QDesignerDnDItems &items, QWidg
void QDesignerMimeData::moveDecoration(const QPoint &globalPos) const
{
const QPoint relativeDistance = globalPos - m_globalStartPos;
- const QDesignerDnDItems::const_iterator cend = m_items.constEnd();
- for (QDesignerDnDItems::const_iterator it =m_items.constBegin(); it != cend; ++it ) {
- QWidget *w = (*it)->decoration();
+ for (auto *item : m_items) {
+ QWidget *w = item->decoration();
w->move(w->pos() + relativeDistance);
}
}
void QDesignerMimeData::removeMovedWidgetsFromSourceForm(const QDesignerDnDItems &items)
{
- typedef QMultiMap<FormWindowBase *, QWidget *> FormWidgetMap;
- FormWidgetMap formWidgetMap;
+ QMultiMap<FormWindowBase *, QWidget *> formWidgetMap;
// Find moved widgets per form
- const QDesignerDnDItems::const_iterator cend = items.constEnd();
- for (QDesignerDnDItems::const_iterator it = items.constBegin(); it != cend; ++it )
- if ((*it)->type() == QDesignerDnDItemInterface::MoveDrop)
- if (QWidget *w = (*it)->widget())
- if (FormWindowBase *fb = qobject_cast<FormWindowBase *>((*it)->source()))
+ for (auto *item : items) {
+ if (item->type() == QDesignerDnDItemInterface::MoveDrop) {
+ if (QWidget *w = item->widget()) {
+ if (FormWindowBase *fb = qobject_cast<FormWindowBase *>(item->source()))
formWidgetMap.insert(fb, w);
+ }
+ }
+ }
const auto &formWindows = formWidgetMap.uniqueKeys();
for (FormWindowBase *fb : formWindows)
diff --git a/src/designer/src/lib/shared/qdesigner_dnditem_p.h b/src/designer/src/lib/shared/qdesigner_dnditem_p.h
index 36419389b..aecd626a9 100644
--- a/src/designer/src/lib/shared/qdesigner_dnditem_p.h
+++ b/src/designer/src/lib/shared/qdesigner_dnditem_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/qdesigner_dockwidget.cpp b/src/designer/src/lib/shared/qdesigner_dockwidget.cpp
index d29fcaba2..9b857efff 100644
--- a/src/designer/src/lib/shared/qdesigner_dockwidget.cpp
+++ b/src/designer/src/lib/shared/qdesigner_dockwidget.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_dockwidget_p.h"
#include "layoutinfo_p.h"
@@ -42,12 +17,14 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
bool QDockWidgetPropertySheet::isEnabled(int index) const
{
const QString &name = propertyName(index);
- if (name == QLatin1String("dockWidgetArea"))
+ if (name == "dockWidgetArea"_L1)
return static_cast<const QDesignerDockWidget *>(object())->docked();
- if (name == QLatin1String("docked"))
+ if (name == "docked"_L1)
return static_cast<const QDesignerDockWidget *>(object())->inMainWindow();
return QDesignerPropertySheet::isEnabled(index);
}
diff --git a/src/designer/src/lib/shared/qdesigner_dockwidget_p.h b/src/designer/src/lib/shared/qdesigner_dockwidget_p.h
index a39ece90d..f8031c045 100644
--- a/src/designer/src/lib/shared/qdesigner_dockwidget_p.h
+++ b/src/designer/src/lib/shared/qdesigner_dockwidget_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/qdesigner_formbuilder.cpp b/src/designer/src/lib/shared/qdesigner_formbuilder.cpp
index 3b25125af..ff52bfd4b 100644
--- a/src/designer/src/lib/shared/qdesigner_formbuilder.cpp
+++ b/src/designer/src/lib/shared/qdesigner_formbuilder.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_formbuilder_p.h"
#include "dynamicpropertysheet.h"
@@ -69,6 +44,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
QDesignerFormBuilder::QDesignerFormBuilder(QDesignerFormEditorInterface *core,
@@ -123,11 +100,11 @@ QWidget *QDesignerFormBuilder::createWidget(const QString &widgetName, QWidget *
{
QWidget *widget = nullptr;
- if (widgetName == QStringLiteral("QToolBar")) {
+ if (widgetName == "QToolBar"_L1) {
widget = new QToolBar(parentWidget);
- } else if (widgetName == QStringLiteral("QMenu")) {
+ } else if (widgetName == "QMenu"_L1) {
widget = new QMenu(parentWidget);
- } else if (widgetName == QStringLiteral("QMenuBar")) {
+ } else if (widgetName == "QMenuBar"_L1) {
widget = new QMenuBar(parentWidget);
} else {
widget = core()->widgetFactory()->createWidget(widgetName, parentWidget);
@@ -231,7 +208,7 @@ void QDesignerFormBuilder::applyProperties(QObject *o, const QList<DomProperty*>
const QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), o);
const QDesignerDynamicPropertySheetExtension *dynamicSheet = qt_extension<QDesignerDynamicPropertySheetExtension*>(core()->extensionManager(), o);
- const bool changingMetaObject = WidgetFactory::classNameOf(core(), o) == QStringLiteral("QAxWidget");
+ const bool changingMetaObject = WidgetFactory::classNameOf(core(), o) == "QAxWidget"_L1;
const QDesignerMetaObjectInterface *meta = core()->introspection()->metaObject(o);
const bool dynamicPropertiesAllowed = dynamicSheet && dynamicSheet->dynamicPropertiesAllowed();
@@ -267,7 +244,7 @@ void QDesignerFormBuilder::applyProperties(QObject *o, const QList<DomProperty*>
QObject *obj = o;
QAbstractScrollArea *scroll = qobject_cast<QAbstractScrollArea *>(o);
- if (scroll && attributeName == QStringLiteral("cursor") && scroll->viewport())
+ if (scroll && attributeName == "cursor"_L1 && scroll->viewport())
obj = scroll->viewport();
// a real property
@@ -346,12 +323,8 @@ QWidget *QDesignerFormBuilder::createPreview(const QDesignerFormWindowInterface
}
// Fake application style sheet by prepending. (If this doesn't work, fake by nesting
// into parent widget).
- if (!appStyleSheet.isEmpty()) {
- QString styleSheet = appStyleSheet;
- styleSheet += QLatin1Char('\n');
- styleSheet += widget->styleSheet();
- widget->setStyleSheet(styleSheet);
- }
+ if (!appStyleSheet.isEmpty())
+ widget->setStyleSheet(appStyleSheet + u'\n' + widget->styleSheet());
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 ceaf1b395..a4652f60a 100644
--- a/src/designer/src/lib/shared/qdesigner_formbuilder_p.h
+++ b/src/designer/src/lib/shared/qdesigner_formbuilder_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/qdesigner_formeditorcommand.cpp b/src/designer/src/lib/shared/qdesigner_formeditorcommand.cpp
index 926bc0b3d..89727103f 100644
--- a/src/designer/src/lib/shared/qdesigner_formeditorcommand.cpp
+++ b/src/designer/src/lib/shared/qdesigner_formeditorcommand.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_formeditorcommand_p.h"
diff --git a/src/designer/src/lib/shared/qdesigner_formeditorcommand_p.h b/src/designer/src/lib/shared/qdesigner_formeditorcommand_p.h
index 071c090c6..8b7d8c9ac 100644
--- a/src/designer/src/lib/shared/qdesigner_formeditorcommand_p.h
+++ b/src/designer/src/lib/shared/qdesigner_formeditorcommand_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/qdesigner_formwindowcommand.cpp b/src/designer/src/lib/shared/qdesigner_formwindowcommand.cpp
index 190540db2..48687277e 100644
--- a/src/designer/src/lib/shared/qdesigner_formwindowcommand.cpp
+++ b/src/designer/src/lib/shared/qdesigner_formwindowcommand.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_formwindowcommand_p.h"
@@ -46,6 +21,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
// ---- QDesignerFormWindowCommand ----
@@ -104,7 +81,7 @@ void QDesignerFormWindowCommand::updateBuddies(QDesignerFormWindowInterface *for
if (label_list.isEmpty())
return;
- const QString buddyProperty = QStringLiteral("buddy");
+ const QString buddyProperty = u"buddy"_s;
const QByteArray oldNameU8 = old_name.toUtf8();
const QByteArray newNameU8 = new_name.toUtf8();
diff --git a/src/designer/src/lib/shared/qdesigner_formwindowcommand_p.h b/src/designer/src/lib/shared/qdesigner_formwindowcommand_p.h
index ff5328792..a2d2ad165 100644
--- a/src/designer/src/lib/shared/qdesigner_formwindowcommand_p.h
+++ b/src/designer/src/lib/shared/qdesigner_formwindowcommand_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/qdesigner_formwindowmanager.cpp b/src/designer/src/lib/shared/qdesigner_formwindowmanager.cpp
index 243a2cac7..449161993 100644
--- a/src/designer/src/lib/shared/qdesigner_formwindowmanager.cpp
+++ b/src/designer/src/lib/shared/qdesigner_formwindowmanager.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_formwindowmanager_p.h"
#include "plugindialog_p.h"
@@ -33,7 +8,7 @@
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+namespace qdesigner_internal {
/*!
\class qdesigner_internal::QDesignerFormWindowManager
@@ -71,4 +46,6 @@ void QDesignerFormWindowManager::showPluginDialog()
dlg.exec();
}
+} // namespace qdesigner_internal
+
QT_END_NAMESPACE
diff --git a/src/designer/src/lib/shared/qdesigner_formwindowmanager_p.h b/src/designer/src/lib/shared/qdesigner_formwindowmanager_p.h
index 5ee960fd8..e4864d710 100644
--- a/src/designer/src/lib/shared/qdesigner_formwindowmanager_p.h
+++ b/src/designer/src/lib/shared/qdesigner_formwindowmanager_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/qdesigner_introspection.cpp b/src/designer/src/lib/shared/qdesigner_introspection.cpp
index 89dc6350e..60a4272d7 100644
--- a/src/designer/src/lib/shared/qdesigner_introspection.cpp
+++ b/src/designer/src/lib/shared/qdesigner_introspection.cpp
@@ -1,39 +1,17 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_introspection_p.h"
+#include <QtCore/qobject.h>
#include <QtCore/qlist.h>
#include <QtCore/qmetaobject.h>
#include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
// Qt Implementation
static QStringList byteArrayListToStringList(const QByteArrayList &l)
{
@@ -63,6 +41,7 @@ namespace {
int keyToValue(const QString &key) const override { return m_enum.keyToValue(key.toUtf8()); }
int keysToValue(const QString &keys) const override { return m_enum.keysToValue(keys.toUtf8()); }
QString name() const override { return m_name; }
+ QString enumName() const override { return charToQString(m_enum.enumName()); }
QString scope() const override { return m_scope; }
QString separator() const override;
int value(int index) const override { return m_enum.value(index); }
@@ -84,8 +63,7 @@ namespace {
QString QDesignerMetaEnum::separator() const
{
- static const QString rc = QStringLiteral("::");
- return rc;
+ return u"::"_s;
}
// ------- QDesignerMetaProperty
@@ -343,7 +321,7 @@ namespace qdesigner_internal {
const QDesignerMetaObjectInterface* QDesignerIntrospection::metaObjectForQMetaObject(const QMetaObject *metaObject) const
{
- MetaObjectMap::iterator it = m_metaObjectMap.find(metaObject);
+ auto it = m_metaObjectMap.find(metaObject);
if (it == m_metaObjectMap.end())
it = m_metaObjectMap.insert(metaObject, new QDesignerMetaObject(this, metaObject));
return it.value();
diff --git a/src/designer/src/lib/shared/qdesigner_introspection_p.h b/src/designer/src/lib/shared/qdesigner_introspection_p.h
index 6c4d37e4d..1cdf0aa4f 100644
--- a/src/designer/src/lib/shared/qdesigner_introspection_p.h
+++ b/src/designer/src/lib/shared/qdesigner_introspection_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -42,7 +17,7 @@
#include "shared_global_p.h"
#include <abstractintrospection_p.h>
-#include <QtCore/qmap.h>
+#include <QtCore/qhash.h>
QT_BEGIN_NAMESPACE
@@ -59,10 +34,9 @@ namespace qdesigner_internal {
const QDesignerMetaObjectInterface* metaObject(const QObject *object) const override;
const QDesignerMetaObjectInterface* metaObjectForQMetaObject(const QMetaObject *metaObject) const;
- private:
- using MetaObjectMap = QMap<const QMetaObject*, QDesignerMetaObjectInterface*>;
- mutable MetaObjectMap m_metaObjectMap;
+ private:
+ mutable QHash<const QMetaObject *, QDesignerMetaObjectInterface *> m_metaObjectMap;
};
}
diff --git a/src/designer/src/lib/shared/qdesigner_membersheet.cpp b/src/designer/src/lib/shared/qdesigner_membersheet.cpp
index 2e62aab7f..5451222fe 100644
--- a/src/designer/src/lib/shared/qdesigner_membersheet.cpp
+++ b/src/designer/src/lib/shared/qdesigner_membersheet.cpp
@@ -1,64 +1,26 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_membersheet_p.h"
+#include "qdesigner_propertysheet_p.h"
#include <QtDesigner/abstractformeditor.h>
#include <abstractintrospection_p.h>
#include <QtWidgets/qwidget.h>
+
QT_BEGIN_NAMESPACE
-static QList<QByteArray> stringListToByteArray(const QStringList &l)
+using namespace Qt::StringLiterals;
+
+static QByteArrayList stringListToByteArray(const QStringList &l)
{
- if (l.isEmpty())
- return QList<QByteArray>();
- QList<QByteArray> rc;
- const QStringList::const_iterator cend = l.constEnd();
- for (QStringList::const_iterator it = l.constBegin(); it != cend; ++it)
- rc += it->toUtf8();
+ QByteArrayList rc;
+ for (const auto &s : l)
+ rc += s.toUtf8();
return rc;
}
-// Find the form editor in the hierarchy.
-// We know that the parent of the sheet is the extension manager
-// whose parent is the core.
-
-static QDesignerFormEditorInterface *formEditorForObject(QObject *o) {
- do {
- if (QDesignerFormEditorInterface* core = qobject_cast<QDesignerFormEditorInterface*>(o))
- return core;
- o = o->parent();
- } while(o);
- Q_ASSERT(o);
- return nullptr;
-}
-
// ------------ QDesignerMemberSheetPrivate
class QDesignerMemberSheetPrivate {
public:
@@ -73,25 +35,22 @@ public:
bool visible{true};
};
- using InfoHash = QHash<int, Info>;
-
Info &ensureInfo(int index);
- InfoHash m_info;
+ QHash<int, Info> m_info;
};
QDesignerMemberSheetPrivate::QDesignerMemberSheetPrivate(QObject *object, QObject *sheetParent) :
- m_core(formEditorForObject(sheetParent)),
+ m_core(QDesignerPropertySheet::formEditorForObject(sheetParent)),
m_meta(m_core->introspection()->metaObject(object))
{
}
QDesignerMemberSheetPrivate::Info &QDesignerMemberSheetPrivate::ensureInfo(int index)
{
- InfoHash::iterator it = m_info.find(index);
- if (it == m_info.end()) {
+ auto it = m_info.find(index);
+ if (it == m_info.end())
it = m_info.insert(index, Info());
- }
return it.value();
}
@@ -183,7 +142,7 @@ bool QDesignerMemberSheet::isSlot(int index) const
bool QDesignerMemberSheet::inheritedFromWidget(int index) const
{
- return declaredInClass(index) == QStringLiteral("QWidget") || declaredInClass(index) == QStringLiteral("QObject");
+ return declaredInClass(index) == "QWidget"_L1 || declaredInClass(index) == "QObject"_L1;
}
@@ -202,24 +161,24 @@ bool QDesignerMemberSheet::signalMatchesSlot(const QString &signal, const QStrin
bool result = true;
do {
- int signal_idx = signal.indexOf(QLatin1Char('('));
- int slot_idx = slot.indexOf(QLatin1Char('('));
+ qsizetype signal_idx = signal.indexOf(u'(');
+ qsizetype slot_idx = slot.indexOf(u'(');
if (signal_idx == -1 || slot_idx == -1)
break;
++signal_idx; ++slot_idx;
- if (slot.at(slot_idx) == QLatin1Char(')'))
+ if (slot.at(slot_idx) == u')')
break;
while (signal_idx < signal.size() && slot_idx < slot.size()) {
const QChar signal_c = signal.at(signal_idx);
const QChar slot_c = slot.at(slot_idx);
- if (signal_c == QLatin1Char(',') && slot_c == QLatin1Char(')'))
+ if (signal_c == u',' && slot_c == u')')
break;
- if (signal_c == QLatin1Char(')') && slot_c == QLatin1Char(')'))
+ if (signal_c == u')' && slot_c == u')')
break;
if (signal_c != slot_c) {
diff --git a/src/designer/src/lib/shared/qdesigner_membersheet_p.h b/src/designer/src/lib/shared/qdesigner_membersheet_p.h
index b67ad3792..b8df5e2fb 100644
--- a/src/designer/src/lib/shared/qdesigner_membersheet_p.h
+++ b/src/designer/src/lib/shared/qdesigner_membersheet_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/qdesigner_menu.cpp b/src/designer/src/lib/shared/qdesigner_menu.cpp
index 35a116bae..c19f98dec 100644
--- a/src/designer/src/lib/shared/qdesigner_menu.cpp
+++ b/src/designer/src/lib/shared/qdesigner_menu.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_menu_p.h"
#include "qdesigner_menubar_p.h"
@@ -56,11 +31,9 @@
#include <QtCore/qtimer.h>
#include <QtCore/qdebug.h>
-Q_DECLARE_METATYPE(QAction*)
-
QT_BEGIN_NAMESPACE
-using namespace qdesigner_internal;
+using namespace Qt::StringLiterals;
// give the user a little more space to click on the sub menu rectangle
static inline void extendClickableArea(QRect *subMenuRect, Qt::LayoutDirection dir)
@@ -78,10 +51,10 @@ static inline void extendClickableArea(QRect *subMenuRect, Qt::LayoutDirection d
QDesignerMenu::QDesignerMenu(QWidget *parent) :
QMenu(parent),
- m_subMenuPixmap(QPixmap(QStringLiteral(":/qt-project.org/formeditor/images/submenu.png"))),
+ m_subMenuPixmap(QPixmap(u":/qt-project.org/formeditor/images/submenu.png"_s)),
m_currentIndex(0),
- m_addItem(new SpecialMenuAction(this)),
- m_addSeparator(new SpecialMenuAction(this)),
+ m_addItem(new qdesigner_internal::SpecialMenuAction(this)),
+ m_addSeparator(new qdesigner_internal::SpecialMenuAction(this)),
m_showSubMenuTimer(new QTimer(this)),
m_deactivateWindowTimer(new QTimer(this)),
m_adjustSizeTimer(new QTimer(this)),
@@ -104,7 +77,7 @@ QDesignerMenu::QDesignerMenu(QWidget *parent) :
connect(m_deactivateWindowTimer, &QTimer::timeout, this, &QDesignerMenu::slotDeactivateNow);
- m_editor->setObjectName(QStringLiteral("__qt__passive_editor"));
+ m_editor->setObjectName(u"__qt__passive_editor"_s);
m_editor->hide();
m_editor->installEventFilter(this);
@@ -152,6 +125,8 @@ bool QDesignerMenu::handleEvent(QWidget *widget, QEvent *event)
void QDesignerMenu::startDrag(const QPoint &pos, Qt::KeyboardModifiers modifiers)
{
+ using namespace qdesigner_internal;
+
const int index = findAction(pos);
if (index >= realActionCount())
return;
@@ -161,7 +136,7 @@ void QDesignerMenu::startDrag(const QPoint &pos, Qt::KeyboardModifiers modifiers
QDesignerFormWindowInterface *fw = formWindow();
const Qt::DropAction dropAction = (modifiers & Qt::ControlModifier) ? Qt::CopyAction : Qt::MoveAction;
if (dropAction == Qt::MoveAction) {
- RemoveActionFromCommand *cmd = new RemoveActionFromCommand(fw);
+ auto *cmd = new RemoveActionFromCommand(fw);
cmd->init(this, action, actions().at(index + 1));
fw->commandHistory()->push(cmd);
}
@@ -176,7 +151,7 @@ void QDesignerMenu::startDrag(const QPoint &pos, Qt::KeyboardModifiers modifiers
if (drag->exec(dropAction) == Qt::IgnoreAction) {
if (dropAction == Qt::MoveAction) {
QAction *previous = safeActionAt(index);
- InsertActionIntoCommand *cmd = new InsertActionIntoCommand(fw);
+ auto *cmd = new InsertActionIntoCommand(fw);
cmd->init(this, action, previous);
fw->commandHistory()->push(cmd);
}
@@ -224,7 +199,7 @@ bool QDesignerMenu::handleKeyPressEvent(QWidget * /*widget*/, QKeyEvent *e)
break;
case Qt::Key_PageDown:
- m_currentIndex = actions().count() - 1;
+ m_currentIndex = actions().size() - 1;
break;
case Qt::Key_Enter:
@@ -460,7 +435,7 @@ bool QDesignerMenu::handleContextMenuEvent(QWidget *, QContextMenuEvent *event)
const int index = findAction(mapFromGlobal(event->globalPos()));
QAction *action = safeActionAt(index);
- if (qobject_cast<SpecialMenuAction*>(action))
+ if (qobject_cast<qdesigner_internal::SpecialMenuAction*>(action))
return true;
QMenu menu;
@@ -502,14 +477,14 @@ void QDesignerMenu::slotAddSeparator()
fw->beginCommand(tr("Add separator"));
QAction *sep = createAction(QString(), true);
- InsertActionIntoCommand *cmd = new InsertActionIntoCommand(fw);
+ auto *cmd = new qdesigner_internal::InsertActionIntoCommand(fw);
cmd->init(this, sep, action_before);
fw->commandHistory()->push(cmd);
if (parentMenu()) {
QAction *parent_action = parentMenu()->currentAction();
if (parent_action->menu() == nullptr) {
- CreateSubmenuCommand *cmd = new CreateSubmenuCommand(fw);
+ auto *cmd = new qdesigner_internal::CreateSubmenuCommand(fw);
cmd->init(parentMenu(), parentMenu()->currentAction());
fw->commandHistory()->push(cmd);
}
@@ -533,7 +508,7 @@ void QDesignerMenu::deleteAction(QAction *a)
action_before = safeActionAt(pos + 1);
QDesignerFormWindowInterface *fw = formWindow();
- RemoveActionFromCommand *cmd = new RemoveActionFromCommand(fw);
+ auto *cmd = new qdesigner_internal::RemoveActionFromCommand(fw);
cmd->init(this, a, action_before);
fw->commandHistory()->push(cmd);
}
@@ -549,7 +524,7 @@ QRect QDesignerMenu::subMenuPixmapRect(QAction *action) const
bool QDesignerMenu::hasSubMenuPixmap(QAction *action) const
{
return action != nullptr
- && qobject_cast<SpecialMenuAction*>(action) == 0
+ && qobject_cast<qdesigner_internal::SpecialMenuAction*>(action) == nullptr
&& !action->isSeparator()
&& !action->menu()
&& canCreateSubMenu(action);
@@ -563,6 +538,8 @@ void QDesignerMenu::showEvent ( QShowEvent * event )
void QDesignerMenu::paintEvent(QPaintEvent *event)
{
+ using namespace qdesigner_internal;
+
QMenu::paintEvent(event);
QPainter p(this);
@@ -697,7 +674,7 @@ QDesignerMenu::ActionDragCheck QDesignerMenu::checkAction(QAction *action) const
if (!action || (action->menu() && action->menu()->parentWidget() != const_cast<QDesignerMenu*>(this)))
return NoActionDrag; // menu action!! nothing to do
- if (!Utils::isObjectAncestorOf(formWindow()->mainContainer(), action))
+ if (!qdesigner_internal::Utils::isObjectAncestorOf(formWindow()->mainContainer(), action))
return NoActionDrag; // the action belongs to another form window
if (actions().contains(action))
@@ -708,7 +685,7 @@ QDesignerMenu::ActionDragCheck QDesignerMenu::checkAction(QAction *action) const
void QDesignerMenu::dragEnterEvent(QDragEnterEvent *event)
{
- const ActionRepositoryMimeData *d = qobject_cast<const ActionRepositoryMimeData*>(event->mimeData());
+ auto *d = qobject_cast<const qdesigner_internal::ActionRepositoryMimeData*>(event->mimeData());
if (!d || d->actionList().isEmpty()) {
event->ignore();
return;
@@ -740,7 +717,7 @@ void QDesignerMenu::dragMoveEvent(QDragMoveEvent *event)
return;
}
- const ActionRepositoryMimeData *d = qobject_cast<const ActionRepositoryMimeData*>(event->mimeData());
+ auto *d = qobject_cast<const qdesigner_internal::ActionRepositoryMimeData*>(event->mimeData());
if (!d || d->actionList().isEmpty()) {
event->ignore();
return;
@@ -785,7 +762,7 @@ void QDesignerMenu::dropEvent(QDropEvent *event)
m_dragging = false;
QDesignerFormWindowInterface *fw = formWindow();
- const ActionRepositoryMimeData *d = qobject_cast<const ActionRepositoryMimeData*>(event->mimeData());
+ auto *d = qobject_cast<const qdesigner_internal::ActionRepositoryMimeData*>(event->mimeData());
if (!d || d->actionList().isEmpty()) {
event->ignore();
return;
@@ -794,10 +771,10 @@ void QDesignerMenu::dropEvent(QDropEvent *event)
if (action && checkAction(action) == AcceptActionDrag) {
event->acceptProposedAction();
int index = findAction(event->position().toPoint());
- index = qMin(index, actions().count() - 1);
+ index = qMin(index, actions().size() - 1);
fw->beginCommand(tr("Insert action"));
- InsertActionIntoCommand *cmd = new InsertActionIntoCommand(fw);
+ auto *cmd = new qdesigner_internal::InsertActionIntoCommand(fw);
cmd->init(this, action, safeActionAt(index));
fw->commandHistory()->push(cmd);
@@ -806,7 +783,7 @@ void QDesignerMenu::dropEvent(QDropEvent *event)
if (parentMenu()) {
QAction *parent_action = parentMenu()->currentAction();
if (parent_action->menu() == nullptr) {
- CreateSubmenuCommand *cmd = new CreateSubmenuCommand(fw);
+ auto *cmd = new qdesigner_internal::CreateSubmenuCommand(fw);
cmd->init(parentMenu(), parentMenu()->currentAction(), action);
fw->commandHistory()->push(cmd);
}
@@ -877,6 +854,8 @@ bool QDesignerMenu::hideSubMenuOnCursorKey()
// Return false to indicate the event must be propagated to the menu bar.
bool QDesignerMenu::showSubMenuOnCursorKey()
{
+ using namespace qdesigner_internal;
+
const QAction *action = currentAction();
if (qobject_cast<const SpecialMenuAction*>(action) || action->isSeparator()) {
@@ -924,7 +903,7 @@ void QDesignerMenu::moveUp(bool ctrl)
void QDesignerMenu::moveDown(bool ctrl)
{
- if (m_currentIndex == actions().count() - 1) {
+ if (m_currentIndex == actions().size() - 1) {
return;
}
@@ -932,7 +911,7 @@ void QDesignerMenu::moveDown(bool ctrl)
(void) swap(m_currentIndex + 1, m_currentIndex);
++m_currentIndex;
- m_currentIndex = qMin(actions().count() - 1, m_currentIndex);
+ m_currentIndex = qMin(actions().size() - 1, m_currentIndex);
update();
if (!ctrl)
selectCurrentAction();
@@ -940,7 +919,7 @@ void QDesignerMenu::moveDown(bool ctrl)
QAction *QDesignerMenu::currentAction() const
{
- if (m_currentIndex < 0 || m_currentIndex >= actions().count())
+ if (m_currentIndex < 0 || m_currentIndex >= actions().size())
return nullptr;
return safeActionAt(m_currentIndex);
@@ -948,11 +927,13 @@ QAction *QDesignerMenu::currentAction() const
int QDesignerMenu::realActionCount() const
{
- return actions().count() - 2; // 2 fake actions
+ return actions().size() - 2; // 2 fake actions
}
void QDesignerMenu::selectCurrentAction()
{
+ using namespace qdesigner_internal;
+
QAction *action = currentAction();
if (!action || action == m_addSeparator || action == m_addItem)
return;
@@ -982,6 +963,8 @@ void QDesignerMenu::selectCurrentAction()
void QDesignerMenu::createRealMenuAction(QAction *action)
{
+ using namespace qdesigner_internal;
+
if (action->menu())
return; // nothing to do
@@ -998,7 +981,7 @@ void QDesignerMenu::createRealMenuAction(QAction *action)
core->widgetFactory()->initialize(menu);
- const QString niceObjectName = ActionEditor::actionTextToName(menu->title(), QStringLiteral("menu"));
+ const QString niceObjectName = ActionEditor::actionTextToName(menu->title(), u"menu"_s);
menu->setObjectName(niceObjectName);
core->metaDataBase()->add(menu);
@@ -1035,16 +1018,15 @@ QDesignerMenu *QDesignerMenu::findOrCreateSubMenu(QAction *action)
bool QDesignerMenu::canCreateSubMenu(QAction *action) const // ### improve it's a bit too slow
{
- const QWidgetList &associatedWidgets = action->associatedWidgets();
- for (const QWidget *aw : associatedWidgets) {
- if (aw != this) {
- if (const QMenu *m = qobject_cast<const QMenu *>(aw)) {
+ const QObjectList associatedObjects = action->associatedObjects();
+ for (const QObject *ao : associatedObjects) {
+ if (ao != this) {
+ if (const QMenu *m = qobject_cast<const QMenu *>(ao)) {
if (m->actions().contains(action))
return false; // sorry
- } else {
- if (const QToolBar *tb = qobject_cast<const QToolBar *>(aw))
- if (tb->actions().contains(action))
- return false; // sorry
+ } else if (const QToolBar *tb = qobject_cast<const QToolBar *>(ao)) {
+ if (tb->actions().contains(action))
+ return false; // sorry
}
}
}
@@ -1095,6 +1077,8 @@ void QDesignerMenu::slotShowSubMenuNow()
void QDesignerMenu::showSubMenu(QAction *action)
{
+ using namespace qdesigner_internal;
+
m_showSubMenuTimer->stop();
if (m_editor->isVisible() || !action || qobject_cast<SpecialMenuAction*>(action)
@@ -1148,14 +1132,14 @@ void QDesignerMenu::enterEditMode()
fw->beginCommand(tr("Add separator"));
QAction *sep = createAction(QString(), true);
- InsertActionIntoCommand *cmd = new InsertActionIntoCommand(fw);
+ auto *cmd = new qdesigner_internal::InsertActionIntoCommand(fw);
cmd->init(this, sep, safeActionAt(realActionCount()));
fw->commandHistory()->push(cmd);
if (parentMenu()) {
QAction *parent_action = parentMenu()->currentAction();
if (parent_action->menu() == nullptr) {
- CreateSubmenuCommand *cmd = new CreateSubmenuCommand(fw);
+ auto *cmd = new qdesigner_internal::CreateSubmenuCommand(fw);
cmd->init(parentMenu(), parentMenu()->currentAction());
fw->commandHistory()->push(cmd);
}
@@ -1170,6 +1154,8 @@ void QDesignerMenu::enterEditMode()
void QDesignerMenu::leaveEditMode(LeaveEditMode mode)
{
+ using namespace qdesigner_internal;
+
if (mode == Default)
return;
@@ -1183,19 +1169,19 @@ void QDesignerMenu::leaveEditMode(LeaveEditMode mode)
Q_ASSERT(fw != nullptr);
fw->beginCommand(QApplication::translate("Command", "Insert action"));
action = createAction(ActionEditor::actionTextToName(m_editor->text()));
- InsertActionIntoCommand *cmd = new InsertActionIntoCommand(fw);
+ auto *cmd = new qdesigner_internal::InsertActionIntoCommand(fw);
cmd->init(this, action, currentAction());
fw->commandHistory()->push(cmd);
}
- SetPropertyCommand *cmd = new SetPropertyCommand(fw);
- cmd->init(action, QStringLiteral("text"), m_editor->text());
+ auto *cmd = new qdesigner_internal::SetPropertyCommand(fw);
+ cmd->init(action, u"text"_s, m_editor->text());
fw->commandHistory()->push(cmd);
if (parentMenu()) {
QAction *parent_action = parentMenu()->currentAction();
if (parent_action->menu() == nullptr) {
- CreateSubmenuCommand *cmd = new CreateSubmenuCommand(fw);
+ auto *cmd = new qdesigner_internal::CreateSubmenuCommand(fw);
cmd->init(parentMenu(), parentMenu()->currentAction(), action);
fw->commandHistory()->push(cmd);
}
@@ -1246,12 +1232,14 @@ QAction *QDesignerMenu::createAction(const QString &objectName, bool separator)
{
QDesignerFormWindowInterface *fw = formWindow();
Q_ASSERT(fw);
- return ToolBarEventFilter::createAction(fw, objectName, separator);
+ return qdesigner_internal::ToolBarEventFilter::createAction(fw, objectName, separator);
}
// ### share with QDesignerMenu::swap
bool QDesignerMenu::swap(int a, int b)
{
+ using namespace qdesigner_internal;
+
const int left = qMin(a, b);
int right = qMax(a, b);
@@ -1274,21 +1262,21 @@ bool QDesignerMenu::swap(int a, int b)
QAction *action_b_before = safeActionAt(right + 1);
- RemoveActionFromCommand *cmd1 = new RemoveActionFromCommand(fw);
+ auto *cmd1 = new qdesigner_internal::RemoveActionFromCommand(fw);
cmd1->init(this, action_b, action_b_before, false);
fw->commandHistory()->push(cmd1);
QAction *action_a_before = safeActionAt(left + 1);
- InsertActionIntoCommand *cmd2 = new InsertActionIntoCommand(fw);
+ auto *cmd2 = new qdesigner_internal::InsertActionIntoCommand(fw);
cmd2->init(this, action_b, action_a_before, false);
fw->commandHistory()->push(cmd2);
- RemoveActionFromCommand *cmd3 = new RemoveActionFromCommand(fw);
+ auto *cmd3 = new qdesigner_internal::RemoveActionFromCommand(fw);
cmd3->init(this, action_a, action_b, false);
fw->commandHistory()->push(cmd3);
- InsertActionIntoCommand *cmd4 = new InsertActionIntoCommand(fw);
+ auto *cmd4 = new qdesigner_internal::InsertActionIntoCommand(fw);
cmd4->init(this, action_a, action_b_before, true);
fw->commandHistory()->push(cmd4);
@@ -1299,7 +1287,7 @@ bool QDesignerMenu::swap(int a, int b)
QAction *QDesignerMenu::safeActionAt(int index) const
{
- if (index < 0 || index >= actions().count())
+ if (index < 0 || index >= actions().size())
return nullptr;
return actions().at(index);
@@ -1322,7 +1310,7 @@ void QDesignerMenu::deleteAction()
action_before = safeActionAt(pos + 1);
QDesignerFormWindowInterface *fw = formWindow();
- RemoveActionFromCommand *cmd = new RemoveActionFromCommand(fw);
+ auto *cmd = new qdesigner_internal::RemoveActionFromCommand(fw);
cmd->init(this, action, action_before);
fw->commandHistory()->push(cmd);
diff --git a/src/designer/src/lib/shared/qdesigner_menu_p.h b/src/designer/src/lib/shared/qdesigner_menu_p.h
index 1093961eb..a3212ad69 100644
--- a/src/designer/src/lib/shared/qdesigner_menu_p.h
+++ b/src/designer/src/lib/shared/qdesigner_menu_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/qdesigner_menubar.cpp b/src/designer/src/lib/shared/qdesigner_menubar.cpp
index 51bab619e..7b442ed31 100644
--- a/src/designer/src/lib/shared/qdesigner_menubar.cpp
+++ b/src/designer/src/lib/shared/qdesigner_menubar.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_menubar_p.h"
#include "qdesigner_menu_p.h"
@@ -52,13 +27,11 @@
#include <QtGui/qpainter.h>
#include <QtGui/qevent.h>
-Q_DECLARE_METATYPE(QAction*)
-
QT_BEGIN_NAMESPACE
-using ActionList = QList<QAction *>;
+using namespace Qt::StringLiterals;
-using namespace qdesigner_internal;
+using ActionList = QList<QAction *>;
namespace qdesigner_internal
{
@@ -77,9 +50,9 @@ SpecialMenuAction::~SpecialMenuAction() = default;
/////////////////////////////////////////////////////////////////////////////////////////////////////////
QDesignerMenuBar::QDesignerMenuBar(QWidget *parent) :
QMenuBar(parent),
- m_addMenu(new SpecialMenuAction(this)),
+ m_addMenu(new qdesigner_internal::SpecialMenuAction(this)),
m_editor(new QLineEdit(this)),
- m_promotionTaskMenu(new PromotionTaskMenu(this, PromotionTaskMenu::ModeSingleWidget, this))
+ m_promotionTaskMenu(new qdesigner_internal::PromotionTaskMenu(this, qdesigner_internal::PromotionTaskMenu::ModeSingleWidget, this))
{
setContextMenuPolicy(Qt::DefaultContextMenu);
@@ -94,7 +67,7 @@ QDesignerMenuBar::QDesignerMenuBar(QWidget *parent) :
italic.setItalic(true);
m_addMenu->setFont(italic);
- m_editor->setObjectName(QStringLiteral("__qt__passive_editor"));
+ m_editor->setObjectName(u"__qt__passive_editor"_s);
m_editor->hide();
m_editor->installEventFilter(this);
installEventFilter(this);
@@ -110,7 +83,7 @@ void QDesignerMenuBar::paintEvent(QPaintEvent *event)
const auto &actionList = actions();
for (QAction *a : actionList) {
- if (qobject_cast<SpecialMenuAction*>(a)) {
+ if (qobject_cast<qdesigner_internal::SpecialMenuAction*>(a)) {
const QRect g = actionGeometry(a);
QLinearGradient lg(g.left(), g.top(), g.left(), g.bottom());
lg.setColorAt(0.0, Qt::transparent);
@@ -223,7 +196,7 @@ bool QDesignerMenuBar::handleKeyPressEvent(QWidget *, QKeyEvent *e)
break;
case Qt::Key_PageDown:
- m_currentIndex = actions().count() - 1;
+ m_currentIndex = actions().size() - 1;
break;
case Qt::Key_Enter:
@@ -287,6 +260,8 @@ bool QDesignerMenuBar::handleKeyPressEvent(QWidget *, QKeyEvent *e)
void QDesignerMenuBar::startDrag(const QPoint &pos)
{
+ using namespace qdesigner_internal;
+
const int index = findAction(pos);
if (m_currentIndex == -1 || index >= realActionCount())
return;
@@ -294,7 +269,7 @@ void QDesignerMenuBar::startDrag(const QPoint &pos)
QAction *action = safeActionAt(index);
QDesignerFormWindowInterface *fw = formWindow();
- RemoveActionFromCommand *cmd = new RemoveActionFromCommand(fw);
+ auto *cmd = new qdesigner_internal::RemoveActionFromCommand(fw);
cmd->init(this, action, actions().at(index + 1));
fw->commandHistory()->push(cmd);
@@ -310,7 +285,7 @@ void QDesignerMenuBar::startDrag(const QPoint &pos)
m_currentIndex = -1;
if (drag->exec(Qt::MoveAction) == Qt::IgnoreAction) {
- InsertActionIntoCommand *cmd = new InsertActionIntoCommand(fw);
+ auto *cmd = new qdesigner_internal::InsertActionIntoCommand(fw);
cmd->init(this, action, safeActionAt(index));
fw->commandHistory()->push(cmd);
@@ -365,7 +340,7 @@ bool QDesignerMenuBar::handleMouseMoveEvent(QWidget *, QMouseEvent *event)
return true;
const int index = actionIndexAt(this, m_startPosition, Qt::Horizontal);
- if (index < actions().count()) {
+ if (index < actions().size()) {
hideMenu(index);
update();
}
@@ -378,6 +353,8 @@ bool QDesignerMenuBar::handleMouseMoveEvent(QWidget *, QMouseEvent *event)
ActionList QDesignerMenuBar::contextMenuActions()
{
+ using namespace qdesigner_internal;
+
ActionList rc;
if (QAction *action = safeActionAt(m_currentIndex)) {
if (!qobject_cast<SpecialMenuAction*>(action)) {
@@ -412,9 +389,8 @@ bool QDesignerMenuBar::handleContextMenuEvent(QWidget *, QContextMenuEvent *even
QMenu menu;
const ActionList al = contextMenuActions();
- const ActionList::const_iterator acend = al.constEnd();
- for (ActionList::const_iterator it = al.constBegin(); it != acend; ++it)
- menu.addAction(*it);
+ for (auto *a : al)
+ menu.addAction(a);
menu.exec(event->globalPos());
return true;
}
@@ -425,7 +401,7 @@ void QDesignerMenuBar::slotRemoveMenuBar()
QDesignerFormWindowInterface *fw = formWindow();
- DeleteMenuBarCommand *cmd = new DeleteMenuBarCommand(fw);
+ auto *cmd = new qdesigner_internal::DeleteMenuBarCommand(fw);
cmd->init(this);
fw->commandHistory()->push(cmd);
}
@@ -444,6 +420,8 @@ void QDesignerMenuBar::enterEditMode()
void QDesignerMenuBar::leaveEditMode(LeaveEditMode mode)
{
+ using namespace qdesigner_internal;
+
m_editor->releaseKeyboard();
if (mode == Default)
@@ -462,20 +440,20 @@ void QDesignerMenuBar::leaveEditMode(LeaveEditMode mode)
fw->beginCommand(QApplication::translate("Command", "Change Title"));
} else {
fw->beginCommand(QApplication::translate("Command", "Insert Menu"));
- const QString niceObjectName = ActionEditor::actionTextToName(m_editor->text(), QStringLiteral("menu"));
- QMenu *menu = qobject_cast<QMenu*>(fw->core()->widgetFactory()->createWidget(QStringLiteral("QMenu"), this));
+ const QString niceObjectName = ActionEditor::actionTextToName(m_editor->text(), u"menu"_s);
+ QMenu *menu = qobject_cast<QMenu*>(fw->core()->widgetFactory()->createWidget(u"QMenu"_s, this));
fw->core()->widgetFactory()->initialize(menu);
menu->setObjectName(niceObjectName);
menu->setTitle(tr("Menu"));
fw->ensureUniqueObjectName(menu);
action = menu->menuAction();
- AddMenuActionCommand *cmd = new AddMenuActionCommand(fw);
+ auto *cmd = new qdesigner_internal::AddMenuActionCommand(fw);
cmd->init(action, m_addMenu, this, this);
fw->commandHistory()->push(cmd);
}
- SetPropertyCommand *cmd = new SetPropertyCommand(fw);
- cmd->init(action, QStringLiteral("text"), m_editor->text());
+ auto *cmd = new qdesigner_internal::SetPropertyCommand(fw);
+ cmd->init(action, u"text"_s, m_editor->text());
fw->commandHistory()->push(cmd);
fw->endCommand();
}
@@ -503,7 +481,7 @@ void QDesignerMenuBar::showLineEdit()
m_editor->selectAll();
m_editor->setGeometry(actionGeometry(action));
m_editor->show();
- qApp->setActiveWindow(m_editor);
+ m_editor->activateWindow();
m_editor->setFocus();
m_editor->grabKeyboard();
}
@@ -585,7 +563,7 @@ void QDesignerMenuBar::adjustIndicator(const QPoint &pos)
QDesignerMenuBar::ActionDragCheck QDesignerMenuBar::checkAction(QAction *action) const
{
// action belongs to another form
- if (!action || !Utils::isObjectAncestorOf(formWindow()->mainContainer(), action))
+ if (!action || !qdesigner_internal::Utils::isObjectAncestorOf(formWindow()->mainContainer(), action))
return NoActionDrag;
if (!action->menu())
@@ -603,7 +581,7 @@ QDesignerMenuBar::ActionDragCheck QDesignerMenuBar::checkAction(QAction *action)
void QDesignerMenuBar::dragEnterEvent(QDragEnterEvent *event)
{
- const ActionRepositoryMimeData *d = qobject_cast<const ActionRepositoryMimeData*>(event->mimeData());
+ auto *d = qobject_cast<const qdesigner_internal::ActionRepositoryMimeData*>(event->mimeData());
if (!d || d->actionList().isEmpty()) {
event->ignore();
return;
@@ -628,7 +606,7 @@ void QDesignerMenuBar::dragEnterEvent(QDragEnterEvent *event)
void QDesignerMenuBar::dragMoveEvent(QDragMoveEvent *event)
{
- const ActionRepositoryMimeData *d = qobject_cast<const ActionRepositoryMimeData*>(event->mimeData());
+ auto *d = qobject_cast<const qdesigner_internal::ActionRepositoryMimeData*>(event->mimeData());
if (!d || d->actionList().isEmpty()) {
event->ignore();
return;
@@ -661,16 +639,16 @@ void QDesignerMenuBar::dropEvent(QDropEvent *event)
{
m_dragging = false;
- if (const ActionRepositoryMimeData *d = qobject_cast<const ActionRepositoryMimeData*>(event->mimeData())) {
+ if (auto *d = qobject_cast<const qdesigner_internal::ActionRepositoryMimeData*>(event->mimeData())) {
QAction *action = d->actionList().first();
if (checkAction(action) == AcceptActionDrag) {
event->acceptProposedAction();
int index = findAction(event->position().toPoint());
- index = qMin(index, actions().count() - 1);
+ index = qMin(index, actions().size() - 1);
QDesignerFormWindowInterface *fw = formWindow();
- InsertActionIntoCommand *cmd = new InsertActionIntoCommand(fw);
+ auto *cmd = new qdesigner_internal::InsertActionIntoCommand(fw);
cmd->init(this, action, safeActionAt(index));
fw->commandHistory()->push(cmd);
@@ -705,7 +683,7 @@ QDesignerActionProviderExtension *QDesignerMenuBar::actionProvider()
QAction *QDesignerMenuBar::currentAction() const
{
- if (m_currentIndex < 0 || m_currentIndex >= actions().count())
+ if (m_currentIndex < 0 || m_currentIndex >= actions().size())
return nullptr;
return safeActionAt(m_currentIndex);
@@ -713,7 +691,7 @@ QAction *QDesignerMenuBar::currentAction() const
int QDesignerMenuBar::realActionCount() const
{
- return actions().count() - 1; // 1 fake actions
+ return actions().size() - 1; // 1 fake actions
}
bool QDesignerMenuBar::dragging() const
@@ -753,7 +731,7 @@ void QDesignerMenuBar::movePrevious(bool ctrl)
void QDesignerMenuBar::moveNext(bool ctrl)
{
const bool swapped = ctrl && swapActions(m_currentIndex + 1, m_currentIndex);
- const int newIndex = qMin(actions().count() - 1, m_currentIndex + 1);
+ const int newIndex = qMin(actions().size() - 1, m_currentIndex + 1);
if (swapped || newIndex != m_currentIndex) {
m_currentIndex = newIndex;
updateCurrentAction(!ctrl);
@@ -802,14 +780,14 @@ void QDesignerMenuBar::deleteMenu()
void QDesignerMenuBar::deleteMenuAction(QAction *action)
{
- if (action && !qobject_cast<SpecialMenuAction*>(action)) {
+ if (action && !qobject_cast<qdesigner_internal::SpecialMenuAction*>(action)) {
const int pos = actions().indexOf(action);
QAction *action_before = nullptr;
if (pos != -1)
action_before = safeActionAt(pos + 1);
QDesignerFormWindowInterface *fw = formWindow();
- RemoveMenuActionCommand *cmd = new RemoveMenuActionCommand(fw);
+ auto *cmd = new qdesigner_internal::RemoveMenuActionCommand(fw);
cmd->init(action, action_before, this, this);
fw->commandHistory()->push(cmd);
}
@@ -858,7 +836,7 @@ void QDesignerMenuBar::showMenu(int index)
QAction *QDesignerMenuBar::safeActionAt(int index) const
{
- if (index < 0 || index >= actions().count())
+ if (index < 0 || index >= actions().size())
return nullptr;
return actions().at(index);
@@ -866,6 +844,8 @@ QAction *QDesignerMenuBar::safeActionAt(int index) const
bool QDesignerMenuBar::swapActions(int a, int b)
{
+ using namespace qdesigner_internal;
+
const int left = qMin(a, b);
int right = qMax(a, b);
@@ -888,21 +868,21 @@ bool QDesignerMenuBar::swapActions(int a, int b)
QAction *action_b_before = safeActionAt(right + 1);
QDesignerFormWindowInterface *fw = formWindow();
- RemoveActionFromCommand *cmd1 = new RemoveActionFromCommand(fw);
+ auto *cmd1 = new qdesigner_internal::RemoveActionFromCommand(fw);
cmd1->init(this, action_b, action_b_before, false);
fw->commandHistory()->push(cmd1);
QAction *action_a_before = safeActionAt(left + 1);
- InsertActionIntoCommand *cmd2 = new InsertActionIntoCommand(fw);
+ auto *cmd2 = new qdesigner_internal::InsertActionIntoCommand(fw);
cmd2->init(this, action_b, action_a_before, false);
fw->commandHistory()->push(cmd2);
- RemoveActionFromCommand *cmd3 = new RemoveActionFromCommand(fw);
+ auto *cmd3 = new qdesigner_internal::RemoveActionFromCommand(fw);
cmd3->init(this, action_a, action_b, false);
fw->commandHistory()->push(cmd3);
- InsertActionIntoCommand *cmd4 = new InsertActionIntoCommand(fw);
+ auto *cmd4 = new qdesigner_internal::InsertActionIntoCommand(fw);
cmd4->init(this, action_a, action_b_before, true);
fw->commandHistory()->push(cmd4);
@@ -923,6 +903,8 @@ void QDesignerMenuBar::keyReleaseEvent(QKeyEvent *event)
void QDesignerMenuBar::updateCurrentAction(bool selectAction)
{
+ using namespace qdesigner_internal;
+
update();
if (!selectAction)
diff --git a/src/designer/src/lib/shared/qdesigner_menubar_p.h b/src/designer/src/lib/shared/qdesigner_menubar_p.h
index 8b6e5383e..e1d02e3fa 100644
--- a/src/designer/src/lib/shared/qdesigner_menubar_p.h
+++ b/src/designer/src/lib/shared/qdesigner_menubar_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/qdesigner_objectinspector.cpp b/src/designer/src/lib/shared/qdesigner_objectinspector.cpp
index c672dca70..9d5465031 100644
--- a/src/designer/src/lib/shared/qdesigner_objectinspector.cpp
+++ b/src/designer/src/lib/shared/qdesigner_objectinspector.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_objectinspector_p.h"
diff --git a/src/designer/src/lib/shared/qdesigner_objectinspector_p.h b/src/designer/src/lib/shared/qdesigner_objectinspector_p.h
index be7925d6e..e43954392 100644
--- a/src/designer/src/lib/shared/qdesigner_objectinspector_p.h
+++ b/src/designer/src/lib/shared/qdesigner_objectinspector_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/qdesigner_promotion.cpp b/src/designer/src/lib/shared/qdesigner_promotion.cpp
index 08b2848fd..eb78dd413 100644
--- a/src/designer/src/lib/shared/qdesigner_promotion.cpp
+++ b/src/designer/src/lib/shared/qdesigner_promotion.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_promotion_p.h"
#include "widgetdatabase_p.h"
@@ -44,19 +19,20 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace {
// Return a set of on-promotable classes
const QSet<QString> &nonPromotableClasses() {
- static QSet<QString> rc;
- if (rc.isEmpty()) {
- rc.insert(QStringLiteral("Line"));
- rc.insert(QStringLiteral("QAction"));
- rc.insert(QStringLiteral("Spacer"));
- rc.insert(QStringLiteral("QMainWindow"));
- rc.insert(QStringLiteral("QDialog"));
- rc.insert(QStringLiteral("QMdiArea"));
- rc.insert(QStringLiteral("QMdiSubWindow"));
- }
+ static const QSet<QString> rc = {
+ u"Line"_s,
+ u"QAction"_s,
+ u"Spacer"_s,
+ u"QMainWindow"_s,
+ u"QDialog"_s,
+ u"QMdiArea"_s,
+ u"QMdiSubWindow"_s
+ };
return rc;
}
@@ -84,13 +60,14 @@ namespace {
}
// extract class name from xml "<widget class="QWidget" ...>". Quite a hack.
- QString classNameFromXml(QString xml) {
- static const QString tag = QStringLiteral("class=\"");
+ QString classNameFromXml(QString xml)
+ {
+ constexpr auto tag = "class=\""_L1;
const int pos = xml.indexOf(tag);
if (pos == -1)
return QString();
xml.remove(0, pos + tag.size());
- const int closingPos = xml.indexOf(QLatin1Char('"'));
+ const auto closingPos = xml.indexOf(u'"');
if (closingPos == -1)
return QString();
xml.remove(closingPos, xml.size() - closingPos);
@@ -193,8 +170,7 @@ namespace qdesigner_internal {
if (nonPromotableClasses().contains(name))
return false;
- if (name.startsWith(QStringLiteral("QDesigner")) ||
- name.startsWith(QStringLiteral("QLayout")))
+ if (name.startsWith("QDesigner"_L1) || name.startsWith("QLayout"_L1))
return false;
return true;
@@ -204,9 +180,7 @@ namespace qdesigner_internal {
{
using ClassNameItemMap = QMap<QString, QDesignerWidgetDataBaseItemInterface *>;
// A map containing base classes and their promoted classes.
- using BaseClassPromotedMap = QMap<QString, ClassNameItemMap>;
-
- BaseClassPromotedMap baseClassPromotedMap;
+ QMap<QString, ClassNameItemMap> baseClassPromotedMap;
QDesignerWidgetDataBaseInterface *widgetDataBase = m_core->widgetDataBase();
// Look for promoted classes and insert into map according to base class.
@@ -215,7 +189,7 @@ namespace qdesigner_internal {
QDesignerWidgetDataBaseItemInterface *dbItem = widgetDataBase->item(i);
if (dbItem->isPromoted()) {
const QString baseClassName = dbItem->extends();
- BaseClassPromotedMap::iterator it = baseClassPromotedMap.find(baseClassName);
+ auto it = baseClassPromotedMap.find(baseClassName);
if (it == baseClassPromotedMap.end()) {
it = baseClassPromotedMap.insert(baseClassName, ClassNameItemMap());
}
@@ -228,14 +202,12 @@ namespace qdesigner_internal {
if (baseClassPromotedMap.isEmpty())
return rc;
- const BaseClassPromotedMap::const_iterator bcend = baseClassPromotedMap.constEnd();
- for (BaseClassPromotedMap::const_iterator bit = baseClassPromotedMap.constBegin(); bit != bcend; ++bit) {
+ for (auto bit = baseClassPromotedMap.cbegin(), bcend = baseClassPromotedMap.cend(); bit != bcend; ++bit) {
const int baseIndex = widgetDataBase->indexOfClassName(bit.key());
Q_ASSERT(baseIndex >= 0);
QDesignerWidgetDataBaseItemInterface *baseItem = widgetDataBase->item(baseIndex);
// promoted
- const ClassNameItemMap::const_iterator pcend = bit.value().constEnd();
- for (ClassNameItemMap::const_iterator pit = bit.value().constBegin(); pit != pcend; ++pit) {
+ for (auto pit = bit.value().cbegin(), pcend = bit.value().cend(); pit != pcend; ++pit) {
PromotedClass item;
item.baseItem = baseItem;
item.promotedItem = pit.value();
@@ -265,11 +237,10 @@ namespace qdesigner_internal {
if (!scratchPadClasses.isEmpty()) {
// Check whether these are actually promoted
QDesignerWidgetDataBaseInterface *widgetDataBase = m_core->widgetDataBase();
- QStringList::const_iterator cend = scratchPadClasses.constEnd();
- for (QStringList::const_iterator it = scratchPadClasses.constBegin(); it != cend; ++it ) {
- const int index = widgetDataBase->indexOfClassName(*it);
+ for (const auto &scItem : scratchPadClasses) {
+ const int index = widgetDataBase->indexOfClassName(scItem);
if (index != -1 && widgetDataBase->item(index)->isPromoted())
- rc += *it;
+ rc.insert(scItem);
}
}
}
@@ -301,12 +272,12 @@ namespace qdesigner_internal {
// class B will depend on it. When removing QWebView, the base class of B will
// be changed to that of QWebView by the below code.
const PromotedClasses promotedList = promotedClasses();
- for (PromotedClasses::const_iterator it = promotedList.constBegin(), end = promotedList.constEnd(); it != end; ++it) {
- if (it->baseItem->name() == className) {
+ for (const auto &pc : promotedList) {
+ if (pc.baseItem->name() == className) {
const QString extends = widgetDataBase->item(index)->extends();
- qWarning().nospace() << "Warning: Promoted class " << it->promotedItem->name()
+ qWarning().nospace() << "Warning: Promoted class " << pc.promotedItem->name()
<< " extends " << className << ", changing its base class to " << extends << '.';
- it->promotedItem->setExtends(extends);
+ pc.promotedItem->setExtends(extends);
}
}
widgetDataBase->remove(index);
diff --git a/src/designer/src/lib/shared/qdesigner_promotion_p.h b/src/designer/src/lib/shared/qdesigner_promotion_p.h
index 3448fd999..e268296ac 100644
--- a/src/designer/src/lib/shared/qdesigner_promotion_p.h
+++ b/src/designer/src/lib/shared/qdesigner_promotion_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/qdesigner_promotiondialog.cpp b/src/designer/src/lib/shared/qdesigner_promotiondialog.cpp
index d8fc28acd..286ee3538 100644
--- a/src/designer/src/lib/shared/qdesigner_promotiondialog.cpp
+++ b/src/designer/src/lib/shared/qdesigner_promotiondialog.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_promotiondialog_p.h"
#include "promotionmodel_p.h"
@@ -60,6 +35,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
// PromotionParameters
struct PromotionParameters {
@@ -83,7 +60,7 @@ namespace qdesigner_internal {
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
QHBoxLayout *hboxLayout = new QHBoxLayout(this);
- m_classNameEdit->setValidator(new QRegularExpressionValidator(QRegularExpression(QStringLiteral("^[_a-zA-Z:][:_a-zA-Z0-9]*$")), m_classNameEdit));
+ m_classNameEdit->setValidator(new QRegularExpressionValidator(QRegularExpression(u"^[_a-zA-Z:][:_a-zA-Z0-9]*$"_s), m_classNameEdit));
connect(m_classNameEdit, &QLineEdit::textChanged,
this, &NewPromotedClassPanel::slotNameChanged);
connect(m_includeFileEdit, &QLineEdit::textChanged,
@@ -106,7 +83,7 @@ namespace qdesigner_internal {
formLayout->addRow(label, m_includeFileEdit);
m_includeFileEdit->setToolTip(toolTip);
- toolTip = tr("Indicates that header file is a global header file. Does not have any effect on Qt for Python.");
+ toolTip = tr("Indicates that the header file is a global header file. Does not have any effect on Qt for Python.");
label = new QLabel(tr("Global include"));
label->setToolTip(toolTip);
formLayout->addRow(label, m_globalIncludeCheckBox);
@@ -154,12 +131,11 @@ namespace qdesigner_internal {
void NewPromotedClassPanel::slotNameChanged(const QString &className) {
// Suggest a name
if (!className.isEmpty()) {
- const QChar dot(QLatin1Char('.'));
QString suggestedHeader = m_promotedHeaderLowerCase ?
className.toLower() : className;
- suggestedHeader.replace(QStringLiteral("::"), QString(QLatin1Char('_')));
- if (!m_promotedHeaderSuffix.startsWith(dot))
- suggestedHeader += dot;
+ suggestedHeader.replace("::"_L1, "_"_L1);
+ if (!m_promotedHeaderSuffix.startsWith(u'.'))
+ suggestedHeader += u'.';
suggestedHeader += m_promotedHeaderSuffix;
const bool blocked = m_includeFileEdit->blockSignals(true);
@@ -208,12 +184,11 @@ namespace qdesigner_internal {
m_model(new PromotionModel(core)),
m_treeView(new QTreeView),
m_buttonBox(nullptr),
- m_removeButton(new QPushButton(createIconSet(QString::fromUtf8("minus.png")), QString()))
+ m_removeButton(new QPushButton(createIconSet("minus.png"_L1), QString()))
{
m_buttonBox = createButtonBox();
setModal(true);
setWindowTitle(tr("Promoted Widgets"));
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QVBoxLayout *vboxLayout = new QVBoxLayout(this);
@@ -252,7 +227,7 @@ namespace qdesigner_internal {
preselectedBaseClass = baseClassNameList.indexOf(m_promotableWidgetClassName);
}
if (preselectedBaseClass == -1)
- preselectedBaseClass = baseClassNameList.indexOf(QStringLiteral("QFrame"));
+ preselectedBaseClass = baseClassNameList.indexOf("QFrame"_L1);
NewPromotedClassPanel *newPromotedClassPanel = new NewPromotedClassPanel(baseClassNameList, preselectedBaseClass);
newPromotedClassPanel->setPromotedHeaderSuffix(core->integration()->headerSuffix());
@@ -306,10 +281,8 @@ namespace qdesigner_internal {
if (rc.isEmpty()) {
// Convert the item list into a string list.
const WidgetDataBaseItemList dbItems = promotion->promotionBaseClasses();
- const WidgetDataBaseItemList::const_iterator cend = dbItems.constEnd();
- for (WidgetDataBaseItemList::const_iterator it = dbItems.constBegin() ; it != cend; ++it) {
- rc.push_back( (*it)->name());
- }
+ for (auto *item : dbItems)
+ rc.append(item->name());
}
return rc;
}
diff --git a/src/designer/src/lib/shared/qdesigner_promotiondialog_p.h b/src/designer/src/lib/shared/qdesigner_promotiondialog_p.h
index e9cb7d4fe..f39b2bd54 100644
--- a/src/designer/src/lib/shared/qdesigner_promotiondialog_p.h
+++ b/src/designer/src/lib/shared/qdesigner_promotiondialog_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/qdesigner_propertycommand.cpp b/src/designer/src/lib/shared/qdesigner_propertycommand.cpp
index 223fd76ae..f24675e7b 100644
--- a/src/designer/src/lib/shared/qdesigner_propertycommand.cpp
+++ b/src/designer/src/lib/shared/qdesigner_propertycommand.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_propertycommand_p.h"
#include "qdesigner_utils_p.h"
@@ -59,6 +34,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace {
enum { debugPropertyCommands = 0 };
@@ -69,21 +46,21 @@ QString fontMask(unsigned m)
{
QString rc;
if (m & QFontFamiliesResolved)
- rc += QStringLiteral("Family");
+ rc += "Family"_L1;
if (m & QFont::SizeResolved)
- rc += QStringLiteral("Size ");
+ rc += "Size "_L1;
if (m & QFont::WeightResolved)
- rc += QStringLiteral("Bold ");
+ rc += "Bold "_L1;
if (m & QFont::StyleResolved)
- rc += QStringLiteral("Style ");
+ rc += "Style "_L1;
if (m & QFont::UnderlineResolved)
- rc += QStringLiteral("Underline ");
+ rc += "Underline "_L1;
if (m & QFont::StrikeOutResolved)
- rc += QStringLiteral("StrikeOut ");
+ rc += "StrikeOut "_L1;
if (m & QFont::KerningResolved)
- rc += QStringLiteral("Kerning ");
+ rc += "Kerning "_L1;
if (m & QFont::StyleStrategyResolved)
- rc += QStringLiteral("StyleStrategy");
+ rc += "StyleStrategy"_L1;
return rc;
}
@@ -91,22 +68,20 @@ QString fontMask(unsigned m)
QString fontString(const QFont &f)
{
QString rc; {
- const QChar comma = QLatin1Char(',');
QTextStream str(&rc);
- str << QStringLiteral("QFont(\"") << f.family() << comma <<
- f.pointSize();
+ str << "QFont(\"" << f.family() << ',' << f.pointSize();
if (f.bold())
- str << comma << QStringLiteral("bold");
+ str << ',' << "bold";
if (f.italic())
- str << comma << QStringLiteral("italic");
+ str << ',' << "italic";
if (f.underline())
- str << comma << QStringLiteral("underline");
+ str << ',' << "underline";
if (f.strikeOut())
- str << comma << QStringLiteral("strikeOut");
+ str << ',' << "strikeOut";
if (f.kerning())
- str << comma << QStringLiteral("kerning");
- str << comma << f.styleStrategy() << QStringLiteral(" resolve: ")
- << fontMask(f.resolveMask()) << QLatin1Char(')');
+ str << ',' << "kerning";
+ str << ',' << f.styleStrategy() << " resolve: "
+ << fontMask(f.resolveMask()) << ')';
}
return rc;
}
@@ -170,16 +145,16 @@ enum KeySequenceSubPropertyMask { SubPropertyKeySequenceValue = 1, SubPropertyKe
SubPropertyKeySequenceTranslatable = 4, SubPropertyKeySequenceDisambiguation = 8,
SubPropertyKeySequenceId = 16 };
-enum CommonSubPropertyMask { SubPropertyAll = 0xFFFFFFFF };
+enum CommonSubPropertyMask : quint64 { SubPropertyAll = quint64(-1) };
// Set the mask flag in mask if the properties do not match.
#define COMPARE_SUBPROPERTY(object1, object2, getter, mask, maskFlag) \
if (object1.getter() != object2.getter()) (mask) |= (maskFlag);
// find changed subproperties of a rectangle
-unsigned compareSubProperties(const QRect & r1, const QRect & r2)
+quint64 compareSubProperties(const QRect & r1, const QRect & r2)
{
- unsigned rc = 0;
+ quint64 rc = 0;
COMPARE_SUBPROPERTY(r1, r2, x, rc, SubPropertyX)
COMPARE_SUBPROPERTY(r1, r2, y, rc, SubPropertyY)
COMPARE_SUBPROPERTY(r1, r2, width, rc, SubPropertyWidth)
@@ -188,17 +163,17 @@ unsigned compareSubProperties(const QRect & r1, const QRect & r2)
}
// find changed subproperties of a QSize
-unsigned compareSubProperties(const QSize & r1, const QSize & r2)
+quint64 compareSubProperties(const QSize & r1, const QSize & r2)
{
- unsigned rc = 0;
+ quint64 rc = 0;
COMPARE_SUBPROPERTY(r1, r2, width, rc, SubPropertyWidth)
COMPARE_SUBPROPERTY(r1, r2, height, rc, SubPropertyHeight)
return rc;
}
// find changed subproperties of a QSizePolicy
-unsigned compareSubProperties(const QSizePolicy & sp1, const QSizePolicy & sp2)
+quint64 compareSubProperties(const QSizePolicy & sp1, const QSizePolicy & sp2)
{
- unsigned rc = 0;
+ quint64 rc = 0;
COMPARE_SUBPROPERTY(sp1, sp2, horizontalPolicy, rc, SubPropertyHSizePolicy)
COMPARE_SUBPROPERTY(sp1, sp2, horizontalStretch, rc, SubPropertyHStretch)
COMPARE_SUBPROPERTY(sp1, sp2, verticalPolicy, rc, SubPropertyVSizePolicy)
@@ -206,9 +181,9 @@ unsigned compareSubProperties(const QSizePolicy & sp1, const QSizePolicy & sp2)
return rc;
}
// find changed subproperties of qdesigner_internal::PropertySheetStringValue
-unsigned compareSubProperties(const qdesigner_internal::PropertySheetStringValue & str1, const qdesigner_internal::PropertySheetStringValue & str2)
+quint64 compareSubProperties(const qdesigner_internal::PropertySheetStringValue & str1, const qdesigner_internal::PropertySheetStringValue & str2)
{
- unsigned rc = 0;
+ quint64 rc = 0;
COMPARE_SUBPROPERTY(str1, str2, value, rc, SubPropertyStringValue)
COMPARE_SUBPROPERTY(str1, str2, comment, rc, SubPropertyStringComment)
COMPARE_SUBPROPERTY(str1, str2, translatable, rc, SubPropertyStringTranslatable)
@@ -217,9 +192,9 @@ unsigned compareSubProperties(const qdesigner_internal::PropertySheetStringValue
return rc;
}
// find changed subproperties of qdesigner_internal::PropertySheetStringListValue
-unsigned compareSubProperties(const qdesigner_internal::PropertySheetStringListValue & str1, const qdesigner_internal::PropertySheetStringListValue & str2)
+quint64 compareSubProperties(const qdesigner_internal::PropertySheetStringListValue & str1, const qdesigner_internal::PropertySheetStringListValue & str2)
{
- unsigned rc = 0;
+ quint64 rc = 0;
COMPARE_SUBPROPERTY(str1, str2, value, rc, SubPropertyStringListValue)
COMPARE_SUBPROPERTY(str1, str2, comment, rc, SubPropertyStringListComment)
COMPARE_SUBPROPERTY(str1, str2, translatable, rc, SubPropertyStringListTranslatable)
@@ -228,9 +203,9 @@ unsigned compareSubProperties(const qdesigner_internal::PropertySheetStringListV
return rc;
}
// find changed subproperties of qdesigner_internal::PropertySheetKeySequenceValue
-unsigned compareSubProperties(const qdesigner_internal::PropertySheetKeySequenceValue & str1, const qdesigner_internal::PropertySheetKeySequenceValue & str2)
+quint64 compareSubProperties(const qdesigner_internal::PropertySheetKeySequenceValue & str1, const qdesigner_internal::PropertySheetKeySequenceValue & str2)
{
- unsigned rc = 0;
+ quint64 rc = 0;
COMPARE_SUBPROPERTY(str1, str2, value, rc, SubPropertyKeySequenceValue)
COMPARE_SUBPROPERTY(str1, str2, comment, rc, SubPropertyKeySequenceComment)
COMPARE_SUBPROPERTY(str1, str2, translatable, rc, SubPropertyKeySequenceTranslatable)
@@ -245,8 +220,8 @@ template <class Property>
void compareFontSubProperty(const QFont & f1,
const QFont & f2,
Property (QFont::*getter) () const,
- unsigned maskBit,
- unsigned &mask)
+ quint64 maskBit,
+ quint64 &mask)
{
const bool f1Changed = f1.resolveMask() & maskBit;
const bool f2Changed = f2.resolveMask() & maskBit;
@@ -260,60 +235,55 @@ void compareFontSubProperty(const QFont & f1,
}
}
// find changed subproperties of a QFont
-unsigned compareSubProperties(const QFont & f1, const QFont & f2)
+quint64 compareSubProperties(const QFont & f1, const QFont & f2)
{
- unsigned rc = 0;
+ quint64 rc = 0;
compareFontSubProperty(f1, f2, &QFont::family, QFontFamiliesResolved, rc);
compareFontSubProperty(f1, f2, &QFont::pointSize, QFont::SizeResolved, rc);
- compareFontSubProperty(f1, f2, &QFont::bold, QFont::WeightResolved, rc);
+ compareFontSubProperty(f1, f2, &QFont::weight, QFont::WeightResolved, rc);
compareFontSubProperty(f1, f2, &QFont::italic, QFont::StyleResolved, rc);
compareFontSubProperty(f1, f2, &QFont::underline, QFont::UnderlineResolved, rc);
compareFontSubProperty(f1, f2, &QFont::strikeOut, QFont::StrikeOutResolved, rc);
compareFontSubProperty(f1, f2, &QFont::kerning, QFont::KerningResolved, rc);
compareFontSubProperty(f1, f2, &QFont::styleStrategy, QFont::StyleStrategyResolved, rc);
+ compareFontSubProperty(f1, f2, &QFont::hintingPreference, QFont::HintingPreferenceResolved, rc);
if (debugPropertyCommands)
qDebug() << "compareSubProperties " << fontString(f1) << fontString(f2) << "\n\treturns " << fontMask(rc);
return rc;
}
-// Compare colors of a role
-bool roleColorChanged(const QPalette & p1, const QPalette & p2, QPalette::ColorRole role)
-{
- for (int group = QPalette::Active; group < QPalette::NColorGroups; group++) {
- const QPalette::ColorGroup pgroup = static_cast<QPalette::ColorGroup>(group);
- if (p1.color(pgroup, role) != p2.color(pgroup, role))
- return true;
- }
- return false;
-}
// find changed subproperties of a QPalette taking the [undocumented] resolve flags into account
-unsigned compareSubProperties(const QPalette & p1, const QPalette & p2)
+quint64 compareSubProperties(const QPalette & p1, const QPalette & p2)
{
- unsigned rc = 0;
- unsigned maskBit = 1u;
+ quint64 rc = 0;
// generate a mask for each role
- const unsigned p1Changed = p1.resolveMask();
- const unsigned p2Changed = p2.resolveMask();
- for (int role = QPalette::WindowText; role < QPalette::NColorRoles; role++, maskBit <<= 1u) {
- const bool p1RoleChanged = p1Changed & maskBit;
- const bool p2RoleChanged = p2Changed & maskBit;
- // Role has been set/reset in editor
- if (p1RoleChanged != p2RoleChanged) {
- rc |= maskBit;
- } else {
- // Was modified in both palettes: Compare values.
- if (p1RoleChanged && p2RoleChanged && roleColorChanged(p1, p2, static_cast<QPalette::ColorRole>(role)))
+ const auto p1Changed = p1.resolveMask();
+ const auto p2Changed = p2.resolveMask();
+
+ for (int r = 0; r < static_cast<int>(QPalette::NColorRoles); ++r) {
+ for (int g = 0; g < static_cast<int>(QPalette::NColorGroups); ++g) {
+ const auto role = static_cast<QPalette::ColorRole>(r);
+ const auto group = static_cast<QPalette::ColorGroup>(g);
+ const auto maskBit = qdesigner_internal::paletteResolveMask(group, role);
+ const bool p1RoleChanged = p1Changed & maskBit;
+ const bool p2RoleChanged = p2Changed & maskBit;
+ if (p1RoleChanged != p2RoleChanged // Role has been set/reset in editor
+ // Was modified in both palettes: Compare values.
+ || (p1RoleChanged && p2RoleChanged
+ && p1.brush(group, role).color() != p2.brush(group, role).color())) {
rc |= maskBit;
+ }
}
}
+
return rc;
}
// find changed subproperties of a QAlignment which is a flag combination of vertical and horizontal
-unsigned compareSubProperties(Qt::Alignment a1, Qt::Alignment a2)
+quint64 compareSubProperties(Qt::Alignment a1, Qt::Alignment a2)
{
- unsigned rc = 0;
+ quint64 rc = 0;
if ((a1 & Qt::AlignHorizontal_Mask) != (a2 & Qt::AlignHorizontal_Mask))
rc |= SubPropertyHorizontalAlignment;
if ((a1 & Qt::AlignVertical_Mask) != (a2 & Qt::AlignVertical_Mask))
@@ -326,7 +296,7 @@ Qt::Alignment variantToAlignment(const QVariant & q)
return Qt::Alignment(qdesigner_internal::Utils::valueOf(q));
}
// find changed subproperties of a variant
-unsigned compareSubProperties(const QVariant & q1, const QVariant & q2, qdesigner_internal::SpecialProperty specialProperty)
+quint64 compareSubProperties(const QVariant & q1, const QVariant & q2, qdesigner_internal::SpecialProperty specialProperty)
{
// Do not clobber new value in the comparison function in
// case someone sets a QString on a PropertySheetStringValue.
@@ -472,38 +442,40 @@ QFont applyFontSubProperty(const QFont &oldValue, const QFont &newValue, unsigne
QFont rc = oldValue;
setFontSubProperty(mask, newValue, QFontFamiliesResolved, &QFont::family, &QFont::setFamily, rc);
setFontSubProperty(mask, newValue, QFont::SizeResolved, &QFont::pointSize, &QFont::setPointSize, rc);
- setFontSubProperty(mask, newValue, QFont::WeightResolved, &QFont::bold, &QFont::setBold, rc);
+ setFontSubProperty(mask, newValue, QFont::WeightResolved, &QFont::weight, &QFont::setWeight, rc);
setFontSubProperty(mask, newValue, QFont::StyleResolved, &QFont::italic, &QFont::setItalic, rc);
setFontSubProperty(mask, newValue, QFont::UnderlineResolved, &QFont::underline, &QFont::setUnderline, rc);
setFontSubProperty(mask, newValue, QFont::StrikeOutResolved, &QFont::strikeOut, &QFont::setStrikeOut, rc);
setFontSubProperty(mask, newValue, QFont::KerningResolved, &QFont::kerning, &QFont::setKerning, rc);
setFontSubProperty(mask, newValue, QFont::StyleStrategyResolved, &QFont::styleStrategy, &QFont::setStyleStrategy, rc);
+ setFontSubProperty(mask, newValue, QFont::HintingPreferenceResolved, &QFont::hintingPreference, &QFont::setHintingPreference, rc);
if (debugPropertyCommands)
qDebug() << "applyFontSubProperty old " << fontMask(oldValue.resolveMask()) << " new " << fontMask(newValue.resolveMask()) << " return: " << fontMask(rc.resolveMask());
return rc;
}
// apply changed subproperties to a QPalette
-QPalette applyPaletteSubProperty(const QPalette &oldValue, const QPalette &newValue, unsigned mask)
+QPalette applyPaletteSubProperty(const QPalette &oldValue, const QPalette &newValue,
+ quint64 mask)
{
QPalette rc = oldValue;
- // apply a mask for each role
- unsigned maskBit = 1u;
- for (int role = QPalette::WindowText; role < QPalette::NColorRoles; role++, maskBit <<= 1u) {
- if (mask & maskBit) {
- for (int group = QPalette::Active; group < QPalette::NColorGroups; group++) {
- const QPalette::ColorGroup pgroup = static_cast<QPalette::ColorGroup>(group);
- const QPalette::ColorRole prole = static_cast<QPalette::ColorRole>(role);
- rc.setColor(pgroup, prole, newValue.color(pgroup, prole));
+ // apply a mask for each role/group
+ for (int r = 0; r < static_cast<int>(QPalette::NColorRoles); ++r) {
+ for (int g = 0; g < static_cast<int>(QPalette::NColorGroups); ++g) {
+ const auto role = static_cast<QPalette::ColorRole>(r);
+ const auto group = static_cast<QPalette::ColorGroup>(g);
+ const auto maskBit = qdesigner_internal::paletteResolveMask(group, role);
+ if (mask & maskBit) {
+ rc.setColor(group, role, newValue.color(group, role));
+ // Set the resolve bit from NewValue in return value
+ auto resolveMask = rc.resolveMask();
+ const bool origFlag = newValue.resolveMask() & maskBit;
+ if (origFlag)
+ resolveMask |= maskBit;
+ else
+ resolveMask &= ~maskBit;
+ rc.setResolveMask(resolveMask);
}
- // Set the resolve bit from NewValue in return value
- uint r = rc.resolveMask();
- const bool origFlag = newValue.resolveMask() & maskBit;
- if (origFlag)
- r |= maskBit;
- else
- r &= ~maskBit;
- rc.setResolveMask(r);
}
}
return rc;
@@ -526,7 +498,9 @@ Qt::Alignment applyAlignmentSubProperty(Qt::Alignment oldValue, Qt::Alignment ne
namespace qdesigner_internal {
// apply changed subproperties to a variant
-PropertyHelper::Value applySubProperty(const QVariant &oldValue, const QVariant &newValue, qdesigner_internal::SpecialProperty specialProperty, unsigned mask, bool changed)
+PropertyHelper::Value applySubProperty(const QVariant &oldValue, const QVariant &newValue,
+ qdesigner_internal::SpecialProperty specialProperty,
+ quint64 mask, bool changed)
{
if (mask == SubPropertyAll)
return PropertyHelper::Value(newValue, changed);
@@ -603,35 +577,35 @@ PropertyHelper::Value applySubProperty(const QVariant &oldValue, const QVariant
// figure out special property
enum SpecialProperty getSpecialProperty(const QString& propertyName)
{
- if (propertyName == QStringLiteral("objectName"))
+ if (propertyName == "objectName"_L1)
return SP_ObjectName;
- if (propertyName == QStringLiteral("layoutName"))
+ if (propertyName == "layoutName"_L1)
return SP_LayoutName;
- if (propertyName == QStringLiteral("spacerName"))
+ if (propertyName == "spacerName"_L1)
return SP_SpacerName;
- if (propertyName == QStringLiteral("icon"))
+ if (propertyName == "icon"_L1)
return SP_Icon;
- if (propertyName == QStringLiteral("currentTabName"))
+ if (propertyName == "currentTabName"_L1)
return SP_CurrentTabName;
- if (propertyName == QStringLiteral("currentItemName"))
+ if (propertyName == "currentItemName"_L1)
return SP_CurrentItemName;
- if (propertyName == QStringLiteral("currentPageName"))
+ if (propertyName == "currentPageName"_L1)
return SP_CurrentPageName;
- if (propertyName == QStringLiteral("geometry"))
+ if (propertyName == "geometry"_L1)
return SP_Geometry;
- if (propertyName == QStringLiteral("windowTitle"))
+ if (propertyName == "windowTitle"_L1)
return SP_WindowTitle;
- if (propertyName == QStringLiteral("minimumSize"))
+ if (propertyName == "minimumSize"_L1)
return SP_MinimumSize;
- if (propertyName == QStringLiteral("maximumSize"))
+ if (propertyName == "maximumSize"_L1)
return SP_MaximumSize;
- if (propertyName == QStringLiteral("alignment"))
+ if (propertyName == "alignment"_L1)
return SP_Alignment;
- if (propertyName == QStringLiteral("autoDefault"))
+ if (propertyName == "autoDefault"_L1)
return SP_AutoDefault;
- if (propertyName == QStringLiteral("shortcut"))
+ if (propertyName == "shortcut"_L1)
return SP_Shortcut;
- if (propertyName == QStringLiteral("orientation"))
+ if (propertyName == "orientation"_L1)
return SP_Orientation;
return SP_None;
}
@@ -651,8 +625,14 @@ PropertyHelper::PropertyHelper(QObject* object,
m_parentWidget = (qobject_cast<QWidget*>(object))->parentWidget();
m_objectType = OT_Widget;
} else {
- if (const QAction *action = qobject_cast<const QAction *>(m_object))
- m_objectType = action->associatedWidgets().isEmpty() ? OT_FreeAction : OT_AssociatedAction;
+ if (const QAction *action = qobject_cast<const QAction *>(m_object)) {
+ const QObjectList associatedObjects = action->associatedObjects();
+ auto it = std::find_if(associatedObjects.cbegin(), associatedObjects.cend(),
+ [](QObject *obj) {
+ return qobject_cast<QWidget *>(obj) != nullptr;
+ });
+ m_objectType = (it == associatedObjects.cend()) ? OT_FreeAction : OT_AssociatedAction;
+ }
}
if(debugPropertyCommands)
@@ -828,7 +808,8 @@ void PropertyHelper::ensureUniqueObjectName(QDesignerFormWindowInterface *fw, QO
}
}
-PropertyHelper::Value PropertyHelper::setValue(QDesignerFormWindowInterface *fw, const QVariant &value, bool changed, unsigned subPropertyMask)
+PropertyHelper::Value PropertyHelper::setValue(QDesignerFormWindowInterface *fw, const QVariant &value,
+ bool changed, quint64 subPropertyMask)
{
// Set new whole value
if (subPropertyMask == SubPropertyAll)
@@ -900,7 +881,7 @@ QVariant PropertyHelper::findDefaultValue(QDesignerFormWindowInterface *fw) cons
PropertyHelper::Value PropertyHelper::restoreDefaultValue(QDesignerFormWindowInterface *fw)
{
- Value defaultValue = qMakePair(QVariant(), false);
+ Value defaultValue{{}, false};
const QVariant currentValue = m_propertySheet->property(m_index);
// try to reset sheet, else try to find default
if (m_propertySheet->reset(m_index)) {
@@ -988,7 +969,7 @@ bool PropertyListCommand::add(QObject *object, const QString &propertyName)
const PropertyDescription description(propertyName, sheet, index);
- if (m_propertyHelperList.isEmpty()) {
+ if (m_propertyHelperList.empty()) {
// first entry
m_propertyDescription = description;
} else {
@@ -998,21 +979,22 @@ bool PropertyListCommand::add(QObject *object, const QString &propertyName)
return false;
}
- const PropertyHelperPtr ph(createPropertyHelper(object, m_propertyDescription.m_specialProperty, sheet, index));
- m_propertyHelperList.push_back(ph);
+ auto ph = createPropertyHelper(object, m_propertyDescription.m_specialProperty, sheet, index);
+ m_propertyHelperList.push_back(std::move(ph));
return true;
}
-PropertyHelper *PropertyListCommand::createPropertyHelper(QObject *object, SpecialProperty sp,
- QDesignerPropertySheetExtension *sheet, int sheetIndex) const
+std::unique_ptr<PropertyHelper>
+PropertyListCommand::createPropertyHelper(QObject *object, SpecialProperty sp,
+ QDesignerPropertySheetExtension *sheet, int sheetIndex) const
{
- return new PropertyHelper(object, sp, sheet, sheetIndex);
+ return std::make_unique<PropertyHelper>(object, sp, sheet, sheetIndex);
}
// Init from a list and make sure referenceObject is added first to obtain the right property group
bool PropertyListCommand::initList(const QObjectList &list, const QString &apropertyName, QObject *referenceObject)
{
- propertyHelperList().clear();
+ m_propertyHelperList.clear();
// Ensure the referenceObject (property editor) is first, so the right property group is chosen.
if (referenceObject) {
@@ -1024,41 +1006,44 @@ bool PropertyListCommand::initList(const QObjectList &list, const QString &aprop
add(o, apropertyName);
}
- return !propertyHelperList().isEmpty();
+ return !m_propertyHelperList.empty();
}
QObject* PropertyListCommand::object(int index) const
{
- Q_ASSERT(index < m_propertyHelperList.size());
- return m_propertyHelperList.at(index)->object();
+ Q_ASSERT(size_t(index) < m_propertyHelperList.size());
+ return m_propertyHelperList[index]->object();
}
QVariant PropertyListCommand::oldValue(int index) const
{
- Q_ASSERT(index < m_propertyHelperList.size());
- return m_propertyHelperList.at(index)->oldValue();
+ Q_ASSERT(size_t(index) < m_propertyHelperList.size());
+ return m_propertyHelperList[index]->oldValue();
}
void PropertyListCommand::setOldValue(const QVariant &oldValue, int index)
{
- Q_ASSERT(index < m_propertyHelperList.size());
- m_propertyHelperList.at(index)->setOldValue(oldValue);
+ Q_ASSERT(size_t(index) < m_propertyHelperList.size());
+ m_propertyHelperList[index]->setOldValue(oldValue);
}
// ----- SetValueFunction: Set a new value when applied to a PropertyHelper.
class SetValueFunction {
public:
- SetValueFunction(QDesignerFormWindowInterface *formWindow, const PropertyHelper::Value &newValue, unsigned subPropertyMask);
+ SetValueFunction(QDesignerFormWindowInterface *formWindow, const PropertyHelper::Value &newValue,
+ quint64 subPropertyMask);
PropertyHelper::Value operator()(PropertyHelper&);
private:
QDesignerFormWindowInterface *m_formWindow;
const PropertyHelper::Value m_newValue;
- const unsigned m_subPropertyMask;
+ const quint64 m_subPropertyMask;
};
-SetValueFunction::SetValueFunction(QDesignerFormWindowInterface *formWindow, const PropertyHelper::Value &newValue, unsigned subPropertyMask) :
+SetValueFunction::SetValueFunction(QDesignerFormWindowInterface *formWindow,
+ const PropertyHelper::Value &newValue,
+ quint64 subPropertyMask) :
m_formWindow(formWindow),
m_newValue(newValue),
m_subPropertyMask(subPropertyMask)
@@ -1102,8 +1087,8 @@ template <class PropertyListIterator, class Function>
QDesignerPropertyEditorInterface *propertyEditor = core->propertyEditor();
bool updatedPropertyEditor = false;
- for (PropertyListIterator it = begin; it != end; ++it) {
- PropertyHelper *ph = it->data();
+ for (auto it = begin; it != end; ++it) {
+ PropertyHelper *ph = it->get();
if (QObject* object = ph->object()) { // Might have been deleted in the meantime
const PropertyHelper::Value newValue = function( *ph );
updateMask |= ph->updateMask();
@@ -1120,7 +1105,7 @@ template <class PropertyListIterator, class Function>
// set a new value, return update mask
-unsigned PropertyListCommand::setValue(const QVariant &value, bool changed, unsigned subPropertyMask)
+unsigned PropertyListCommand::setValue(const QVariant &value, bool changed, quint64 subPropertyMask)
{
if(debugPropertyCommands)
qDebug() << "PropertyListCommand::setValue(" << value
@@ -1184,10 +1169,10 @@ void PropertyListCommand::undo()
// check if lists are aequivalent for command merging (same widgets and props)
bool PropertyListCommand::canMergeLists(const PropertyHelperList& other) const
{
- if (m_propertyHelperList.size() != other.size())
+ if (m_propertyHelperList.size() != other.size())
return false;
- for (int i = 0; i < m_propertyHelperList.size(); i++) {
- if (!m_propertyHelperList.at(i)->canMerge(*other.at(i)))
+ for (size_t i = 0; i < m_propertyHelperList.size(); ++i) {
+ if (!m_propertyHelperList[i]->canMerge(*other[i]))
return false;
}
return true;
@@ -1233,7 +1218,7 @@ bool SetPropertyCommand::init(const QObjectList &list, const QString &apropertyN
return true;
}
-unsigned SetPropertyCommand::subPropertyMask(const QVariant &newValue, QObject *referenceObject)
+quint64 SetPropertyCommand::subPropertyMask(const QVariant &newValue, QObject *referenceObject)
{
// figure out the mask of changed sub properties when comparing newValue to the current value of the reference object.
if (!referenceObject)
@@ -1253,9 +1238,9 @@ void SetPropertyCommand::setDescription()
{
if (propertyHelperList().size() == 1) {
setText(QApplication::translate("Command", "Changed '%1' of '%2'")
- .arg(propertyName(), propertyHelperList().at(0)->object()->objectName()));
+ .arg(propertyName(), propertyHelperList().front()->object()->objectName()));
} else {
- int count = propertyHelperList().size();
+ int count = static_cast<int>(propertyHelperList().size());
setText(QCoreApplication::translate("Command", "Changed '%1' of %n objects", "", count).arg(propertyName()));
}
}
@@ -1353,9 +1338,9 @@ void ResetPropertyCommand::setDescription()
{
if (propertyHelperList().size() == 1) {
setText(QCoreApplication::translate("Command", "Reset '%1' of '%2'")
- .arg(propertyName(), propertyHelperList().at(0)->object()->objectName()));
+ .arg(propertyName(), propertyHelperList().front()->object()->objectName()));
} else {
- int count = propertyHelperList().size();
+ int count = static_cast<int>(propertyHelperList().size());
setText(QCoreApplication::translate("Command", "Reset '%1' of %n objects", "", count).arg(propertyName()));
}
}
@@ -1412,7 +1397,7 @@ bool AddDynamicPropertyCommand::init(const QObjectList &selection, QObject *curr
void AddDynamicPropertyCommand::redo()
{
QDesignerFormEditorInterface *core = formWindow()->core();
- for (QObject *obj : qAsConst(m_selection)) {
+ for (QObject *obj : std::as_const(m_selection)) {
QDesignerDynamicPropertySheetExtension *dynamicSheet = qt_extension<QDesignerDynamicPropertySheetExtension*>(core->extensionManager(), obj);
dynamicSheet->addDynamicProperty(m_propertyName, m_value);
if (QDesignerPropertyEditorInterface *propertyEditor = formWindow()->core()->propertyEditor()) {
@@ -1425,7 +1410,7 @@ void AddDynamicPropertyCommand::redo()
void AddDynamicPropertyCommand::undo()
{
QDesignerFormEditorInterface *core = formWindow()->core();
- for (QObject *obj : qAsConst(m_selection)) {
+ for (QObject *obj : std::as_const(m_selection)) {
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), obj);
QDesignerDynamicPropertySheetExtension *dynamicSheet = qt_extension<QDesignerDynamicPropertySheetExtension*>(core->extensionManager(), obj);
dynamicSheet->removeDynamicProperty(sheet->indexOf(m_propertyName));
@@ -1473,7 +1458,8 @@ bool RemoveDynamicPropertyCommand::init(const QObjectList &selection, QObject *c
if (!dynamicSheet->isDynamicProperty(index))
return false;
- m_objectToValueAndChanged[current] = qMakePair(propertySheet->property(index), propertySheet->isChanged(index));
+ m_objectToValueAndChanged[current] = {propertySheet->property(index),
+ propertySheet->isChanged(index)};
for (QObject *obj : selection) {
if (m_objectToValueAndChanged.contains(obj))
@@ -1483,7 +1469,8 @@ bool RemoveDynamicPropertyCommand::init(const QObjectList &selection, QObject *c
dynamicSheet = qt_extension<QDesignerDynamicPropertySheetExtension*>(core->extensionManager(), obj);
const int idx = propertySheet->indexOf(m_propertyName);
if (dynamicSheet->isDynamicProperty(idx))
- m_objectToValueAndChanged[obj] = qMakePair(propertySheet->property(idx), propertySheet->isChanged(idx));
+ m_objectToValueAndChanged[obj] = {propertySheet->property(idx),
+ propertySheet->isChanged(idx)};
}
setDescription();
@@ -1493,8 +1480,7 @@ bool RemoveDynamicPropertyCommand::init(const QObjectList &selection, QObject *c
void RemoveDynamicPropertyCommand::redo()
{
QDesignerFormEditorInterface *core = formWindow()->core();
- QMap<QObject *, QPair<QVariant, bool> >::ConstIterator it = m_objectToValueAndChanged.constBegin();
- while (it != m_objectToValueAndChanged.constEnd()) {
+ for (auto it = m_objectToValueAndChanged.cbegin(), end = m_objectToValueAndChanged.cend(); it != end; ++it) {
QObject *obj = it.key();
QDesignerDynamicPropertySheetExtension *dynamicSheet = qt_extension<QDesignerDynamicPropertySheetExtension*>(core->extensionManager(), obj);
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), obj);
@@ -1503,15 +1489,13 @@ void RemoveDynamicPropertyCommand::redo()
if (propertyEditor->object() == obj)
propertyEditor->setObject(obj);
}
- ++it;
}
}
void RemoveDynamicPropertyCommand::undo()
{
QDesignerFormEditorInterface *core = formWindow()->core();
- QMap<QObject *, QPair<QVariant, bool> >::ConstIterator it = m_objectToValueAndChanged.constBegin();
- while (it != m_objectToValueAndChanged.constEnd()) {
+ for (auto it = m_objectToValueAndChanged.cbegin(), end = m_objectToValueAndChanged.cend(); it != end; ++it) {
QObject *obj = it.key();
QDesignerPropertySheetExtension *propertySheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), obj);
QDesignerDynamicPropertySheetExtension *dynamicSheet = qt_extension<QDesignerDynamicPropertySheetExtension*>(core->extensionManager(), obj);
@@ -1521,7 +1505,6 @@ void RemoveDynamicPropertyCommand::undo()
if (propertyEditor->object() == obj)
propertyEditor->setObject(obj);
}
- ++it;
}
}
diff --git a/src/designer/src/lib/shared/qdesigner_propertycommand_p.h b/src/designer/src/lib/shared/qdesigner_propertycommand_p.h
index 7afd7b55a..d069e76b1 100644
--- a/src/designer/src/lib/shared/qdesigner_propertycommand_p.h
+++ b/src/designer/src/lib/shared/qdesigner_propertycommand_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -43,8 +18,10 @@
#include "qdesigner_formwindowcommand_p.h"
#include <QtCore/qvariant.h>
+#include <QtCore/qhash.h>
#include <QtCore/qlist.h>
#include <QtCore/qpair.h>
+#include <QtCore/qpointer.h>
#include <QtCore/qsharedpointer.h>
QT_BEGIN_NAMESPACE
@@ -72,7 +49,7 @@ class QDESIGNER_SHARED_EXPORT PropertyHelper {
Q_DISABLE_COPY(PropertyHelper)
public:
// A pair of Value and changed flag
- using Value = QPair<QVariant, bool>;
+ using Value = std::pair<QVariant, bool>;
enum ObjectType {OT_Object, OT_FreeAction, OT_AssociatedAction, OT_Widget};
@@ -86,7 +63,8 @@ public:
SpecialProperty specialProperty() const { return m_specialProperty; }
// set a new value. Can be overwritten to perform a transformation (see
// handling of Arrow key move in FormWindow class).
- virtual Value setValue(QDesignerFormWindowInterface *fw, const QVariant &value, bool changed, unsigned subPropertyMask);
+ virtual Value setValue(QDesignerFormWindowInterface *fw, const QVariant &value,
+ bool changed, quint64 subPropertyMask);
// restore old value
Value restoreOldValue(QDesignerFormWindowInterface *fw);
@@ -147,8 +125,8 @@ public:
void undo() override;
protected:
- using PropertyHelperPtr = QSharedPointer<PropertyHelper>;
- using PropertyHelperList = QList<PropertyHelperPtr>;
+ using PropertyHelperPtr = std::unique_ptr<PropertyHelper>;
+ using PropertyHelperList = std::vector<PropertyHelperPtr>;
// add an object
bool add(QObject *object, const QString &propertyName);
@@ -157,7 +135,7 @@ protected:
bool initList(const QObjectList &list, const QString &apropertyName, QObject *referenceObject = nullptr);
// set a new value, return update mask
- unsigned setValue(const QVariant &value, bool changed, unsigned subPropertyMask);
+ unsigned setValue(const QVariant &value, bool changed, quint64 subPropertyMask);
// restore old value, return update mask
unsigned restoreOldValue();
@@ -193,8 +171,9 @@ protected:
const PropertyDescription &propertyDescription() const { return m_propertyDescription; }
protected:
- virtual PropertyHelper *createPropertyHelper(QObject *o, SpecialProperty sp,
- QDesignerPropertySheetExtension *sheet, int sheetIndex) const;
+ virtual std::unique_ptr<PropertyHelper>
+ createPropertyHelper(QObject *o, SpecialProperty sp,
+ QDesignerPropertySheetExtension *sheet, int sheetIndex) const;
private:
PropertyDescription m_propertyDescription;
@@ -227,10 +206,10 @@ protected:
virtual QVariant mergeValue(const QVariant &newValue);
private:
- unsigned subPropertyMask(const QVariant &newValue, QObject *referenceObject);
+ quint64 subPropertyMask(const QVariant &newValue, QObject *referenceObject);
void setDescription();
QVariant m_newValue;
- unsigned m_subPropertyMask;
+ quint64 m_subPropertyMask;
};
class QDESIGNER_SHARED_EXPORT ResetPropertyCommand: public PropertyListCommand
@@ -259,14 +238,14 @@ class QDESIGNER_SHARED_EXPORT AddDynamicPropertyCommand: public QDesignerFormWin
public:
explicit AddDynamicPropertyCommand(QDesignerFormWindowInterface *formWindow);
- bool init(const QList<QObject *> &selection, QObject *current, const QString &propertyName, const QVariant &value);
+ bool init(const QObjectList &selection, QObject *current, const QString &propertyName, const QVariant &value);
void redo() override;
void undo() override;
private:
void setDescription();
QString m_propertyName;
- QList<QObject *> m_selection;
+ QObjectList m_selection;
QVariant m_value;
};
@@ -276,14 +255,14 @@ class QDESIGNER_SHARED_EXPORT RemoveDynamicPropertyCommand: public QDesignerForm
public:
explicit RemoveDynamicPropertyCommand(QDesignerFormWindowInterface *formWindow);
- bool init(const QList<QObject *> &selection, QObject *current, const QString &propertyName);
+ bool init(const QObjectList &selection, QObject *current, const QString &propertyName);
void redo() override;
void undo() override;
private:
void setDescription();
QString m_propertyName;
- QMap<QObject *, QPair<QVariant, bool> > m_objectToValueAndChanged;
+ QHash<QObject *, std::pair<QVariant, bool> > m_objectToValueAndChanged;
};
} // namespace qdesigner_internal
diff --git a/src/designer/src/lib/shared/qdesigner_propertyeditor.cpp b/src/designer/src/lib/shared/qdesigner_propertyeditor.cpp
index a31b6ab08..42a04b753 100644
--- a/src/designer/src/lib/shared/qdesigner_propertyeditor.cpp
+++ b/src/designer/src/lib/shared/qdesigner_propertyeditor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_propertyeditor_p.h"
#include "pluginmanager_p.h"
@@ -42,6 +17,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
using StringPropertyParameters = QDesignerPropertyEditor::StringPropertyParameters;
// A map of property name to type
@@ -54,31 +31,31 @@ static const PropertyNameTypeMap &stringPropertyTypes()
if (propertyNameTypeMap.isEmpty()) {
const StringPropertyParameters richtext(ValidationRichText, true);
// Accessibility. Both are texts the narrator reads
- propertyNameTypeMap.insert(QStringLiteral("accessibleDescription"), richtext);
- propertyNameTypeMap.insert(QStringLiteral("accessibleName"), richtext);
+ propertyNameTypeMap.insert(u"accessibleDescription"_s, richtext);
+ propertyNameTypeMap.insert(u"accessibleName"_s, richtext);
// object names
const StringPropertyParameters objectName(ValidationObjectName, false);
- propertyNameTypeMap.insert(QStringLiteral("buddy"), objectName);
- propertyNameTypeMap.insert(QStringLiteral("currentItemName"), objectName);
- propertyNameTypeMap.insert(QStringLiteral("currentPageName"), objectName);
- propertyNameTypeMap.insert(QStringLiteral("currentTabName"), objectName);
- propertyNameTypeMap.insert(QStringLiteral("layoutName"), objectName);
- propertyNameTypeMap.insert(QStringLiteral("spacerName"), objectName);
+ propertyNameTypeMap.insert(u"buddy"_s, objectName);
+ propertyNameTypeMap.insert(u"currentItemName"_s, objectName);
+ propertyNameTypeMap.insert(u"currentPageName"_s, objectName);
+ propertyNameTypeMap.insert(u"currentTabName"_s, objectName);
+ propertyNameTypeMap.insert(u"layoutName"_s, objectName);
+ propertyNameTypeMap.insert(u"spacerName"_s, objectName);
// Style sheet
- propertyNameTypeMap.insert(QStringLiteral("styleSheet"), StringPropertyParameters(ValidationStyleSheet, false));
+ propertyNameTypeMap.insert(u"styleSheet"_s, StringPropertyParameters(ValidationStyleSheet, false));
// Buttons/ QCommandLinkButton
const StringPropertyParameters multiline(ValidationMultiLine, true);
- propertyNameTypeMap.insert(QStringLiteral("description"), multiline);
- propertyNameTypeMap.insert(QStringLiteral("iconText"), multiline);
+ propertyNameTypeMap.insert(u"description"_s, multiline);
+ propertyNameTypeMap.insert(u"iconText"_s, multiline);
// Tooltips, etc.
- propertyNameTypeMap.insert(QStringLiteral("toolTip"), richtext);
- propertyNameTypeMap.insert(QStringLiteral("whatsThis"), richtext);
- propertyNameTypeMap.insert(QStringLiteral("windowIconText"), richtext);
- propertyNameTypeMap.insert(QStringLiteral("html"), richtext);
+ propertyNameTypeMap.insert(u"toolTip"_s, richtext);
+ propertyNameTypeMap.insert(u"whatsThis"_s, richtext);
+ propertyNameTypeMap.insert(u"windowIconText"_s, richtext);
+ propertyNameTypeMap.insert(u"html"_s, richtext);
// A QWizard page id
- propertyNameTypeMap.insert(QStringLiteral("pageId"), StringPropertyParameters(ValidationSingleLine, false));
+ propertyNameTypeMap.insert(u"pageId"_s, StringPropertyParameters(ValidationSingleLine, false));
// QPlainTextEdit
- propertyNameTypeMap.insert(QStringLiteral("plainText"), StringPropertyParameters(ValidationMultiLine, true));
+ propertyNameTypeMap.insert(u"plainText"_s, StringPropertyParameters(ValidationMultiLine, true));
}
return propertyNameTypeMap;
}
@@ -110,7 +87,7 @@ QDesignerPropertyEditor::StringPropertyParameters QDesignerPropertyEditor::textP
const QString &propertyName, bool isMainContainer)
{
// object name - no comment
- if (propertyName == QStringLiteral("objectName")) {
+ if (propertyName == "objectName"_L1) {
const TextPropertyValidationMode vm = isMainContainer ? ValidationObjectNameScope : ValidationObjectName;
return StringPropertyParameters(vm, false);
}
@@ -128,12 +105,12 @@ QDesignerPropertyEditor::StringPropertyParameters QDesignerPropertyEditor::textP
return StringPropertyParameters(ValidationMultiLine, true);
// Check hardcoded property ames
- const PropertyNameTypeMap::const_iterator hit = stringPropertyTypes().constFind(propertyName);
+ const auto hit = stringPropertyTypes().constFind(propertyName);
if (hit != stringPropertyTypes().constEnd())
return hit.value();
// text: Check according to widget type.
- if (propertyName == QStringLiteral("text")) {
+ if (propertyName == "text"_L1) {
if (qobject_cast<const QAction *>(object) || qobject_cast<const QLineEdit *>(object))
return StringPropertyParameters(ValidationSingleLine, true);
if (qobject_cast<const QAbstractButton *>(object))
@@ -142,14 +119,14 @@ QDesignerPropertyEditor::StringPropertyParameters QDesignerPropertyEditor::textP
}
// Fuzzy matching
- if (propertyName.endsWith(QStringLiteral("Name")))
+ if (propertyName.endsWith("Name"_L1))
return StringPropertyParameters(ValidationSingleLine, true);
- if (propertyName.endsWith(QStringLiteral("ToolTip")))
+ if (propertyName.endsWith("ToolTip"_L1))
return StringPropertyParameters(ValidationRichText, true);
#ifdef Q_OS_WIN // No translation for the active X "control" property
- if (propertyName == QStringLiteral("control") && className == QStringLiteral("QAxWidget"))
+ if (propertyName == "control"_L1 && className == "QAxWidget"_L1)
return StringPropertyParameters(ValidationSingleLine, false);
#endif
diff --git a/src/designer/src/lib/shared/qdesigner_propertyeditor_p.h b/src/designer/src/lib/shared/qdesigner_propertyeditor_p.h
index 5995cd21e..0aa1feb45 100644
--- a/src/designer/src/lib/shared/qdesigner_propertyeditor_p.h
+++ b/src/designer/src/lib/shared/qdesigner_propertyeditor_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -59,7 +34,7 @@ public:
explicit QDesignerPropertyEditor(QWidget *parent = nullptr, Qt::WindowFlags flags = {});
// A pair <ValidationMode, bool isTranslatable>.
- using StringPropertyParameters = QPair<TextPropertyValidationMode, bool>;
+ using StringPropertyParameters = std::pair<TextPropertyValidationMode, bool>;
// Return a pair of validation mode and flag indicating whether property is translatable
// for textual properties.
diff --git a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp
index 209582b1e..573cfed4a 100644
--- a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp
+++ b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_propertysheet_p.h"
#include "qdesigner_utils_p.h"
@@ -56,9 +31,12 @@
#include <QtGui/qaction.h>
#include <QtCore/qdebug.h>
+#include <QtCore/qhash.h>
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
#define USE_LAYOUT_SIZE_CONSTRAINT
static const QDesignerMetaObjectInterface *propertyIntroducedBy(const QDesignerMetaObjectInterface *meta, int index)
@@ -81,40 +59,26 @@ static const QDesignerMetaObjectInterface *propertyIntroducedBy(const QDesignerM
// old forms, QLayoutWidget will show up as ''; however, the uic code will
// still use 'verticalLayout' (in case someone accesses it). New Layouts get autogenerated names,
// legacy forms will keep their empty names (unless someone types in a new name).
-static const char *layoutObjectNameC = "layoutName";
-static const char *layoutLeftMarginC = "layoutLeftMargin";
-static const char *layoutTopMarginC = "layoutTopMargin";
-static const char *layoutRightMarginC = "layoutRightMargin";
-static const char *layoutBottomMarginC = "layoutBottomMargin";
-static const char *layoutSpacingC = "layoutSpacing";
-static const char *layoutHorizontalSpacingC = "layoutHorizontalSpacing";
-static const char *layoutVerticalSpacingC = "layoutVerticalSpacing";
-static const char *layoutSizeConstraintC = "layoutSizeConstraint";
+static constexpr auto layoutObjectNameC = "layoutName"_L1;
+static constexpr auto layoutLeftMarginC = "layoutLeftMargin"_L1;
+static constexpr auto layoutTopMarginC = "layoutTopMargin"_L1;
+static constexpr auto layoutRightMarginC = "layoutRightMargin"_L1;
+static constexpr auto layoutBottomMarginC = "layoutBottomMargin"_L1;
+static constexpr auto layoutSpacingC = "layoutSpacing"_L1;
+static constexpr auto layoutHorizontalSpacingC = "layoutHorizontalSpacing"_L1;
+static constexpr auto layoutVerticalSpacingC = "layoutVerticalSpacing"_L1;
+static constexpr auto layoutSizeConstraintC = "layoutSizeConstraint"_L1;
// form layout
-static const char *layoutFieldGrowthPolicyC = "layoutFieldGrowthPolicy";
-static const char *layoutRowWrapPolicyC = "layoutRowWrapPolicy";
-static const char *layoutLabelAlignmentC = "layoutLabelAlignment";
-static const char *layoutFormAlignmentC = "layoutFormAlignment";
+static constexpr auto layoutFieldGrowthPolicyC = "layoutFieldGrowthPolicy"_L1;
+static constexpr auto layoutRowWrapPolicyC = "layoutRowWrapPolicy"_L1;
+static constexpr auto layoutLabelAlignmentC = "layoutLabelAlignment"_L1;
+static constexpr auto layoutFormAlignmentC = "layoutFormAlignment"_L1;
// stretches
-static const char *layoutboxStretchPropertyC = "layoutStretch";
-static const char *layoutGridRowStretchPropertyC = "layoutRowStretch";
-static const char *layoutGridColumnStretchPropertyC = "layoutColumnStretch";
-static const char *layoutGridRowMinimumHeightC = "layoutRowMinimumHeight";
-static const char *layoutGridColumnMinimumWidthC = "layoutColumnMinimumWidth";
-
-// Find the form editor in the hierarchy.
-// We know that the parent of the sheet is the extension manager
-// whose parent is the core.
-
-static QDesignerFormEditorInterface *formEditorForObject(QObject *o) {
- do {
- if (QDesignerFormEditorInterface* core = qobject_cast<QDesignerFormEditorInterface*>(o))
- return core;
- o = o->parent();
- } while(o);
- Q_ASSERT(o);
- return nullptr;
-}
+static constexpr auto layoutboxStretchPropertyC = "layoutStretch"_L1;
+static constexpr auto layoutGridRowStretchPropertyC = "layoutRowStretch"_L1;
+static constexpr auto layoutGridColumnStretchPropertyC = "layoutColumnStretch"_L1;
+static constexpr auto layoutGridRowMinimumHeightC = "layoutRowMinimumHeight"_L1;
+static constexpr auto layoutGridColumnMinimumWidthC = "layoutColumnMinimumWidth"_L1;
static bool hasLayoutAttributes(QDesignerFormEditorInterface *core, QObject *object)
{
@@ -132,15 +96,14 @@ static bool hasLayoutAttributes(QDesignerFormEditorInterface *core, QObject *obj
// Cache DesignerMetaEnum by scope/name of a QMetaEnum
static const qdesigner_internal::DesignerMetaEnum &designerMetaEnumFor(const QDesignerMetaEnumInterface *me)
{
- using ScopeNameKey = QPair<QString, QString>;
- using DesignerMetaEnumCache = QMap<ScopeNameKey, qdesigner_internal::DesignerMetaEnum>;
- static DesignerMetaEnumCache cache;
+ using ScopeNameKey = std::pair<QString, QString>;
+ static QMap<ScopeNameKey, qdesigner_internal::DesignerMetaEnum> cache;
const QString name = me->name();
const QString scope = me->scope();
const ScopeNameKey key = ScopeNameKey(scope, name);
- DesignerMetaEnumCache::iterator it = cache.find(key);
+ auto it = cache.find(key);
if (it == cache.end()) {
qdesigner_internal::DesignerMetaEnum dme = qdesigner_internal::DesignerMetaEnum(name, scope, me->separator());
const int keyCount = me->keyCount();
@@ -154,17 +117,16 @@ 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)
{
- using ScopeNameKey = QPair<QString, QString>;
- using DesignerMetaFlagsCache = QMap<ScopeNameKey, qdesigner_internal::DesignerMetaFlags>;
- static DesignerMetaFlagsCache cache;
+ using ScopeNameKey = std::pair<QString, QString>;
+ static QMap<ScopeNameKey, qdesigner_internal::DesignerMetaFlags> cache;
const QString name = me->name();
const QString scope = me->scope();
const ScopeNameKey key = ScopeNameKey(scope, name);
- DesignerMetaFlagsCache::iterator it = cache.find(key);
+ auto it = cache.find(key);
if (it == cache.end()) {
- qdesigner_internal::DesignerMetaFlags dme = qdesigner_internal::DesignerMetaFlags(name, scope, me->separator());
+ auto dme = qdesigner_internal::DesignerMetaFlags(me->enumName(), scope, me->separator());
const int keyCount = me->keyCount();
for (int i=0; i < keyCount; ++i)
dme.addKey(me->value(i), me->key(i));
@@ -183,7 +145,7 @@ public:
explicit QDesignerPropertySheetPrivate(QDesignerPropertySheet *sheetPublic, QObject *object, QObject *sheetParent);
bool invalidIndex(const char *functionName, int index) const;
- inline int count() const { return m_meta->propertyCount() + m_addProperties.count(); }
+ inline int count() const { return m_meta->propertyCount() + m_addProperties.size(); }
PropertyType propertyType(int index) const;
QString transformLayoutPropertyName(int index) const;
@@ -235,8 +197,7 @@ public:
const ObjectType m_objectType;
const ObjectFlags m_objectFlags;
- using InfoHash = QHash<int, Info>;
- InfoHash m_info;
+ QHash<int, Info> m_info;
QHash<int, QVariant> m_fakeProperties;
QHash<int, QVariant> m_addProperties;
QHash<QString, int> m_addIndex;
@@ -392,7 +353,7 @@ void QDesignerPropertySheetPrivate::setKeySequenceProperty(int index, const qdes
QDesignerPropertySheetPrivate::QDesignerPropertySheetPrivate(QDesignerPropertySheet *sheetPublic, QObject *object, QObject *sheetParent) :
q(sheetPublic),
- m_core(formEditorForObject(sheetParent)),
+ m_core(QDesignerPropertySheet::formEditorForObject(sheetParent)),
m_meta(m_core->introspection()->metaObject(object)),
m_objectType(QDesignerPropertySheet::objectTypeFromObject(object)),
m_objectFlags(QDesignerPropertySheet::objectFlagsFromObject(object)),
@@ -460,7 +421,7 @@ QLayout* QDesignerPropertySheetPrivate::layout(QDesignerPropertySheetExtension *
QDesignerPropertySheetPrivate::Info &QDesignerPropertySheetPrivate::ensureInfo(int index)
{
- InfoHash::iterator it = m_info.find(index);
+ auto it = m_info.find(index);
if (it == m_info.end())
it = m_info.insert(index, Info());
return it.value();
@@ -468,7 +429,7 @@ QDesignerPropertySheetPrivate::Info &QDesignerPropertySheetPrivate::ensureInfo(i
QDesignerPropertySheet::PropertyType QDesignerPropertySheetPrivate::propertyType(int index) const
{
- const InfoHash::const_iterator it = m_info.constFind(index);
+ const auto it = m_info.constFind(index);
if (it == m_info.constEnd())
return QDesignerPropertySheet::PropertyNone;
return it.value().propertyType;
@@ -477,28 +438,27 @@ QDesignerPropertySheet::PropertyType QDesignerPropertySheetPrivate::propertyType
QString QDesignerPropertySheetPrivate::transformLayoutPropertyName(int index) const
{
using TypeNameMap = QMap<QDesignerPropertySheet::PropertyType, QString>;
- static TypeNameMap typeNameMap;
- if (typeNameMap.isEmpty()) {
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutObjectName, QStringLiteral("objectName"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutLeftMargin, QStringLiteral("leftMargin"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutTopMargin, QStringLiteral("topMargin"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutRightMargin, QStringLiteral("rightMargin"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutBottomMargin, QStringLiteral("bottomMargin"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutSpacing, QStringLiteral("spacing"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutHorizontalSpacing, QStringLiteral("horizontalSpacing"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutVerticalSpacing, QStringLiteral("verticalSpacing"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutSizeConstraint, QStringLiteral("sizeConstraint"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutFieldGrowthPolicy, QStringLiteral("fieldGrowthPolicy"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutRowWrapPolicy, QStringLiteral("rowWrapPolicy"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutLabelAlignment, QStringLiteral("labelAlignment"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutFormAlignment, QStringLiteral("formAlignment"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutBoxStretch, QStringLiteral("stretch"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutGridRowStretch, QStringLiteral("rowStretch"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutGridColumnStretch, QStringLiteral("columnStretch"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutGridRowMinimumHeight, QStringLiteral("rowMinimumHeight"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutGridColumnMinimumWidth, QStringLiteral("columnMinimumWidth"));
- }
- const TypeNameMap::const_iterator it = typeNameMap.constFind(propertyType(index));
+ static const TypeNameMap typeNameMap = {
+ {QDesignerPropertySheet::PropertyLayoutObjectName, u"objectName"_s},
+ {QDesignerPropertySheet::PropertyLayoutLeftMargin, u"leftMargin"_s},
+ {QDesignerPropertySheet::PropertyLayoutTopMargin, u"topMargin"_s},
+ {QDesignerPropertySheet::PropertyLayoutRightMargin, u"rightMargin"_s},
+ {QDesignerPropertySheet::PropertyLayoutBottomMargin, u"bottomMargin"_s},
+ {QDesignerPropertySheet::PropertyLayoutSpacing, u"spacing"_s},
+ {QDesignerPropertySheet::PropertyLayoutHorizontalSpacing, u"horizontalSpacing"_s},
+ {QDesignerPropertySheet::PropertyLayoutVerticalSpacing, u"verticalSpacing"_s},
+ {QDesignerPropertySheet::PropertyLayoutSizeConstraint, u"sizeConstraint"_s},
+ {QDesignerPropertySheet::PropertyLayoutFieldGrowthPolicy, u"fieldGrowthPolicy"_s},
+ {QDesignerPropertySheet::PropertyLayoutRowWrapPolicy, u"rowWrapPolicy"_s},
+ {QDesignerPropertySheet::PropertyLayoutLabelAlignment, u"labelAlignment"_s},
+ {QDesignerPropertySheet::PropertyLayoutFormAlignment, u"formAlignment"_s},
+ {QDesignerPropertySheet::PropertyLayoutBoxStretch, u"stretch"_s},
+ {QDesignerPropertySheet::PropertyLayoutGridRowStretch, u"rowStretch"_s},
+ {QDesignerPropertySheet::PropertyLayoutGridColumnStretch, u"columnStretch"_s},
+ {QDesignerPropertySheet::PropertyLayoutGridRowMinimumHeight, u"rowMinimumHeight"_s},
+ {QDesignerPropertySheet::PropertyLayoutGridColumnMinimumWidth, u"columnMinimumWidth"_s}
+ };
+ const auto it = typeNameMap.constFind(propertyType(index));
if (it != typeNameMap.constEnd())
return it.value();
return QString();
@@ -536,44 +496,42 @@ QDesignerPropertySheet::ObjectFlags QDesignerPropertySheet::objectFlagsFromObjec
QDesignerPropertySheet::PropertyType QDesignerPropertySheet::propertyTypeFromName(const QString &name)
{
- typedef QHash<QString, PropertyType> PropertyTypeHash;
- static PropertyTypeHash propertyTypeHash;
- if (propertyTypeHash.isEmpty()) {
- propertyTypeHash.insert(QLatin1String(layoutObjectNameC), PropertyLayoutObjectName);
- propertyTypeHash.insert(QLatin1String(layoutLeftMarginC), PropertyLayoutLeftMargin);
- propertyTypeHash.insert(QLatin1String(layoutTopMarginC), PropertyLayoutTopMargin);
- propertyTypeHash.insert(QLatin1String(layoutRightMarginC), PropertyLayoutRightMargin);
- propertyTypeHash.insert(QLatin1String(layoutBottomMarginC), PropertyLayoutBottomMargin);
- propertyTypeHash.insert(QLatin1String(layoutSpacingC), PropertyLayoutSpacing);
- propertyTypeHash.insert(QLatin1String(layoutHorizontalSpacingC), PropertyLayoutHorizontalSpacing);
- propertyTypeHash.insert(QLatin1String(layoutVerticalSpacingC), PropertyLayoutVerticalSpacing);
- propertyTypeHash.insert(QLatin1String(layoutSizeConstraintC), PropertyLayoutSizeConstraint);
- propertyTypeHash.insert(QLatin1String(layoutFieldGrowthPolicyC), PropertyLayoutFieldGrowthPolicy);
- propertyTypeHash.insert(QLatin1String(layoutRowWrapPolicyC), PropertyLayoutRowWrapPolicy);
- propertyTypeHash.insert(QLatin1String(layoutLabelAlignmentC), PropertyLayoutLabelAlignment);
- propertyTypeHash.insert(QLatin1String(layoutFormAlignmentC), PropertyLayoutFormAlignment);
- propertyTypeHash.insert(QLatin1String(layoutboxStretchPropertyC), PropertyLayoutBoxStretch);
- propertyTypeHash.insert(QLatin1String(layoutGridRowStretchPropertyC), PropertyLayoutGridRowStretch);
- propertyTypeHash.insert(QLatin1String(layoutGridColumnStretchPropertyC), PropertyLayoutGridColumnStretch);
- propertyTypeHash.insert(QLatin1String(layoutGridRowMinimumHeightC), PropertyLayoutGridRowMinimumHeight);
- propertyTypeHash.insert(QLatin1String(layoutGridColumnMinimumWidthC), PropertyLayoutGridColumnMinimumWidth);
- propertyTypeHash.insert(QStringLiteral("buddy"), PropertyBuddy);
- propertyTypeHash.insert(QStringLiteral("geometry"), PropertyGeometry);
- propertyTypeHash.insert(QStringLiteral("checked"), PropertyChecked);
- propertyTypeHash.insert(QStringLiteral("checkable"), PropertyCheckable);
- propertyTypeHash.insert(QStringLiteral("accessibleName"), PropertyAccessibility);
- propertyTypeHash.insert(QStringLiteral("accessibleDescription"), PropertyAccessibility);
- propertyTypeHash.insert(QStringLiteral("visible"), PropertyVisible);
- propertyTypeHash.insert(QStringLiteral("windowTitle"), PropertyWindowTitle);
- propertyTypeHash.insert(QStringLiteral("windowIcon"), PropertyWindowIcon);
- propertyTypeHash.insert(QStringLiteral("windowFilePath"), PropertyWindowFilePath);
- propertyTypeHash.insert(QStringLiteral("windowOpacity"), PropertyWindowOpacity);
- propertyTypeHash.insert(QStringLiteral("windowIconText"), PropertyWindowIconText);
- propertyTypeHash.insert(QStringLiteral("windowModality"), PropertyWindowModality);
- propertyTypeHash.insert(QStringLiteral("windowModified"), PropertyWindowModified);
- propertyTypeHash.insert(QStringLiteral("styleSheet"), PropertyStyleSheet);
- propertyTypeHash.insert(QStringLiteral("text"), PropertyText);
- }
+ static const QHash<QString, PropertyType> propertyTypeHash = {
+ {layoutObjectNameC, PropertyLayoutObjectName},
+ {layoutLeftMarginC, PropertyLayoutLeftMargin},
+ {layoutTopMarginC, PropertyLayoutTopMargin},
+ {layoutRightMarginC, PropertyLayoutRightMargin},
+ {layoutBottomMarginC, PropertyLayoutBottomMargin},
+ {layoutSpacingC, PropertyLayoutSpacing},
+ {layoutHorizontalSpacingC, PropertyLayoutHorizontalSpacing},
+ {layoutVerticalSpacingC, PropertyLayoutVerticalSpacing},
+ {layoutSizeConstraintC, PropertyLayoutSizeConstraint},
+ {layoutFieldGrowthPolicyC, PropertyLayoutFieldGrowthPolicy},
+ {layoutRowWrapPolicyC, PropertyLayoutRowWrapPolicy},
+ {layoutLabelAlignmentC, PropertyLayoutLabelAlignment},
+ {layoutFormAlignmentC, PropertyLayoutFormAlignment},
+ {layoutboxStretchPropertyC, PropertyLayoutBoxStretch},
+ {layoutGridRowStretchPropertyC, PropertyLayoutGridRowStretch},
+ {layoutGridColumnStretchPropertyC, PropertyLayoutGridColumnStretch},
+ {layoutGridRowMinimumHeightC, PropertyLayoutGridRowMinimumHeight},
+ {layoutGridColumnMinimumWidthC, PropertyLayoutGridColumnMinimumWidth},
+ {u"buddy"_s, PropertyBuddy},
+ {u"geometry"_s, PropertyGeometry},
+ {u"checked"_s, PropertyChecked},
+ {u"checkable"_s, PropertyCheckable},
+ {u"accessibleName"_s, PropertyAccessibility},
+ {u"accessibleDescription"_s, PropertyAccessibility},
+ {u"visible"_s, PropertyVisible},
+ {u"windowTitle"_s, PropertyWindowTitle},
+ {u"windowIcon"_s, PropertyWindowIcon},
+ {u"windowFilePath"_s, PropertyWindowFilePath},
+ {u"windowOpacity"_s, PropertyWindowOpacity},
+ {u"windowIconText"_s, PropertyWindowIconText},
+ {u"windowModality"_s, PropertyWindowModality},
+ {u"windowModified"_s, PropertyWindowModified},
+ {u"styleSheet"_s, PropertyStyleSheet},
+ {u"text"_s, PropertyText}
+ };
return propertyTypeHash.value(name, PropertyNone);
}
@@ -584,7 +542,7 @@ QDesignerPropertySheet::QDesignerPropertySheet(QObject *object, QObject *parent)
using Info = QDesignerPropertySheetPrivate::Info;
const QDesignerMetaObjectInterface *baseMeta = d->m_meta;
- while (baseMeta &&baseMeta->className().startsWith(QStringLiteral("QDesigner"))) {
+ while (baseMeta &&baseMeta->className().startsWith("QDesigner"_L1)) {
baseMeta = baseMeta->superClass();
}
Q_ASSERT(baseMeta != nullptr);
@@ -640,28 +598,28 @@ QDesignerPropertySheet::QDesignerPropertySheet(QObject *object, QObject *parent)
}
if (object->isWidgetType()) {
- createFakeProperty(QStringLiteral("focusPolicy"));
- createFakeProperty(QStringLiteral("cursor"));
- createFakeProperty(QStringLiteral("toolTip"));
- createFakeProperty(QStringLiteral("whatsThis"));
- createFakeProperty(QStringLiteral("acceptDrops"));
- createFakeProperty(QStringLiteral("dragEnabled"));
+ createFakeProperty(u"focusPolicy"_s);
+ createFakeProperty(u"cursor"_s);
+ createFakeProperty(u"toolTip"_s);
+ createFakeProperty(u"whatsThis"_s);
+ createFakeProperty(u"acceptDrops"_s);
+ createFakeProperty(u"dragEnabled"_s);
// windowModality/Opacity is visible only for the main container, in which case the form windows enables it on loading
- setVisible(createFakeProperty(QStringLiteral("windowModality")), false);
- setVisible(createFakeProperty(QStringLiteral("windowOpacity"), double(1.0)), false);
+ setVisible(createFakeProperty(u"windowModality"_s), false);
+ setVisible(createFakeProperty(u"windowOpacity"_s, double(1.0)), false);
if (qobject_cast<const QToolBar *>(d->m_object)) { // prevent toolbars from being dragged off
- createFakeProperty(QStringLiteral("floatable"), QVariant(true));
+ createFakeProperty(u"floatable"_s, QVariant(true));
} else {
if (qobject_cast<const QMenuBar *>(d->m_object)) {
// Keep the menu bar editable in the form even if a native menu bar is used.
const bool nativeMenuBarDefault =
!QCoreApplication::testAttribute(Qt::AA_DontUseNativeMenuBar);
- createFakeProperty(QStringLiteral("nativeMenuBar"), QVariant(nativeMenuBarDefault));
+ createFakeProperty(u"nativeMenuBar"_s, QVariant(nativeMenuBarDefault));
}
}
if (d->m_canHaveLayoutAttributes) {
- static const QString layoutGroup = QStringLiteral("Layout");
- const char* fakeLayoutProperties[] = {
+ const QString layoutGroup = u"Layout"_s;
+ static constexpr QLatin1StringView fakeLayoutProperties[] = {
layoutObjectNameC, layoutLeftMarginC, layoutTopMarginC, layoutRightMarginC, layoutBottomMarginC, layoutSpacingC, layoutHorizontalSpacingC, layoutVerticalSpacingC,
layoutFieldGrowthPolicyC, layoutRowWrapPolicyC, layoutLabelAlignmentC, layoutFormAlignmentC,
layoutboxStretchPropertyC, layoutGridRowStretchPropertyC, layoutGridColumnStretchPropertyC,
@@ -670,42 +628,37 @@ QDesignerPropertySheet::QDesignerPropertySheet(QObject *object, QObject *parent)
, layoutSizeConstraintC
#endif
};
- const int fakeLayoutPropertyCount = sizeof(fakeLayoutProperties)/sizeof(const char*);
+ static constexpr int fakeLayoutPropertyCount = sizeof(fakeLayoutProperties)/sizeof(fakeLayoutProperties[0]);
const int size = count();
for (int i = 0; i < fakeLayoutPropertyCount; i++) {
- createFakeProperty(QLatin1String(fakeLayoutProperties[i]), 0);
+ createFakeProperty(fakeLayoutProperties[i], 0);
setAttribute(size + i, true);
setPropertyGroup(size + i, layoutGroup);
}
}
if (d->m_objectType == ObjectLabel)
- createFakeProperty(QStringLiteral("buddy"), QVariant(QByteArray()));
+ createFakeProperty(u"buddy"_s, QVariant(QByteArray()));
/* We need to create a fake property since the property does not work
* for non-toplevel windows or on other systems than Mac and only if
* it is above a certain Mac OS version. */
if (qobject_cast<const QMainWindow *>(d->m_object))
- createFakeProperty(QStringLiteral("unifiedTitleAndToolBarOnMac"), false);
+ createFakeProperty(u"unifiedTitleAndToolBarOnMac"_s, false);
}
if (qobject_cast<const QDialog*>(object)) {
- createFakeProperty(QStringLiteral("modal"));
+ createFakeProperty(u"modal"_s);
}
if (qobject_cast<const QDockWidget*>(object)) {
- createFakeProperty(QStringLiteral("floating"));
+ createFakeProperty(u"floating"_s);
}
- using ByteArrayList = QList<QByteArray>;
- const ByteArrayList names = object->dynamicPropertyNames();
- if (!names.isEmpty()) {
- const ByteArrayList::const_iterator cend = names.constEnd();
- for (ByteArrayList::const_iterator it = names.constBegin(); it != cend; ++it) {
- const char* cName = it->constData();
- const QString name = QString::fromLatin1(cName);
- const int idx = addDynamicProperty(name, object->property(cName));
- if (idx != -1)
- d->ensureInfo(idx).kind = QDesignerPropertySheetPrivate::DefaultDynamicProperty;
- }
+ const QByteArrayList names = object->dynamicPropertyNames();
+ for (const auto &nameB : names) {
+ const QString name = QString::fromLatin1(nameB);
+ const int idx = addDynamicProperty(name, object->property(nameB.constData()));
+ if (idx != -1)
+ d->ensureInfo(idx).kind = QDesignerPropertySheetPrivate::DefaultDynamicProperty;
}
}
@@ -727,8 +680,7 @@ bool QDesignerPropertySheet::dynamicPropertiesAllowed() const
bool QDesignerPropertySheet::canAddDynamicProperty(const QString &propName) const
{
// used internally
- if (propName == QStringLiteral("database") ||
- propName == QStringLiteral("buttonGroupId"))
+ if (propName == "database"_L1 || propName == "buttonGroupId"_L1)
return false;
const int index = d->m_meta->indexOfProperty(propName);
if (index != -1)
@@ -738,7 +690,7 @@ bool QDesignerPropertySheet::canAddDynamicProperty(const QString &propName) cons
return !isVisible(idx); // dynamic property already exists
}
return QDesignerPropertySheet::internalDynamicPropertiesEnabled()
- || !propName.startsWith(QStringLiteral("_q_"));
+ || !propName.startsWith("_q_"_L1);
}
int QDesignerPropertySheet::addDynamicProperty(const QString &propName, const QVariant &value)
@@ -863,6 +815,7 @@ bool QDesignerPropertySheet::isDynamic(int index) const
case PropertyLayoutGridColumnMinimumWidth:
if (d->m_object->isWidgetType() && d->m_canHaveLayoutAttributes)
return false;
+ break;
default:
break;
}
@@ -1015,7 +968,7 @@ QString QDesignerPropertySheet::propertyGroup(int index) const
return g;
if (propertyType(index) == PropertyAccessibility)
- return QString::fromUtf8("Accessibility");
+ return u"Accessibility"_s;
if (isAdditionalProperty(index))
return d->m_meta->className();
@@ -1255,7 +1208,7 @@ void QDesignerPropertySheet::setProperty(int index, const QVariant &value)
const QDesignerMetaPropertyInterface *p = d->m_meta->property(index);
p->write(d->m_object, resolvePropertyValue(index, value));
if (qobject_cast<QGroupBox *>(d->m_object) && propertyType(index) == PropertyCheckable) {
- const int idx = indexOf(QStringLiteral("focusPolicy"));
+ const int idx = indexOf(u"focusPolicy"_s);
if (!isChanged(idx)) {
qdesigner_internal::PropertySheetEnumValue e = qvariant_cast<qdesigner_internal::PropertySheetEnumValue>(property(idx));
if (value.toBool()) {
@@ -1292,7 +1245,7 @@ bool QDesignerPropertySheet::reset(int index)
if (d->isStringProperty(index)) {
qdesigner_internal::PropertySheetStringValue value;
// Main container: Reset to stored class name as not to change the file names generated by uic.
- if (propertyName(index) == QStringLiteral("objectName")) {
+ if (propertyName(index) == "objectName"_L1) {
const QVariant classNameDefaultV = d->m_object->property("_q_classname");
if (classNameDefaultV.isValid())
value.setValue(classNameDefaultV.toString());
@@ -1495,7 +1448,7 @@ bool QDesignerPropertySheet::isFakeLayoutProperty(int index) const
}
// Visible vs. Enabled: In Qt 5, it was possible to define a boolean function
-// for the DESIGNABLE attribute of Q_PROPERTY. Qt Designer would use that to
+// for the DESIGNABLE attribute of Q_PROPERTY. Qt Widgets Designer would use that to
// determine isEnabled() for the property and return isVisible() = false
// for properties that specified 'false' for DESIGNABLE.
// This was used for example for the "checked" property of QAbstractButton,
@@ -1657,6 +1610,20 @@ void QDesignerPropertySheet::setInternalDynamicPropertiesEnabled(bool v)
QDesignerPropertySheetPrivate::m_internalDynamicPropertiesEnabled = v;
}
+// Find the form editor in the hierarchy.
+// We know that the parent of the sheet is the extension manager
+// whose parent is the core.
+QDesignerFormEditorInterface *QDesignerPropertySheet::formEditorForObject(QObject *o)
+{
+ do {
+ if (auto *core = qobject_cast<QDesignerFormEditorInterface*>(o))
+ return core;
+ o = o->parent();
+ } while (o);
+ Q_ASSERT(o);
+ return nullptr;
+}
+
// ---------- QDesignerAbstractPropertySheetFactory
struct QDesignerAbstractPropertySheetFactory::PropertySheetFactoryPrivate {
@@ -1664,8 +1631,7 @@ struct QDesignerAbstractPropertySheetFactory::PropertySheetFactoryPrivate {
const QString m_propertySheetId;
const QString m_dynamicPropertySheetId;
- using ExtensionMap = QMap<QObject*, QObject*>;
- ExtensionMap m_extensions;
+ QHash<QObject *, QObject *> m_extensions;
};
QDesignerAbstractPropertySheetFactory::PropertySheetFactoryPrivate::PropertySheetFactoryPrivate() :
diff --git a/src/designer/src/lib/shared/qdesigner_propertysheet_p.h b/src/designer/src/lib/shared/qdesigner_propertysheet_p.h
index e066d0c4f..b9f88626f 100644
--- a/src/designer/src/lib/shared/qdesigner_propertysheet_p.h
+++ b/src/designer/src/lib/shared/qdesigner_propertysheet_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -119,6 +94,8 @@ public:
static bool internalDynamicPropertiesEnabled();
static void setInternalDynamicPropertiesEnabled(bool v);
+ static QDesignerFormEditorInterface *formEditorForObject(QObject *o);
+
protected:
bool isAdditionalProperty(int index) const;
bool isFakeProperty(int index) const;
@@ -254,7 +231,7 @@ void QDesignerPropertySheetFactory<Object, PropertySheet>::registerExtension(QEx
// Standard property sheet
-typedef QDesignerPropertySheetFactory<QObject, QDesignerPropertySheet> QDesignerDefaultPropertySheetFactory;
+using QDesignerDefaultPropertySheetFactory = QDesignerPropertySheetFactory<QObject, QDesignerPropertySheet>;
Q_DECLARE_OPERATORS_FOR_FLAGS(QDesignerPropertySheet::ObjectFlags)
diff --git a/src/designer/src/lib/shared/qdesigner_qsettings.cpp b/src/designer/src/lib/shared/qdesigner_qsettings.cpp
index 0fa7d676e..3105132a0 100644
--- a/src/designer/src/lib/shared/qdesigner_qsettings.cpp
+++ b/src/designer/src/lib/shared/qdesigner_qsettings.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_qsettings_p.h"
diff --git a/src/designer/src/lib/shared/qdesigner_qsettings_p.h b/src/designer/src/lib/shared/qdesigner_qsettings_p.h
index fe25142ea..12c6efd25 100644
--- a/src/designer/src/lib/shared/qdesigner_qsettings_p.h
+++ b/src/designer/src/lib/shared/qdesigner_qsettings_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/qdesigner_stackedbox.cpp b/src/designer/src/lib/shared/qdesigner_stackedbox.cpp
index c62b12972..993dd6089 100644
--- a/src/designer/src/lib/shared/qdesigner_stackedbox.cpp
+++ b/src/designer/src/lib/shared/qdesigner_stackedbox.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_stackedbox_p.h"
#include "qdesigner_command_p.h"
@@ -46,7 +21,10 @@
QT_BEGIN_NAMESPACE
-static QToolButton *createToolButton(QWidget *parent, Qt::ArrowType at, const QString &name) {
+using namespace Qt::StringLiterals;
+
+static QToolButton *createToolButton(QWidget *parent, Qt::ArrowType at, const QString &name)
+{
QToolButton *rc = new QToolButton();
rc->setAttribute(Qt::WA_NoChildEventsForParent, true);
rc->setParent(parent);
@@ -63,8 +41,8 @@ QStackedWidgetPreviewEventFilter::QStackedWidgetPreviewEventFilter(QStackedWidge
QObject(parent),
m_buttonToolTipEnabled(false), // Not on preview
m_stackedWidget(parent),
- m_prev(createToolButton(m_stackedWidget, Qt::LeftArrow, QStringLiteral("__qt__passive_prev"))),
- m_next(createToolButton(m_stackedWidget, Qt::RightArrow, QStringLiteral("__qt__passive_next")))
+ m_prev(createToolButton(m_stackedWidget, Qt::LeftArrow, u"__qt__passive_prev"_s)),
+ m_next(createToolButton(m_stackedWidget, Qt::RightArrow, u"__qt__passive_next"_s))
{
connect(m_prev, &QAbstractButton::clicked, this, &QStackedWidgetPreviewEventFilter::prevPage);
connect(m_next, &QAbstractButton::clicked, this, &QStackedWidgetPreviewEventFilter::nextPage);
@@ -158,7 +136,7 @@ static inline QString stackedClassName(QStackedWidget *w)
{
if (const QDesignerFormWindowInterface *fw = QDesignerFormWindowInterface::findFormWindow(w))
return qdesigner_internal::WidgetFactory::classNameOf(fw->core(), w);
- return QStringLiteral("Stacked widget");
+ return u"Stacked widget"_s;
}
void QStackedWidgetPreviewEventFilter::updateButtonToolTip(QObject *o)
@@ -290,7 +268,7 @@ void QStackedWidgetEventFilter::gotoPage(int page) {
// Are we on a form or in a preview?
if (QDesignerFormWindowInterface *fw = QDesignerFormWindowInterface::findFormWindow(stackedWidget())) {
qdesigner_internal::SetPropertyCommand *cmd = new qdesigner_internal::SetPropertyCommand(fw);
- cmd->init(stackedWidget(), QStringLiteral("currentIndex"), page);
+ cmd->init(stackedWidget(), u"currentIndex"_s, page);
fw->commandHistory()->push(cmd);
fw->emitSelectionChanged(); // Magically prevent an endless loop triggered by auto-repeat.
updateButtons();
@@ -335,25 +313,25 @@ QMenu *QStackedWidgetEventFilter::addContextMenuActions(QMenu *popup)
// -------- QStackedWidgetPropertySheet
-static const char *pagePropertyName = "currentPageName";
+static constexpr auto pagePropertyName = "currentPageName"_L1;
QStackedWidgetPropertySheet::QStackedWidgetPropertySheet(QStackedWidget *object, QObject *parent) :
QDesignerPropertySheet(object, parent),
m_stackedWidget(object)
{
- createFakeProperty(QLatin1String(pagePropertyName), QString());
+ createFakeProperty(pagePropertyName, QString());
}
bool QStackedWidgetPropertySheet::isEnabled(int index) const
{
- if (propertyName(index) != QLatin1String(pagePropertyName))
+ if (propertyName(index) != pagePropertyName)
return QDesignerPropertySheet::isEnabled(index);
return m_stackedWidget->currentWidget() != nullptr;
}
void QStackedWidgetPropertySheet::setProperty(int index, const QVariant &value)
{
- if (propertyName(index) == QLatin1String(pagePropertyName)) {
+ if (propertyName(index) == pagePropertyName) {
if (QWidget *w = m_stackedWidget->currentWidget())
w->setObjectName(value.toString());
} else {
@@ -363,7 +341,7 @@ void QStackedWidgetPropertySheet::setProperty(int index, const QVariant &value)
QVariant QStackedWidgetPropertySheet::property(int index) const
{
- if (propertyName(index) == QLatin1String(pagePropertyName)) {
+ if (propertyName(index) == pagePropertyName) {
if (const QWidget *w = m_stackedWidget->currentWidget())
return w->objectName();
return QString();
@@ -373,7 +351,7 @@ QVariant QStackedWidgetPropertySheet::property(int index) const
bool QStackedWidgetPropertySheet::reset(int index)
{
- if (propertyName(index) == QLatin1String(pagePropertyName)) {
+ if (propertyName(index) == pagePropertyName) {
setProperty(index, QString());
return true;
}
@@ -382,7 +360,7 @@ bool QStackedWidgetPropertySheet::reset(int index)
bool QStackedWidgetPropertySheet::checkProperty(const QString &propertyName)
{
- return propertyName != QLatin1String(pagePropertyName);
+ return propertyName != pagePropertyName;
}
QT_END_NAMESPACE
diff --git a/src/designer/src/lib/shared/qdesigner_stackedbox_p.h b/src/designer/src/lib/shared/qdesigner_stackedbox_p.h
index 36b876d78..9ef21fcfd 100644
--- a/src/designer/src/lib/shared/qdesigner_stackedbox_p.h
+++ b/src/designer/src/lib/shared/qdesigner_stackedbox_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/qdesigner_tabwidget.cpp b/src/designer/src/lib/shared/qdesigner_tabwidget.cpp
index 9325e386d..36d0c3798 100644
--- a/src/designer/src/lib/shared/qdesigner_tabwidget.cpp
+++ b/src/designer/src/lib/shared/qdesigner_tabwidget.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_tabwidget_p.h"
#include "qdesigner_command_p.h"
@@ -49,6 +24,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
// Store tab widget as drag source
class MyMimeData : public QMimeData
@@ -179,7 +156,7 @@ bool QTabWidgetEventFilter::eventFilter(QObject *o, QEvent *e)
if (tabbar->tabRect(i).contains(m_pressPoint)) {
if (i != tabbar->currentIndex()) {
qdesigner_internal::SetPropertyCommand *cmd = new qdesigner_internal::SetPropertyCommand(fw);
- cmd->init(m_tabWidget, QStringLiteral("currentIndex"), i);
+ cmd->init(m_tabWidget, u"currentIndex"_s, i);
fw->commandHistory()->push(cmd);
}
break;
@@ -381,39 +358,37 @@ QMenu *QTabWidgetEventFilter::addContextMenuActions(QMenu *popup)
// ----------- QTabWidgetPropertySheet
-static const char *currentTabTextKey = "currentTabText";
-static const char *currentTabNameKey = "currentTabName";
-static const char *currentTabIconKey = "currentTabIcon";
-static const char *currentTabToolTipKey = "currentTabToolTip";
-static const char *currentTabWhatsThisKey = "currentTabWhatsThis";
-static const char *tabMovableKey = "movable";
+static constexpr auto currentTabTextKey = "currentTabText"_L1;
+static constexpr auto currentTabNameKey = "currentTabName"_L1;
+static constexpr auto currentTabIconKey = "currentTabIcon"_L1;
+static constexpr auto currentTabToolTipKey = "currentTabToolTip"_L1;
+static constexpr auto currentTabWhatsThisKey = "currentTabWhatsThis"_L1;
+static constexpr auto tabMovableKey = "movable"_L1;
QTabWidgetPropertySheet::QTabWidgetPropertySheet(QTabWidget *object, QObject *parent) :
QDesignerPropertySheet(object, parent),
m_tabWidget(object)
{
- createFakeProperty(QLatin1String(currentTabTextKey), QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
- createFakeProperty(QLatin1String(currentTabNameKey), QString());
- createFakeProperty(QLatin1String(currentTabIconKey), QVariant::fromValue(qdesigner_internal::PropertySheetIconValue()));
+ createFakeProperty(currentTabTextKey, QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
+ createFakeProperty(currentTabNameKey, QString());
+ createFakeProperty(currentTabIconKey, QVariant::fromValue(qdesigner_internal::PropertySheetIconValue()));
if (formWindowBase())
- formWindowBase()->addReloadableProperty(this, indexOf(QLatin1String(currentTabIconKey)));
- createFakeProperty(QLatin1String(currentTabToolTipKey), QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
- createFakeProperty(QLatin1String(currentTabWhatsThisKey), QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
+ formWindowBase()->addReloadableProperty(this, indexOf(currentTabIconKey));
+ createFakeProperty(currentTabToolTipKey, QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
+ createFakeProperty(currentTabWhatsThisKey, QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
// Prevent the tab widget's drag and drop handling from interfering with Designer's
- createFakeProperty(QLatin1String(tabMovableKey), QVariant(false));
+ createFakeProperty(tabMovableKey, QVariant(false));
}
QTabWidgetPropertySheet::TabWidgetProperty QTabWidgetPropertySheet::tabWidgetPropertyFromName(const QString &name)
{
- using TabWidgetPropertyHash = QHash<QString, TabWidgetProperty>;
- static TabWidgetPropertyHash tabWidgetPropertyHash;
- if (tabWidgetPropertyHash.isEmpty()) {
- tabWidgetPropertyHash.insert(QLatin1String(currentTabTextKey), PropertyCurrentTabText);
- tabWidgetPropertyHash.insert(QLatin1String(currentTabNameKey), PropertyCurrentTabName);
- tabWidgetPropertyHash.insert(QLatin1String(currentTabIconKey), PropertyCurrentTabIcon);
- tabWidgetPropertyHash.insert(QLatin1String(currentTabToolTipKey), PropertyCurrentTabToolTip);
- tabWidgetPropertyHash.insert(QLatin1String(currentTabWhatsThisKey), PropertyCurrentTabWhatsThis);
- }
+ static const QHash<QString, TabWidgetProperty> tabWidgetPropertyHash = {
+ {currentTabTextKey, PropertyCurrentTabText},
+ {currentTabNameKey, PropertyCurrentTabName},
+ {currentTabIconKey, PropertyCurrentTabIcon},
+ {currentTabToolTipKey, PropertyCurrentTabToolTip},
+ {currentTabWhatsThisKey, PropertyCurrentTabWhatsThis}
+ };
return tabWidgetPropertyHash.value(name, PropertyTabWidgetNone);
}
diff --git a/src/designer/src/lib/shared/qdesigner_tabwidget_p.h b/src/designer/src/lib/shared/qdesigner_tabwidget_p.h
index 1a488fe69..c83d93aed 100644
--- a/src/designer/src/lib/shared/qdesigner_tabwidget_p.h
+++ b/src/designer/src/lib/shared/qdesigner_tabwidget_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -44,6 +19,7 @@
#include "qdesigner_propertysheet_p.h"
#include "qdesigner_utils_p.h"
+#include <QtCore/qhash.h>
#include <QtCore/qpointer.h>
#include <QtGui/qicon.h>
@@ -130,7 +106,7 @@ private:
qdesigner_internal::PropertySheetStringValue whatsthis;
qdesigner_internal::PropertySheetIconValue icon;
};
- QMap<QWidget *, PageData> m_pageToData;
+ QHash<QWidget *, PageData> m_pageToData;
};
using QTabWidgetPropertySheetFactory = QDesignerPropertySheetFactory<QTabWidget, QTabWidgetPropertySheet>;
diff --git a/src/designer/src/lib/shared/qdesigner_taskmenu.cpp b/src/designer/src/lib/shared/qdesigner_taskmenu.cpp
index e51cd3a73..8bdf01f37 100644
--- a/src/designer/src/lib/shared/qdesigner_taskmenu.cpp
+++ b/src/designer/src/lib/shared/qdesigner_taskmenu.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_taskmenu_p.h"
#include "qdesigner_command_p.h"
@@ -77,6 +52,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
static inline QAction *createSeparatorHelper(QObject *parent) {
QAction *rc = new QAction(parent);
rc->setSeparator(true);
@@ -88,8 +65,7 @@ static QString objName(const QDesignerFormEditorInterface *core, QObject *object
= qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), object);
Q_ASSERT(sheet != nullptr);
- const QString objectNameProperty = QStringLiteral("objectName");
- const int index = sheet->indexOf(objectNameProperty);
+ const int index = sheet->indexOf(u"objectName"_s);
const QVariant v = sheet->property(index);
if (v.canConvert<qdesigner_internal::PropertySheetStringValue>())
return v.value<qdesigner_internal::PropertySheetStringValue>().value();
@@ -116,7 +92,6 @@ ObjectNameDialog::ObjectNameDialog(QWidget *parent, const QString &oldName)
qdesigner_internal::ValidationObjectName))
{
setWindowTitle(QCoreApplication::translate("ObjectNameDialog", "Change Object Name"));
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QVBoxLayout *vboxLayout = new QVBoxLayout(this);
vboxLayout->addWidget(new QLabel(QCoreApplication::translate("ObjectNameDialog", "Object Name")));
@@ -146,20 +121,22 @@ namespace qdesigner_internal {
// Sub menu displaying the alignment options of a widget in a managed
// grid/box layout cell.
-class LayoutAlignmentMenu {
+class LayoutAlignmentMenu : public QObject {
+ Q_OBJECT
public:
explicit LayoutAlignmentMenu(QObject *parent);
QAction *subMenuAction() const { return m_subMenuAction; }
- void connect(QObject *receiver, const char *aSlot);
-
// Set up enabled state and checked actions according to widget (managed box/grid)
bool setAlignment(const QDesignerFormEditorInterface *core, QWidget *w);
// Return the currently checked alignment
Qt::Alignment alignment() const;
+signals:
+ void changed();
+
private:
enum Actions { HorizNone, Left, HorizCenter, Right, VerticalNone, Top, VerticalCenter, Bottom };
static QAction *createAction(const QString &text, int data, QMenu *menu, QActionGroup *ag);
@@ -180,13 +157,15 @@ QAction *LayoutAlignmentMenu::createAction(const QString &text, int data, QMenu
return a;
}
-LayoutAlignmentMenu::LayoutAlignmentMenu(QObject *parent) :
+LayoutAlignmentMenu::LayoutAlignmentMenu(QObject *parent) : QObject(parent),
m_subMenuAction(new QAction(QDesignerTaskMenu::tr("Layout Alignment"), parent)),
m_horizGroup(new QActionGroup(parent)),
m_verticalGroup(new QActionGroup(parent))
{
m_horizGroup->setExclusive(true);
m_verticalGroup->setExclusive(true);
+ connect(m_horizGroup, &QActionGroup::triggered, this, &LayoutAlignmentMenu::changed);
+ connect(m_verticalGroup, &QActionGroup::triggered, this, &LayoutAlignmentMenu::changed);
QMenu *menu = new QMenu;
m_subMenuAction->setMenu(menu);
@@ -202,18 +181,12 @@ LayoutAlignmentMenu::LayoutAlignmentMenu(QObject *parent) :
m_actions[Bottom] = createAction(QDesignerTaskMenu::tr("Bottom"), Qt::AlignBottom, menu, m_verticalGroup);
}
-void LayoutAlignmentMenu::connect(QObject *receiver, const char *aSlot)
-{
- QObject::connect(m_horizGroup, SIGNAL(triggered(QAction*)), receiver, aSlot);
- QObject::connect(m_verticalGroup, SIGNAL(triggered(QAction*)), receiver, aSlot);
-}
-
bool LayoutAlignmentMenu::setAlignment(const QDesignerFormEditorInterface *core, QWidget *w)
{
bool enabled;
const Qt::Alignment alignment = LayoutAlignmentCommand::alignmentOf(core, w, &enabled);
+ m_subMenuAction->setEnabled(enabled);
if (!enabled) {
- m_subMenuAction->setEnabled(false);
m_actions[HorizNone]->setChecked(true);
m_actions[VerticalNone]->setChecked(true);
return false;
@@ -370,18 +343,19 @@ QDesignerTaskMenu::QDesignerTaskMenu(QWidget *widget, QObject *parent) :
[this] () { this->addToolBar(Qt::TopToolBarArea); });
auto areaMenu = new QMenu;
d->m_addAreaSubMenu->setMenu(areaMenu);
- areaMenu->addAction(QDesignerTaskMenu::tr("Left"),
+ areaMenu->addAction(QDesignerTaskMenu::tr("Left"), this,
[this] () { this->addToolBar(Qt::LeftToolBarArea); });
- areaMenu->addAction(QDesignerTaskMenu::tr("Right"),
+ areaMenu->addAction(QDesignerTaskMenu::tr("Right"), this,
[this] () { this->addToolBar(Qt::RightToolBarArea); });
- areaMenu->addAction(QDesignerTaskMenu::tr("Bottom"),
+ areaMenu->addAction(QDesignerTaskMenu::tr("Bottom"), this,
[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);
connect(d->m_navigateToSlot, &QAction::triggered, this, &QDesignerTaskMenu::slotNavigateToSlot);
connect(d->m_sizeActionGroup, &QActionGroup::triggered, this, &QDesignerTaskMenu::applySize);
- d->m_layoutAlignmentMenu.connect(this, SLOT(slotLayoutAlignment()));
+ connect(&d->m_layoutAlignmentMenu, &LayoutAlignmentMenu::changed,
+ this, &QDesignerTaskMenu::slotLayoutAlignment);
}
QDesignerTaskMenu::~QDesignerTaskMenu()
@@ -531,10 +505,10 @@ void QDesignerTaskMenu::changeObjectName()
if (dialog.exec() == QDialog::Accepted) {
const QString newObjectName = dialog.newObjectName();
if (!newObjectName.isEmpty() && newObjectName != oldObjectName ) {
- const QString objectNameProperty = QStringLiteral("objectName");
PropertySheetStringValue objectNameValue;
objectNameValue.setValue(newObjectName);
- setProperty(fw, CurrentWidgetMode, objectNameProperty, QVariant::fromValue(objectNameValue));
+ setProperty(fw, CurrentWidgetMode, u"objectName"_s,
+ QVariant::fromValue(objectNameValue));
}
}
}
@@ -590,12 +564,12 @@ void QDesignerTaskMenu::changeTextProperty(const QString &propertyName, const QS
void QDesignerTaskMenu::changeToolTip()
{
- changeTextProperty(QStringLiteral("toolTip"), tr("Edit ToolTip"), MultiSelectionMode, Qt::AutoText);
+ changeTextProperty(u"toolTip"_s, tr("Edit ToolTip"), MultiSelectionMode, Qt::AutoText);
}
void QDesignerTaskMenu::changeWhatsThis()
{
- changeTextProperty(QStringLiteral("whatsThis"), tr("Edit WhatsThis"), MultiSelectionMode, Qt::AutoText);
+ changeTextProperty(u"whatsThis"_s, tr("Edit WhatsThis"), MultiSelectionMode, Qt::AutoText);
}
void QDesignerTaskMenu::changeStyleSheet()
@@ -655,7 +629,7 @@ static void createSizeCommand(QDesignerFormWindowInterface *fw, QWidget *w, int
if (flags & ApplyMinimumHeight)
minimumSize.setHeight(size.height());
SetPropertyCommand* cmd = new SetPropertyCommand(fw);
- cmd->init(w, QStringLiteral("minimumSize"), minimumSize);
+ cmd->init(w, u"minimumSize"_s, minimumSize);
fw->commandHistory()->push(cmd);
}
if (flags & (ApplyMaximumWidth|ApplyMaximumHeight)) {
@@ -665,7 +639,7 @@ static void createSizeCommand(QDesignerFormWindowInterface *fw, QWidget *w, int
if (flags & ApplyMaximumHeight)
maximumSize.setHeight(size.height());
SetPropertyCommand* cmd = new SetPropertyCommand(fw);
- cmd->init(w, QStringLiteral("maximumSize"), maximumSize);
+ cmd->init(w, u"maximumSize"_s, maximumSize);
fw->commandHistory()->push(cmd);
}
}
@@ -681,10 +655,10 @@ void QDesignerTaskMenu::applySize(QAction *a)
return;
const int mask = a->data().toInt();
- const int size = selection.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()->beginMacro(tr("Set size constraint on %n widget(s)", nullptr,
+ int(selection.size())));
+ for (auto *w : selection)
+ createSizeCommand(fw, w, mask);
fw->commandHistory()->endMacro();
}
@@ -703,10 +677,10 @@ template <class Container>
Selection s;
designerObjectInspector->getSelection(s);
const QWidgetList &source = fw->isManaged(current) ? s.managed : s.unmanaged;
- const QWidgetList::const_iterator cend = source.constEnd();
- for ( QWidgetList::const_iterator it = source.constBegin(); it != cend; ++it)
- if (*it != current) // was first
- c->push_back(*it);
+ for (auto *w : source) {
+ if (w != current) // was first
+ c->append(w);
+ }
}
QObjectList QDesignerTaskMenu::applicableObjects(const QDesignerFormWindowInterface *fw, PropertyMode pm) const
@@ -748,3 +722,5 @@ void QDesignerTaskMenu::slotLayoutAlignment()
} // namespace qdesigner_internal
QT_END_NAMESPACE
+
+#include "qdesigner_taskmenu.moc"
diff --git a/src/designer/src/lib/shared/qdesigner_taskmenu_p.h b/src/designer/src/lib/shared/qdesigner_taskmenu_p.h
index b4bc23da4..9c504f893 100644
--- a/src/designer/src/lib/shared/qdesigner_taskmenu_p.h
+++ b/src/designer/src/lib/shared/qdesigner_taskmenu_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/qdesigner_toolbar.cpp b/src/designer/src/lib/shared/qdesigner_toolbar.cpp
index 5e8eeccdd..a5d75d23f 100644
--- a/src/designer/src/lib/shared/qdesigner_toolbar.cpp
+++ b/src/designer/src/lib/shared/qdesigner_toolbar.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_toolbar_p.h"
#include "qdesigner_command_p.h"
@@ -52,10 +27,10 @@
#include <QtCore/qdebug.h>
-Q_DECLARE_METATYPE(QAction*)
-
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
using ActionList = QList<QAction *>;
namespace qdesigner_internal {
@@ -90,6 +65,7 @@ bool ToolBarEventFilter::eventFilter (QObject *watched, QEvent *event)
if (watched != m_toolBar)
return QObject::eventFilter (watched, event);
+ bool handled = false;
switch (event->type()) {
case QEvent::ChildAdded: {
// Children should not interact with the mouse
@@ -101,24 +77,32 @@ bool ToolBarEventFilter::eventFilter (QObject *watched, QEvent *event)
}
break;
case QEvent::ContextMenu:
- return handleContextMenuEvent(static_cast<QContextMenuEvent*>(event));
+ handled = handleContextMenuEvent(static_cast<QContextMenuEvent*>(event));
+ break;
case QEvent::DragEnter:
case QEvent::DragMove:
- return handleDragEnterMoveEvent(static_cast<QDragMoveEvent *>(event));
+ handled = handleDragEnterMoveEvent(static_cast<QDragMoveEvent *>(event));
+ break;
case QEvent::DragLeave:
- return handleDragLeaveEvent(static_cast<QDragLeaveEvent *>(event));
+ handled = handleDragLeaveEvent(static_cast<QDragLeaveEvent *>(event));
+ break;
case QEvent::Drop:
- return handleDropEvent(static_cast<QDropEvent *>(event));
+ handled = handleDropEvent(static_cast<QDropEvent *>(event));
+ break;
case QEvent::MouseButtonPress:
- return handleMousePressEvent(static_cast<QMouseEvent*>(event));
+ handled = handleMousePressEvent(static_cast<QMouseEvent*>(event));
+ break;
case QEvent::MouseButtonRelease:
- return handleMouseReleaseEvent(static_cast<QMouseEvent*>(event));
+ handled = handleMouseReleaseEvent(static_cast<QMouseEvent*>(event));
+ break;
case QEvent::MouseMove:
- return handleMouseMoveEvent(static_cast<QMouseEvent*>(event));
+ handled = handleMouseMoveEvent(static_cast<QMouseEvent*>(event));
+ break;
default:
break;
}
- return QObject::eventFilter (watched, event);
+
+ return handled || QObject::eventFilter(watched, event);
}
ActionList ToolBarEventFilter::contextMenuActions(const QPoint &globalPos)
@@ -173,9 +157,8 @@ bool ToolBarEventFilter::handleContextMenuEvent(QContextMenuEvent * event )
const ActionList al = contextMenuActions(event->globalPos());
QMenu menu(nullptr);
- const ActionList::const_iterator acend = al.constEnd();
- for (ActionList::const_iterator it = al.constBegin(); it != acend; ++it)
- menu.addAction(*it);
+ for (auto *a : al)
+ menu.addAction(a);
menu.exec(globalPos);
return true;
}
@@ -195,7 +178,7 @@ void ToolBarEventFilter::slotRemoveSelectedAction()
const ActionList actions = m_toolBar->actions();
const int pos = actions.indexOf(a);
QAction *action_before = nullptr;
- if (pos != -1 && actions.count() > pos + 1)
+ if (pos != -1 && actions.size() > pos + 1)
action_before = actions.at(pos + 1);
RemoveActionFromCommand *cmd = new RemoveActionFromCommand(fw);
@@ -218,7 +201,7 @@ void ToolBarEventFilter::slotInsertSeparator()
QAction *theSender = qobject_cast<QAction*>(sender());
QAction *previous = qvariant_cast<QAction *>(theSender->data());
fw->beginCommand(tr("Insert Separator"));
- QAction *action = createAction(fw, QStringLiteral("separator"), true);
+ QAction *action = createAction(fw, u"separator"_s, true);
InsertActionIntoCommand *cmd = new InsertActionIntoCommand(fw);
cmd->init(m_toolBar, action, previous);
fw->commandHistory()->push(cmd);
@@ -276,9 +259,13 @@ bool ToolBarEventFilter::handleMousePressEvent(QMouseEvent *event)
}
core->propertyEditor()->setObject(m_toolBar);
}
- m_startPosition = m_toolBar->mapFromGlobal(event->globalPosition().toPoint());
- event->accept();
- return true;
+ const auto pos = m_toolBar->mapFromGlobal(event->globalPosition().toPoint());
+ if (actionIndexAt(m_toolBar, pos, m_toolBar->orientation()) != -1) {
+ m_startPosition = pos;
+ event->accept();
+ return true;
+ }
+ return false;
}
bool ToolBarEventFilter::handleMouseReleaseEvent(QMouseEvent *event)
@@ -298,8 +285,8 @@ bool ToolBarEventFilter::handleMouseMoveEvent(QMouseEvent *event)
return false;
const QPoint pos = m_toolBar->mapFromGlobal(event->globalPosition().toPoint());
- if ((pos - m_startPosition).manhattanLength() > qApp->startDragDistance()) {
- startDrag(m_startPosition, event->modifiers());
+ if ((pos - m_startPosition).manhattanLength() > QApplication::startDragDistance()
+ && startDrag(m_startPosition, event->modifiers())) {
m_startPosition = QPoint();
event->accept();
return true;
@@ -381,11 +368,11 @@ bool ToolBarEventFilter::handleDropEvent(QDropEvent *event)
return true;
}
-void ToolBarEventFilter::startDrag(const QPoint &pos, Qt::KeyboardModifiers modifiers)
+bool ToolBarEventFilter::startDrag(const QPoint &pos, Qt::KeyboardModifiers modifiers)
{
const int index = actionIndexAt(m_toolBar, pos, m_toolBar->orientation());
if (index == - 1)
- return;
+ return false;
const ActionList actions = m_toolBar->actions();
QAction *action = actions.at(index);
@@ -416,6 +403,7 @@ void ToolBarEventFilter::startDrag(const QPoint &pos, Qt::KeyboardModifiers modi
fw->commandHistory()->push(cmd);
}
}
+ return true;
}
QAction *ToolBarEventFilter::actionAt(const QToolBar *tb, const QPoint &pos)
diff --git a/src/designer/src/lib/shared/qdesigner_toolbar_p.h b/src/designer/src/lib/shared/qdesigner_toolbar_p.h
index a3fa2c2ad..bd897ae0a 100644
--- a/src/designer/src/lib/shared/qdesigner_toolbar_p.h
+++ b/src/designer/src/lib/shared/qdesigner_toolbar_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -109,7 +84,7 @@ private:
QDesignerFormWindowInterface *formWindow() const;
void adjustDragIndicator(const QPoint &pos);
void hideDragIndicator();
- void startDrag(const QPoint &pos, Qt::KeyboardModifiers modifiers);
+ bool startDrag(const QPoint &pos, Qt::KeyboardModifiers modifiers);
bool withinHandleArea(const QPoint &pos) const;
QToolBar *m_toolBar;
diff --git a/src/designer/src/lib/shared/qdesigner_toolbox.cpp b/src/designer/src/lib/shared/qdesigner_toolbox.cpp
index 26b36c8f9..0295e4d07 100644
--- a/src/designer/src/lib/shared/qdesigner_toolbox.cpp
+++ b/src/designer/src/lib/shared/qdesigner_toolbox.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_toolbox_p.h"
#include "qdesigner_command_p.h"
@@ -46,6 +21,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
QToolBoxHelper::QToolBoxHelper(QToolBox *toolbox) :
QObject(toolbox),
m_toolbox(toolbox),
@@ -233,11 +210,11 @@ QMenu *QToolBoxHelper::addContextMenuActions(QMenu *popup) const
// -------- QToolBoxWidgetPropertySheet
-static const char *currentItemTextKey = "currentItemText";
-static const char *currentItemNameKey = "currentItemName";
-static const char *currentItemIconKey = "currentItemIcon";
-static const char *currentItemToolTipKey = "currentItemToolTip";
-static const char *tabSpacingKey = "tabSpacing";
+static constexpr auto currentItemTextKey = "currentItemText"_L1;
+static constexpr auto currentItemNameKey = "currentItemName"_L1;
+static constexpr auto currentItemIconKey = "currentItemIcon"_L1;
+static constexpr auto currentItemToolTipKey = "currentItemToolTip"_L1;
+static constexpr auto tabSpacingKey = "tabSpacing"_L1;
enum { tabSpacingDefault = -1 };
@@ -245,26 +222,24 @@ QToolBoxWidgetPropertySheet::QToolBoxWidgetPropertySheet(QToolBox *object, QObje
QDesignerPropertySheet(object, parent),
m_toolBox(object)
{
- createFakeProperty(QLatin1String(currentItemTextKey), QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
- createFakeProperty(QLatin1String(currentItemNameKey), QString());
- createFakeProperty(QLatin1String(currentItemIconKey), QVariant::fromValue(qdesigner_internal::PropertySheetIconValue()));
+ createFakeProperty(currentItemTextKey, QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
+ createFakeProperty(currentItemNameKey, QString());
+ createFakeProperty(currentItemIconKey, QVariant::fromValue(qdesigner_internal::PropertySheetIconValue()));
if (formWindowBase())
- formWindowBase()->addReloadableProperty(this, indexOf(QLatin1String(currentItemIconKey)));
- createFakeProperty(QLatin1String(currentItemToolTipKey), QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
- createFakeProperty(QLatin1String(tabSpacingKey), QVariant(tabSpacingDefault));
+ formWindowBase()->addReloadableProperty(this, indexOf(currentItemIconKey));
+ createFakeProperty(currentItemToolTipKey, QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
+ createFakeProperty(tabSpacingKey, QVariant(tabSpacingDefault));
}
QToolBoxWidgetPropertySheet::ToolBoxProperty QToolBoxWidgetPropertySheet::toolBoxPropertyFromName(const QString &name)
{
- using ToolBoxPropertyHash = QHash<QString, ToolBoxProperty>;
- static ToolBoxPropertyHash toolBoxPropertyHash;
- if (toolBoxPropertyHash.isEmpty()) {
- toolBoxPropertyHash.insert(QLatin1String(currentItemTextKey), PropertyCurrentItemText);
- toolBoxPropertyHash.insert(QLatin1String(currentItemNameKey), PropertyCurrentItemName);
- toolBoxPropertyHash.insert(QLatin1String(currentItemIconKey), PropertyCurrentItemIcon);
- toolBoxPropertyHash.insert(QLatin1String(currentItemToolTipKey), PropertyCurrentItemToolTip);
- toolBoxPropertyHash.insert(QLatin1String(tabSpacingKey), PropertyTabSpacing);
- }
+ static const QHash<QString, ToolBoxProperty> toolBoxPropertyHash = {
+ {currentItemTextKey, PropertyCurrentItemText},
+ {currentItemNameKey, PropertyCurrentItemName},
+ {currentItemIconKey, PropertyCurrentItemIcon},
+ {currentItemToolTipKey, PropertyCurrentItemToolTip},
+ {tabSpacingKey, PropertyTabSpacing}
+ };
return toolBoxPropertyHash.value(name, PropertyToolBoxNone);
}
diff --git a/src/designer/src/lib/shared/qdesigner_toolbox_p.h b/src/designer/src/lib/shared/qdesigner_toolbox_p.h
index 9828ff2c3..8a86e23e6 100644
--- a/src/designer/src/lib/shared/qdesigner_toolbox_p.h
+++ b/src/designer/src/lib/shared/qdesigner_toolbox_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -117,7 +92,7 @@ private:
qdesigner_internal::PropertySheetStringValue tooltip;
qdesigner_internal::PropertySheetIconValue icon;
};
- QMap<QWidget *, PageData> m_pageToData;
+ QHash<QWidget *, PageData> m_pageToData;
};
using QToolBoxWidgetPropertySheetFactory = QDesignerPropertySheetFactory<QToolBox, QToolBoxWidgetPropertySheet>;
diff --git a/src/designer/src/lib/shared/qdesigner_utils.cpp b/src/designer/src/lib/shared/qdesigner_utils.cpp
index a8c253117..67ff4df2d 100644
--- a/src/designer/src/lib/shared/qdesigner_utils.cpp
+++ b/src/designer/src/lib/shared/qdesigner_utils.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_utils_p.h"
#include "qdesigner_propertycommand_p.h"
@@ -38,7 +13,10 @@
#include <QtDesigner/taskmenu.h>
#include <QtDesigner/qextensionmanager.h>
+#include <QtCore/qcoreapplication.h>
#include <QtCore/qdir.h>
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qoperatingsystemversion.h>
#include <QtCore/qprocess.h>
#include <QtCore/qlibraryinfo.h>
#include <QtCore/qdebug.h>
@@ -48,6 +26,7 @@
#include <QtWidgets/qapplication.h>
#include <QtGui/qicon.h>
+#include <QtGui/qpalette.h>
#include <QtGui/qpixmap.h>
#include <QtWidgets/qlistwidget.h>
#include <QtWidgets/qtreewidget.h>
@@ -56,19 +35,21 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal
{
// ### FIXME Qt 8: Remove (QTBUG-96005)
QString legacyDataDirectory()
{
- return QDir::homePath() + u"/.designer"_qs;
+ return QDir::homePath() + u"/.designer"_s;
}
QString dataDirectory()
{
#if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0)
return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
- + u'/' + QCoreApplication::organizationName() + u"/Designer"_qs;
+ + u'/' + QCoreApplication::organizationName() + u"/Designer"_s;
#else
return legacyDataDirectory();
#endif
@@ -177,18 +158,19 @@ namespace qdesigner_internal
{
return QCoreApplication::translate("DesignerMetaEnum",
"%1 is not a valid enumeration value of '%2'.")
- .arg(value).arg(name());
+ .arg(value).arg(enumName());
}
QString DesignerMetaEnum::messageParseFailed(const QString &s) const
{
return QCoreApplication::translate("DesignerMetaEnum",
"'%1' could not be converted to an enumeration value of type '%2'.")
- .arg(s, name());
+ .arg(s, enumName());
}
// -------------- DesignerMetaFlags
- DesignerMetaFlags::DesignerMetaFlags(const QString &name, const QString &scope, const QString &separator) :
- MetaEnum<uint>(name, scope, separator)
+ DesignerMetaFlags::DesignerMetaFlags(const QString &enumName, const QString &scope,
+ const QString &separator) :
+ MetaEnum<uint>(enumName, scope, separator)
{
}
@@ -196,18 +178,18 @@ namespace qdesigner_internal
{
QStringList rc;
const uint v = static_cast<uint>(ivalue);
- for (auto it = keyToValueMap().constBegin(), cend = keyToValueMap().constEnd(); it != cend; ++it ) {
- const uint itemValue = it.value();
+ for (auto it = keyToValueMap().begin(), end = keyToValueMap().end(); it != end; ++it) {
+ const uint itemValue = it->second;
// Check for equality first as flag values can be 0 or -1, too. Takes preference over a bitwise flag
if (v == itemValue) {
rc.clear();
- rc.push_back(it.key());
+ rc.push_back(it->first);
return rc;
}
// Do not add 0-flags (None-flags)
if (itemValue)
if ((v & itemValue) == itemValue)
- rc.push_back(it.key());
+ rc.push_back(it->first);
}
return rc;
}
@@ -219,16 +201,14 @@ namespace qdesigner_internal
if (flagIds.isEmpty())
return QString();
- const QChar delimiter = QLatin1Char('|');
QString rc;
- const QStringList::const_iterator cend = flagIds.constEnd();
- for (QStringList::const_iterator it = flagIds.constBegin(); it != cend; ++it) {
+ for (const auto &id : flagIds) {
if (!rc.isEmpty())
- rc += delimiter ;
+ rc += u'|';
if (sm == FullyQualified)
- appendQualifiedName(*it, rc);
+ appendQualifiedName(id, rc);
else
- rc += *it;
+ rc += id;
}
return rc;
}
@@ -243,9 +223,9 @@ namespace qdesigner_internal
}
uint flags = 0;
bool valueOk = true;
- QStringList keys = s.split(QString(QLatin1Char('|')));
- for (auto it = keys.constBegin(), cend = keys.constEnd(); it != cend; ++it) {
- const uint flagValue = keyToValue(*it, &valueOk);
+ const auto keys = QStringView{s}.split(u'|');
+ for (const auto &key : keys) {
+ const uint flagValue = keyToValue(key, &valueOk);
if (!valueOk) {
flags = 0;
break;
@@ -261,7 +241,7 @@ namespace qdesigner_internal
{
return QCoreApplication::translate("DesignerMetaFlags",
"'%1' could not be converted to a flag value of type '%2'.")
- .arg(s, name());
+ .arg(s, enumName());
}
// ---------- PropertySheetEnumValue
@@ -294,12 +274,7 @@ namespace qdesigner_internal
{
if (const QDesignerLanguageExtension *lang = qt_extension<QDesignerLanguageExtension *>(core->extensionManager(), core))
return lang->isLanguageResource(path) ? LanguageResourcePixmap : FilePixmap;
- return path.startsWith(QLatin1Char(':')) ? ResourcePixmap : FilePixmap;
- }
-
- int PropertySheetPixmapValue::compare(const PropertySheetPixmapValue &other) const
- {
- return m_path.compare(other.m_path);
+ return path.startsWith(u':') ? ResourcePixmap : FilePixmap;
}
QString PropertySheetPixmapValue::path() const
@@ -320,6 +295,7 @@ namespace qdesigner_internal
public:
PropertySheetIconValue::ModeStateToPixmapMap m_paths;
QString m_theme;
+ int m_themeEnum = -1;
};
PropertySheetIconValue::PropertySheetIconValue(const PropertySheetPixmapValue &pixmap) :
@@ -335,52 +311,37 @@ namespace qdesigner_internal
PropertySheetIconValue::~PropertySheetIconValue() = default;
- PropertySheetIconValue::PropertySheetIconValue(const PropertySheetIconValue &rhs) :
- m_data(rhs.m_data)
- {
- }
+ PropertySheetIconValue::PropertySheetIconValue(const PropertySheetIconValue &rhs) noexcept = default;
+ PropertySheetIconValue &PropertySheetIconValue::operator=(const PropertySheetIconValue &rhs) = default;
- PropertySheetIconValue &PropertySheetIconValue::operator=(const PropertySheetIconValue &rhs)
- {
- if (this != &rhs)
- m_data.operator=(rhs.m_data);
- return *this;
- }
+ PropertySheetIconValue::PropertySheetIconValue(PropertySheetIconValue &&) noexcept = default;
+ PropertySheetIconValue &PropertySheetIconValue::operator=(PropertySheetIconValue &&) noexcept = default;
+
+} // namespace qdesigner_internal
+
+namespace qdesigner_internal {
- bool PropertySheetIconValue::equals(const PropertySheetIconValue &rhs) const
+ size_t qHash(const PropertySheetIconValue &p, size_t seed) noexcept
{
- return m_data->m_theme == rhs.m_data->m_theme && m_data->m_paths == rhs.m_data->m_paths;
+ // qHash for paths making use of the existing QPair hash functions.
+ const auto *d = p.m_data.constData();
+ return qHashMulti(seed, d->m_paths, d->m_themeEnum, d->m_theme);
}
- bool PropertySheetIconValue::operator<(const PropertySheetIconValue &other) const
+ bool comparesEqual(const PropertySheetIconValue &lhs,
+ const PropertySheetIconValue &rhs) noexcept
{
- if (const int themeCmp = m_data->m_theme.compare(other.m_data->m_theme))
- return themeCmp < 0;
- auto itThis = m_data->m_paths.cbegin();
- auto itThisEnd = m_data->m_paths.cend();
- auto itOther = other.m_data->m_paths.cbegin();
- auto itOtherEnd = other.m_data->m_paths.cend();
- while (itThis != itThisEnd && itOther != itOtherEnd) {
- const ModeStateKey thisPair = itThis.key();
- const ModeStateKey otherPair = itOther.key();
- if (thisPair < otherPair)
- return true;
- if (otherPair < thisPair)
- return false;
- const int crc = itThis.value().compare(itOther.value());
- if (crc < 0)
- return true;
- if (crc > 0)
- return false;
- ++itThis;
- ++itOther;
- }
- return itOther != itOtherEnd;
+ const auto *lhsd = lhs.m_data.constData();
+ const auto *rhsd = rhs.m_data.constData();
+ return lhsd == rhsd
+ || (lhsd->m_themeEnum == rhsd->m_themeEnum
+ && lhsd->m_theme == rhsd->m_theme && lhsd->m_paths == rhsd->m_paths);
}
bool PropertySheetIconValue::isEmpty() const
{
- return m_data->m_theme.isEmpty() && m_data->m_paths.isEmpty();
+ return m_data->m_themeEnum == -1 && m_data->m_theme.isEmpty()
+ && m_data->m_paths.isEmpty();
}
QString PropertySheetIconValue::theme() const
@@ -393,15 +354,25 @@ namespace qdesigner_internal
m_data->m_theme = t;
}
+ int PropertySheetIconValue::themeEnum() const
+ {
+ return m_data->m_themeEnum;
+ }
+
+ void PropertySheetIconValue::setThemeEnum(int e)
+ {
+ m_data->m_themeEnum = e;
+ }
+
PropertySheetPixmapValue PropertySheetIconValue::pixmap(QIcon::Mode mode, QIcon::State state) const
{
- const ModeStateKey pair = qMakePair(mode, state);
+ const ModeStateKey pair{mode, state};
return m_data->m_paths.value(pair);
}
void PropertySheetIconValue::setPixmap(QIcon::Mode mode, QIcon::State state, const PropertySheetPixmapValue &pixmap)
{
- const ModeStateKey pair = qMakePair(mode, state);
+ const ModeStateKey pair{mode, state};
if (pixmap.path().isEmpty())
m_data->m_paths.remove(pair);
else
@@ -410,7 +381,7 @@ namespace qdesigner_internal
QPixmap DesignerPixmapCache::pixmap(const PropertySheetPixmapValue &value) const
{
- QMap<PropertySheetPixmapValue, QPixmap>::const_iterator it = m_cache.constFind(value);
+ const auto it = m_cache.constFind(value);
if (it != m_cache.constEnd())
return it.value();
@@ -436,6 +407,11 @@ namespace qdesigner_internal
return it.value();
// Match on the theme first if it is available.
+ if (value.themeEnum() != -1) {
+ const QIcon themeIcon = QIcon::fromTheme(static_cast<QIcon::ThemeIcon>(value.themeEnum()));
+ m_cache.insert(value, themeIcon);
+ return themeIcon;
+ }
if (!value.theme().isEmpty()) {
const QString theme = value.theme();
if (QIcon::hasThemeIcon(theme)) {
@@ -470,14 +446,6 @@ namespace qdesigner_internal
PropertySheetTranslatableData::PropertySheetTranslatableData(bool translatable, const QString &disambiguation, const QString &comment) :
m_translatable(translatable), m_disambiguation(disambiguation), m_comment(comment) { }
- bool PropertySheetTranslatableData::equals(const PropertySheetTranslatableData &rhs) const
- {
- return m_translatable == rhs.m_translatable
- && m_disambiguation == rhs.m_disambiguation
- && m_comment == rhs.m_comment
- && m_id == rhs.m_id;
- }
-
PropertySheetStringValue::PropertySheetStringValue(const QString &value,
bool translatable, const QString &disambiguation, const QString &comment) :
PropertySheetTranslatableData(translatable, disambiguation, comment), m_value(value) {}
@@ -492,11 +460,6 @@ namespace qdesigner_internal
m_value = value;
}
- bool PropertySheetStringValue::equals(const PropertySheetStringValue &rhs) const
- {
- return m_value == rhs.m_value && PropertySheetTranslatableData::equals(rhs);
- }
-
PropertySheetStringListValue::PropertySheetStringListValue(const QStringList &value,
bool translatable,
const QString &disambiguation,
@@ -515,11 +478,6 @@ namespace qdesigner_internal
m_value = value;
}
- bool PropertySheetStringListValue::equals(const PropertySheetStringListValue &rhs) const
- {
- return m_value == rhs.m_value && PropertySheetTranslatableData::equals(rhs);
- }
-
QStringList m_value;
@@ -560,12 +518,6 @@ namespace qdesigner_internal
return m_standardKey != QKeySequence::UnknownKey;
}
- bool PropertySheetKeySequenceValue::equals(const PropertySheetKeySequenceValue &rhs) const
- {
- return m_value == rhs.m_value && m_standardKey == rhs.m_standardKey
- && PropertySheetTranslatableData::equals(rhs);
- }
-
/* IconSubPropertyMask: Assign each icon sub-property (pixmaps for the
* various states/modes and the theme) a flag bit (see QFont) so that they
* can be handled individually when assigning property values to
@@ -582,7 +534,8 @@ namespace qdesigner_internal
ActiveOnIconMask = 0x20,
SelectedOffIconMask = 0x40,
SelectedOnIconMask = 0x80,
- ThemeIconMask = 0x10000
+ ThemeIconMask = 0x10000,
+ ThemeEnumIconMask = 0x20000
};
static inline uint iconStateToSubPropertyFlag(QIcon::Mode mode, QIcon::State state)
@@ -600,28 +553,28 @@ namespace qdesigner_internal
return state == QIcon::On ? NormalOnIconMask : NormalOffIconMask;
}
- static inline QPair<QIcon::Mode, QIcon::State> subPropertyFlagToIconModeState(unsigned flag)
+ static inline std::pair<QIcon::Mode, QIcon::State> subPropertyFlagToIconModeState(unsigned flag)
{
switch (flag) {
case NormalOnIconMask:
- return qMakePair(QIcon::Normal, QIcon::On);
+ return {QIcon::Normal, QIcon::On};
case DisabledOffIconMask:
- return qMakePair(QIcon::Disabled, QIcon::Off);
+ return {QIcon::Disabled, QIcon::Off};
case DisabledOnIconMask:
- return qMakePair(QIcon::Disabled, QIcon::On);
+ return {QIcon::Disabled, QIcon::On};
case ActiveOffIconMask:
- return qMakePair(QIcon::Active, QIcon::Off);
+ return {QIcon::Active, QIcon::Off};
case ActiveOnIconMask:
- return qMakePair(QIcon::Active, QIcon::On);
+ return {QIcon::Active, QIcon::On};
case SelectedOffIconMask:
- return qMakePair(QIcon::Selected, QIcon::Off);
+ return {QIcon::Selected, QIcon::Off};
case SelectedOnIconMask:
- return qMakePair(QIcon::Selected, QIcon::On);
+ return {QIcon::Selected, QIcon::On};
case NormalOffIconMask:
default:
break;
}
- return qMakePair(QIcon::Normal, QIcon::Off);
+ return {QIcon::Normal, QIcon::Off};
}
uint PropertySheetIconValue::mask() const
@@ -631,6 +584,8 @@ namespace qdesigner_internal
flags |= iconStateToSubPropertyFlag(it.key().first, it.key().second);
if (!m_data->m_theme.isEmpty())
flags |= ThemeIconMask;
+ if (m_data->m_themeEnum != -1)
+ flags |= ThemeEnumIconMask;
return flags;
}
@@ -640,13 +595,16 @@ namespace qdesigner_internal
for (int i = 0; i < 8; i++) {
const uint flag = 1 << i;
if (diffMask & flag) { // if state is set in both icons, compare the values
- const QPair<QIcon::Mode, QIcon::State> state = subPropertyFlagToIconModeState(flag);
+ const auto state = subPropertyFlagToIconModeState(flag);
if (pixmap(state.first, state.second) == other.pixmap(state.first, state.second))
diffMask &= ~flag;
}
}
if ((diffMask & ThemeIconMask) && theme() == other.theme())
diffMask &= ~ThemeIconMask;
+ if ((diffMask & ThemeEnumIconMask) && themeEnum() == other.themeEnum())
+ diffMask &= ~ThemeEnumIconMask;
+
return diffMask;
}
@@ -661,6 +619,7 @@ namespace qdesigner_internal
{
PropertySheetIconValue rc(*this);
rc.m_data->m_theme.clear();
+ rc.m_data->m_themeEnum = -1;
return rc;
}
@@ -675,6 +634,8 @@ namespace qdesigner_internal
}
if (mask & ThemeIconMask)
setTheme(other.theme());
+ if (mask & ThemeEnumIconMask)
+ setThemeEnum(other.themeEnum());
}
const PropertySheetIconValue::ModeStateToPixmapMap &PropertySheetIconValue::paths() const
@@ -682,17 +643,24 @@ namespace qdesigner_internal
return m_data->m_paths;
}
- QDESIGNER_SHARED_EXPORT QDebug operator<<(QDebug d, const PropertySheetIconValue &p)
+ QDESIGNER_SHARED_EXPORT QDebug operator<<(QDebug debug, const PropertySheetIconValue &p)
{
- QDebug nospace = d.nospace();
- nospace << "PropertySheetIconValue theme='" << p.theme() << "' ";
+ QDebugStateSaver saver(debug);
+ debug.nospace();
+ debug.noquote();
+ debug << "PropertySheetIconValue(mask=0x" << Qt::hex << p.mask() << Qt::dec << ", ";
+ if (p.themeEnum() != -1)
+ debug << "theme=" << p.themeEnum() << ", ";
+ if (!p.theme().isEmpty())
+ debug << "XDG theme=\"" << p.theme() << "\", ";
const PropertySheetIconValue::ModeStateToPixmapMap &paths = p.paths();
- for (auto it = paths.constBegin(), cend = paths.constEnd(); it != cend; ++it)
- nospace << " mode=" << it.key().first << ",state=" << it.key().second
- << ",'" << it.value().path() << '\'';
- nospace << " mask=0x" << QString::number(p.mask(), 16);
- return d;
+ for (auto it = paths.constBegin(), cend = paths.constEnd(); it != cend; ++it) {
+ debug << " mode=" << it.key().first << ",state=" << it.key().second
+ << ", \"" << it.value().path() << '"';
+ }
+ debug << ')';
+ return debug;
}
QDESIGNER_SHARED_EXPORT QDesignerFormWindowCommand *createTextPropertyCommand(const QString &propertyName, const QString &text, QObject *object, QDesignerFormWindowInterface *fw)
@@ -719,8 +687,8 @@ namespace qdesigner_internal
}
}
if (!action) {
- if (const QDesignerTaskMenuExtension *taskMenu = qobject_cast<QDesignerTaskMenuExtension *>(
- core->extensionManager()->extension(managedWidget, QStringLiteral("QDesignerInternalTaskMenuExtension")))) {
+ if (const auto *taskMenu = qobject_cast<QDesignerTaskMenuExtension *>(
+ core->extensionManager()->extension(managedWidget, u"QDesignerInternalTaskMenuExtension"_s))) {
action = taskMenu->preferredEditAction();
if (!action) {
const auto actions = taskMenu->taskActions();
@@ -737,12 +705,25 @@ namespace qdesigner_internal
{
QProcess uic;
QStringList arguments;
- QString binary = QLibraryInfo::path(QLibraryInfo::LibraryExecutablesPath) + QStringLiteral("/uic");
+ static constexpr auto uicBinary =
+ QOperatingSystemVersion::currentType() != QOperatingSystemVersion::Windows
+ ? "/uic"_L1 : "/uic.exe"_L1;
+ QString binary = QLibraryInfo::path(QLibraryInfo::LibraryExecutablesPath) + uicBinary;
+ // In a PySide6 installation, there is no libexec directory; uic.exe is
+ // in the main wheel directory next to designer.exe.
+ if (!QFileInfo::exists(binary))
+ binary = QCoreApplication::applicationDirPath() + uicBinary;
+ if (!QFileInfo::exists(binary)) {
+ errorMessage = QApplication::translate("Designer", "%1 does not exist.").
+ arg(QDir::toNativeSeparators(binary));
+ return false;
+ }
+
switch (language) {
case UicLanguage::Cpp:
break;
case UicLanguage::Python:
- arguments << QLatin1String("-g") << QLatin1String("python");
+ arguments << u"-g"_s << u"python"_s;
break;
}
arguments << fileName;
@@ -772,14 +753,14 @@ namespace qdesigner_internal
Q_ASSERT(qname.isEmpty() == false);
- if (qname.count() > 1 && qname.at(1).isUpper()) {
+ if (qname.size() > 1 && qname.at(1).isUpper()) {
const QChar first = qname.at(0);
- if (first == QLatin1Char('Q') || first == QLatin1Char('K'))
+ if (first == u'Q' || first == u'K')
qname.remove(0, 1);
}
- const int len = qname.count();
- for (int i = 0; i < len && qname.at(i).isUpper(); i++)
+ const qsizetype len = qname.size();
+ for (qsizetype i = 0; i < len && qname.at(i).isUpper(); ++i)
qname[i] = qname.at(i).toLower();
return qname;
@@ -800,6 +781,24 @@ namespace qdesigner_internal
m_widget->setUpdatesEnabled(true);
}
+// from qpalette.cpp
+quint64 paletteResolveMask(QPalette::ColorGroup colorGroup,
+ QPalette::ColorRole colorRole)
+{
+ if (colorRole == QPalette::Accent)
+ colorRole = QPalette::NoRole; // See qtbase/17c589df94a2245ee92d45839c2cba73566d7310
+ const auto offset = quint64(QPalette::NColorRoles - 1) * quint64(colorGroup);
+ const auto bitPos = quint64(colorRole) + offset;
+ return 1ull << bitPos;
+}
+
+quint64 paletteResolveMask(QPalette::ColorRole colorRole)
+{
+ return paletteResolveMask(QPalette::Active, colorRole)
+ | paletteResolveMask(QPalette::Inactive, colorRole)
+ | paletteResolveMask(QPalette::Disabled, colorRole);
+}
+
} // namespace qdesigner_internal
QT_END_NAMESPACE
diff --git a/src/designer/src/lib/shared/qdesigner_utils_p.h b/src/designer/src/lib/shared/qdesigner_utils_p.h
index 73d907bed..223a12337 100644
--- a/src/designer/src/lib/shared/qdesigner_utils_p.h
+++ b/src/designer/src/lib/shared/qdesigner_utils_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -44,13 +19,16 @@
#include <QtDesigner/abstractformwindow.h>
+#include <QtCore/qcompare.h>
+#include <QtCore/qhash.h>
#include <QtCore/qvariant.h>
#include <QtCore/qshareddata.h>
-#include <QtCore/qmap.h>
#include <QtWidgets/qmainwindow.h>
#include <QtGui/qicon.h>
#include <QtGui/qpixmap.h>
+#include <map>
+
QT_BEGIN_NAMESPACE
class QDebug;
@@ -85,17 +63,17 @@ template <class IntType>
class MetaEnum
{
public:
- using KeyToValueMap = QMap<QString, IntType>;
+ using KeyToValueMap = std::map<QString, IntType, std::less<>>;
- MetaEnum(const QString &name, const QString &scope, const QString &separator);
+ MetaEnum(const QString &enumName, const QString &scope, const QString &separator);
MetaEnum() = default;
void addKey(IntType value, const QString &name);
QString valueToKey(IntType value, bool *ok = nullptr) const;
// Ignorant of scopes.
- IntType keyToValue(QString key, bool *ok = nullptr) const;
+ IntType keyToValue(QStringView key, bool *ok = nullptr) const;
- const QString &name() const { return m_name; }
+ const QString &enumName() const { return m_enumName; }
const QString &scope() const { return m_scope; }
const QString &separator() const { return m_separator; }
@@ -106,7 +84,7 @@ protected:
void appendQualifiedName(const QString &key, QString &target) const;
private:
- QString m_name;
+ QString m_enumName;
QString m_scope;
QString m_separator;
KeyToValueMap m_keyToValueMap;
@@ -114,8 +92,8 @@ private:
};
template <class IntType>
-MetaEnum<IntType>::MetaEnum(const QString &name, const QString &scope, const QString &separator) :
- m_name(name),
+MetaEnum<IntType>::MetaEnum(const QString &enumName, const QString &scope, const QString &separator) :
+ m_enumName(enumName),
m_scope(scope),
m_separator(separator)
{
@@ -124,29 +102,36 @@ MetaEnum<IntType>::MetaEnum(const QString &name, const QString &scope, const QSt
template <class IntType>
void MetaEnum<IntType>::addKey(IntType value, const QString &name)
{
- m_keyToValueMap.insert(name, value);
+ m_keyToValueMap.insert({name, value});
m_keys.append(name);
}
template <class IntType>
QString MetaEnum<IntType>::valueToKey(IntType value, bool *ok) const
{
- const QString rc = m_keyToValueMap.key(value);
+ QString rc;
+ for (auto it = m_keyToValueMap.begin(), end = m_keyToValueMap.end(); it != end; ++it) {
+ if (it->second == value) {
+ rc = it->first;
+ break;
+ }
+ }
if (ok)
*ok = !rc.isEmpty();
return rc;
}
template <class IntType>
-IntType MetaEnum<IntType>::keyToValue(QString key, bool *ok) const
+IntType MetaEnum<IntType>::keyToValue(QStringView key, bool *ok) const
{
- if (!m_scope.isEmpty() && key.startsWith(m_scope))
- key.remove(0, m_scope.size() + m_separator.size());
- const typename KeyToValueMap::const_iterator it = m_keyToValueMap.find(key);
- const bool found = it != m_keyToValueMap.constEnd();
+ const auto lastSep = key.lastIndexOf(m_separator);
+ if (lastSep != -1)
+ key = key.sliced(lastSep + m_separator.size());
+ const auto it = m_keyToValueMap.find(key);
+ const bool found = it != m_keyToValueMap.end();
if (ok)
*ok = found;
- return found ? it.value() : IntType(0);
+ return found ? it->second : IntType(0);
}
template <class IntType>
@@ -156,7 +141,7 @@ void MetaEnum<IntType>::appendQualifiedName(const QString &key, QString &target)
target += m_scope;
target += m_separator;
}
- target += key;
+ target += m_enumName + m_separator + key;
}
// -------------- DesignerMetaEnum: Meta type for enumerations
@@ -184,7 +169,8 @@ public:
class QDESIGNER_SHARED_EXPORT DesignerMetaFlags : public MetaEnum<uint>
{
public:
- DesignerMetaFlags(const QString &name, const QString &scope, const QString &separator);
+ explicit DesignerMetaFlags(const QString &enumName, const QString &scope,
+ const QString &separator);
DesignerMetaFlags() = default;
enum SerializationMode { FullyQualified, NameOnly };
@@ -225,10 +211,6 @@ public:
PropertySheetPixmapValue(const QString &path);
PropertySheetPixmapValue();
- bool operator==(const PropertySheetPixmapValue &other) const { return compare(other) == 0; }
- bool operator!=(const PropertySheetPixmapValue &other) const { return compare(other) != 0; }
- bool operator<(const PropertySheetPixmapValue &other) const { return compare(other) < 0; }
-
// Check where a pixmap comes from
enum PixmapSource { LanguageResourcePixmap , ResourcePixmap, FilePixmap };
static PixmapSource getPixmapSource(QDesignerFormEditorInterface *core, const QString & path);
@@ -238,9 +220,18 @@ public:
QString path() const;
void setPath(const QString &path); // passing the empty path resets the pixmap
- int compare(const PropertySheetPixmapValue &other) const;
-
private:
+ friend size_t qHash(const PropertySheetPixmapValue &p, size_t seed = 0) noexcept
+ {
+ return qHash(p.m_path, seed);
+ }
+ friend bool comparesEqual(const PropertySheetPixmapValue &lhs,
+ const PropertySheetPixmapValue &rhs) noexcept
+ {
+ return lhs.m_path == rhs.m_path;
+ }
+ Q_DECLARE_EQUALITY_COMPARABLE(PropertySheetPixmapValue)
+
QString m_path;
};
@@ -251,21 +242,22 @@ class PropertySheetIconValueData;
class QDESIGNER_SHARED_EXPORT PropertySheetIconValue
{
public:
- PropertySheetIconValue(const PropertySheetPixmapValue &pixmap);
+ explicit PropertySheetIconValue(const PropertySheetPixmapValue &pixmap);
PropertySheetIconValue();
~PropertySheetIconValue();
- PropertySheetIconValue(const PropertySheetIconValue &);
+ PropertySheetIconValue(const PropertySheetIconValue &) noexcept;
PropertySheetIconValue &operator=(const PropertySheetIconValue &);
-
- bool operator==(const PropertySheetIconValue &other) const { return equals(other); }
- bool operator!=(const PropertySheetIconValue &other) const { return !equals(other); }
- bool operator<(const PropertySheetIconValue &other) const;
+ PropertySheetIconValue(PropertySheetIconValue &&) noexcept;
+ PropertySheetIconValue &operator=(PropertySheetIconValue &&) noexcept;
bool isEmpty() const;
QString theme() const;
void setTheme(const QString &);
+ int themeEnum() const;
+ void setThemeEnum(int e);
+
PropertySheetPixmapValue pixmap(QIcon::Mode mode, QIcon::State state) const;
void setPixmap(QIcon::Mode mode, QIcon::State state, const PropertySheetPixmapValue &path); // passing the empty path resets the pixmap
@@ -277,13 +269,21 @@ class QDESIGNER_SHARED_EXPORT PropertySheetIconValue
PropertySheetIconValue themed() const;
PropertySheetIconValue unthemed() const;
- using ModeStateKey = QPair<QIcon::Mode, QIcon::State>;
+ using ModeStateKey = std::pair<QIcon::Mode, QIcon::State>;
using ModeStateToPixmapMap = QMap<ModeStateKey, PropertySheetPixmapValue>;
const ModeStateToPixmapMap &paths() const;
private:
- bool equals(const PropertySheetIconValue &rhs) const;
+ friend QDESIGNER_SHARED_EXPORT
+ size_t qHash(const PropertySheetIconValue &p, size_t seed) noexcept;
+ friend size_t qHash(const PropertySheetIconValue &p) noexcept
+ { return qHash(p, 0); }
+ friend QDESIGNER_SHARED_EXPORT
+ bool comparesEqual(const PropertySheetIconValue &lhs,
+ const PropertySheetIconValue &rhs) noexcept;
+ Q_DECLARE_EQUALITY_COMPARABLE(PropertySheetIconValue)
+
QSharedDataPointer<PropertySheetIconValueData> m_data;
};
@@ -299,7 +299,7 @@ public:
signals:
void reloaded();
private:
- mutable QMap<PropertySheetPixmapValue, QPixmap> m_cache;
+ mutable QHash<PropertySheetPixmapValue, QPixmap> m_cache;
friend class FormWindowBase;
};
@@ -313,7 +313,7 @@ public:
signals:
void reloaded();
private:
- mutable QMap<PropertySheetIconValue, QIcon> m_cache;
+ mutable QHash<PropertySheetIconValue, QIcon> m_cache;
DesignerPixmapCache *m_pixmapCache;
friend class FormWindowBase;
};
@@ -325,7 +325,6 @@ protected:
PropertySheetTranslatableData(bool translatable = true,
const QString &disambiguation = QString(),
const QString &comment = QString());
- bool equals(const PropertySheetTranslatableData &rhs) const;
public:
bool translatable() const { return m_translatable; }
@@ -338,6 +337,16 @@ public:
void setId(const QString &id) { m_id = id; }
private:
+ friend bool comparesEqual(const PropertySheetTranslatableData &lhs,
+ const PropertySheetTranslatableData &rhs) noexcept
+ {
+ return lhs.m_translatable == rhs.m_translatable
+ && lhs.m_disambiguation == rhs.m_disambiguation
+ && lhs.m_comment == rhs.m_comment
+ && lhs.m_id == rhs.m_id;
+ }
+ Q_DECLARE_EQUALITY_COMPARABLE(PropertySheetTranslatableData)
+
bool m_translatable;
QString m_disambiguation;
QString m_comment;
@@ -351,14 +360,18 @@ public:
PropertySheetStringValue(const QString &value = QString(), bool translatable = true,
const QString &disambiguation = QString(), const QString &comment = QString());
- bool operator==(const PropertySheetStringValue &other) const { return equals(other); }
- bool operator!=(const PropertySheetStringValue &other) const { return !equals(other); }
-
QString value() const;
void setValue(const QString &value);
private:
- bool equals(const PropertySheetStringValue &rhs) const;
+ friend bool comparesEqual(const PropertySheetStringValue &lhs,
+ const PropertySheetStringValue &rhs) noexcept
+ {
+ const PropertySheetTranslatableData &upLhs = lhs;
+ const PropertySheetTranslatableData &upRhs = rhs;
+ return lhs.m_value == rhs.m_value && upLhs == upRhs;
+ }
+ Q_DECLARE_EQUALITY_COMPARABLE(PropertySheetStringValue)
QString m_value;
};
@@ -372,14 +385,18 @@ public:
const QString &disambiguation = QString(),
const QString &comment = QString());
- bool operator==(const PropertySheetStringListValue &other) const { return equals(other); }
- bool operator!=(const PropertySheetStringListValue &other) const { return !equals(other); }
-
QStringList value() const;
void setValue(const QStringList &value);
private:
- bool equals(const PropertySheetStringListValue &rhs) const;
+ friend bool comparesEqual(const PropertySheetStringListValue &lhs,
+ const PropertySheetStringListValue &rhs) noexcept
+ {
+ const PropertySheetTranslatableData &upLhs = lhs;
+ const PropertySheetTranslatableData &upRhs = rhs;
+ return lhs.m_value == rhs.m_value && upLhs == upRhs;
+ }
+ Q_DECLARE_EQUALITY_COMPARABLE(PropertySheetStringListValue)
QStringList m_value;
};
@@ -397,9 +414,6 @@ public:
const QString &disambiguation = QString(),
const QString &comment = QString());
- bool operator==(const PropertySheetKeySequenceValue &other) const { return equals(other); }
- bool operator!=(const PropertySheetKeySequenceValue &other) const { return !equals(other); }
-
QKeySequence value() const;
void setValue(const QKeySequence &value);
QKeySequence::StandardKey standardKey() const;
@@ -407,7 +421,15 @@ public:
bool isStandardKey() const;
private:
- bool equals(const PropertySheetKeySequenceValue &rhs) const;
+ friend bool comparesEqual(const PropertySheetKeySequenceValue &lhs,
+ const PropertySheetKeySequenceValue &rhs) noexcept
+ {
+ const PropertySheetTranslatableData &upLhs = lhs;
+ const PropertySheetTranslatableData &upRhs = rhs;
+ return lhs.m_value == rhs.m_value && lhs.m_standardKey == rhs.m_standardKey
+ && upLhs == upRhs;
+ }
+ Q_DECLARE_EQUALITY_COMPARABLE(PropertySheetKeySequenceValue)
QKeySequence m_value;
QKeySequence::StandardKey m_standardKey;
@@ -468,6 +490,12 @@ private:
const bool m_enabled;
};
+// QPalette helpers: Mask for a single color role/group
+QDESIGNER_SHARED_EXPORT quint64 paletteResolveMask(QPalette::ColorGroup colorGroup,
+ QPalette::ColorRole colorRole);
+// Mask for the colors of a role in all groups (Active/Inactive/Disabled)
+QDESIGNER_SHARED_EXPORT quint64 paletteResolveMask(QPalette::ColorRole colorRole);
+
namespace Utils {
inline int valueOf(const QVariant &value, bool *ok = nullptr)
diff --git a/src/designer/src/lib/shared/qdesigner_widget.cpp b/src/designer/src/lib/shared/qdesigner_widget.cpp
index b4f885006..88f43d5ab 100644
--- a/src/designer/src/lib/shared/qdesigner_widget.cpp
+++ b/src/designer/src/lib/shared/qdesigner_widget.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_widget_p.h"
#include "formwindowbase_p.h"
diff --git a/src/designer/src/lib/shared/qdesigner_widget_p.h b/src/designer/src/lib/shared/qdesigner_widget_p.h
index c12970692..4deeaaf83 100644
--- a/src/designer/src/lib/shared/qdesigner_widget_p.h
+++ b/src/designer/src/lib/shared/qdesigner_widget_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -80,7 +55,7 @@ public:
explicit QDesignerDialog(QDesignerFormWindowInterface *fw, QWidget *parent);
QSize minimumSizeHint() const override
- { return QWidget::minimumSizeHint().expandedTo(QSize(16, 16)); }
+ { return QDialog::minimumSizeHint().expandedTo(QSize(16, 16)); }
protected:
void paintEvent(QPaintEvent *e) override;
diff --git a/src/designer/src/lib/shared/qdesigner_widgetbox.cpp b/src/designer/src/lib/shared/qdesigner_widgetbox.cpp
index 03cd9a3ad..260f68a9c 100644
--- a/src/designer/src/lib/shared/qdesigner_widgetbox.cpp
+++ b/src/designer/src/lib/shared/qdesigner_widgetbox.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_widgetbox_p.h"
#include "qdesigner_utils_p.h"
@@ -38,6 +13,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
class QDesignerWidgetBoxWidgetData : public QSharedData
{
public:
@@ -86,7 +63,8 @@ QString QDesignerWidgetBoxInterface::Widget::name() const
void QDesignerWidgetBoxInterface::Widget::setName(const QString &aname)
{
- m_data->m_name = aname;
+ if (m_data->m_name != aname)
+ m_data->m_name = aname;
}
QString QDesignerWidgetBoxInterface::Widget::domXml() const
@@ -96,7 +74,8 @@ QString QDesignerWidgetBoxInterface::Widget::domXml() const
void QDesignerWidgetBoxInterface::Widget::setDomXml(const QString &xml)
{
- m_data->m_xml = xml;
+ if (m_data->m_xml != xml)
+ m_data->m_xml = xml;
}
QString QDesignerWidgetBoxInterface::Widget::iconName() const
@@ -106,7 +85,8 @@ QString QDesignerWidgetBoxInterface::Widget::iconName() const
void QDesignerWidgetBoxInterface::Widget::setIconName(const QString &icon_name)
{
- m_data->m_icon_name = icon_name;
+ if (m_data->m_icon_name != icon_name)
+ m_data->m_icon_name = icon_name;
}
QDesignerWidgetBoxInterface::Widget::Type QDesignerWidgetBoxInterface::Widget::type() const
@@ -116,7 +96,8 @@ QDesignerWidgetBoxInterface::Widget::Type QDesignerWidgetBoxInterface::Widget::t
void QDesignerWidgetBoxInterface::Widget::setType(Type atype)
{
- m_data->m_type = atype;
+ if (m_data->m_type != atype)
+ m_data->m_type = atype;
}
bool QDesignerWidgetBoxInterface::Widget::isNull() const
@@ -150,7 +131,6 @@ bool QDesignerWidgetBox::findWidget(const QDesignerWidgetBoxInterface *wbox,
// Note that entry names do not necessarily match the class name
// (at least, not for the standard widgets), so,
// look in the XML for the class name of the first widget to appear
- const QString widgetTag = QStringLiteral("<widget");
QString pattern = QStringLiteral("^<widget\\s+class\\s*=\\s*\"");
pattern += className;
pattern += QStringLiteral("\".*$");
@@ -164,7 +144,7 @@ bool QDesignerWidgetBox::findWidget(const QDesignerWidgetBoxInterface *wbox,
for (int w = 0; w < widgetCount; w++) {
const Widget widget = cat.widget(w);
QString xml = widget.domXml(); // Erase the <ui> tag that can be present starting from 4.4
- const int widgetTagIndex = xml.indexOf(widgetTag);
+ const auto widgetTagIndex = xml.indexOf("<widget"_L1);
if (widgetTagIndex != -1) {
xml.remove(0, widgetTagIndex);
if (regexp.match(xml).hasMatch()) {
@@ -196,12 +176,12 @@ DomUI *QDesignerWidgetBox::xmlToUi(const QString &name, const QString &xml, bool
continue;
}
- if (name.compare(QStringLiteral("widget"), Qt::CaseInsensitive) == 0) { // 4.3 legacy, wrap into DomUI
+ if (name.compare("widget"_L1, Qt::CaseInsensitive) == 0) { // 4.3 legacy, wrap into DomUI
ui = new DomUI;
DomWidget *widget = new DomWidget;
widget->read(reader);
ui->setElementWidget(widget);
- } else if (name.compare(QStringLiteral("ui"), Qt::CaseInsensitive) == 0) { // 4.4
+ } else if (name.compare("ui"_L1, Qt::CaseInsensitive) == 0) { // 4.4
ui = new DomUI;
ui->read(reader);
} else {
@@ -228,7 +208,7 @@ DomUI *QDesignerWidgetBox::xmlToUi(const QString &name, const QString &xml, bool
if (insertFakeTopLevel) {
DomWidget *fakeTopLevel = new DomWidget;
- fakeTopLevel->setAttributeClass(QStringLiteral("QWidget"));
+ fakeTopLevel->setAttributeClass(u"QWidget"_s);
QList<DomWidget *> children;
children.push_back(ui->takeElementWidget());
fakeTopLevel->setElementWidget(children);
diff --git a/src/designer/src/lib/shared/qdesigner_widgetbox_p.h b/src/designer/src/lib/shared/qdesigner_widgetbox_p.h
index cad8e04da..813d65893 100644
--- a/src/designer/src/lib/shared/qdesigner_widgetbox_p.h
+++ b/src/designer/src/lib/shared/qdesigner_widgetbox_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/qdesigner_widgetitem.cpp b/src/designer/src/lib/shared/qdesigner_widgetitem.cpp
index e6e6cd00a..b986aede8 100644
--- a/src/designer/src/lib/shared/qdesigner_widgetitem.cpp
+++ b/src/designer/src/lib/shared/qdesigner_widgetitem.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdesigner_widgetitem_p.h"
#include "qdesigner_widget_p.h"
diff --git a/src/designer/src/lib/shared/qdesigner_widgetitem_p.h b/src/designer/src/lib/shared/qdesigner_widgetitem_p.h
index 7b3ed395f..b7a533e08 100644
--- a/src/designer/src/lib/shared/qdesigner_widgetitem_p.h
+++ b/src/designer/src/lib/shared/qdesigner_widgetitem_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/qlayout_widget.cpp b/src/designer/src/lib/shared/qlayout_widget.cpp
index aa0502076..28b25ce84 100644
--- a/src/designer/src/lib/shared/qlayout_widget.cpp
+++ b/src/designer/src/lib/shared/qlayout_widget.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qlayout_widget_p.h"
#include "qdesigner_utils_p.h"
@@ -48,6 +23,7 @@
#include <QtCore/qdebug.h>
#include <QtCore/qalgorithms.h>
+#include <QtCore/qhash.h>
#include <QtCore/qmap.h>
#include <QtCore/qstack.h>
#include <QtCore/qpair.h>
@@ -102,8 +78,10 @@ inline void getGridItemPosition(QFormLayout *formLayout, int index, int *row, in
QT_BEGIN_NAMESPACE
-static const char *objectNameC = "objectName";
-static const char *sizeConstraintC = "sizeConstraint";
+using namespace Qt::StringLiterals;
+
+static constexpr auto objectNameC = "objectName"_L1;
+static constexpr auto sizeConstraintC = "sizeConstraint"_L1;
/* A padding spacer element that is used to represent an empty form layout cell. It should grow with its cell.
* Should not be used on a grid as it causes resizing inconsistencies */
@@ -219,8 +197,9 @@ static bool removeEmptyCellsOnGrid(GridLikeLayout *grid, const QRect &area)
// remove, starting from last
if (!indexesToBeRemoved.isEmpty()) {
std::stable_sort(indexesToBeRemoved.begin(), indexesToBeRemoved.end());
- for (int i = indexesToBeRemoved.size() - 1; i >= 0; i--)
- delete grid->takeAt(indexesToBeRemoved[i]);
+ std::reverse(indexesToBeRemoved.begin(), indexesToBeRemoved.end());
+ for (auto i : std::as_const(indexesToBeRemoved))
+ delete grid->takeAt(i);
}
return true;
}
@@ -275,15 +254,15 @@ int LayoutProperties::visibleProperties(const QLayout *layout)
static const char *marginPropertyNamesC[] = {"leftMargin", "topMargin", "rightMargin", "bottomMargin"};
static const char *spacingPropertyNamesC[] = {"spacing", "horizontalSpacing", "verticalSpacing" };
-static const char *fieldGrowthPolicyPropertyC = "fieldGrowthPolicy";
-static const char *rowWrapPolicyPropertyC = "rowWrapPolicy";
-static const char *labelAlignmentPropertyC = "labelAlignment";
-static const char *formAlignmentPropertyC = "formAlignment";
-static const char *boxStretchPropertyC = "stretch";
-static const char *gridRowStretchPropertyC = "rowStretch";
-static const char *gridColumnStretchPropertyC = "columnStretch";
-static const char *gridRowMinimumHeightPropertyC = "rowMinimumHeight";
-static const char *gridColumnMinimumWidthPropertyC = "columnMinimumWidth";
+static constexpr auto fieldGrowthPolicyPropertyC = "fieldGrowthPolicy"_L1;
+static constexpr auto rowWrapPolicyPropertyC = "rowWrapPolicy"_L1;
+static constexpr auto labelAlignmentPropertyC = "labelAlignment"_L1;
+static constexpr auto formAlignmentPropertyC = "formAlignment"_L1;
+static constexpr auto boxStretchPropertyC = "stretch"_L1;
+static constexpr auto gridRowStretchPropertyC = "rowStretch"_L1;
+static constexpr auto gridColumnStretchPropertyC = "columnStretch"_L1;
+static constexpr auto gridRowMinimumHeightPropertyC = "rowMinimumHeight"_L1;
+static constexpr auto gridColumnMinimumWidthPropertyC = "columnMinimumWidth"_L1;
static bool intValueFromSheet(const QDesignerPropertySheetExtension *sheet, const QString &name, int *value, bool *changed)
{
@@ -315,7 +294,7 @@ int LayoutProperties::fromPropertySheet(const QDesignerFormEditorInterface *core
Q_ASSERT(sheet);
// name
if (mask & ObjectNameProperty) {
- const int nameIndex = sheet->indexOf(QLatin1String(objectNameC));
+ const int nameIndex = sheet->indexOf(objectNameC);
Q_ASSERT(nameIndex != -1);
m_objectName = sheet->property(nameIndex);
m_objectNameChanged = sheet->isChanged(nameIndex);
@@ -325,25 +304,25 @@ int LayoutProperties::fromPropertySheet(const QDesignerFormEditorInterface *core
const int marginFlags[MarginCount] = { LeftMarginProperty, TopMarginProperty, RightMarginProperty, BottomMarginProperty};
for (int i = 0; i < MarginCount; i++)
if (mask & marginFlags[i])
- if (intValueFromSheet(sheet, QLatin1String(marginPropertyNamesC[i]), m_margins + i, m_marginsChanged + i))
+ if (intValueFromSheet(sheet, QLatin1StringView(marginPropertyNamesC[i]), m_margins + i, m_marginsChanged + i))
rc |= marginFlags[i];
const int spacingFlags[] = { SpacingProperty, HorizSpacingProperty, VertSpacingProperty};
for (int i = 0; i < SpacingsCount; i++)
if (mask & spacingFlags[i])
- if (intValueFromSheet(sheet, QLatin1String(spacingPropertyNamesC[i]), m_spacings + i, m_spacingsChanged + i))
+ if (intValueFromSheet(sheet, QLatin1StringView(spacingPropertyNamesC[i]), m_spacings + i, m_spacingsChanged + i))
rc |= spacingFlags[i];
// sizeConstraint, flags
- variantPropertyFromSheet(mask, SizeConstraintProperty, sheet, QLatin1String(sizeConstraintC), &m_sizeConstraint, &m_sizeConstraintChanged, &rc);
- variantPropertyFromSheet(mask, FieldGrowthPolicyProperty, sheet, QLatin1String(fieldGrowthPolicyPropertyC), &m_fieldGrowthPolicy, &m_fieldGrowthPolicyChanged, &rc);
- variantPropertyFromSheet(mask, RowWrapPolicyProperty, sheet, QLatin1String(rowWrapPolicyPropertyC), &m_rowWrapPolicy, &m_rowWrapPolicyChanged, &rc);
- variantPropertyFromSheet(mask, LabelAlignmentProperty, sheet, QLatin1String(labelAlignmentPropertyC), &m_labelAlignment, &m_labelAlignmentChanged, &rc);
- variantPropertyFromSheet(mask, FormAlignmentProperty, sheet, QLatin1String(formAlignmentPropertyC), &m_formAlignment, &m_formAlignmentChanged, &rc);
- variantPropertyFromSheet(mask, BoxStretchProperty, sheet, QLatin1String(boxStretchPropertyC), &m_boxStretch, & m_boxStretchChanged, &rc);
- variantPropertyFromSheet(mask, GridRowStretchProperty, sheet, QLatin1String(gridRowStretchPropertyC), &m_gridRowStretch, &m_gridRowStretchChanged, &rc);
- variantPropertyFromSheet(mask, GridColumnStretchProperty, sheet, QLatin1String(gridColumnStretchPropertyC), &m_gridColumnStretch, &m_gridColumnStretchChanged, &rc);
- variantPropertyFromSheet(mask, GridRowMinimumHeightProperty, sheet, QLatin1String(gridRowMinimumHeightPropertyC), &m_gridRowMinimumHeight, &m_gridRowMinimumHeightChanged, &rc);
- variantPropertyFromSheet(mask, GridColumnMinimumWidthProperty, sheet, QLatin1String(gridColumnMinimumWidthPropertyC), &m_gridColumnMinimumWidth, &m_gridColumnMinimumWidthChanged, &rc);
+ variantPropertyFromSheet(mask, SizeConstraintProperty, sheet, sizeConstraintC, &m_sizeConstraint, &m_sizeConstraintChanged, &rc);
+ variantPropertyFromSheet(mask, FieldGrowthPolicyProperty, sheet, fieldGrowthPolicyPropertyC, &m_fieldGrowthPolicy, &m_fieldGrowthPolicyChanged, &rc);
+ variantPropertyFromSheet(mask, RowWrapPolicyProperty, sheet, rowWrapPolicyPropertyC, &m_rowWrapPolicy, &m_rowWrapPolicyChanged, &rc);
+ variantPropertyFromSheet(mask, LabelAlignmentProperty, sheet, labelAlignmentPropertyC, &m_labelAlignment, &m_labelAlignmentChanged, &rc);
+ variantPropertyFromSheet(mask, FormAlignmentProperty, sheet, formAlignmentPropertyC, &m_formAlignment, &m_formAlignmentChanged, &rc);
+ variantPropertyFromSheet(mask, BoxStretchProperty, sheet, boxStretchPropertyC, &m_boxStretch, & m_boxStretchChanged, &rc);
+ variantPropertyFromSheet(mask, GridRowStretchProperty, sheet, gridRowStretchPropertyC, &m_gridRowStretch, &m_gridRowStretchChanged, &rc);
+ variantPropertyFromSheet(mask, GridColumnStretchProperty, sheet, gridColumnStretchPropertyC, &m_gridColumnStretch, &m_gridColumnStretchChanged, &rc);
+ variantPropertyFromSheet(mask, GridRowMinimumHeightProperty, sheet, gridRowMinimumHeightPropertyC, &m_gridRowMinimumHeight, &m_gridRowMinimumHeightChanged, &rc);
+ variantPropertyFromSheet(mask, GridColumnMinimumWidthProperty, sheet, gridColumnMinimumWidthPropertyC, &m_gridColumnMinimumWidth, &m_gridColumnMinimumWidthChanged, &rc);
return rc;
}
@@ -383,7 +362,7 @@ int LayoutProperties::toPropertySheet(const QDesignerFormEditorInterface *core,
Q_ASSERT(sheet);
// name
if (mask & ObjectNameProperty) {
- const int nameIndex = sheet->indexOf(QLatin1String(objectNameC));
+ const int nameIndex = sheet->indexOf(objectNameC);
Q_ASSERT(nameIndex != -1);
sheet->setProperty(nameIndex, m_objectName);
if (applyChanged)
@@ -394,25 +373,25 @@ int LayoutProperties::toPropertySheet(const QDesignerFormEditorInterface *core,
const int marginFlags[MarginCount] = { LeftMarginProperty, TopMarginProperty, RightMarginProperty, BottomMarginProperty};
for (int i = 0; i < MarginCount; i++)
if (mask & marginFlags[i])
- if (intValueToSheet(sheet, QLatin1String(marginPropertyNamesC[i]), m_margins[i], m_marginsChanged[i], applyChanged))
+ if (intValueToSheet(sheet, QLatin1StringView(marginPropertyNamesC[i]), m_margins[i], m_marginsChanged[i], applyChanged))
rc |= marginFlags[i];
const int spacingFlags[] = { SpacingProperty, HorizSpacingProperty, VertSpacingProperty};
for (int i = 0; i < SpacingsCount; i++)
if (mask & spacingFlags[i])
- if (intValueToSheet(sheet, QLatin1String(spacingPropertyNamesC[i]), m_spacings[i], m_spacingsChanged[i], applyChanged))
+ if (intValueToSheet(sheet, QLatin1StringView(spacingPropertyNamesC[i]), m_spacings[i], m_spacingsChanged[i], applyChanged))
rc |= spacingFlags[i];
// sizeConstraint
- variantPropertyToSheet(mask, SizeConstraintProperty, applyChanged, sheet, QLatin1String(sizeConstraintC), m_sizeConstraint, m_sizeConstraintChanged, &rc);
- variantPropertyToSheet(mask, FieldGrowthPolicyProperty, applyChanged, sheet, QLatin1String(fieldGrowthPolicyPropertyC), m_fieldGrowthPolicy, m_fieldGrowthPolicyChanged, &rc);
- variantPropertyToSheet(mask, RowWrapPolicyProperty, applyChanged, sheet, QLatin1String(rowWrapPolicyPropertyC), m_rowWrapPolicy, m_rowWrapPolicyChanged, &rc);
- variantPropertyToSheet(mask, LabelAlignmentProperty, applyChanged, sheet, QLatin1String(labelAlignmentPropertyC), m_labelAlignment, m_labelAlignmentChanged, &rc);
- variantPropertyToSheet(mask, FormAlignmentProperty, applyChanged, sheet, QLatin1String(formAlignmentPropertyC), m_formAlignment, m_formAlignmentChanged, &rc);
- variantPropertyToSheet(mask, BoxStretchProperty, applyChanged, sheet, QLatin1String(boxStretchPropertyC), m_boxStretch, m_boxStretchChanged, &rc);
- variantPropertyToSheet(mask, GridRowStretchProperty, applyChanged, sheet, QLatin1String(gridRowStretchPropertyC), m_gridRowStretch, m_gridRowStretchChanged, &rc);
- variantPropertyToSheet(mask, GridColumnStretchProperty, applyChanged, sheet, QLatin1String(gridColumnStretchPropertyC), m_gridColumnStretch, m_gridColumnStretchChanged, &rc);
- variantPropertyToSheet(mask, GridRowMinimumHeightProperty, applyChanged, sheet, QLatin1String(gridRowMinimumHeightPropertyC), m_gridRowMinimumHeight, m_gridRowMinimumHeightChanged, &rc);
- variantPropertyToSheet(mask, GridColumnMinimumWidthProperty, applyChanged, sheet, QLatin1String(gridColumnMinimumWidthPropertyC), m_gridColumnMinimumWidth, m_gridColumnMinimumWidthChanged, &rc);
+ variantPropertyToSheet(mask, SizeConstraintProperty, applyChanged, sheet, sizeConstraintC, m_sizeConstraint, m_sizeConstraintChanged, &rc);
+ variantPropertyToSheet(mask, FieldGrowthPolicyProperty, applyChanged, sheet, fieldGrowthPolicyPropertyC, m_fieldGrowthPolicy, m_fieldGrowthPolicyChanged, &rc);
+ variantPropertyToSheet(mask, RowWrapPolicyProperty, applyChanged, sheet, rowWrapPolicyPropertyC, m_rowWrapPolicy, m_rowWrapPolicyChanged, &rc);
+ variantPropertyToSheet(mask, LabelAlignmentProperty, applyChanged, sheet, labelAlignmentPropertyC, m_labelAlignment, m_labelAlignmentChanged, &rc);
+ variantPropertyToSheet(mask, FormAlignmentProperty, applyChanged, sheet, formAlignmentPropertyC, m_formAlignment, m_formAlignmentChanged, &rc);
+ variantPropertyToSheet(mask, BoxStretchProperty, applyChanged, sheet, boxStretchPropertyC, m_boxStretch, m_boxStretchChanged, &rc);
+ variantPropertyToSheet(mask, GridRowStretchProperty, applyChanged, sheet, gridRowStretchPropertyC, m_gridRowStretch, m_gridRowStretchChanged, &rc);
+ variantPropertyToSheet(mask, GridColumnStretchProperty, applyChanged, sheet, gridColumnStretchPropertyC, m_gridColumnStretch, m_gridColumnStretchChanged, &rc);
+ variantPropertyToSheet(mask, GridRowMinimumHeightProperty, applyChanged, sheet, gridRowMinimumHeightPropertyC, m_gridRowMinimumHeight, m_gridRowMinimumHeightChanged, &rc);
+ variantPropertyToSheet(mask, GridColumnMinimumWidthProperty, applyChanged, sheet, gridColumnMinimumWidthPropertyC, m_gridColumnMinimumWidth, m_gridColumnMinimumWidthChanged, &rc);
return rc;
}
@@ -534,11 +513,10 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
QLayoutItem *BoxLayoutHelper::findItemOfWidget(const LayoutItemVector &lv, QWidget *w)
{
- const LayoutItemVector::const_iterator cend = lv.constEnd();
- for (LayoutItemVector::const_iterator it = lv.constBegin(); it != cend; ++it)
- if ( (*it)->widget() == w)
- return *it;
-
+ for (auto *l : lv) {
+ if (l->widget() == w)
+ return l;
+ }
return nullptr;
}
@@ -567,12 +545,11 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
if (savedState == state(boxLayout))
return;
- const int count = savedState.size();
- Q_ASSERT(count == currentState.size());
+ Q_ASSERT(savedState.size() == currentState.size());
// Take items and reassemble in saved order
const LayoutItemVector items = disassembleLayout(boxLayout);
- for (int i = 0; i < count; i++) {
- QLayoutItem *item = findItemOfWidget(items, savedState[i]);
+ for (auto *w : savedState) {
+ QLayoutItem *item = findItemOfWidget(items, w);
Q_ASSERT(item);
boxLayout->addItem(item);
}
@@ -603,18 +580,15 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
Occupied // Item bordering on it
};
// Horiontal, Vertical pair of state
- typedef QPair<DimensionCellState, DimensionCellState> CellState;
+ using CellState = std::pair<DimensionCellState, DimensionCellState>;
using CellStates = QList<CellState>;
// Figure out states of a cell and return as a flat vector of
// [column1, column2,...] (address as row * columnCount + col)
static CellStates cellStates(const QList<QRect> &rects, int numRows, int numColumns);
- typedef QMap<QWidget *, QRect> WidgetItemMap;
- typedef QMap<QWidget *, Qt::Alignment> WidgetAlignmentMap;
-
- WidgetItemMap widgetItemMap;
- WidgetAlignmentMap widgetAlignmentMap;
+ QHash<QWidget *, QRect> widgetItemMap;
+ QHash<QWidget *, Qt::Alignment> widgetAlignmentMap;
int rowCount = 0;
int colCount = 0;
@@ -629,8 +603,8 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
str << "GridLayoutState: " << gs.rowCount << " rows x " << gs.colCount
<< " cols " << gs.widgetItemMap.size() << " items\n";
- const GridLayoutState::WidgetItemMap::const_iterator wcend = gs.widgetItemMap.constEnd();
- for (GridLayoutState::WidgetItemMap::const_iterator it = gs.widgetItemMap.constBegin(); it != wcend; ++it)
+ const auto wcend = gs.widgetItemMap.constEnd();
+ for (auto it = gs.widgetItemMap.constBegin(); it != wcend; ++it)
str << "Item " << it.key() << it.value() << '\n';
return str;
}
@@ -690,19 +664,18 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
void GridLayoutState::applyToLayout(const QDesignerFormEditorInterface *core, QWidget *w) const
{
- using LayoutItemRectMap =QHash<QLayoutItem *, QRect>;
QGridLayout *grid = qobject_cast<QGridLayout *>(LayoutInfo::managedLayout(core, w));
Q_ASSERT(grid);
if (debugLayout)
qDebug() << ">GridLayoutState::applyToLayout" << *this << *grid;
const bool shrink = grid->rowCount() > rowCount || grid->columnCount() > colCount;
// Build a map of existing items to rectangles via widget map, delete spacers
- LayoutItemRectMap itemMap;
+ QHash<QLayoutItem *, QRect> itemMap;
while (grid->count()) {
QLayoutItem *item = grid->takeAt(0);
if (!LayoutInfo::isEmptyItem(item)) {
QWidget *itemWidget = item->widget();
- const WidgetItemMap::const_iterator it = widgetItemMap.constFind(itemWidget);
+ const auto it = widgetItemMap.constFind(itemWidget);
if (it == widgetItemMap.constEnd())
qFatal("GridLayoutState::applyToLayout: Attempt to apply to a layout that has a widget '%s'/'%s' added after saving the state.",
itemWidget->metaObject()->className(), itemWidget->objectName().toUtf8().constData());
@@ -717,8 +690,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
grid = static_cast<QGridLayout*>(recreateManagedLayout(core, w, grid));
// Add widgets items
- const LayoutItemRectMap::const_iterator icend = itemMap.constEnd();
- for (LayoutItemRectMap::const_iterator it = itemMap.constBegin(); it != icend; ++it) {
+ for (auto it = itemMap.cbegin(), icend = itemMap.cend(); it != icend; ++it) {
const QRect info = it.value();
const Qt::Alignment alignment = widgetAlignmentMap.value(it.key()->widget(), {});
grid->addItem(it.key(), info.y(), info.x(), info.height(), info.width(), alignment);
@@ -1009,8 +981,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
// ---------------- FormLayoutHelper
class FormLayoutHelper : public LayoutHelper {
public:
- typedef QPair<QWidget *, QWidget *> WidgetPair;
- using FormLayoutState = QList<WidgetPair>;
+ using FormLayoutState = QList<std::pair<QWidget *, QWidget *>>;
FormLayoutHelper() = default;
@@ -1103,7 +1074,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
const int rowCount = lt->rowCount();
if (rowCount == 0)
return FormLayoutState();
- FormLayoutState rc(rowCount, WidgetPair(0, 0));
+ FormLayoutState rc(rowCount, {nullptr, nullptr});
const int count = lt->count();
int row, column, colspan;
for (int i = 0; i < count; i++) {
@@ -1174,7 +1145,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
void FormLayoutHelper::simplify(const QDesignerFormEditorInterface *core, QWidget *widgetWithManagedLayout, const QRect &restrictionArea)
{
- using LayoutItemPair = QPair<QLayoutItem*, QLayoutItem*>;
+ using LayoutItemPair = std::pair<QLayoutItem*, QLayoutItem*>;
using LayoutItemPairs = QList<LayoutItemPair>;
QFormLayout *formLayout = qobject_cast<QFormLayout *>(LayoutInfo::managedLayout(core, widgetWithManagedLayout));
@@ -1299,7 +1270,7 @@ void QLayoutSupport::setInsertMode(InsertMode im)
m_currentInsertMode = im;
}
-void QLayoutSupport::setCurrentCell(const QPair<int, int> &cell)
+void QLayoutSupport::setCurrentCell(const std::pair<int, int> &cell)
{
m_currentCell = cell;
}
@@ -1537,7 +1508,7 @@ class QBoxLayoutSupport: public QLayoutSupport
public:
QBoxLayoutSupport(QDesignerFormWindowInterface *formWindow, QWidget *widget, Qt::Orientation orientation, QObject *parent = nullptr);
- void insertWidget(QWidget *widget, const QPair<int, int> &cell) override;
+ void insertWidget(QWidget *widget, const std::pair<int, int> &cell) override;
void removeWidget(QWidget *widget) override;
void simplify() override {}
void insertRow(int /*row*/) override {}
@@ -1563,7 +1534,7 @@ void QBoxLayoutSupport::removeWidget(QWidget *widget)
// of higher index, which happens as follows:
// Drag start: The widget is hidden
// Drop: Current cell is stored, widget is removed and re-added, causing an index offset that needs to be compensated
- QPair<int, int> currCell = currentCell();
+ std::pair<int, int> currCell = currentCell();
switch (m_orientation) {
case Qt::Horizontal:
if (currCell.second > 0 && index < currCell.second ) {
@@ -1590,10 +1561,10 @@ QBoxLayoutSupport::QBoxLayoutSupport(QDesignerFormWindowInterface *formWindow, Q
void QBoxLayoutSupport::setCurrentCellFromIndicatorOnEmptyCell(int index)
{
qDebug() << "QBoxLayoutSupport::setCurrentCellFromIndicatorOnEmptyCell(): Warning: found a fake spacer inside a vbox layout at " << index;
- setCurrentCell(qMakePair(0, 0));
+ setCurrentCell({0, 0});
}
-void QBoxLayoutSupport::insertWidget(QWidget *widget, const QPair<int, int> &cell)
+void QBoxLayoutSupport::insertWidget(QWidget *widget, const std::pair<int, int> &cell)
{
switch (m_orientation) {
case Qt::Horizontal:
@@ -1607,11 +1578,10 @@ void QBoxLayoutSupport::insertWidget(QWidget *widget, const QPair<int, int> &cel
void QBoxLayoutSupport::setCurrentCellFromIndicator(Qt::Orientation indicatorOrientation, int index, int increment)
{
- if (m_orientation == Qt::Horizontal && indicatorOrientation == Qt::Vertical) {
- setCurrentCell(qMakePair(0, index + increment));
- } else if (m_orientation == Qt::Vertical && indicatorOrientation == Qt::Horizontal) {
- setCurrentCell(qMakePair(index + increment, 0));
- }
+ if (m_orientation == Qt::Horizontal && indicatorOrientation == Qt::Vertical)
+ setCurrentCell({0, index + increment});
+ else if (m_orientation == Qt::Vertical && indicatorOrientation == Qt::Horizontal)
+ setCurrentCell({index + increment, 0});
}
bool QBoxLayoutSupport::supportsIndicatorOrientation(Qt::Orientation indicatorOrientation) const
@@ -1669,7 +1639,7 @@ public:
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;
+ void insertWidget(QWidget *widget, const std::pair<int, int> &cell) override;
void removeWidget(QWidget *widget) override { helper()->removeWidget(layout(), widget); }
int findItemAt(int row, int column) const override;
using QLayoutSupport::findItemAt;
@@ -1701,7 +1671,7 @@ void GridLikeLayoutSupportBase<GridLikeLayout>::setCurrentCellFromIndicatorOnEmp
int row, column, rowspan, colspan;
getGridItemPosition(grid, index, &row, &column, &rowspan, &colspan);
- setCurrentCell(qMakePair(row, column));
+ setCurrentCell({row, column});
}
template <class GridLikeLayout>
@@ -1713,7 +1683,7 @@ void GridLikeLayoutSupportBase<GridLikeLayout>::setCurrentCellFromIndicator(Qt::
int row = info.top();
int column = increment ? info.right() + 1 : info.left();
checkCellForInsertion(&row, &column);
- setCurrentCell(qMakePair(row , column));
+ setCurrentCell({row, column});
}
break;
case Qt::Horizontal: {
@@ -1721,14 +1691,14 @@ void GridLikeLayoutSupportBase<GridLikeLayout>::setCurrentCellFromIndicator(Qt::
int row = increment ? info.bottom() + 1 : info.top();
int column = info.left();
checkCellForInsertion(&row, &column);
- setCurrentCell(qMakePair(row, column));
+ setCurrentCell({row, column});
}
break;
}
}
template <class GridLikeLayout>
-void GridLikeLayoutSupportBase<GridLikeLayout>::insertWidget(QWidget *widget, const QPair<int, int> &cell)
+void GridLikeLayoutSupportBase<GridLikeLayout>::insertWidget(QWidget *widget, const std::pair<int, int> &cell)
{
helper()->insertWidget(layout(), QRect(cell.second, cell.first, 1, 1), widget);
}
diff --git a/src/designer/src/lib/shared/qlayout_widget_p.h b/src/designer/src/lib/shared/qlayout_widget_p.h
index 1efe3a905..16185d5ec 100644
--- a/src/designer/src/lib/shared/qlayout_widget_p.h
+++ b/src/designer/src/lib/shared/qlayout_widget_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -182,7 +157,7 @@ public:
InsertMode currentInsertMode() const override { return m_currentInsertMode; }
- QPair<int, int> currentCell() const override { return m_currentCell; }
+ std::pair<int, int> currentCell() const override { return m_currentCell; }
int findItemAt(const QPoint &pos) const override;
int indexOf(QWidget *widget) const override;
@@ -201,6 +176,7 @@ public:
// grid helpers: find item index
static int findItemAt(QGridLayout *, int row, int column);
+ using QDesignerLayoutDecorationExtension::findItemAt;
// grid helpers: Quick check whether simplify should be enabled for grids. May return false positives.
static bool canSimplifyQuickCheck(const QGridLayout *);
static bool canSimplifyQuickCheck(const QFormLayout *fl);
@@ -224,7 +200,7 @@ protected:
QWidget *widget() const { return m_widget; }
void setInsertMode(InsertMode im);
- void setCurrentCell(const QPair<int, int> &cell);
+ void setCurrentCell(const std::pair<int, int> &cell);
private:
enum Indicator { LeftIndicator, TopIndicator, RightIndicator, BottomIndicator, NumIndicators };
@@ -239,7 +215,7 @@ private:
QPointer<QWidget> m_indicators[NumIndicators];
int m_currentIndex;
InsertMode m_currentInsertMode;
- QPair<int, int> m_currentCell;
+ std::pair<int, int> m_currentCell;
};
} // namespace qdesigner_internal
diff --git a/src/designer/src/lib/shared/qsimpleresource.cpp b/src/designer/src/lib/shared/qsimpleresource.cpp
index e988d0731..2b0ef4a07 100644
--- a/src/designer/src/lib/shared/qsimpleresource.cpp
+++ b/src/designer/src/lib/shared/qsimpleresource.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qsimpleresource_p.h"
#include "widgetfactory_p.h"
@@ -51,6 +26,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
bool QSimpleResource::m_warningsEnabled = true;
@@ -158,16 +135,16 @@ void QSimpleResource::addCustomWidgetsToWidgetDatabase(const QDesignerFormEditor
QList<DomCustomWidget *> &custom_widget_list)
{
QDesignerWidgetDataBaseInterface *db = core->widgetDataBase();
- for (int i=0; i < custom_widget_list.size(); ) {
+ for (qsizetype i = 0; i < custom_widget_list.size(); ) {
bool classInserted = false;
- DomCustomWidget *custom_widget = custom_widget_list[i];
+ DomCustomWidget *custom_widget = custom_widget_list.at(i);
const QString customClassName = custom_widget->elementClass();
const QString base_class = custom_widget->elementExtends();
QString includeFile;
IncludeType includeType = IncludeLocal;
if (const DomHeader *header = custom_widget->elementHeader()) {
includeFile = header->text();
- if (header->hasAttributeLocation() && header->attributeLocation() == QStringLiteral("global"))
+ if (header->hasAttributeLocation() && header->attributeLocation() == "global"_L1)
includeType = IncludeGlobal;
}
const bool domIsContainer = custom_widget->elementContainer();
@@ -228,8 +205,8 @@ void QSimpleResource::handleDomCustomWidgets(const QDesignerFormEditorInterface
}
// Oops, there are classes left whose base class could not be found.
// Default them to QWidget with warnings.
- const QString fallBackBaseClass = QStringLiteral("QWidget");
- for (DomCustomWidget *custom_widget : qAsConst(custom_widget_list)) {
+ const QString fallBackBaseClass = u"QWidget"_s;
+ for (DomCustomWidget *custom_widget : std::as_const(custom_widget_list)) {
const QString customClassName = custom_widget->elementClass();
const QString base_class = custom_widget->elementExtends();
qDebug() << "** WARNING The base class " << base_class << " of the custom widget class " << customClassName
diff --git a/src/designer/src/lib/shared/qsimpleresource_p.h b/src/designer/src/lib/shared/qsimpleresource_p.h
index 2c8ae1456..37b9f5c04 100644
--- a/src/designer/src/lib/shared/qsimpleresource_p.h
+++ b/src/designer/src/lib/shared/qsimpleresource_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/qtresourceeditordialog.cpp b/src/designer/src/lib/shared/qtresourceeditordialog.cpp
index 613c5d0c9..589363e54 100644
--- a/src/designer/src/lib/shared/qtresourceeditordialog.cpp
+++ b/src/designer/src/lib/shared/qtresourceeditordialog.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qtresourceeditordialog_p.h"
#include "ui_qtresourceeditordialog.h"
@@ -36,6 +11,7 @@
#include <QtDesigner/abstractsettings.h>
#include <QtDesigner/abstractformeditor.h>
+#include <QtCore/qcompare.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qdir.h>
#include <QtCore/qcoreapplication.h>
@@ -49,15 +25,17 @@
QT_BEGIN_NAMESPACE
-static const char *rccRootTag = "RCC";
-static const char *rccTag = "qresource";
-static const char *rccFileTag = "file";
-static const char *rccAliasAttribute = "alias";
-static const char *rccPrefixAttribute = "prefix";
-static const char *rccLangAttribute = "lang";
-static const char *SplitterPosition = "SplitterPosition";
-static const char *Geometry = "Geometry";
-static const char *QrcDialogC = "QrcDialog";
+using namespace Qt::StringLiterals;
+
+static constexpr auto rccRootTag = "RCC"_L1;
+static constexpr auto rccTag = "qresource"_L1;
+static constexpr auto rccFileTag = "file"_L1;
+static constexpr auto rccAliasAttribute = "alias"_L1;
+static constexpr auto rccPrefixAttribute = "prefix"_L1;
+static constexpr auto rccLangAttribute = "lang"_L1;
+static constexpr auto SplitterPosition = "SplitterPosition"_L1;
+static constexpr auto ResourceEditorGeometry = "Geometry"_L1;
+static constexpr auto QrcDialogC = "QrcDialog"_L1;
static QString msgOverwrite(const QString &fname)
{
@@ -69,48 +47,71 @@ static QString msgTagMismatch(const QString &got, const QString &expected)
return QCoreApplication::translate("QtResourceEditorDialog", "The file does not appear to be a resource file; element '%1' was found where '%2' was expected.").arg(got, expected);
}
-namespace {
+namespace qdesigner_internal {
// below 3 data classes should be derived from QSharedData and made implicit shared class
-struct QtResourceFileData {
+struct QtResourceFileData
+{
QString path;
QString alias;
- bool operator==(const QtResourceFileData &other) const
- { return path == other.path && alias == other.alias; }
+
+ friend bool comparesEqual(const QtResourceFileData &lhs,
+ const QtResourceFileData &rhs) noexcept
+ {
+ return lhs.path == rhs.path && lhs.alias == rhs.alias;
+ }
+ Q_DECLARE_EQUALITY_COMPARABLE(QtResourceFileData)
};
-struct QtResourcePrefixData {
+struct QtResourcePrefixData
+{
QString prefix;
QString language;
QList<QtResourceFileData> resourceFileList;
- bool operator==(const QtResourcePrefixData &other) const
+
+ friend bool comparesEqual(const QtResourcePrefixData &lhs,
+ const QtResourcePrefixData &rhs) noexcept
{
- return prefix == other.prefix && language == other.language
- && resourceFileList == other.resourceFileList;
+ return lhs.prefix == rhs.prefix && lhs.language == rhs.language
+ && lhs.resourceFileList == rhs.resourceFileList;
}
+ Q_DECLARE_EQUALITY_COMPARABLE(QtResourcePrefixData)
};
-struct QtQrcFileData {
+struct QtQrcFileData
+{
QString qrcPath;
QList<QtResourcePrefixData> resourceList;
- bool operator==(const QtQrcFileData &other) const
- { return qrcPath == other.qrcPath && resourceList == other.resourceList; }
+
+ friend bool comparesEqual(const QtQrcFileData &lhs,
+ const QtQrcFileData &rhs) noexcept
+ {
+ return lhs.qrcPath == rhs.qrcPath && lhs.resourceList == rhs.resourceList;
+ }
+ Q_DECLARE_EQUALITY_COMPARABLE(QtQrcFileData)
};
-bool loadResourceFileData(const QDomElement &fileElem, QtResourceFileData *fileData, QString *errorMessage)
+} // namespace qdesigner_internal
+
+using QtResourcePrefixData = qdesigner_internal::QtResourcePrefixData;
+using QtResourceFileData = qdesigner_internal::QtResourceFileData;
+using QtQrcFileData = qdesigner_internal::QtQrcFileData;
+
+static bool loadResourceFileData(const QDomElement &fileElem, QtResourceFileData *fileData,
+ QString *errorMessage)
{
if (!fileData)
return false;
- if (fileElem.tagName() != QLatin1String(rccFileTag)) {
- *errorMessage = msgTagMismatch(fileElem.tagName(), QLatin1String(rccFileTag));
+ if (fileElem.tagName() != rccFileTag) {
+ *errorMessage = msgTagMismatch(fileElem.tagName(), rccFileTag);
return false;
}
QtResourceFileData &data = *fileData;
data.path = fileElem.text();
- data.alias = fileElem.attribute(QLatin1String(rccAliasAttribute));
+ data.alias = fileElem.attribute(rccAliasAttribute);
return true;
}
@@ -120,15 +121,15 @@ static bool loadResourcePrefixData(const QDomElement &prefixElem, QtResourcePref
if (!prefixData)
return false;
- if (prefixElem.tagName() != QLatin1String(rccTag)) {
- *errorMessage = msgTagMismatch(prefixElem.tagName(), QLatin1String(rccTag));
+ if (prefixElem.tagName() != rccTag) {
+ *errorMessage = msgTagMismatch(prefixElem.tagName(), rccTag);
return false;
}
QtResourcePrefixData &data = *prefixData;
- data.prefix = prefixElem.attribute(QLatin1String(rccPrefixAttribute));
- data.language = prefixElem.attribute(QLatin1String(rccLangAttribute));
+ data.prefix = prefixElem.attribute(rccPrefixAttribute);
+ data.language = prefixElem.attribute(rccLangAttribute);
QDomElement fileElem = prefixElem.firstChildElement();
while (!fileElem.isNull()) {
QtResourceFileData fileData;
@@ -148,8 +149,8 @@ static bool loadQrcFileData(const QDomDocument &doc, const QString &path, QtQrcF
QtQrcFileData &data = *qrcFileData;
QDomElement docElem = doc.documentElement();
- if (docElem.tagName() != QLatin1String(rccRootTag)) {
- *errorMessage = msgTagMismatch(docElem.tagName(), QLatin1String(rccRootTag));
+ if (docElem.tagName() != rccRootTag) {
+ *errorMessage = msgTagMismatch(docElem.tagName(), rccRootTag);
return false;
}
@@ -167,11 +168,11 @@ static bool loadQrcFileData(const QDomDocument &doc, const QString &path, QtQrcF
return true;
}
-QDomElement saveResourceFileData(QDomDocument &doc, const QtResourceFileData &fileData)
+static QDomElement saveResourceFileData(QDomDocument &doc, const QtResourceFileData &fileData)
{
- QDomElement fileElem = doc.createElement(QLatin1String(rccFileTag));
+ QDomElement fileElem = doc.createElement(rccFileTag);
if (!fileData.alias.isEmpty())
- fileElem.setAttribute(QLatin1String(rccAliasAttribute), fileData.alias);
+ fileElem.setAttribute(rccAliasAttribute, fileData.alias);
QDomText textElem = doc.createTextNode(fileData.path);
fileElem.appendChild(textElem);
@@ -179,13 +180,13 @@ QDomElement saveResourceFileData(QDomDocument &doc, const QtResourceFileData &fi
return fileElem;
}
-QDomElement saveResourcePrefixData(QDomDocument &doc, const QtResourcePrefixData &prefixData)
+static QDomElement saveResourcePrefixData(QDomDocument &doc, const QtResourcePrefixData &prefixData)
{
- QDomElement prefixElem = doc.createElement(QLatin1String(rccTag));
+ QDomElement prefixElem = doc.createElement(rccTag);
if (!prefixData.prefix.isEmpty())
- prefixElem.setAttribute(QLatin1String(rccPrefixAttribute), prefixData.prefix);
+ prefixElem.setAttribute(rccPrefixAttribute, prefixData.prefix);
if (!prefixData.language.isEmpty())
- prefixElem.setAttribute(QLatin1String(rccLangAttribute), prefixData.language);
+ prefixElem.setAttribute(rccLangAttribute, prefixData.language);
for (const QtResourceFileData &rfd : prefixData.resourceFileList) {
QDomElement fileElem = saveResourceFileData(doc, rfd);
@@ -195,10 +196,10 @@ QDomElement saveResourcePrefixData(QDomDocument &doc, const QtResourcePrefixData
return prefixElem;
}
-QDomDocument saveQrcFileData(const QtQrcFileData &qrcFileData)
+static QDomDocument saveQrcFileData(const QtQrcFileData &qrcFileData)
{
QDomDocument doc;
- QDomElement docElem = doc.createElement(QLatin1String(rccRootTag));
+ QDomElement docElem = doc.createElement(rccRootTag);
for (const QtResourcePrefixData &prefixData : qrcFileData.resourceList) {
QDomElement prefixElem = saveResourcePrefixData(doc, prefixData);
@@ -208,6 +209,9 @@ QDomDocument saveQrcFileData(const QtQrcFileData &qrcFileData)
return doc;
}
+
+namespace qdesigner_internal {
+
// --------------- QtResourceFile
class QtResourceFile {
public:
@@ -334,9 +338,9 @@ private:
QList<QtQrcFile *> m_qrcFiles;
QMap<QString, QtQrcFile *> m_pathToQrc;
- QMap<QtQrcFile *, bool> m_qrcFileToExists;
- QMap<QtResourcePrefix *, QtQrcFile *> m_prefixToQrc;
- QMap<QtResourceFile *, QtResourcePrefix *> m_fileToPrefix;
+ QHash<QtQrcFile *, bool> m_qrcFileToExists;
+ QHash<QtResourcePrefix *, QtQrcFile *> m_prefixToQrc;
+ QHash<QtResourceFile *, QtResourcePrefix *> m_fileToPrefix;
QMap<QString, QList<QtResourceFile *> > m_fullPathToResourceFiles;
QMap<QString, QIcon> m_fullPathToIcon;
QMap<QString, bool> m_fullPathToExists;
@@ -784,9 +788,12 @@ void QtQrcManager::removeResourceFile(QtResourceFile *resourceFile)
delete resourceFile;
}
+} // namespace qdesigner_internal
-
-}
+using QtResourceFile = qdesigner_internal::QtResourceFile;
+using QtResourcePrefix = qdesigner_internal::QtResourcePrefix;
+using QtQrcFile = qdesigner_internal::QtQrcFile;
+using QtQrcManager = qdesigner_internal::QtQrcManager;
// ----------------- QtResourceEditorDialogPrivate
class QtResourceEditorDialogPrivate
@@ -859,16 +866,16 @@ public:
QtQrcManager *m_qrcManager = nullptr;
QList<QtQrcFileData> m_initialState;
- QMap<QtQrcFile *, QListWidgetItem *> m_qrcFileToItem;
- QMap<QListWidgetItem *, QtQrcFile *> m_itemToQrcFile;
- QMap<QtResourcePrefix *, QStandardItem *> m_resourcePrefixToPrefixItem;
- QMap<QtResourcePrefix *, QStandardItem *> m_resourcePrefixToLanguageItem;
- QMap<QStandardItem *, QtResourcePrefix *> m_prefixItemToResourcePrefix;
- QMap<QStandardItem *, QtResourcePrefix *> m_languageItemToResourcePrefix;
- QMap<QtResourceFile *, QStandardItem *> m_resourceFileToPathItem;
- QMap<QtResourceFile *, QStandardItem *> m_resourceFileToAliasItem;
- QMap<QStandardItem *, QtResourceFile *> m_pathItemToResourceFile;
- QMap<QStandardItem *, QtResourceFile *> m_aliasItemToResourceFile;
+ QHash<QtQrcFile *, QListWidgetItem *> m_qrcFileToItem;
+ QHash<QListWidgetItem *, QtQrcFile *> m_itemToQrcFile;
+ QHash<QtResourcePrefix *, QStandardItem *> m_resourcePrefixToPrefixItem;
+ QHash<QtResourcePrefix *, QStandardItem *> m_resourcePrefixToLanguageItem;
+ QHash<QStandardItem *, QtResourcePrefix *> m_prefixItemToResourcePrefix;
+ QHash<QStandardItem *, QtResourcePrefix *> m_languageItemToResourcePrefix;
+ QHash<QtResourceFile *, QStandardItem *> m_resourceFileToPathItem;
+ QHash<QtResourceFile *, QStandardItem *> m_resourceFileToAliasItem;
+ QHash<QStandardItem *, QtResourceFile *> m_pathItemToResourceFile;
+ QHash<QStandardItem *, QtResourceFile *> m_aliasItemToResourceFile;
bool m_ignoreCurrentChanged = false;
bool m_firstQrcFileDialog = true;
@@ -1186,7 +1193,7 @@ void QtResourceEditorDialogPrivate::slotCurrentQrcFileChanged(QListWidgetItem *i
return;
if (m_currentQrcFile) {
- QMap<QtResourcePrefix *, QStandardItem *> currentPrefixList = m_resourcePrefixToPrefixItem;
+ QHash<QtResourcePrefix *, QStandardItem *> currentPrefixList = m_resourcePrefixToPrefixItem;
for (auto it = currentPrefixList.cbegin(), end = currentPrefixList.cend(); it != end; ++it) {
QtResourcePrefix *resourcePrefix = it.key();
const auto currentResourceFiles = resourcePrefix->resourceFiles();
@@ -1312,8 +1319,6 @@ void QtResourceEditorDialogPrivate::slotTreeViewItemChanged(QStandardItem *item)
QString QtResourceEditorDialogPrivate::getSaveFileNameWithExtension(QWidget *parent,
const QString &title, QString dir, const QString &filter, const QString &extension) const
{
- const QChar dot = QLatin1Char('.');
-
QString saveFile;
while (true) {
saveFile = m_dlgGui->getSaveFileName(parent, title, dir, filter, nullptr, QFileDialog::DontConfirmOverwrite);
@@ -1321,10 +1326,8 @@ QString QtResourceEditorDialogPrivate::getSaveFileNameWithExtension(QWidget *par
return saveFile;
const QFileInfo fInfo(saveFile);
- if (fInfo.suffix().isEmpty() && !fInfo.fileName().endsWith(dot)) {
- saveFile += dot;
- saveFile += extension;
- }
+ if (fInfo.suffix().isEmpty() && !fInfo.fileName().endsWith(u'.'))
+ saveFile += u'.' + extension;
const QFileInfo fi(saveFile);
if (!fi.exists())
@@ -1352,7 +1355,7 @@ void QtResourceEditorDialogPrivate::slotNewQrcFile()
QCoreApplication::translate("QtResourceEditorDialog", "New Resource File"),
m_firstQrcFileDialog ? qrcStartDirectory() : QString(),
QCoreApplication::translate("QtResourceEditorDialog", "Resource files (*.qrc)"),
- QStringLiteral("qrc"));
+ u"qrc"_s);
if (qrcPath.isEmpty())
return;
@@ -1543,7 +1546,7 @@ void QtResourceEditorDialogPrivate::slotAddFiles()
QtResourceFile *nextResourceFile = m_qrcManager->nextResourceFile(currentResourceFile);
if (!currentResourceFile) {
const auto resourceFiles = currentResourcePrefix->resourceFiles();
- if (resourceFiles.count() > 0)
+ if (!resourceFiles.isEmpty())
nextResourceFile = resourceFiles.first();
}
@@ -1552,7 +1555,7 @@ void QtResourceEditorDialogPrivate::slotAddFiles()
const QDir dir(fi.absolutePath());
for (QString resourcePath : resourcePaths) {
QString relativePath = dir.relativeFilePath(resourcePath);
- if (relativePath.startsWith(QStringLiteral(".."))) {
+ if (relativePath.startsWith(".."_L1)) {
QMessageBox msgBox(QMessageBox::Warning,
QCoreApplication::translate("QtResourceEditorDialog", "Incorrect Path"),
outOfPathWarning(relativePath), QMessageBox::Cancel);
@@ -1667,7 +1670,7 @@ void QtResourceEditorDialogPrivate::slotClonePrefix()
QDir dir(fi.dir());
QString oldSuffix = fi.completeSuffix();
if (!oldSuffix.isEmpty())
- oldSuffix = QLatin1Char('.') + oldSuffix;
+ oldSuffix = u'.' + oldSuffix;
const QString newBaseName = fi.baseName() + suffix + oldSuffix;
const QString newPath = QDir::cleanPath(dir.filePath(newBaseName));
m_qrcManager->insertResourceFile(newResourcePrefix, newPath,
@@ -1765,7 +1768,7 @@ QString QtResourceEditorDialogPrivate::browseForNewLocation(const QString &resou
QCoreApplication::translate("QtResourceEditorDialog", "Copy As"),
initialPath);
QString relativePath = rootDir.relativeFilePath(newPath);
- if (relativePath.startsWith(QStringLiteral(".."))) {
+ if (relativePath.startsWith(".."_L1)) {
if (warning(QCoreApplication::translate("QtResourceEditorDialog", "Copy As"),
QCoreApplication::translate("QtResourceEditorDialog", "<p>The selected file:</p>"
"<p>%1</p><p>is outside of the current resource file's directory:</p><p>%2</p>"
@@ -1827,16 +1830,15 @@ bool QtResourceEditorDialogPrivate::loadQrcFile(const QString &path, QtQrcFileDa
file.close();
QDomDocument doc;
- int errLine, errCol;
- if (!doc.setContent(dataArray, errorMessage, &errLine, &errCol)) {
+ if (QDomDocument::ParseResult result = doc.setContent(dataArray)) {
+ return loadQrcFileData(doc, path, qrcFileData, errorMessage);
+ } else {
*errorMessage =
QCoreApplication::translate("QtResourceEditorDialog",
"A parse error occurred at line %1, column %2 of %3:\n%4")
- .arg(errLine).arg(errCol).arg(path, *errorMessage);
+ .arg(result.errorLine).arg(result.errorColumn).arg(path, result.errorMessage);
return false;
}
-
- return loadQrcFileData(doc, path, qrcFileData, errorMessage);
}
bool QtResourceEditorDialogPrivate::saveQrcFile(const QtQrcFileData &qrcFileData)
@@ -1881,41 +1883,42 @@ QtResourceEditorDialog::QtResourceEditorDialog(QDesignerFormEditorInterface *cor
d_ptr->m_dlgGui = dlgGui;
d_ptr->m_core = core;
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowTitle(tr("Edit Resources"));
- connect(d_ptr->m_qrcManager, SIGNAL(qrcFileInserted(QtQrcFile*)),
- this, SLOT(slotQrcFileInserted(QtQrcFile*)));
- connect(d_ptr->m_qrcManager, SIGNAL(qrcFileMoved(QtQrcFile*,QtQrcFile*)),
- this, SLOT(slotQrcFileMoved(QtQrcFile*)));
- connect(d_ptr->m_qrcManager, SIGNAL(qrcFileRemoved(QtQrcFile*)),
- this, SLOT(slotQrcFileRemoved(QtQrcFile*)));
- connect(d_ptr->m_qrcManager, SIGNAL(resourcePrefixInserted(QtResourcePrefix*)),
- this, SLOT(slotResourcePrefixInserted(QtResourcePrefix*)));
- connect(d_ptr->m_qrcManager, SIGNAL(resourcePrefixMoved(QtResourcePrefix*,QtResourcePrefix*)),
- this, SLOT(slotResourcePrefixMoved(QtResourcePrefix*)));
- connect(d_ptr->m_qrcManager, SIGNAL(resourcePrefixChanged(QtResourcePrefix*,QString)),
- this, SLOT(slotResourcePrefixChanged(QtResourcePrefix*)));
- connect(d_ptr->m_qrcManager, SIGNAL(resourceLanguageChanged(QtResourcePrefix*,QString)),
- this, SLOT(slotResourceLanguageChanged(QtResourcePrefix*)));
- connect(d_ptr->m_qrcManager, SIGNAL(resourcePrefixRemoved(QtResourcePrefix*)),
- this, SLOT(slotResourcePrefixRemoved(QtResourcePrefix*)));
- connect(d_ptr->m_qrcManager, SIGNAL(resourceFileInserted(QtResourceFile*)),
- this, SLOT(slotResourceFileInserted(QtResourceFile*)));
- connect(d_ptr->m_qrcManager, SIGNAL(resourceFileMoved(QtResourceFile*,QtResourceFile*)),
- this, SLOT(slotResourceFileMoved(QtResourceFile*)));
- connect(d_ptr->m_qrcManager, SIGNAL(resourceAliasChanged(QtResourceFile*,QString)),
- this, SLOT(slotResourceAliasChanged(QtResourceFile*)));
- connect(d_ptr->m_qrcManager, SIGNAL(resourceFileRemoved(QtResourceFile*)),
- this, SLOT(slotResourceFileRemoved(QtResourceFile*)));
-
- QIcon upIcon = qdesigner_internal::createIconSet(QString::fromUtf8("up.png"));
- QIcon downIcon = qdesigner_internal::createIconSet(QString::fromUtf8("down.png"));
- QIcon minusIcon = qdesigner_internal::createIconSet(QString::fromUtf8("minus-16.png"));
- QIcon newIcon = qdesigner_internal::createIconSet(QString::fromUtf8("filenew-16.png"));
- QIcon openIcon = qdesigner_internal::createIconSet(QString::fromUtf8("fileopen-16.png"));
- QIcon removeIcon = qdesigner_internal::createIconSet(QString::fromUtf8("editdelete-16.png"));
- QIcon addPrefixIcon = qdesigner_internal::createIconSet(QString::fromUtf8("prefix-add.png"));
+ connect(d_ptr->m_qrcManager, &QtQrcManager::qrcFileInserted,
+ this, [this](QtQrcFile *file) { d_ptr->slotQrcFileInserted(file); });
+ connect(d_ptr->m_qrcManager, &QtQrcManager::qrcFileMoved,
+ this, [this](QtQrcFile *file) { d_ptr->slotQrcFileMoved(file); });
+ connect(d_ptr->m_qrcManager, &QtQrcManager::qrcFileRemoved,
+ this, [this](QtQrcFile *file) { d_ptr->slotQrcFileRemoved(file); });
+
+ connect(d_ptr->m_qrcManager, &QtQrcManager::resourcePrefixInserted,
+ this, [this](QtResourcePrefix *prefix) { d_ptr->slotResourcePrefixInserted(prefix); });
+ connect(d_ptr->m_qrcManager, &QtQrcManager::resourcePrefixMoved,
+ this, [this](QtResourcePrefix *prefix) { d_ptr->slotResourcePrefixMoved(prefix); });
+ connect(d_ptr->m_qrcManager, &QtQrcManager::resourcePrefixChanged,
+ this, [this](QtResourcePrefix *prefix) { d_ptr->slotResourcePrefixChanged(prefix); });
+ connect(d_ptr->m_qrcManager, &QtQrcManager::resourceLanguageChanged,
+ this, [this](QtResourcePrefix *prefix) { d_ptr->slotResourceLanguageChanged(prefix); });
+ connect(d_ptr->m_qrcManager, &QtQrcManager::resourcePrefixRemoved,
+ this, [this](QtResourcePrefix *prefix) { d_ptr->slotResourcePrefixRemoved(prefix); });
+
+ connect(d_ptr->m_qrcManager, &QtQrcManager::resourceFileInserted,
+ this, [this](QtResourceFile *file) { d_ptr->slotResourceFileInserted(file); });
+ connect(d_ptr->m_qrcManager, &QtQrcManager::resourceFileMoved,
+ this, [this](QtResourceFile *file) { d_ptr->slotResourceFileMoved(file); });
+ connect(d_ptr->m_qrcManager, &QtQrcManager::resourceAliasChanged,
+ this, [this](QtResourceFile *file) { d_ptr->slotResourceAliasChanged(file); });
+ connect(d_ptr->m_qrcManager, &QtQrcManager::resourceFileRemoved,
+ this, [this](QtResourceFile *file) { d_ptr->slotResourceFileRemoved(file); });
+
+ QIcon upIcon = qdesigner_internal::createIconSet("up.png"_L1);
+ QIcon downIcon = qdesigner_internal::createIconSet("down.png"_L1);
+ QIcon minusIcon = qdesigner_internal::createIconSet("minus-16.png"_L1);
+ QIcon newIcon = qdesigner_internal::createIconSet("filenew-16.png"_L1);
+ QIcon openIcon = qdesigner_internal::createIconSet("fileopen-16.png"_L1);
+ QIcon removeIcon = qdesigner_internal::createIconSet("editdelete-16.png"_L1);
+ QIcon addPrefixIcon = qdesigner_internal::createIconSet("prefix-add.png"_L1);
d_ptr->m_newQrcFileAction = new QAction(newIcon, tr("New..."), this);
d_ptr->m_newQrcFileAction->setToolTip(tr("New Resource File"));
@@ -1944,27 +1947,41 @@ QtResourceEditorDialog::QtResourceEditorDialog(QDesignerFormEditorInterface *cor
d_ptr->m_ui.addResourceButton->setDefaultAction(d_ptr->m_addResourceFileAction);
d_ptr->m_ui.removeResourceButton->setDefaultAction(d_ptr->m_removeAction);
- connect(d_ptr->m_newQrcFileAction, SIGNAL(triggered()), this, SLOT(slotNewQrcFile()));
- connect(d_ptr->m_importQrcFileAction, SIGNAL(triggered()), this, SLOT(slotImportQrcFile()));
- connect(d_ptr->m_removeQrcFileAction, SIGNAL(triggered()), this, SLOT(slotRemoveQrcFile()));
- connect(d_ptr->m_moveUpQrcFileAction, SIGNAL(triggered()), this, SLOT(slotMoveUpQrcFile()));
- connect(d_ptr->m_moveDownQrcFileAction, SIGNAL(triggered()), this, SLOT(slotMoveDownQrcFile()));
-
- connect(d_ptr->m_newPrefixAction, SIGNAL(triggered()), this, SLOT(slotNewPrefix()));
- connect(d_ptr->m_addResourceFileAction, SIGNAL(triggered()), this, SLOT(slotAddFiles()));
- connect(d_ptr->m_changePrefixAction, SIGNAL(triggered()), this, SLOT(slotChangePrefix()));
- connect(d_ptr->m_changeLanguageAction, SIGNAL(triggered()), this, SLOT(slotChangeLanguage()));
- connect(d_ptr->m_changeAliasAction, SIGNAL(triggered()), this, SLOT(slotChangeAlias()));
- connect(d_ptr->m_clonePrefixAction, SIGNAL(triggered()), this, SLOT(slotClonePrefix()));
- connect(d_ptr->m_removeAction, SIGNAL(triggered()), this, SLOT(slotRemove()));
- connect(d_ptr->m_moveUpAction, SIGNAL(triggered()), this, SLOT(slotMoveUp()));
- connect(d_ptr->m_moveDownAction, SIGNAL(triggered()), this, SLOT(slotMoveDown()));
+ connect(d_ptr->m_newQrcFileAction, &QAction::triggered,
+ this, [this] { d_ptr->slotNewQrcFile(); });
+ connect(d_ptr->m_importQrcFileAction, &QAction::triggered,
+ this, [this] { d_ptr->slotImportQrcFile(); });
+ connect(d_ptr->m_removeQrcFileAction, &QAction::triggered,
+ this, [this] { d_ptr->slotRemoveQrcFile(); });
+ connect(d_ptr->m_moveUpQrcFileAction, &QAction::triggered,
+ this, [this] { d_ptr->slotMoveUpQrcFile(); });
+ connect(d_ptr->m_moveDownQrcFileAction, &QAction::triggered,
+ this, [this] { d_ptr->slotMoveDownQrcFile(); });
+
+ connect(d_ptr->m_newPrefixAction, &QAction::triggered,
+ this, [this] { d_ptr->slotNewPrefix(); });
+ connect(d_ptr->m_addResourceFileAction, &QAction::triggered,
+ this, [this] { d_ptr->slotAddFiles(); });
+ connect(d_ptr->m_changePrefixAction, &QAction::triggered,
+ this, [this] { d_ptr->slotChangePrefix(); });
+ connect(d_ptr->m_changeLanguageAction, &QAction::triggered,
+ this, [this] { d_ptr->slotChangeLanguage(); });
+ connect(d_ptr->m_changeAliasAction, &QAction::triggered,
+ this, [this] { d_ptr->slotChangeAlias(); });
+ connect(d_ptr->m_clonePrefixAction, &QAction::triggered,
+ this, [this] { d_ptr->slotClonePrefix(); });
+ connect(d_ptr->m_removeAction, &QAction::triggered,
+ this, [this] { d_ptr->slotRemove(); });
+ connect(d_ptr->m_moveUpAction, &QAction::triggered,
+ this, [this] { d_ptr->slotMoveUp(); });
+ connect(d_ptr->m_moveDownAction, &QAction::triggered,
+ this, [this] { d_ptr->slotMoveDown(); });
d_ptr->m_ui.qrcFileList->setContextMenuPolicy(Qt::CustomContextMenu);
- connect(d_ptr->m_ui.qrcFileList, SIGNAL(customContextMenuRequested(QPoint)),
- this, SLOT(slotListWidgetContextMenuRequested(QPoint)));
- connect(d_ptr->m_ui.qrcFileList, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
- this, SLOT(slotCurrentQrcFileChanged(QListWidgetItem*)));
+ connect(d_ptr->m_ui.qrcFileList, &QListWidget::customContextMenuRequested,
+ this, [this](const QPoint &point) { d_ptr->slotListWidgetContextMenuRequested(point); });
+ connect(d_ptr->m_ui.qrcFileList, &QListWidget::currentItemChanged,
+ this, [this](QListWidgetItem *item) { d_ptr->slotCurrentQrcFileChanged(item); });
d_ptr->m_treeModel = new QStandardItemModel(this);
d_ptr->m_treeModel->setColumnCount(2);
@@ -1977,12 +1994,12 @@ QtResourceEditorDialog::QtResourceEditorDialog(QDesignerFormEditorInterface *cor
d_ptr->m_ui.resourceTreeView, &QTreeView::resizeColumnToContents);
d_ptr->m_ui.resourceTreeView->setTextElideMode(Qt::ElideLeft);
- connect(d_ptr->m_ui.resourceTreeView, SIGNAL(customContextMenuRequested(QPoint)),
- this, SLOT(slotTreeViewContextMenuRequested(QPoint)));
- connect(d_ptr->m_treeModel, SIGNAL(itemChanged(QStandardItem*)),
- this, SLOT(slotTreeViewItemChanged(QStandardItem*)));
- connect(d_ptr->m_treeSelection, SIGNAL(currentChanged(QModelIndex,QModelIndex)),
- this, SLOT(slotCurrentTreeViewItemChanged(QModelIndex)));
+ connect(d_ptr->m_ui.resourceTreeView, &QTreeView::customContextMenuRequested,
+ this, [this](const QPoint &point) { d_ptr->slotTreeViewContextMenuRequested(point); });
+ connect(d_ptr->m_treeModel, &QStandardItemModel::itemChanged,
+ this, [this](QStandardItem *item) { d_ptr->slotTreeViewItemChanged(item); });
+ connect(d_ptr->m_treeSelection, &QItemSelectionModel::currentChanged,
+ this, [this](const QModelIndex &index) { d_ptr->slotCurrentTreeViewItemChanged(index); });
d_ptr->m_ui.resourceTreeView->setColumnWidth(0, 200);
@@ -1992,10 +2009,10 @@ QtResourceEditorDialog::QtResourceEditorDialog(QDesignerFormEditorInterface *cor
d_ptr->m_moveDownQrcFileAction->setEnabled(false);
QDesignerSettingsInterface *settings = core->settingsManager();
- settings->beginGroup(QLatin1String(QrcDialogC));
+ settings->beginGroup(QrcDialogC);
- d_ptr->m_ui.splitter->restoreState(settings->value(QLatin1String(SplitterPosition)).toByteArray());
- const QVariant geometry = settings->value(QLatin1String(Geometry));
+ d_ptr->m_ui.splitter->restoreState(settings->value(SplitterPosition).toByteArray());
+ const QVariant geometry = settings->value(ResourceEditorGeometry);
if (geometry.metaType().id() == QMetaType::QByteArray) // Used to be a QRect up until 5.4.0, QTBUG-43374
restoreGeometry(geometry.toByteArray());
@@ -2005,11 +2022,13 @@ QtResourceEditorDialog::QtResourceEditorDialog(QDesignerFormEditorInterface *cor
QtResourceEditorDialog::~QtResourceEditorDialog()
{
QDesignerSettingsInterface *settings = d_ptr->m_core->settingsManager();
- settings->beginGroup(QLatin1String(QrcDialogC));
+ settings->beginGroup(QrcDialogC);
- settings->setValue(QLatin1String(SplitterPosition), d_ptr->m_ui.splitter->saveState());
- settings->setValue(QLatin1String(Geometry), saveGeometry());
+ settings->setValue(SplitterPosition, d_ptr->m_ui.splitter->saveState());
+ settings->setValue(ResourceEditorGeometry, saveGeometry());
settings->endGroup();
+
+ disconnect(d_ptr->m_qrcManager, nullptr, this, nullptr);
}
QtResourceModel *QtResourceEditorDialog::model() const
@@ -2050,13 +2069,13 @@ QString QtResourceEditorDialog::selectedResource() const
if (!currentResourcePrefix)
return QString();
- const QChar slash(QLatin1Char('/'));
+ const QChar slash(u'/');
QString resource = currentResourcePrefix->prefix();
if (!resource.startsWith(slash))
resource.prepend(slash);
if (!resource.endsWith(slash))
resource.append(slash);
- resource.prepend(QLatin1Char(':'));
+ resource.prepend(u':');
QtResourceFile *currentResourceFile = d_ptr->getCurrentResourceFile();
if (!currentResourceFile)
@@ -2066,15 +2085,15 @@ QString QtResourceEditorDialog::selectedResource() const
if (!currentResourceFile->alias().isEmpty())
resourceEnding = currentResourceFile->alias();
- const QString dotSlash(QStringLiteral("./"));
- const QString dotDotSlash(QStringLiteral("../"));
+ const auto dotSlash = "./"_L1;
+ const auto dotDotSlash = "../"_L1;
while (true) {
if (resourceEnding.startsWith(slash))
resourceEnding = resourceEnding.mid(1);
else if (resourceEnding.startsWith(dotSlash))
- resourceEnding = resourceEnding.mid(dotSlash.count());
+ resourceEnding = resourceEnding.mid(dotSlash.size());
else if (resourceEnding.startsWith(dotDotSlash))
- resourceEnding = resourceEnding.mid(dotDotSlash.count());
+ resourceEnding = resourceEnding.mid(dotDotSlash.size());
else
break;
}
diff --git a/src/designer/src/lib/shared/qtresourceeditordialog_p.h b/src/designer/src/lib/shared/qtresourceeditordialog_p.h
index 5a6ea9755..cc832a881 100644
--- a/src/designer/src/lib/shared/qtresourceeditordialog_p.h
+++ b/src/designer/src/lib/shared/qtresourceeditordialog_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -74,41 +49,6 @@ private:
QScopedPointer<class QtResourceEditorDialogPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtResourceEditorDialog)
Q_DISABLE_COPY_MOVE(QtResourceEditorDialog)
-
- Q_PRIVATE_SLOT(d_func(), void slotQrcFileInserted(QtQrcFile *))
- Q_PRIVATE_SLOT(d_func(), void slotQrcFileMoved(QtQrcFile *))
- Q_PRIVATE_SLOT(d_func(), void slotQrcFileRemoved(QtQrcFile *))
- Q_PRIVATE_SLOT(d_func(), void slotResourcePrefixInserted(QtResourcePrefix *))
- Q_PRIVATE_SLOT(d_func(), void slotResourcePrefixMoved(QtResourcePrefix *))
- Q_PRIVATE_SLOT(d_func(), void slotResourcePrefixChanged(QtResourcePrefix *))
- Q_PRIVATE_SLOT(d_func(), void slotResourceLanguageChanged(QtResourcePrefix *))
- Q_PRIVATE_SLOT(d_func(), void slotResourcePrefixRemoved(QtResourcePrefix *))
- Q_PRIVATE_SLOT(d_func(), void slotResourceFileInserted(QtResourceFile *))
- Q_PRIVATE_SLOT(d_func(), void slotResourceFileMoved(QtResourceFile *))
- Q_PRIVATE_SLOT(d_func(), void slotResourceAliasChanged(QtResourceFile *))
- Q_PRIVATE_SLOT(d_func(), void slotResourceFileRemoved(QtResourceFile *))
-
- Q_PRIVATE_SLOT(d_func(), void slotCurrentQrcFileChanged(QListWidgetItem *))
- Q_PRIVATE_SLOT(d_func(), void slotCurrentTreeViewItemChanged(const QModelIndex &))
- Q_PRIVATE_SLOT(d_func(), void slotListWidgetContextMenuRequested(const QPoint &))
- Q_PRIVATE_SLOT(d_func(), void slotTreeViewContextMenuRequested(const QPoint &))
- Q_PRIVATE_SLOT(d_func(), void slotTreeViewItemChanged(QStandardItem *))
-
- Q_PRIVATE_SLOT(d_func(), void slotNewQrcFile())
- Q_PRIVATE_SLOT(d_func(), void slotImportQrcFile())
- Q_PRIVATE_SLOT(d_func(), void slotRemoveQrcFile())
- Q_PRIVATE_SLOT(d_func(), void slotMoveUpQrcFile())
- Q_PRIVATE_SLOT(d_func(), void slotMoveDownQrcFile())
-
- Q_PRIVATE_SLOT(d_func(), void slotNewPrefix())
- Q_PRIVATE_SLOT(d_func(), void slotAddFiles())
- Q_PRIVATE_SLOT(d_func(), void slotChangePrefix())
- Q_PRIVATE_SLOT(d_func(), void slotChangeLanguage())
- Q_PRIVATE_SLOT(d_func(), void slotChangeAlias())
- Q_PRIVATE_SLOT(d_func(), void slotClonePrefix())
- Q_PRIVATE_SLOT(d_func(), void slotRemove())
- Q_PRIVATE_SLOT(d_func(), void slotMoveUp())
- Q_PRIVATE_SLOT(d_func(), void slotMoveDown())
};
QT_END_NAMESPACE
diff --git a/src/designer/src/lib/shared/qtresourcemodel.cpp b/src/designer/src/lib/shared/qtresourcemodel.cpp
index 391cf49a3..acee5cc98 100644
--- a/src/designer/src/lib/shared/qtresourcemodel.cpp
+++ b/src/designer/src/lib/shared/qtresourcemodel.cpp
@@ -1,35 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qtresourcemodel_p.h"
#include "rcc_p.h"
#include <QtCore/qstringlist.h>
+#include <QtCore/qhash.h>
#include <QtCore/qmap.h>
#include <QtCore/qresource.h>
#include <QtCore/qfileinfo.h>
@@ -71,19 +47,18 @@ public:
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;
- QMap<QtResourceSet *, QStringList> m_resourceSetToPaths;
- QMap<QtResourceSet *, bool> m_resourceSetToReload; // while path is recreated it needs to be reregistered
- // (it is - in the new current resource set, but when the path was used in
- // other resource set
- // then later when that resource set is activated it needs to be reregistered)
- 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 = nullptr;
+ QMap<QString, bool> m_pathToModified;
+ QHash<QtResourceSet *, QStringList> m_resourceSetToPaths;
+ QHash<QtResourceSet *, bool> m_resourceSetToReload; // while path is recreated it needs to be reregistered
+ // (it is - in the new current resource set, but when the path was used in
+ // other resource set
+ // then later when that resource set is activated it needs to be reregistered)
+ QHash<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 = nullptr;
- typedef QMap<QString, const QByteArray *> PathDataMap;
- PathDataMap m_pathToData;
+ QMap<QString, const QByteArray *> m_pathToData;
QMap<QString, QStringList> m_pathToContents; // qrc path to its contents.
QMap<QString, QString> m_fileToQrc; // this map contains the content of active resource set only.
@@ -152,7 +127,7 @@ const QByteArray *QtResourceModelPrivate::createResource(const QString &path, QS
contents->clear();
do {
// run RCC
- RCCResourceLibrary library;
+ RCCResourceLibrary library(3);
library.setVerbose(true);
library.setInputFiles(QStringList(path));
library.setFormat(RCCResourceLibrary::Binary);
@@ -163,7 +138,7 @@ const QByteArray *QtResourceModelPrivate::createResource(const QString &path, QS
break;
// return code cannot be fully trusted, might still be empty
const ResourceDataFileMap resMap = library.resourceDataFileMap();
- if (!library.output(buffer, errorDevice))
+ if (!library.output(buffer, buffer /* tempfile, unused */, errorDevice))
break;
*errorCount = library.failedResources().size();
@@ -200,7 +175,7 @@ void QtResourceModelPrivate::registerResourceSet(QtResourceSet *resourceSet)
for (const QString &path : toRegister) {
if (debugResourceModel)
qDebug() << "registerResourceSet " << path;
- const PathDataMap::const_iterator itRcc = m_pathToData.constFind(path);
+ const auto itRcc = m_pathToData.constFind(path);
if (itRcc != m_pathToData.constEnd()) { // otherwise data was not created yet
const QByteArray *data = itRcc.value();
if (data) {
@@ -228,7 +203,7 @@ void QtResourceModelPrivate::unregisterResourceSet(QtResourceSet *resourceSet)
for (const QString &path : toUnregister) {
if (debugResourceModel)
qDebug() << "unregisterResourceSet " << path;
- const PathDataMap::const_iterator itRcc = m_pathToData.constFind(path);
+ const auto itRcc = m_pathToData.constFind(path);
if (itRcc != m_pathToData.constEnd()) { // otherwise data was not created yet
const QByteArray *data = itRcc.value();
if (data) {
@@ -259,12 +234,12 @@ void QtResourceModelPrivate::activate(QtResourceSet *resourceSet, const QStringL
if (resourceSet && resourceSet->activeResourceFilePaths() != newPaths && !m_newlyCreated.contains(resourceSet))
newResourceSetChanged = true;
- PathDataMap newPathToData = m_pathToData;
+ auto newPathToData = m_pathToData;
for (const QString &path : newPaths) {
if (resourceSet && !m_pathToResourceSet[path].contains(resourceSet))
m_pathToResourceSet[path].append(resourceSet);
- const QMap<QString, bool>::iterator itMod = m_pathToModified.find(path);
+ const auto itMod = m_pathToModified.find(path);
if (itMod == m_pathToModified.end() || itMod.value()) { // new path or path is already created, but needs to be recreated
QStringList contents;
int qrcErrorCount;
@@ -313,7 +288,7 @@ void QtResourceModelPrivate::activate(QtResourceSet *resourceSet, const QStringL
*errorMessages = stderrOutput;
}
// register
- const QMap<QtResourceSet *, bool>::iterator itReload = m_resourceSetToReload.find(resourceSet);
+ const auto itReload = m_resourceSetToReload.find(resourceSet);
if (itReload != m_resourceSetToReload.end()) {
if (itReload.value()) {
newResourceSetChanged = true;
@@ -327,7 +302,7 @@ void QtResourceModelPrivate::activate(QtResourceSet *resourceSet, const QStringL
const bool needReregister = (oldActivePaths != newPaths) || newResourceSetChanged;
- QMap<QtResourceSet *, bool>::iterator itNew = m_newlyCreated.find(resourceSet);
+ const auto itNew = m_newlyCreated.find(resourceSet);
if (itNew != m_newlyCreated.end()) {
m_newlyCreated.remove(resourceSet);
if (needReregister)
@@ -335,7 +310,7 @@ void QtResourceModelPrivate::activate(QtResourceSet *resourceSet, const QStringL
}
if (!newResourceSetChanged && !needReregister && (m_currentResourceSet == resourceSet)) {
- for (const QByteArray *data : qAsConst(toDelete))
+ for (const QByteArray *data : std::as_const(toDelete))
deleteResource(data);
return; // nothing changed
@@ -344,7 +319,7 @@ void QtResourceModelPrivate::activate(QtResourceSet *resourceSet, const QStringL
if (needReregister)
unregisterResourceSet(m_currentResourceSet);
- for (const QByteArray *data : qAsConst(toDelete))
+ for (const QByteArray *data : std::as_const(toDelete))
deleteResource(data);
m_pathToData = newPathToData;
@@ -378,8 +353,8 @@ void QtResourceModelPrivate::removeOldPaths(QtResourceSet *resourceSet, const QS
const int idx = itRemove.value().indexOf(resourceSet);
if (idx >= 0)
itRemove.value().removeAt(idx);
- if (itRemove.value().count() == 0) {
- PathDataMap::iterator it = m_pathToData.find(oldPath);
+ if (itRemove.value().isEmpty()) {
+ const auto it = m_pathToData.find(oldPath);
if (it != m_pathToData.end())
deleteResource(it.value());
m_pathToResourceSet.erase(itRemove);
@@ -409,7 +384,7 @@ void QtResourceModelPrivate::setWatcherEnabled(const QString &path, bool enable)
void QtResourceModelPrivate::addWatcher(const QString &path)
{
- QMap<QString, bool>::ConstIterator it = m_fileWatchedMap.constFind(path);
+ const auto it = m_fileWatchedMap.constFind(path);
if (it != m_fileWatchedMap.constEnd() && !it.value())
return;
@@ -445,8 +420,8 @@ QtResourceModel::QtResourceModel(QObject *parent) :
d_ptr->q_ptr = this;
d_ptr->m_fileWatcher = new QFileSystemWatcher(this);
- connect(d_ptr->m_fileWatcher, SIGNAL(fileChanged(QString)),
- this, SLOT(slotFileChanged(QString)));
+ connect(d_ptr->m_fileWatcher, &QFileSystemWatcher::fileChanged,
+ this, [this](const QString &fileName) { d_ptr->slotFileChanged(fileName); });
}
QtResourceModel::~QtResourceModel()
@@ -465,16 +440,12 @@ QStringList QtResourceModel::loadedQrcFiles() const
bool QtResourceModel::isModified(const QString &path) const
{
- QMap<QString, bool>::const_iterator it = d_ptr->m_pathToModified.constFind(path);
- if (it != d_ptr->m_pathToModified.constEnd())
- return it.value();
- return true;
+ return d_ptr->m_pathToModified.value(path, true);
}
void QtResourceModel::setModified(const QString &path)
{
- QMap<QString, bool>::const_iterator itMod = d_ptr->m_pathToModified.constFind(path);
- if (itMod == d_ptr->m_pathToModified.constEnd())
+ if (!d_ptr->m_pathToModified.contains(path))
return;
d_ptr->m_pathToModified[path] = true;
@@ -539,19 +510,12 @@ void QtResourceModel::reload(const QString &path, int *errorCount, QString *erro
void QtResourceModel::reload(int *errorCount, QString *errorMessages)
{
- QMap<QString, bool>::iterator it = d_ptr->m_pathToModified.begin();
- QMap<QString, bool>::iterator itEnd = d_ptr->m_pathToModified.end(); // will it be valid when I iterate the map and change it???
- while (it != itEnd) {
- it = d_ptr->m_pathToModified.insert(it.key(), true);
- ++it;
- }
+ for (auto it = d_ptr->m_pathToModified.begin(), end = d_ptr->m_pathToModified.end(); it != end; ++it)
+ it.value() = true;
- QMap<QtResourceSet *, bool>::iterator itReload = d_ptr->m_resourceSetToReload.begin();
- QMap<QtResourceSet *, bool>::iterator itReloadEnd = d_ptr->m_resourceSetToReload.end();
- while (itReload != itReloadEnd) {
- itReload = d_ptr->m_resourceSetToReload.insert(itReload.key(), true); // empty resourceSets could be omitted here
- ++itReload;
- }
+ // empty resourceSets could be omitted here
+ for (auto itReload = d_ptr->m_resourceSetToReload.begin(), end = d_ptr->m_resourceSetToReload.end(); itReload != end; ++itReload)
+ itReload.value() = true;
d_ptr->activate(d_ptr->m_currentResourceSet, d_ptr->m_resourceSetToPaths.value(d_ptr->m_currentResourceSet), errorCount, errorMessages);
}
@@ -584,7 +548,7 @@ bool QtResourceModel::isWatcherEnabled() const
void QtResourceModel::setWatcherEnabled(const QString &path, bool enable)
{
- QMap<QString, bool>::Iterator it = d_ptr->m_fileWatchedMap.find(path);
+ const auto it = d_ptr->m_fileWatchedMap.find(path);
if (it == d_ptr->m_fileWatchedMap.end())
return;
diff --git a/src/designer/src/lib/shared/qtresourcemodel_p.h b/src/designer/src/lib/shared/qtresourcemodel_p.h
index 65d615f52..43afe5c50 100644
--- a/src/designer/src/lib/shared/qtresourcemodel_p.h
+++ b/src/designer/src/lib/shared/qtresourcemodel_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -123,8 +98,6 @@ private:
QScopedPointer<class QtResourceModelPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtResourceModel)
Q_DISABLE_COPY_MOVE(QtResourceModel)
-
- Q_PRIVATE_SLOT(d_func(), void slotFileChanged(const QString &))
};
QT_END_NAMESPACE
diff --git a/src/designer/src/lib/shared/qtresourceview.cpp b/src/designer/src/lib/shared/qtresourceview.cpp
index fa40394b5..5663b0ddc 100644
--- a/src/designer/src/lib/shared/qtresourceview.cpp
+++ b/src/designer/src/lib/shared/qtresourceview.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qtresourceview_p.h"
#include "qtresourcemodel_p.h"
@@ -57,6 +32,7 @@
#include <QtCore/qmimedata.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qdir.h>
+#include <QtCore/qhash.h>
#include <QtCore/qqueue.h>
#include <QtXml/qdom.h>
@@ -65,15 +41,17 @@
QT_BEGIN_NAMESPACE
-static const char *elementResourceData = "resource";
-static const char *typeAttribute = "type";
-static const char *typeImage = "image";
-static const char *typeStyleSheet = "stylesheet";
-static const char *typeOther = "other";
-static const char *fileAttribute = "file";
-static const char *SplitterPosition = "SplitterPosition";
-static const char *Geometry = "Geometry";
-static const char *ResourceViewDialogC = "ResourceDialog";
+using namespace Qt::StringLiterals;
+
+static constexpr auto elementResourceData = "resource"_L1;
+static constexpr auto typeAttribute = "type"_L1;
+static constexpr auto typeImage = "image"_L1;
+static constexpr auto typeStyleSheet = "stylesheet"_L1;
+static constexpr auto typeOther = "other"_L1;
+static constexpr auto fileAttribute = "file"_L1;
+static constexpr auto qrvSplitterPosition = "SplitterPosition"_L1;
+static constexpr auto qrvGeometry = "Geometry"_L1;
+static constexpr auto ResourceViewDialogC = "ResourceDialog"_L1;
// ---------------- ResourceListWidget: A list widget that has drag enabled
class ResourceListWidget : public QListWidget {
@@ -160,13 +138,13 @@ public:
QTreeWidget *m_treeWidget;
QListWidget *m_listWidget;
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
+ 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
QMap<QString, QTreeWidgetItem *> m_pathToItem;
- QMap<QTreeWidgetItem *, QString> m_itemToPath;
+ QHash<QTreeWidgetItem *, QString> m_itemToPath;
QMap<QString, QListWidgetItem *> m_resourceToItem;
- QMap<QListWidgetItem *, QString> m_itemToResource;
+ QHash<QListWidgetItem *, QString> m_itemToResource;
QAction *m_editResourcesAction = nullptr;
QAction *m_reloadResourcesAction = nullptr;
QAction *m_copyResourcePathAction = nullptr;
@@ -196,7 +174,7 @@ void QtResourceViewPrivate::restoreSettings()
QDesignerSettingsInterface *settings = m_core->settingsManager();
settings->beginGroup(m_settingsKey);
- m_splitter->restoreState(settings->value(QLatin1String(SplitterPosition)).toByteArray());
+ m_splitter->restoreState(settings->value(qrvSplitterPosition).toByteArray());
settings->endGroup();
}
@@ -208,7 +186,7 @@ void QtResourceViewPrivate::saveSettings()
QDesignerSettingsInterface *settings = m_core->settingsManager();
settings->beginGroup(m_settingsKey);
- settings->setValue(QLatin1String(SplitterPosition), m_splitter->saveState());
+ settings->setValue(qrvSplitterPosition, m_splitter->saveState());
settings->endGroup();
}
@@ -362,7 +340,7 @@ void QtResourceViewPrivate::createPaths()
return;
// Resource root up until 4.6 was ':', changed to ":/" as of 4.7
- const QString root(QStringLiteral(":/"));
+ const QString root(u":/"_s);
QMap<QString, QString> contents = m_resourceModel->contents();
for (auto it = contents.cbegin(), end = contents.cend(); it != end; ++it) {
@@ -378,15 +356,15 @@ void QtResourceViewPrivate::createPaths()
}
}
- QQueue<QPair<QString, QTreeWidgetItem *> > pathToParentItemQueue;
- pathToParentItemQueue.enqueue(qMakePair(root, static_cast<QTreeWidgetItem *>(nullptr)));
+ QQueue<std::pair<QString, QTreeWidgetItem *>> pathToParentItemQueue;
+ pathToParentItemQueue.enqueue(std::make_pair(root, static_cast<QTreeWidgetItem *>(nullptr)));
while (!pathToParentItemQueue.isEmpty()) {
- QPair<QString, QTreeWidgetItem *> pathToParentItem = pathToParentItemQueue.dequeue();
+ std::pair<QString, QTreeWidgetItem *> pathToParentItem = pathToParentItemQueue.dequeue();
const QString path = pathToParentItem.first;
QTreeWidgetItem *item = createPath(path, pathToParentItem.second);
const QStringList subPaths = m_pathToSubPaths.value(path);
for (const QString &subPath : subPaths)
- pathToParentItemQueue.enqueue(qMakePair(subPath, item));
+ pathToParentItemQueue.enqueue(std::make_pair(subPath, item));
}
}
@@ -402,7 +380,7 @@ void QtResourceViewPrivate::filterOutResources()
// 3) we hide these items which has pathToVisible value false.
const bool matchAll = m_filterPattern.isEmpty();
- const QString root(QStringLiteral(":/"));
+ const QString root(u":/"_s);
QQueue<QString> pathQueue;
pathQueue.enqueue(root);
@@ -445,21 +423,18 @@ void QtResourceViewPrivate::filterOutResources()
bool searchForNewPathWithContents = true;
if (!currentPath.isEmpty()) { // if the currentPath is empty we will search for a new path too
- QMap<QString, bool>::ConstIterator it = pathToMatchingContents.constFind(currentPath);
+ const auto it = pathToMatchingContents.constFind(currentPath);
if (it != pathToMatchingContents.constEnd() && it.value()) // the current item has contents, we don't need to search for another path
searchForNewPathWithContents = false;
}
if (searchForNewPathWithContents) {
// we find the first path with the matching contents
- QMap<QString, bool>::ConstIterator itContents = pathToMatchingContents.constBegin();
- while (itContents != pathToMatchingContents.constEnd()) {
+ for (auto itContents = pathToMatchingContents.cbegin(), cend = pathToMatchingContents.cend(); itContents != cend; ++itContents) {
if (itContents.value()) {
newCurrentPath = itContents.key(); // the new path will be activated
break;
}
-
- itContents++;
}
}
@@ -510,7 +485,7 @@ QTreeWidgetItem *QtResourceViewPrivate::createPath(const QString &path, QTreeWid
QFileInfo di(path);
substPath = di.fileName();
} else {
- substPath = QStringLiteral("<resource root>");
+ substPath = u"<resource root>"_s;
}
item->setText(0, substPath);
item->setToolTip(0, path);
@@ -555,23 +530,29 @@ QtResourceView::QtResourceView(QDesignerFormEditorInterface *core, QWidget *pare
{
d_ptr->q_ptr = this;
- QIcon editIcon = QIcon::fromTheme(QStringLiteral("document-properties"), qdesigner_internal::createIconSet(QStringLiteral("edit.png")));
+ QIcon editIcon = qdesigner_internal::createIconSet(QIcon::ThemeIcon::DocumentProperties,
+ "edit.png"_L1);
d_ptr->m_editResourcesAction = new QAction(editIcon, tr("Edit Resources..."), this);
d_ptr->m_toolBar->addAction(d_ptr->m_editResourcesAction);
- connect(d_ptr->m_editResourcesAction, SIGNAL(triggered()), this, SLOT(slotEditResources()));
+ connect(d_ptr->m_editResourcesAction, &QAction::triggered,
+ this, [this] { d_ptr->slotEditResources(); });
d_ptr->m_editResourcesAction->setEnabled(false);
- QIcon refreshIcon = QIcon::fromTheme(QStringLiteral("view-refresh"), qdesigner_internal::createIconSet(QStringLiteral("reload.png")));
+ QIcon refreshIcon = qdesigner_internal::createIconSet(QIcon::ThemeIcon::ViewRefresh,
+ "reload.png"_L1);
d_ptr->m_reloadResourcesAction = new QAction(refreshIcon, tr("Reload"), this);
d_ptr->m_toolBar->addAction(d_ptr->m_reloadResourcesAction);
- connect(d_ptr->m_reloadResourcesAction, SIGNAL(triggered()), this, SLOT(slotReloadResources()));
+ connect(d_ptr->m_reloadResourcesAction, &QAction::triggered,
+ this, [this] { d_ptr->slotReloadResources(); });
d_ptr->m_reloadResourcesAction->setEnabled(false);
#if QT_CONFIG(clipboard)
- QIcon copyIcon = QIcon::fromTheme(QStringLiteral("edit-copy"), qdesigner_internal::createIconSet(QStringLiteral("editcopy.png")));
+ QIcon copyIcon = qdesigner_internal::createIconSet(QIcon::ThemeIcon::EditCopy,
+ "editcopy.png"_L1);
d_ptr->m_copyResourcePathAction = new QAction(copyIcon, tr("Copy Path"), this);
- connect(d_ptr->m_copyResourcePathAction, SIGNAL(triggered()), this, SLOT(slotCopyResourcePath()));
+ connect(d_ptr->m_copyResourcePathAction, &QAction::triggered,
+ this, [this] { d_ptr->slotCopyResourcePath(); });
d_ptr->m_copyResourcePathAction->setEnabled(false);
#endif
@@ -579,7 +560,8 @@ QtResourceView::QtResourceView(QDesignerFormEditorInterface *core, QWidget *pare
QHBoxLayout *filterLayout = new QHBoxLayout(d_ptr->m_filterWidget);
filterLayout->setContentsMargins(0, 0, 0, 0);
QLineEdit *filterLineEdit = new QLineEdit(d_ptr->m_filterWidget);
- connect(filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotFilterChanged(QString)));
+ connect(filterLineEdit, &QLineEdit::textChanged,
+ this, [this](const QString &text) { d_ptr->slotFilterChanged(text); });
filterLineEdit->setPlaceholderText(tr("Filter"));
filterLineEdit->setClearButtonEnabled(true);
filterLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Ignored));
@@ -606,15 +588,15 @@ QtResourceView::QtResourceView(QDesignerFormEditorInterface *core, QWidget *pare
d_ptr->m_listWidget->setIconSize(QSize(48, 48));
d_ptr->m_listWidget->setGridSize(QSize(64, 64));
- connect(d_ptr->m_treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
- this, SLOT(slotCurrentPathChanged(QTreeWidgetItem*)));
- connect(d_ptr->m_listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
- this, SLOT(slotCurrentResourceChanged(QListWidgetItem*)));
- connect(d_ptr->m_listWidget, SIGNAL(itemActivated(QListWidgetItem*)),
- this, SLOT(slotResourceActivated(QListWidgetItem*)));
+ connect(d_ptr->m_treeWidget, &QTreeWidget::currentItemChanged,
+ this, [this](QTreeWidgetItem *item) { d_ptr->slotCurrentPathChanged(item); });
+ connect(d_ptr->m_listWidget, &QListWidget::currentItemChanged,
+ this, [this](QListWidgetItem *item) { d_ptr->slotCurrentResourceChanged(item); });
+ connect(d_ptr->m_listWidget, &QListWidget::itemActivated,
+ this, [this](QListWidgetItem *item) { d_ptr->slotResourceActivated(item); });
d_ptr->m_listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
- connect(d_ptr->m_listWidget, SIGNAL(customContextMenuRequested(QPoint)),
- this, SLOT(slotListWidgetContextMenuRequested(QPoint)));
+ connect(d_ptr->m_listWidget, &QListWidget::customContextMenuRequested,
+ this, [this](const QPoint &point) { d_ptr->slotListWidgetContextMenuRequested(point); });
}
QtResourceView::~QtResourceView()
@@ -693,10 +675,8 @@ void QtResourceView::setSettingsKey(const QString &key)
void QtResourceView::setResourceModel(QtResourceModel *model)
{
- if (d_ptr->m_resourceModel) {
- disconnect(d_ptr->m_resourceModel, SIGNAL(resourceSetActivated(QtResourceSet*,bool)),
- this, SLOT(slotResourceSetActivated(QtResourceSet*)));
- }
+ if (d_ptr->m_resourceModel)
+ disconnect(d_ptr->m_resourceModel, &QtResourceModel::resourceSetActivated, this, nullptr);
// clear here
d_ptr->m_treeWidget->clear();
@@ -707,8 +687,8 @@ void QtResourceView::setResourceModel(QtResourceModel *model)
if (!d_ptr->m_resourceModel)
return;
- connect(d_ptr->m_resourceModel, SIGNAL(resourceSetActivated(QtResourceSet*,bool)),
- this, SLOT(slotResourceSetActivated(QtResourceSet*)));
+ connect(d_ptr->m_resourceModel, &QtResourceModel::resourceSetActivated,
+ this, [this](QtResourceSet *resource) { d_ptr->slotResourceSetActivated(resource); });
// fill new here
d_ptr->slotResourceSetActivated(d_ptr->m_resourceModel->currentResourceSet());
@@ -738,19 +718,19 @@ bool QtResourceView::dragEnabled() const
QString QtResourceView::encodeMimeData(ResourceType resourceType, const QString &path)
{
QDomDocument doc;
- QDomElement elem = doc.createElement(QLatin1String(elementResourceData));
+ QDomElement elem = doc.createElement(elementResourceData);
switch (resourceType) {
case ResourceImage:
- elem.setAttribute(QLatin1String(typeAttribute), QLatin1String(typeImage));
+ elem.setAttribute(typeAttribute, typeImage);
break;
case ResourceStyleSheet:
- elem.setAttribute(QLatin1String(typeAttribute), QLatin1String(typeStyleSheet));
+ elem.setAttribute(typeAttribute, typeStyleSheet);
break;
case ResourceOther:
- elem.setAttribute(QLatin1String(typeAttribute), QLatin1String(typeOther));
+ elem.setAttribute(typeAttribute, typeOther);
break;
}
- elem.setAttribute(QLatin1String(fileAttribute), path);
+ elem.setAttribute(fileAttribute, path);
doc.appendChild(elem);
return doc.toString();
}
@@ -763,8 +743,8 @@ bool QtResourceView::decodeMimeData(const QMimeData *md, ResourceType *t, QStrin
bool QtResourceView::decodeMimeData(const QString &text, ResourceType *t, QString *file)
{
- const QString docElementName = QLatin1String(elementResourceData);
- static const QString docElementString = QLatin1Char('<') + docElementName;
+ static auto docElementName = elementResourceData;
+ static const QString docElementString = u'<' + docElementName;
if (text.isEmpty() || text.indexOf(docElementString) == -1)
return false;
@@ -778,18 +758,18 @@ bool QtResourceView::decodeMimeData(const QString &text, ResourceType *t, QStrin
return false;
if (t) {
- const QString typeAttr = QLatin1String(typeAttribute);
+ const QString typeAttr = typeAttribute;
if (domElement.hasAttribute (typeAttr)) {
- const QString typeValue = domElement.attribute(typeAttr, QLatin1String(typeOther));
- if (typeValue == QLatin1String(typeImage)) {
+ const QString typeValue = domElement.attribute(typeAttr, typeOther);
+ if (typeValue == typeImage) {
*t = ResourceImage;
} else {
- *t = typeValue == QLatin1String(typeStyleSheet) ? ResourceStyleSheet : ResourceOther;
+ *t = typeValue == typeStyleSheet ? ResourceStyleSheet : ResourceOther;
}
}
}
if (file) {
- const QString fileAttr = QLatin1String(fileAttribute);
+ const QString fileAttr = fileAttribute;
if (domElement.hasAttribute(fileAttr)) {
*file = domElement.attribute(fileAttr, QString());
} else {
@@ -822,7 +802,7 @@ QtResourceViewDialogPrivate::QtResourceViewDialogPrivate(QDesignerFormEditorInte
m_view(new QtResourceView(core)),
m_box(new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel))
{
- m_view->setSettingsKey(QLatin1String(ResourceViewDialogC));
+ m_view->setSettingsKey(ResourceViewDialogC);
}
// ------------ QtResourceViewDialog
@@ -831,7 +811,6 @@ QtResourceViewDialog::QtResourceViewDialog(QDesignerFormEditorInterface *core, Q
d_ptr(new QtResourceViewDialogPrivate(core))
{
setWindowTitle(tr("Select Resource"));
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
d_ptr->q_ptr = this;
QVBoxLayout *layout = new QVBoxLayout(this);
layout->addWidget(d_ptr->m_view);
@@ -839,14 +818,15 @@ QtResourceViewDialog::QtResourceViewDialog(QDesignerFormEditorInterface *core, Q
connect(d_ptr->m_box, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(d_ptr->m_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
connect(d_ptr->m_view, &QtResourceView::resourceActivated, this, &QDialog::accept);
- connect(d_ptr->m_view, SIGNAL(resourceSelected(QString)), this, SLOT(slotResourceSelected(QString)));
+ connect(d_ptr->m_view, &QtResourceView::resourceSelected,
+ this, [this](const QString &resource) { d_ptr->slotResourceSelected(resource); });
d_ptr->setOkButtonEnabled(false);
d_ptr->m_view->setResourceModel(core->resourceModel());
QDesignerSettingsInterface *settings = core->settingsManager();
- settings->beginGroup(QLatin1String(ResourceViewDialogC));
+ settings->beginGroup(ResourceViewDialogC);
- const QVariant geometry = settings->value(QLatin1String(Geometry));
+ const QVariant geometry = settings->value(qrvGeometry);
if (geometry.metaType().id() == QMetaType::QByteArray) // Used to be a QRect up until 5.4.0, QTBUG-43374.
restoreGeometry(geometry.toByteArray());
@@ -856,9 +836,9 @@ QtResourceViewDialog::QtResourceViewDialog(QDesignerFormEditorInterface *core, Q
QtResourceViewDialog::~QtResourceViewDialog()
{
QDesignerSettingsInterface *settings = d_ptr->m_core->settingsManager();
- settings->beginGroup(QLatin1String(ResourceViewDialogC));
+ settings->beginGroup(ResourceViewDialogC);
- settings->setValue(QLatin1String(Geometry), saveGeometry());
+ settings->setValue(qrvGeometry, saveGeometry());
settings->endGroup();
}
diff --git a/src/designer/src/lib/shared/qtresourceview_p.h b/src/designer/src/lib/shared/qtresourceview_p.h
index 17ec9c194..7d2ed6235 100644
--- a/src/designer/src/lib/shared/qtresourceview_p.h
+++ b/src/designer/src/lib/shared/qtresourceview_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -88,21 +63,9 @@ protected:
bool event(QEvent *event) override;
private:
-
QScopedPointer<class QtResourceViewPrivate> d_ptr;
Q_DECLARE_PRIVATE(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 *))
- Q_PRIVATE_SLOT(d_func(), void slotResourceActivated(QListWidgetItem *))
- Q_PRIVATE_SLOT(d_func(), void slotEditResources())
- Q_PRIVATE_SLOT(d_func(), void slotReloadResources())
-#if QT_CONFIG(clipboard)
- Q_PRIVATE_SLOT(d_func(), void slotCopyResourcePath())
-#endif
- Q_PRIVATE_SLOT(d_func(), void slotListWidgetContextMenuRequested(const QPoint &pos))
- Q_PRIVATE_SLOT(d_func(), void slotFilterChanged(const QString &pattern))
};
class QDESIGNER_SHARED_EXPORT QtResourceViewDialog : public QDialog
@@ -122,7 +85,6 @@ private:
QScopedPointer<class QtResourceViewDialogPrivate> d_ptr;
Q_DECLARE_PRIVATE(QtResourceViewDialog)
Q_DISABLE_COPY_MOVE(QtResourceViewDialog)
- Q_PRIVATE_SLOT(d_func(), void slotResourceSelected(const QString &))
};
QT_END_NAMESPACE
diff --git a/src/designer/src/lib/shared/rcc.cpp b/src/designer/src/lib/shared/rcc.cpp
index 6d271bd8a..38772d8a1 100644
--- a/src/designer/src/lib/shared/rcc.cpp
+++ b/src/designer/src/lib/shared/rcc.cpp
@@ -1,62 +1,42 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// Copyright (C) 2018 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
/* Note: This is a copy of qtbase/src/tools/rcc/rcc.cpp. */
#include "rcc_p.h"
-#include <QtCore/qbytearray.h>
-#include <QtCore/qdatetime.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qdir.h>
-#include <QtCore/qdiriterator.h>
-#include <QtCore/qfile.h>
-#include <QtCore/qiodevice.h>
-#include <QtCore/qlocale.h>
-#include <QtCore/qstack.h>
-#include <QtCore/qxmlstream.h>
+#include <qbytearray.h>
+#include <qdatetime.h>
+#include <qdebug.h>
+#include <qdir.h>
+#include <qdiriterator.h>
+#include <qfile.h>
+#include <qiodevice.h>
+#include <qlocale.h>
+#include <qstack.h>
+#include <qxmlstream.h>
#include <algorithm>
+#if QT_CONFIG(zstd)
+# include <zstd.h>
+#endif
+
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
enum {
CONSTANT_USENAMESPACE = 1,
CONSTANT_COMPRESSLEVEL_DEFAULT = -1,
+ CONSTANT_ZSTDCOMPRESSLEVEL_CHECK = 1, // Zstd level to check if compressing is a good idea
+ CONSTANT_ZSTDCOMPRESSLEVEL_STORE = 14, // Zstd level to actually store the data
CONSTANT_COMPRESSTHRESHOLD_DEFAULT = 70
};
-
-#define writeString(s) write(s, sizeof(s))
-
void RCCResourceLibrary::write(const char *str, int len)
{
- --len; // trailing \0 on string literals...
int n = m_out.size();
m_out.resize(n + len);
memcpy(m_out.data() + n, str, len);
@@ -64,12 +44,16 @@ void RCCResourceLibrary::write(const char *str, int len)
void RCCResourceLibrary::writeByteArray(const QByteArray &other)
{
- m_out.append(other);
+ if (m_format == Pass2) {
+ m_outDevice->write(other);
+ } else {
+ m_out.append(other);
+ }
}
static inline QString msgOpenReadFailed(const QString &fname, const QString &why)
{
- return QString::fromUtf8("Unable to open %1 for reading: %2\n").arg(fname).arg(why);
+ return QString::fromLatin1("Unable to open %1 for reading: %2\n").arg(fname, why);
}
@@ -84,18 +68,25 @@ class RCCFileInfo
public:
enum Flags
{
+ // must match qresource.cpp
NoFlags = 0x00,
Compressed = 0x01,
- Directory = 0x02
+ Directory = 0x02,
+ CompressedZstd = 0x04
};
- RCCFileInfo(const QString &name = QString(), const QFileInfo &fileInfo = QFileInfo(),
- QLocale::Language language = QLocale::C,
- QLocale::Country country = QLocale::AnyCountry,
- uint flags = NoFlags,
- int compressLevel = CONSTANT_COMPRESSLEVEL_DEFAULT,
- int compressThreshold = CONSTANT_COMPRESSTHRESHOLD_DEFAULT);
+
+ RCCFileInfo() = default;
+ RCCFileInfo(const QString &name, const QFileInfo &fileInfo, QLocale::Language language,
+ QLocale::Territory territory, uint flags,
+ RCCResourceLibrary::CompressionAlgorithm compressAlgo, int compressLevel,
+ int compressThreshold, bool noZstd, bool isEmpty);
+
~RCCFileInfo();
+ RCCFileInfo(const RCCFileInfo &) = delete;
+ RCCFileInfo &operator=(const RCCFileInfo &) = delete;
+ RCCFileInfo(RCCFileInfo &&) = default;
+ RCCFileInfo &operator=(RCCFileInfo &&other) = delete;
QString resourceName() const;
@@ -104,36 +95,40 @@ public:
qint64 writeDataName(RCCResourceLibrary &, qint64 offset);
void writeDataInfo(RCCResourceLibrary &lib);
- int m_flags;
+ int m_flags = NoFlags;
+ QLocale::Language m_language = QLocale::C;
+ QLocale::Territory m_territory = QLocale::AnyTerritory;
QString m_name;
- QLocale::Language m_language;
- QLocale::Country m_country;
QFileInfo m_fileInfo;
- RCCFileInfo *m_parent;
- QHash<QString, RCCFileInfo*> m_children;
- int m_compressLevel;
- int m_compressThreshold;
-
- qint64 m_nameOffset;
- qint64 m_dataOffset;
- qint64 m_childOffset;
+ RCCFileInfo *m_parent = nullptr;
+ QMultiHash<QString, RCCFileInfo *> m_children;
+
+ RCCResourceLibrary::CompressionAlgorithm m_compressAlgo = RCCResourceLibrary::CompressionAlgorithm::Best;
+ int m_compressLevel = CONSTANT_COMPRESSLEVEL_DEFAULT;
+ int m_compressThreshold = CONSTANT_COMPRESSTHRESHOLD_DEFAULT;
+ bool m_noZstd = false;
+ bool m_isEmpty = false;
+
+ qint64 m_nameOffset = 0;
+ qint64 m_dataOffset = 0;
+ qint64 m_childOffset = 0;
};
-RCCFileInfo::RCCFileInfo(const QString &name, const QFileInfo &fileInfo,
- QLocale::Language language, QLocale::Country country, uint flags,
- int compressLevel, int compressThreshold)
+RCCFileInfo::RCCFileInfo(const QString &name, const QFileInfo &fileInfo, QLocale::Language language,
+ QLocale::Territory territory, uint flags,
+ RCCResourceLibrary::CompressionAlgorithm compressAlgo, int compressLevel,
+ int compressThreshold, bool noZstd, bool isEmpty)
+ : m_flags(flags),
+ m_language(language),
+ m_territory(territory),
+ m_name(name),
+ m_fileInfo(fileInfo),
+ m_compressAlgo(compressAlgo),
+ m_compressLevel(compressLevel),
+ m_compressThreshold(compressThreshold),
+ m_noZstd(noZstd),
+ m_isEmpty(isEmpty)
{
- m_name = name;
- m_fileInfo = fileInfo;
- m_language = language;
- m_country = country;
- m_flags = flags;
- m_parent = nullptr;
- m_nameOffset = 0;
- m_dataOffset = 0;
- m_childOffset = 0;
- m_compressLevel = compressLevel;
- m_compressThreshold = compressThreshold;
}
RCCFileInfo::~RCCFileInfo()
@@ -145,20 +140,23 @@ QString RCCFileInfo::resourceName() const
{
QString resource = m_name;
for (RCCFileInfo *p = m_parent; p; p = p->m_parent)
- resource = resource.prepend(p->m_name + QLatin1Char('/'));
- return QLatin1Char(':') + resource;
+ resource = resource.prepend(p->m_name + u'/');
+ resource.prepend(u':');
+ return resource;
}
void RCCFileInfo::writeDataInfo(RCCResourceLibrary &lib)
{
- const bool text = (lib.m_format == RCCResourceLibrary::C_Code);
+ const bool text = lib.m_format == RCCResourceLibrary::C_Code;
+ const bool pass1 = lib.m_format == RCCResourceLibrary::Pass1;
+ const bool python = lib.m_format == RCCResourceLibrary::Python_Code;
//some info
- if (text) {
+ if (text || pass1) {
if (m_language != QLocale::C) {
lib.writeString(" // ");
lib.writeByteArray(resourceName().toLocal8Bit());
lib.writeString(" [");
- lib.writeByteArray(QByteArray::number(m_country));
+ lib.writeByteArray(QByteArray::number(m_territory));
lib.writeString("::");
lib.writeByteArray(QByteArray::number(m_language));
lib.writeString("[\n ");
@@ -190,120 +188,228 @@ void RCCFileInfo::writeDataInfo(RCCResourceLibrary &lib)
lib.writeNumber2(m_flags);
// locale
- lib.writeNumber2(m_country);
+ lib.writeNumber2(m_territory);
lib.writeNumber2(m_language);
//data offset
lib.writeNumber4(m_dataOffset);
}
- if (text)
+ if (text || pass1)
lib.writeChar('\n');
+ else if (python)
+ lib.writeString("\\\n");
+
+ if (lib.formatVersion() >= 2) {
+ // last modified time stamp
+ const QDateTime lastModified = m_fileInfo.lastModified(QTimeZone::UTC);
+ quint64 lastmod = quint64(lastModified.isValid() ? lastModified.toMSecsSinceEpoch() : 0);
+ static const quint64 sourceDate = 1000 * qgetenv("QT_RCC_SOURCE_DATE_OVERRIDE").toULongLong();
+ if (sourceDate != 0)
+ lastmod = sourceDate;
+ static const quint64 sourceDate2 = 1000 * qgetenv("SOURCE_DATE_EPOCH").toULongLong();
+ if (sourceDate2 != 0)
+ lastmod = sourceDate2;
+ lib.writeNumber8(lastmod);
+ if (text || pass1)
+ lib.writeChar('\n');
+ else if (python)
+ lib.writeString("\\\n");
+ }
}
qint64 RCCFileInfo::writeDataBlob(RCCResourceLibrary &lib, qint64 offset,
QString *errorMessage)
{
- const bool text = (lib.m_format == RCCResourceLibrary::C_Code);
+ const bool text = lib.m_format == RCCResourceLibrary::C_Code;
+ const bool pass1 = lib.m_format == RCCResourceLibrary::Pass1;
+ const bool pass2 = lib.m_format == RCCResourceLibrary::Pass2;
+ const bool binary = lib.m_format == RCCResourceLibrary::Binary;
+ const bool python = lib.m_format == RCCResourceLibrary::Python_Code;
//capture the offset
m_dataOffset = offset;
+ QByteArray data;
+
+ if (!m_isEmpty) {
+ //find the data to be written
+ QFile file(m_fileInfo.absoluteFilePath());
+ if (!file.open(QFile::ReadOnly)) {
+ *errorMessage = msgOpenReadFailed(m_fileInfo.absoluteFilePath(), file.errorString());
+ return 0;
+ }
- //find the data to be written
- QFile file(m_fileInfo.absoluteFilePath());
- if (!file.open(QFile::ReadOnly)) {
- *errorMessage = msgOpenReadFailed(m_fileInfo.absoluteFilePath(), file.errorString());
- return 0;
+ data = file.readAll();
}
- QByteArray data = file.readAll();
-#ifndef QT_NO_COMPRESS
// Check if compression is useful for this file
- if (m_compressLevel != 0 && data.size() != 0) {
- QByteArray compressed =
- qCompress(reinterpret_cast<uchar *>(data.data()), data.size(), m_compressLevel);
-
- int compressRatio = int(100.0 * (data.size() - compressed.size()) / data.size());
- if (compressRatio >= m_compressThreshold) {
- data = compressed;
- m_flags |= Compressed;
+ if (data.size() != 0) {
+#if QT_CONFIG(zstd)
+ if (m_compressAlgo == RCCResourceLibrary::CompressionAlgorithm::Best && !m_noZstd) {
+ m_compressAlgo = RCCResourceLibrary::CompressionAlgorithm::Zstd;
+ m_compressLevel = 19; // not ZSTD_maxCLevel(), as 20+ are experimental
+ }
+ if (m_compressAlgo == RCCResourceLibrary::CompressionAlgorithm::Zstd && !m_noZstd) {
+ if (lib.m_zstdCCtx == nullptr)
+ lib.m_zstdCCtx = ZSTD_createCCtx();
+ qsizetype size = data.size();
+ size = ZSTD_COMPRESSBOUND(size);
+
+ int compressLevel = m_compressLevel;
+ if (compressLevel < 0)
+ compressLevel = CONSTANT_ZSTDCOMPRESSLEVEL_CHECK;
+
+ QByteArray compressed(size, Qt::Uninitialized);
+ char *dst = const_cast<char *>(compressed.constData());
+ size_t n = ZSTD_compressCCtx(lib.m_zstdCCtx, dst, size,
+ data.constData(), data.size(),
+ compressLevel);
+ if (n * 100.0 < data.size() * 1.0 * (100 - m_compressThreshold) ) {
+ // compressing is worth it
+ if (m_compressLevel < 0) {
+ // heuristic compression, so recompress
+ n = ZSTD_compressCCtx(lib.m_zstdCCtx, dst, size,
+ data.constData(), data.size(),
+ CONSTANT_ZSTDCOMPRESSLEVEL_STORE);
+ }
+ if (ZSTD_isError(n)) {
+ QString msg = QString::fromLatin1("%1: error: compression with zstd failed: %2\n")
+ .arg(m_name, QString::fromUtf8(ZSTD_getErrorName(n)));
+ lib.m_errorDevice->write(msg.toUtf8());
+ } else if (lib.verbose()) {
+ QString msg = QString::fromLatin1("%1: note: compressed using zstd (%2 -> %3)\n")
+ .arg(m_name).arg(data.size()).arg(n);
+ lib.m_errorDevice->write(msg.toUtf8());
+ }
+
+ lib.m_overallFlags |= CompressedZstd;
+ m_flags |= CompressedZstd;
+ data = std::move(compressed);
+ data.truncate(n);
+ } else if (lib.verbose()) {
+ QString msg = QString::fromLatin1("%1: note: not compressed\n").arg(m_name);
+ lib.m_errorDevice->write(msg.toUtf8());
+ }
+ }
+#endif
+#ifndef QT_NO_COMPRESS
+ if (m_compressAlgo == RCCResourceLibrary::CompressionAlgorithm::Best) {
+ m_compressAlgo = RCCResourceLibrary::CompressionAlgorithm::Zlib;
+ m_compressLevel = 9;
+ }
+ if (m_compressAlgo == RCCResourceLibrary::CompressionAlgorithm::Zlib) {
+ QByteArray compressed =
+ qCompress(reinterpret_cast<uchar *>(data.data()), data.size(), m_compressLevel);
+
+ int compressRatio = int(100.0 * (data.size() - compressed.size()) / data.size());
+ if (compressRatio >= m_compressThreshold) {
+ if (lib.verbose()) {
+ QString msg = QString::fromLatin1("%1: note: compressed using zlib (%2 -> %3)\n")
+ .arg(m_name).arg(data.size()).arg(compressed.size());
+ lib.m_errorDevice->write(msg.toUtf8());
+ }
+ data = compressed;
+ lib.m_overallFlags |= Compressed;
+ m_flags |= Compressed;
+ } else if (lib.verbose()) {
+ QString msg = QString::fromLatin1("%1: note: not compressed\n").arg(m_name);
+ lib.m_errorDevice->write(msg.toUtf8());
+ }
}
- }
#endif // QT_NO_COMPRESS
+ }
// some info
- if (text) {
+ if (text || pass1) {
lib.writeString(" // ");
lib.writeByteArray(m_fileInfo.absoluteFilePath().toLocal8Bit());
lib.writeString("\n ");
}
// write the length
-
- lib.writeNumber4(data.size());
- if (text)
+ if (text || binary || pass2 || python)
+ lib.writeNumber4(data.size());
+ if (text || pass1)
lib.writeString("\n ");
+ else if (python)
+ lib.writeString("\\\n");
offset += 4;
// write the payload
const char *p = data.constData();
- if (text) {
+ if (text || python) {
for (int i = data.size(), j = 0; --i >= 0; --j) {
lib.writeHex(*p++);
if (j == 0) {
- lib.writeString("\n ");
+ if (text)
+ lib.writeString("\n ");
+ else
+ lib.writeString("\\\n");
j = 16;
}
}
- } else {
- for (int i = data.size(); --i >= 0; )
- lib.writeChar(*p++);
+ } else if (binary || pass2) {
+ lib.writeByteArray(data);
}
offset += data.size();
// done
- if (text)
+ if (text || pass1)
lib.writeString("\n ");
+ else if (python)
+ lib.writeString("\\\n");
+
return offset;
}
qint64 RCCFileInfo::writeDataName(RCCResourceLibrary &lib, qint64 offset)
{
- const bool text = (lib.m_format == RCCResourceLibrary::C_Code);
+ const bool text = lib.m_format == RCCResourceLibrary::C_Code;
+ const bool pass1 = lib.m_format == RCCResourceLibrary::Pass1;
+ const bool python = lib.m_format == RCCResourceLibrary::Python_Code;
// capture the offset
m_nameOffset = offset;
// some info
- if (text) {
+ if (text || pass1) {
lib.writeString(" // ");
lib.writeByteArray(m_name.toLocal8Bit());
lib.writeString("\n ");
}
// write the length
- lib.writeNumber2(m_name.length());
- if (text)
+ lib.writeNumber2(m_name.size());
+ if (text || pass1)
lib.writeString("\n ");
+ else if (python)
+ lib.writeString("\\\n");
offset += 2;
// write the hash
lib.writeNumber4(qt_hash(m_name));
- if (text)
+ if (text || pass1)
lib.writeString("\n ");
+ else if (python)
+ lib.writeString("\\\n");
offset += 4;
// write the m_name
const QChar *unicode = m_name.unicode();
- for (int i = 0; i < m_name.length(); ++i) {
+ for (int i = 0; i < m_name.size(); ++i) {
lib.writeNumber2(unicode[i].unicode());
- if (text && i % 16 == 0)
+ if ((text || pass1) && i % 16 == 0)
lib.writeString("\n ");
+ else if (python && i % 16 == 0)
+ lib.writeString("\\\n");
}
- offset += m_name.length()*2;
+ offset += m_name.size()*2;
// done
- if (text)
+ if (text || pass1)
lib.writeString("\n ");
+ else if (python)
+ lib.writeString("\\\n");
+
return offset;
}
@@ -315,35 +421,48 @@ qint64 RCCFileInfo::writeDataName(RCCResourceLibrary &lib, qint64 offset)
///////////////////////////////////////////////////////////
RCCResourceLibrary::Strings::Strings() :
- TAG_RCC(QLatin1String("RCC")),
- TAG_RESOURCE(QLatin1String("qresource")),
- TAG_FILE(QLatin1String("file")),
- ATTRIBUTE_LANG(QLatin1String("lang")),
- ATTRIBUTE_PREFIX(QLatin1String("prefix")),
- ATTRIBUTE_ALIAS(QLatin1String("alias")),
- ATTRIBUTE_THRESHOLD(QLatin1String("threshold")),
- ATTRIBUTE_COMPRESS(QLatin1String("compress"))
+ TAG_RCC("RCC"_L1),
+ TAG_RESOURCE("qresource"_L1),
+ TAG_FILE("file"_L1),
+ ATTRIBUTE_LANG("lang"_L1),
+ ATTRIBUTE_PREFIX("prefix"_L1),
+ ATTRIBUTE_ALIAS("alias"_L1),
+ ATTRIBUTE_EMPTY("empty"_L1),
+ ATTRIBUTE_THRESHOLD("threshold"_L1),
+ ATTRIBUTE_COMPRESS("compress"_L1),
+ ATTRIBUTE_COMPRESSALGO(QStringLiteral("compression-algorithm"))
{
}
-RCCResourceLibrary::RCCResourceLibrary()
+RCCResourceLibrary::RCCResourceLibrary(quint8 formatVersion)
: m_root(nullptr),
m_format(C_Code),
m_verbose(false),
+ m_compressionAlgo(CompressionAlgorithm::Best),
m_compressLevel(CONSTANT_COMPRESSLEVEL_DEFAULT),
m_compressThreshold(CONSTANT_COMPRESSTHRESHOLD_DEFAULT),
m_treeOffset(0),
m_namesOffset(0),
m_dataOffset(0),
+ m_overallFlags(0),
m_useNameSpace(CONSTANT_USENAMESPACE),
- m_errorDevice(0)
+ m_errorDevice(nullptr),
+ m_outDevice(nullptr),
+ m_formatVersion(formatVersion),
+ m_noZstd(false)
{
m_out.reserve(30 * 1000 * 1000);
+#if QT_CONFIG(zstd)
+ m_zstdCCtx = nullptr;
+#endif
}
RCCResourceLibrary::~RCCResourceLibrary()
{
delete m_root;
+#if QT_CONFIG(zstd)
+ ZSTD_freeCCtx(m_zstdCCtx);
+#endif
}
enum RCCXmlTag {
@@ -351,12 +470,24 @@ enum RCCXmlTag {
ResourceTag,
FileTag
};
+Q_DECLARE_TYPEINFO(RCCXmlTag, Q_PRIMITIVE_TYPE);
+
+static bool parseBoolean(QStringView value, QString *errorMsg)
+{
+ if (value.compare("true"_L1, Qt::CaseInsensitive) == 0)
+ return true;
+ if (value.compare("false"_L1, Qt::CaseInsensitive) == 0)
+ return false;
+
+ *errorMsg = QString::fromLatin1("Invalid value for boolean attribute: '%1'").arg(value);
+ return false;
+}
bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
- const QString &fname, QString currentPath, bool ignoreErrors)
+ const QString &fname, QString currentPath, bool listMode)
{
Q_ASSERT(m_errorDevice);
- const QChar slash = QLatin1Char('/');
+ const QChar slash = u'/';
if (!currentPath.isEmpty() && !currentPath.endsWith(slash))
currentPath += slash;
@@ -365,8 +496,10 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
QString prefix;
QLocale::Language language = QLocale::c().language();
- QLocale::Country country = QLocale::c().country();
+ QLocale::Territory territory = QLocale::c().territory();
QString alias;
+ bool empty = false;
+ auto compressAlgo = m_compressionAlgo;
int compressLevel = m_compressLevel;
int compressThreshold = m_compressThreshold;
@@ -376,28 +509,28 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
case QXmlStreamReader::StartElement:
if (reader.name() == m_strings.TAG_RCC) {
if (!tokens.isEmpty())
- reader.raiseError(QLatin1String("expected <RCC> tag"));
+ reader.raiseError("expected <RCC> tag"_L1);
else
tokens.push(RccTag);
} else if (reader.name() == m_strings.TAG_RESOURCE) {
if (tokens.isEmpty() || tokens.top() != RccTag) {
- reader.raiseError(QLatin1String("unexpected <RESOURCE> tag"));
+ reader.raiseError("unexpected <RESOURCE> tag"_L1);
} else {
tokens.push(ResourceTag);
QXmlStreamAttributes attributes = reader.attributes();
language = QLocale::c().language();
- country = QLocale::c().country();
+ territory = QLocale::c().territory();
if (attributes.hasAttribute(m_strings.ATTRIBUTE_LANG)) {
QString attribute = attributes.value(m_strings.ATTRIBUTE_LANG).toString();
QLocale lang = QLocale(attribute);
language = lang.language();
- if (2 == attribute.length()) {
+ if (2 == attribute.size()) {
// Language only
- country = QLocale::AnyCountry;
+ territory = QLocale::AnyTerritory;
} else {
- country = lang.country();
+ territory = lang.territory();
}
}
@@ -411,7 +544,7 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
}
} else if (reader.name() == m_strings.TAG_FILE) {
if (tokens.isEmpty() || tokens.top() != ResourceTag) {
- reader.raiseError(QLatin1String("unexpected <FILE> tag"));
+ reader.raiseError("unexpected <FILE> tag"_L1);
} else {
tokens.push(FileTag);
@@ -420,20 +553,35 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
if (attributes.hasAttribute(m_strings.ATTRIBUTE_ALIAS))
alias = attributes.value(m_strings.ATTRIBUTE_ALIAS).toString();
+ compressAlgo = m_compressionAlgo;
compressLevel = m_compressLevel;
- if (attributes.hasAttribute(m_strings.ATTRIBUTE_COMPRESS))
- compressLevel = attributes.value(m_strings.ATTRIBUTE_COMPRESS).toString().toInt();
-
compressThreshold = m_compressThreshold;
+
+ QString errorString;
+ if (attributes.hasAttribute(m_strings.ATTRIBUTE_EMPTY))
+ empty = parseBoolean(attributes.value(m_strings.ATTRIBUTE_EMPTY), &errorString);
+ else
+ empty = false;
+
+ if (attributes.hasAttribute(m_strings.ATTRIBUTE_COMPRESSALGO))
+ compressAlgo = parseCompressionAlgorithm(attributes.value(m_strings.ATTRIBUTE_COMPRESSALGO), &errorString);
+ if (errorString.isEmpty() && attributes.hasAttribute(m_strings.ATTRIBUTE_COMPRESS)) {
+ QString value = attributes.value(m_strings.ATTRIBUTE_COMPRESS).toString();
+ compressLevel = parseCompressionLevel(compressAlgo, value, &errorString);
+ }
+
+ // Special case for -no-compress
+ if (m_compressLevel == -2)
+ compressAlgo = CompressionAlgorithm::None;
+
if (attributes.hasAttribute(m_strings.ATTRIBUTE_THRESHOLD))
compressThreshold = attributes.value(m_strings.ATTRIBUTE_THRESHOLD).toString().toInt();
- // Special case for -no-compress. Overrides all other settings.
- if (m_compressLevel == -2)
- compressLevel = 0;
+ if (!errorString.isEmpty())
+ reader.raiseError(errorString);
}
} else {
- reader.raiseError(QString(QLatin1String("unexpected tag: %1")).arg(reader.name().toString()));
+ reader.raiseError("unexpected tag: %1"_L1.arg(reader.name().toString()));
}
break;
@@ -442,17 +590,17 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
if (!tokens.isEmpty() && tokens.top() == RccTag)
tokens.pop();
else
- reader.raiseError(QLatin1String("unexpected closing tag"));
+ reader.raiseError("unexpected closing tag"_L1);
} else if (reader.name() == m_strings.TAG_RESOURCE) {
if (!tokens.isEmpty() && tokens.top() == ResourceTag)
tokens.pop();
else
- reader.raiseError(QLatin1String("unexpected closing tag"));
+ reader.raiseError("unexpected closing tag"_L1);
} else if (reader.name() == m_strings.TAG_FILE) {
if (!tokens.isEmpty() && tokens.top() == FileTag)
tokens.pop();
else
- reader.raiseError(QLatin1String("unexpected closing tag"));
+ reader.raiseError("unexpected closing tag"_L1);
}
break;
@@ -460,7 +608,7 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
if (reader.isWhitespace())
break;
if (tokens.isEmpty() || tokens.top() != FileTag) {
- reader.raiseError(QLatin1String("unexpected text"));
+ reader.raiseError("unexpected text"_L1);
} else {
QString fileName = reader.text().toString();
if (fileName.isEmpty()) {
@@ -472,7 +620,7 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
alias = fileName;
alias = QDir::cleanPath(alias);
- while (alias.startsWith(QLatin1String("../")))
+ while (alias.startsWith("../"_L1))
alias.remove(0, 3);
alias = QDir::cleanPath(m_resourceRoot) + prefix + alias;
@@ -480,58 +628,62 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
if (QDir::isRelativePath(absFileName))
absFileName.prepend(currentPath);
QFileInfo file(absFileName);
- if (!file.exists()) {
- m_failedResources.push_back(absFileName);
- const QString msg = QString::fromLatin1("RCC: Error in '%1': Cannot find file '%2'\n").arg(fname).arg(fileName);
- m_errorDevice->write(msg.toUtf8());
- if (ignoreErrors)
- continue;
- else
- return false;
- } else if (file.isFile()) {
+ if (file.isDir()) {
+ QDir dir(file.filePath());
+ if (!alias.endsWith(slash))
+ alias += slash;
+
+ QStringList filePaths;
+ QDirIterator it(dir, QDirIterator::FollowSymlinks|QDirIterator::Subdirectories);
+ while (it.hasNext()) {
+ it.next();
+ if (it.fileName() == "."_L1 || it.fileName() == ".."_L1)
+ continue;
+ filePaths.append(it.filePath());
+ }
+
+ // make rcc output deterministic
+ std::sort(filePaths.begin(), filePaths.end());
+
+ for (const QString &filePath : filePaths) {
+ QFileInfo child(filePath);
+ const bool arc =
+ addFile(alias + child.fileName(),
+ RCCFileInfo(child.fileName(), child, language, territory,
+ child.isDir() ? RCCFileInfo::Directory
+ : RCCFileInfo::NoFlags,
+ compressAlgo, compressLevel, compressThreshold,
+ m_noZstd, empty));
+ if (!arc)
+ m_failedResources.push_back(child.fileName());
+ }
+ } else if (listMode || file.isFile()) {
const bool arc =
addFile(alias,
RCCFileInfo(alias.section(slash, -1),
file,
language,
- country,
+ territory,
RCCFileInfo::NoFlags,
+ compressAlgo,
compressLevel,
- compressThreshold)
+ compressThreshold,
+ m_noZstd, empty)
);
if (!arc)
m_failedResources.push_back(absFileName);
+ } else if (file.exists()) {
+ m_failedResources.push_back(absFileName);
+ const QString msg = QString::fromLatin1("RCC: Error in '%1': Entry '%2' is neither a file nor a directory\n")
+ .arg(fname, fileName);
+ m_errorDevice->write(msg.toUtf8());
+ return false;
} else {
- QDir dir;
- if (file.isDir()) {
- dir.setPath(file.filePath());
- } else {
- dir.setPath(file.path());
- dir.setNameFilters(QStringList(file.fileName()));
- if (alias.endsWith(file.fileName()))
- alias = alias.left(alias.length()-file.fileName().length());
- }
- if (!alias.endsWith(slash))
- alias += slash;
- QDirIterator it(dir, QDirIterator::FollowSymlinks|QDirIterator::Subdirectories);
- while (it.hasNext()) {
- it.next();
- QFileInfo child(it.fileInfo());
- if (child.fileName() != QLatin1String(".") && child.fileName() != QLatin1String("..")) {
- const bool arc =
- addFile(alias + child.fileName(),
- RCCFileInfo(child.fileName(),
- child,
- language,
- country,
- RCCFileInfo::NoFlags,
- compressLevel,
- compressThreshold)
- );
- if (!arc)
- m_failedResources.push_back(child.fileName());
- }
- }
+ m_failedResources.push_back(absFileName);
+ const QString msg = QString::fromLatin1("RCC: Error in '%1': Cannot find file '%2'\n")
+ .arg(fname, fileName);
+ m_errorDevice->write(msg.toUtf8());
+ return false;
}
}
break;
@@ -542,8 +694,6 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
}
if (reader.hasError()) {
- if (ignoreErrors)
- return true;
int errorLine = reader.lineNumber();
int errorColumn = reader.columnNumber();
QString errorMessage = reader.errorString();
@@ -553,37 +703,41 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
}
if (m_root == nullptr) {
- const QString msg = QString::fromUtf8("RCC: Warning: No resources in '%1'.\n").arg(fname);
+ const QString msg = QString::fromLatin1("RCC: Warning: No resources in '%1'.\n").arg(fname);
m_errorDevice->write(msg.toUtf8());
- if (!ignoreErrors && m_format == Binary) {
+ if (!listMode && m_format == Binary) {
// create dummy entry, otherwise loading with QResource will crash
- m_root = new RCCFileInfo(QString(), QFileInfo(),
- QLocale::C, QLocale::AnyCountry, RCCFileInfo::Directory);
+ m_root = new RCCFileInfo{};
+ m_root->m_flags = RCCFileInfo::Directory;
}
}
return true;
}
-bool RCCResourceLibrary::addFile(const QString &alias, const RCCFileInfo &file)
+bool RCCResourceLibrary::addFile(const QString &alias, RCCFileInfo file)
{
Q_ASSERT(m_errorDevice);
if (file.m_fileInfo.size() > 0xffffffff) {
- const QString msg = QString::fromUtf8("File too big: %1\n").arg(file.m_fileInfo.absoluteFilePath());
+ const QString msg = QString::fromLatin1("File too big: %1\n").arg(file.m_fileInfo.absoluteFilePath());
m_errorDevice->write(msg.toUtf8());
return false;
}
- if (!m_root)
- m_root = new RCCFileInfo(QString(), QFileInfo(), QLocale::C, QLocale::AnyCountry, RCCFileInfo::Directory);
+ if (!m_root) {
+ m_root = new RCCFileInfo{};
+ m_root->m_flags = RCCFileInfo::Directory;
+ }
RCCFileInfo *parent = m_root;
- const QStringList nodes = alias.split(QLatin1Char('/'));
+ const QStringList nodes = alias.split(u'/');
for (int i = 1; i < nodes.size()-1; ++i) {
const QString node = nodes.at(i);
if (node.isEmpty())
continue;
if (!parent->m_children.contains(node)) {
- RCCFileInfo *s = new RCCFileInfo(node, QFileInfo(), QLocale::C, QLocale::AnyCountry, RCCFileInfo::Directory);
+ RCCFileInfo *s = new RCCFileInfo{};
+ s->m_name = node;
+ s->m_flags = RCCFileInfo::Directory;
s->m_parent = parent;
parent->m_children.insert(node, s);
parent = s;
@@ -593,12 +747,18 @@ bool RCCResourceLibrary::addFile(const QString &alias, const RCCFileInfo &file)
}
const QString filename = nodes.at(nodes.size()-1);
- RCCFileInfo *s = new RCCFileInfo(file);
+ RCCFileInfo *s = new RCCFileInfo(std::move(file));
s->m_parent = parent;
- if (parent->m_children.contains(filename)) {
- for (const QString &fileName : qAsConst(m_fileNames)) {
- qWarning("%s: Warning: potential duplicate alias detected: '%s'",
- qPrintable(fileName), qPrintable(filename));
+ auto cbegin = parent->m_children.constFind(filename);
+ auto cend = parent->m_children.constEnd();
+ for (auto it = cbegin; it != cend; ++it) {
+ if (it.key() == filename && it.value()->m_language == s->m_language &&
+ it.value()->m_territory == s->m_territory) {
+ for (const QString &name : std::as_const(m_fileNames)) {
+ qWarning("%s: Warning: potential duplicate alias detected: '%s'",
+ qPrintable(name), qPrintable(filename));
+ }
+ break;
}
}
parent->m_children.insert(filename, s);
@@ -616,22 +776,22 @@ void RCCResourceLibrary::reset()
}
-bool RCCResourceLibrary::readFiles(bool ignoreErrors, QIODevice &errorDevice)
+bool RCCResourceLibrary::readFiles(bool listMode, QIODevice &errorDevice)
{
reset();
m_errorDevice = &errorDevice;
//read in data
if (m_verbose) {
- const QString msg = QString::fromUtf8("Processing %1 files [%2]\n")
- .arg(m_fileNames.size()).arg(static_cast<int>(ignoreErrors));
+ const QString msg = QString::fromLatin1("Processing %1 files [listMode=%2]\n")
+ .arg(m_fileNames.size()).arg(static_cast<int>(listMode));
m_errorDevice->write(msg.toUtf8());
}
for (int i = 0; i < m_fileNames.size(); ++i) {
QFile fileIn;
QString fname = m_fileNames.at(i);
QString pwd;
- if (fname == QLatin1String("-")) {
- fname = QLatin1String("(stdin)");
+ if (fname == "-"_L1) {
+ fname = "(stdin)"_L1;
pwd = QDir::currentPath();
fileIn.setFileName(fname);
if (!fileIn.open(stdin, QIODevice::ReadOnly)) {
@@ -647,11 +807,11 @@ bool RCCResourceLibrary::readFiles(bool ignoreErrors, QIODevice &errorDevice)
}
}
if (m_verbose) {
- const QString msg = QString::fromUtf8("Interpreting %1\n").arg(fname);
+ const QString msg = QString::fromLatin1("Interpreting %1\n").arg(fname);
m_errorDevice->write(msg.toUtf8());
}
- if (!interpretResourceFile(&fileIn, fname, pwd, ignoreErrors))
+ if (!interpretResourceFile(&fileIn, fname, pwd, listMode))
return false;
}
return true;
@@ -667,12 +827,13 @@ QStringList RCCResourceLibrary::dataFiles() const
pending.push(m_root);
while (!pending.isEmpty()) {
RCCFileInfo *file = pending.pop();
- for (QHash<QString, RCCFileInfo*>::iterator it = file->m_children.begin();
+ for (auto it = file->m_children.begin();
it != file->m_children.end(); ++it) {
RCCFileInfo *child = it.value();
if (child->m_flags & RCCFileInfo::Directory)
pending.push(child);
- ret.append(child->m_fileInfo.filePath());
+ else
+ ret.append(child->m_fileInfo.filePath());
}
}
return ret;
@@ -681,12 +842,11 @@ QStringList RCCResourceLibrary::dataFiles() const
// Determine map of resource identifier (':/newPrefix/images/p1.png') to file via recursion
static void resourceDataFileMapRecursion(const RCCFileInfo *m_root, const QString &path, RCCResourceLibrary::ResourceDataFileMap &m)
{
- const QChar slash = QLatin1Char('/');
- for (auto it = m_root->m_children.constBegin(), cend = m_root->m_children.constEnd(); it != cend; ++it) {
+ const QChar slash = u'/';
+ const auto cend = m_root->m_children.constEnd();
+ for (auto it = m_root->m_children.constBegin(); it != cend; ++it) {
const RCCFileInfo *child = it.value();
- QString childName = path;
- childName += slash;
- childName += child->m_name;
+ const QString childName = path + slash + child->m_name;
if (child->m_flags & RCCFileInfo::Directory) {
resourceDataFileMapRecursion(child, childName, m);
} else {
@@ -699,13 +859,100 @@ RCCResourceLibrary::ResourceDataFileMap RCCResourceLibrary::resourceDataFileMap(
{
ResourceDataFileMap rc;
if (m_root)
- resourceDataFileMapRecursion(m_root, QString(QLatin1Char(':')), rc);
+ resourceDataFileMapRecursion(m_root, QString(u':'), rc);
return rc;
}
-bool RCCResourceLibrary::output(QIODevice &outDevice, QIODevice &errorDevice)
+RCCResourceLibrary::CompressionAlgorithm RCCResourceLibrary::parseCompressionAlgorithm(QStringView value, QString *errorMsg)
+{
+ if (value == "best"_L1)
+ return CompressionAlgorithm::Best;
+ if (value == "zlib"_L1) {
+#ifdef QT_NO_COMPRESS
+ *errorMsg = "zlib support not compiled in"_L1;
+#else
+ return CompressionAlgorithm::Zlib;
+#endif
+ } else if (value == "zstd"_L1) {
+#if QT_CONFIG(zstd)
+ return CompressionAlgorithm::Zstd;
+#else
+ *errorMsg = "Zstandard support not compiled in"_L1;
+#endif
+ } else if (value != "none"_L1) {
+ *errorMsg = QString::fromLatin1("Unknown compression algorithm '%1'").arg(value);
+ }
+
+ return CompressionAlgorithm::None;
+}
+
+int RCCResourceLibrary::parseCompressionLevel(CompressionAlgorithm algo, const QString &level, QString *errorMsg)
+{
+ bool ok;
+ int c = level.toInt(&ok);
+ if (ok) {
+ switch (algo) {
+ case CompressionAlgorithm::None:
+ case CompressionAlgorithm::Best:
+ return 0;
+ case CompressionAlgorithm::Zlib:
+ if (c >= 1 && c <= 9)
+ return c;
+ break;
+ case CompressionAlgorithm::Zstd:
+#if QT_CONFIG(zstd)
+ if (c >= 0 && c <= ZSTD_maxCLevel())
+ return c;
+#endif
+ break;
+ }
+ }
+
+ *errorMsg = QString::fromLatin1("invalid compression level '%1'").arg(level);
+ return 0;
+}
+
+bool RCCResourceLibrary::output(QIODevice &outDevice, QIODevice &tempDevice, QIODevice &errorDevice)
{
m_errorDevice = &errorDevice;
+
+ if (m_format == Pass2) {
+ const char pattern[] = { 'Q', 'R', 'C', '_', 'D', 'A', 'T', 'A' };
+ bool foundSignature = false;
+
+ while (true) {
+ char c;
+ for (int i = 0; i < 8; ) {
+ if (!tempDevice.getChar(&c)) {
+ if (foundSignature)
+ return true;
+ m_errorDevice->write("No data signature found\n");
+ return false;
+ }
+
+ if (c != pattern[i]) {
+ for (int k = 0; k < i; ++k)
+ outDevice.putChar(pattern[k]);
+ i = 0;
+ }
+
+ if (c == pattern[i]) {
+ ++i;
+ } else {
+ outDevice.putChar(c);
+ }
+ }
+
+ m_outDevice = &outDevice;
+ quint64 start = outDevice.pos();
+ writeDataBlobs();
+ quint64 len = outDevice.pos() - start;
+
+ tempDevice.seek(tempDevice.pos() + len - 8);
+ foundSignature = true;
+ }
+ }
+
//write out
if (m_verbose)
m_errorDevice->write("Outputting code\n");
@@ -735,18 +982,44 @@ bool RCCResourceLibrary::output(QIODevice &outDevice, QIODevice &errorDevice)
return true;
}
+void RCCResourceLibrary::writeDecimal(int value)
+{
+ Q_ASSERT(m_format != RCCResourceLibrary::Binary);
+ char buf[std::numeric_limits<int>::digits10 + 2];
+ int n = snprintf(buf, sizeof(buf), "%d", value);
+ write(buf, n);
+}
+
+static const char hexDigits[] = "0123456789abcdef";
+
+inline void RCCResourceLibrary::write2HexDigits(quint8 number)
+{
+ writeChar(hexDigits[number >> 4]);
+ writeChar(hexDigits[number & 0xf]);
+}
+
void RCCResourceLibrary::writeHex(quint8 tmp)
{
- const char digits[] = "0123456789abcdef";
- writeChar('0');
- writeChar('x');
- if (tmp < 16) {
- writeChar(digits[tmp]);
- } else {
- writeChar(digits[tmp >> 4]);
- writeChar(digits[tmp & 0xf]);
+ switch (m_format) {
+ case RCCResourceLibrary::Python_Code:
+ if (tmp >= 32 && tmp < 127 && tmp != '"' && tmp != '\\') {
+ writeChar(char(tmp));
+ } else {
+ writeChar('\\');
+ writeChar('x');
+ write2HexDigits(tmp);
+ }
+ break;
+ default:
+ writeChar('0');
+ writeChar('x');
+ if (tmp < 16)
+ writeChar(hexDigits[tmp]);
+ else
+ write2HexDigits(tmp);
+ writeChar(',');
+ break;
}
- writeChar(',');
}
void RCCResourceLibrary::writeNumber2(quint16 number)
@@ -762,12 +1035,49 @@ void RCCResourceLibrary::writeNumber2(quint16 number)
void RCCResourceLibrary::writeNumber4(quint32 number)
{
- if (m_format == RCCResourceLibrary::Binary) {
+ if (m_format == RCCResourceLibrary::Pass2) {
+ m_outDevice->putChar(char(number >> 24));
+ m_outDevice->putChar(char(number >> 16));
+ m_outDevice->putChar(char(number >> 8));
+ m_outDevice->putChar(char(number));
+ } else if (m_format == RCCResourceLibrary::Binary) {
+ writeChar(number >> 24);
+ writeChar(number >> 16);
+ writeChar(number >> 8);
+ writeChar(number);
+ } else {
+ writeHex(number >> 24);
+ writeHex(number >> 16);
+ writeHex(number >> 8);
+ writeHex(number);
+ }
+}
+
+void RCCResourceLibrary::writeNumber8(quint64 number)
+{
+ if (m_format == RCCResourceLibrary::Pass2) {
+ m_outDevice->putChar(char(number >> 56));
+ m_outDevice->putChar(char(number >> 48));
+ m_outDevice->putChar(char(number >> 40));
+ m_outDevice->putChar(char(number >> 32));
+ m_outDevice->putChar(char(number >> 24));
+ m_outDevice->putChar(char(number >> 16));
+ m_outDevice->putChar(char(number >> 8));
+ m_outDevice->putChar(char(number));
+ } else if (m_format == RCCResourceLibrary::Binary) {
+ writeChar(number >> 56);
+ writeChar(number >> 48);
+ writeChar(number >> 40);
+ writeChar(number >> 32);
writeChar(number >> 24);
writeChar(number >> 16);
writeChar(number >> 8);
writeChar(number);
} else {
+ writeHex(number >> 56);
+ writeHex(number >> 48);
+ writeHex(number >> 40);
+ writeHex(number >> 32);
writeHex(number >> 24);
writeHex(number >> 16);
writeHex(number >> 8);
@@ -777,24 +1087,40 @@ void RCCResourceLibrary::writeNumber4(quint32 number)
bool RCCResourceLibrary::writeHeader()
{
- if (m_format == C_Code) {
+ switch (m_format) {
+ case C_Code:
+ case Pass1:
writeString("/****************************************************************************\n");
writeString("** Resource object code\n");
writeString("**\n");
- writeString("** Created: ");
- writeByteArray(QDateTime::currentDateTime().toString().toLatin1());
- writeString("\n** by: The Resource Compiler for Qt version ");
+ writeString("** Created by: The Resource Compiler for Qt version ");
writeByteArray(QT_VERSION_STR);
writeString("\n**\n");
writeString("** WARNING! All changes made in this file will be lost!\n");
writeString( "*****************************************************************************/\n\n");
- writeString("#include <QtCore/qglobal.h>\n\n");
- } else if (m_format == Binary) {
+ break;
+ case Python_Code:
+ writeString("# Resource object code (Python 3)\n");
+ writeString("# Created by: object code\n");
+ writeString("# Created by: The Resource Compiler for Qt version ");
+ writeByteArray(QT_VERSION_STR);
+ writeString("\n");
+ writeString("# WARNING! All changes made in this file will be lost!\n\n");
+ writeString("from PySide");
+ writeByteArray(QByteArray::number(QT_VERSION_MAJOR));
+ writeString(" import QtCore\n\n");
+ break;
+ case Binary:
writeString("qres");
writeNumber4(0);
writeNumber4(0);
writeNumber4(0);
writeNumber4(0);
+ if (m_formatVersion >= 3)
+ writeNumber4(m_overallFlags);
+ break;
+ default:
+ break;
}
return true;
}
@@ -802,22 +1128,30 @@ bool RCCResourceLibrary::writeHeader()
bool RCCResourceLibrary::writeDataBlobs()
{
Q_ASSERT(m_errorDevice);
- if (m_format == C_Code)
+ switch (m_format) {
+ case C_Code:
writeString("static const unsigned char qt_resource_data[] = {\n");
- else if (m_format == Binary)
+ break;
+ case Python_Code:
+ writeString("qt_resource_data = b\"\\\n");
+ break;
+ case Binary:
m_dataOffset = m_out.size();
- QStack<RCCFileInfo*> pending;
+ break;
+ default:
+ break;
+ }
if (!m_root)
return false;
+ QStack<RCCFileInfo*> pending;
pending.push(m_root);
qint64 offset = 0;
QString errorMessage;
while (!pending.isEmpty()) {
RCCFileInfo *file = pending.pop();
- for (QHash<QString, RCCFileInfo*>::iterator it = file->m_children.begin();
- it != file->m_children.end(); ++it) {
+ for (auto it = file->m_children.cbegin(); it != file->m_children.cend(); ++it) {
RCCFileInfo *child = it.value();
if (child->m_flags & RCCFileInfo::Directory)
pending.push(child);
@@ -830,17 +1164,42 @@ bool RCCResourceLibrary::writeDataBlobs()
}
}
}
- if (m_format == C_Code)
+ switch (m_format) {
+ case C_Code:
writeString("\n};\n\n");
+ break;
+ case Python_Code:
+ writeString("\"\n\n");
+ break;
+ case Pass1:
+ if (offset < 8)
+ offset = 8;
+ writeString("\nstatic const unsigned char qt_resource_data[");
+ writeByteArray(QByteArray::number(offset));
+ writeString("] = { 'Q', 'R', 'C', '_', 'D', 'A', 'T', 'A' };\n\n");
+ break;
+ default:
+ break;
+ }
return true;
}
bool RCCResourceLibrary::writeDataNames()
{
- if (m_format == C_Code)
+ switch (m_format) {
+ case C_Code:
+ case Pass1:
writeString("static const unsigned char qt_resource_name[] = {\n");
- else if (m_format == Binary)
+ break;
+ case Python_Code:
+ writeString("qt_resource_name = b\"\\\n");
+ break;
+ case Binary:
m_namesOffset = m_out.size();
+ break;
+ default:
+ break;
+ }
QHash<QString, int> names;
QStack<RCCFileInfo*> pending;
@@ -852,8 +1211,7 @@ bool RCCResourceLibrary::writeDataNames()
qint64 offset = 0;
while (!pending.isEmpty()) {
RCCFileInfo *file = pending.pop();
- for (QHash<QString, RCCFileInfo*>::iterator it = file->m_children.begin();
- it != file->m_children.end(); ++it) {
+ for (auto it = file->m_children.cbegin(); it != file->m_children.cend(); ++it) {
RCCFileInfo *child = it.value();
if (child->m_flags & RCCFileInfo::Directory)
pending.push(child);
@@ -865,22 +1223,46 @@ bool RCCResourceLibrary::writeDataNames()
}
}
}
- if (m_format == C_Code)
+ switch (m_format) {
+ case C_Code:
+ case Pass1:
writeString("\n};\n\n");
+ break;
+ case Python_Code:
+ writeString("\"\n\n");
+ break;
+ default:
+ break;
+ }
return true;
}
-static bool qt_rcc_compare_hash(const RCCFileInfo *left, const RCCFileInfo *right)
+struct qt_rcc_compare_hash
{
- return qt_hash(left->m_name) < qt_hash(right->m_name);
-}
+ typedef bool result_type;
+ result_type operator()(const RCCFileInfo *left, const RCCFileInfo *right) const
+ {
+ return qt_hash(left->m_name) < qt_hash(right->m_name);
+ }
+};
bool RCCResourceLibrary::writeDataStructure()
{
- if (m_format == C_Code)
+ switch (m_format) {
+ case C_Code:
+ case Pass1:
writeString("static const unsigned char qt_resource_struct[] = {\n");
- else if (m_format == Binary)
+ break;
+ case Python_Code:
+ writeString("qt_resource_struct = b\"\\\n");
+ break;
+ case Binary:
m_treeOffset = m_out.size();
+ break;
+ default:
+ break;
+ }
+
QStack<RCCFileInfo*> pending;
if (!m_root)
@@ -894,11 +1276,12 @@ bool RCCResourceLibrary::writeDataStructure()
file->m_childOffset = offset;
//sort by hash value for binary lookup
- auto children = file->m_children.values();
- std::sort(children.begin(), children.end(), qt_rcc_compare_hash);
+ QList<RCCFileInfo*> m_children = file->m_children.values();
+ std::sort(m_children.begin(), m_children.end(), qt_rcc_compare_hash());
//write out the actual data now
- for (RCCFileInfo *child : children) {
+ for (int i = 0; i < m_children.size(); ++i) {
+ RCCFileInfo *child = m_children.at(i);
++offset;
if (child->m_flags & RCCFileInfo::Directory)
pending.push(child);
@@ -912,18 +1295,28 @@ bool RCCResourceLibrary::writeDataStructure()
RCCFileInfo *file = pending.pop();
//sort by hash value for binary lookup
- auto children = file->m_children.values();
- std::sort(children.begin(), children.end(), qt_rcc_compare_hash);
+ QList<RCCFileInfo*> m_children = file->m_children.values();
+ std::sort(m_children.begin(), m_children.end(), qt_rcc_compare_hash());
//write out the actual data now
- for (RCCFileInfo *child : children) {
+ for (int i = 0; i < m_children.size(); ++i) {
+ RCCFileInfo *child = m_children.at(i);
child->writeDataInfo(*this);
if (child->m_flags & RCCFileInfo::Directory)
pending.push(child);
}
}
- if (m_format == C_Code)
+ switch (m_format) {
+ case C_Code:
+ case Pass1:
writeString("\n};\n\n");
+ break;
+ case Python_Code:
+ writeString("\"\n\n");
+ break;
+ default:
+ break;
+ }
return true;
}
@@ -931,7 +1324,7 @@ bool RCCResourceLibrary::writeDataStructure()
void RCCResourceLibrary::writeMangleNamespaceFunction(const QByteArray &name)
{
if (m_useNameSpace) {
- writeString("QT_MANGLE_NAMESPACE(");
+ writeString("QT_RCC_MANGLE_NAMESPACE(");
writeByteArray(name);
writeChar(')');
} else {
@@ -942,7 +1335,7 @@ void RCCResourceLibrary::writeMangleNamespaceFunction(const QByteArray &name)
void RCCResourceLibrary::writeAddNamespaceFunction(const QByteArray &name)
{
if (m_useNameSpace) {
- writeString("QT_PREPEND_NAMESPACE(");
+ writeString("QT_RCC_PREPEND_NAMESPACE(");
writeByteArray(name);
writeChar(')');
} else {
@@ -950,82 +1343,173 @@ void RCCResourceLibrary::writeAddNamespaceFunction(const QByteArray &name)
}
}
-static bool unacceptableChar(QChar qc)
-{
- if (qc.isDigit())
- return false;
- if (!qc.isLetter())
- return true;
- auto c = qc.toLower().toLatin1();
- return c < 'a' || c > 'z';
-}
-
bool RCCResourceLibrary::writeInitializer()
{
- if (m_format == C_Code) {
+ if (m_format == C_Code || m_format == Pass1) {
//write("\nQT_BEGIN_NAMESPACE\n");
- QString initName = m_initName;
- if (!initName.isEmpty()) {
- initName.prepend(QLatin1Char('_'));
- std::replace_if(initName.begin(), initName.end(),
- unacceptableChar, QLatin1Char('_'));
+ QString initNameStr = m_initName;
+ if (!initNameStr.isEmpty()) {
+ initNameStr.prepend(u'_');
+ auto isAsciiLetterOrNumber = [] (QChar c) -> bool {
+ ushort ch = c.unicode();
+ return (ch >= '0' && ch <= '9') ||
+ (ch >= 'A' && ch <= 'Z') ||
+ (ch >= 'a' && ch <= 'z') ||
+ ch == '_';
+ };
+ for (QChar &c : initNameStr) {
+ if (!isAsciiLetterOrNumber(c))
+ c = u'_';
+ }
}
+ QByteArray initName = initNameStr.toLatin1();
//init
- if (m_useNameSpace)
- writeString("QT_BEGIN_NAMESPACE\n\n");
+ if (m_useNameSpace) {
+ writeString("#ifdef QT_NAMESPACE\n"
+ "# define QT_RCC_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name\n"
+ "# define QT_RCC_MANGLE_NAMESPACE0(x) x\n"
+ "# define QT_RCC_MANGLE_NAMESPACE1(a, b) a##_##b\n"
+ "# define QT_RCC_MANGLE_NAMESPACE2(a, b) QT_RCC_MANGLE_NAMESPACE1(a,b)\n"
+ "# define QT_RCC_MANGLE_NAMESPACE(name) QT_RCC_MANGLE_NAMESPACE2( \\\n"
+ " QT_RCC_MANGLE_NAMESPACE0(name), QT_RCC_MANGLE_NAMESPACE0(QT_NAMESPACE))\n"
+ "#else\n"
+ "# define QT_RCC_PREPEND_NAMESPACE(name) name\n"
+ "# define QT_RCC_MANGLE_NAMESPACE(name) name\n"
+ "#endif\n\n");
+
+ writeString("#ifdef QT_NAMESPACE\n"
+ "namespace QT_NAMESPACE {\n"
+ "#endif\n\n");
+ }
+
if (m_root) {
- writeString("extern Q_CORE_EXPORT bool qRegisterResourceData\n "
+ writeString("bool qRegisterResourceData"
"(int, const unsigned char *, "
- "const unsigned char *, const unsigned char *);\n\n");
- writeString("extern Q_CORE_EXPORT bool qUnregisterResourceData\n "
+ "const unsigned char *, const unsigned char *);\n");
+ writeString("bool qUnregisterResourceData"
"(int, const unsigned char *, "
"const unsigned char *, const unsigned char *);\n\n");
+
+ if (m_overallFlags & (RCCFileInfo::Compressed | RCCFileInfo::CompressedZstd)) {
+ // use variable relocations with ELF and Mach-O
+ writeString("#if defined(__ELF__) || defined(__APPLE__)\n");
+ if (m_overallFlags & RCCFileInfo::Compressed) {
+ writeString("static inline unsigned char qResourceFeatureZlib()\n"
+ "{\n"
+ " extern const unsigned char qt_resourceFeatureZlib;\n"
+ " return qt_resourceFeatureZlib;\n"
+ "}\n");
+ }
+ if (m_overallFlags & RCCFileInfo::CompressedZstd) {
+ writeString("static inline unsigned char qResourceFeatureZstd()\n"
+ "{\n"
+ " extern const unsigned char qt_resourceFeatureZstd;\n"
+ " return qt_resourceFeatureZstd;\n"
+ "}\n");
+ }
+ writeString("#else\n");
+ if (m_overallFlags & RCCFileInfo::Compressed)
+ writeString("unsigned char qResourceFeatureZlib();\n");
+ if (m_overallFlags & RCCFileInfo::CompressedZstd)
+ writeString("unsigned char qResourceFeatureZstd();\n");
+ writeString("#endif\n\n");
+ }
}
+
if (m_useNameSpace)
- writeString("QT_END_NAMESPACE\n\n\n");
- QString initResources = QLatin1String("qInitResources");
+ writeString("#ifdef QT_NAMESPACE\n}\n#endif\n\n");
+
+ QByteArray initResources = "qInitResources";
initResources += initName;
+
+ // Work around -Wmissing-declarations warnings.
writeString("int ");
- writeMangleNamespaceFunction(initResources.toLatin1());
+ writeMangleNamespaceFunction(initResources);
+ writeString("();\n");
+
+ writeString("int ");
+ writeMangleNamespaceFunction(initResources);
writeString("()\n{\n");
if (m_root) {
- writeString(" ");
+ writeString(" int version = ");
+ writeDecimal(m_formatVersion);
+ writeString(";\n ");
writeAddNamespaceFunction("qRegisterResourceData");
- writeString("\n (0x01, qt_resource_struct, "
- "qt_resource_name, qt_resource_data);\n");
+ writeString("\n (version, qt_resource_struct, "
+ "qt_resource_name, qt_resource_data);\n");
}
writeString(" return 1;\n");
writeString("}\n\n");
- writeString("Q_CONSTRUCTOR_FUNCTION(");
- writeMangleNamespaceFunction(initResources.toLatin1());
- writeString(")\n\n");
//cleanup
- QString cleanResources = QLatin1String("qCleanupResources");
+ QByteArray cleanResources = "qCleanupResources";
cleanResources += initName;
+
+ // Work around -Wmissing-declarations warnings.
writeString("int ");
- writeMangleNamespaceFunction(cleanResources.toLatin1());
+ writeMangleNamespaceFunction(cleanResources);
+ writeString("();\n");
+
+ writeString("int ");
+ writeMangleNamespaceFunction(cleanResources);
writeString("()\n{\n");
if (m_root) {
- writeString(" ");
+ writeString(" int version = ");
+ writeDecimal(m_formatVersion);
+ writeString(";\n ");
+
+ // ODR-use certain symbols from QtCore if we require optional features
+ if (m_overallFlags & RCCFileInfo::Compressed) {
+ writeString("version += ");
+ writeAddNamespaceFunction("qResourceFeatureZlib()");
+ writeString(";\n ");
+ }
+ if (m_overallFlags & RCCFileInfo::CompressedZstd) {
+ writeString("version += ");
+ writeAddNamespaceFunction("qResourceFeatureZstd()");
+ writeString(";\n ");
+ }
+
writeAddNamespaceFunction("qUnregisterResourceData");
- writeString("\n (0x01, qt_resource_struct, "
+ writeString("\n (version, qt_resource_struct, "
"qt_resource_name, qt_resource_data);\n");
}
writeString(" return 1;\n");
writeString("}\n\n");
- writeString("Q_DESTRUCTOR_FUNCTION(");
- writeMangleNamespaceFunction(cleanResources.toLatin1());
- writeString(")\n\n");
+
+ // -Wexit-time-destructors was added to clang 3.0.0 in 2011.
+ writeString("#ifdef __clang__\n"
+ "# pragma clang diagnostic push\n"
+ "# pragma clang diagnostic ignored \"-Wexit-time-destructors\"\n"
+ "#endif\n\n");
+
+ writeString("namespace {\n"
+ " struct initializer {\n");
+
+ if (m_useNameSpace) {
+ writeByteArray(" initializer() { QT_RCC_MANGLE_NAMESPACE(" + initResources + ")(); }\n"
+ " ~initializer() { QT_RCC_MANGLE_NAMESPACE(" + cleanResources + ")(); }\n");
+ } else {
+ writeByteArray(" initializer() { " + initResources + "(); }\n"
+ " ~initializer() { " + cleanResources + "(); }\n");
+ }
+ writeString(" } dummy;\n"
+ "}\n\n");
+
+ writeString("#ifdef __clang__\n"
+ "# pragma clang diagnostic pop\n"
+ "#endif\n");
+
+
} else if (m_format == Binary) {
int i = 4;
char *p = m_out.data();
- p[i++] = 0; // 0x01
p[i++] = 0;
p[i++] = 0;
- p[i++] = 1;
+ p[i++] = 0;
+ p[i++] = m_formatVersion;
p[i++] = (m_treeOffset >> 24) & 0xff;
p[i++] = (m_treeOffset >> 16) & 0xff;
@@ -1041,6 +1525,23 @@ bool RCCResourceLibrary::writeInitializer()
p[i++] = (m_namesOffset >> 16) & 0xff;
p[i++] = (m_namesOffset >> 8) & 0xff;
p[i++] = (m_namesOffset >> 0) & 0xff;
+
+ if (m_formatVersion >= 3) {
+ p[i++] = (m_overallFlags >> 24) & 0xff;
+ p[i++] = (m_overallFlags >> 16) & 0xff;
+ p[i++] = (m_overallFlags >> 8) & 0xff;
+ p[i++] = (m_overallFlags >> 0) & 0xff;
+ }
+ } else if (m_format == Python_Code) {
+ writeString("def qInitResources():\n");
+ writeString(" QtCore.qRegisterResourceData(0x");
+ write2HexDigits(m_formatVersion);
+ writeString(", qt_resource_struct, qt_resource_name, qt_resource_data)\n\n");
+ writeString("def qCleanupResources():\n");
+ writeString(" QtCore.qUnregisterResourceData(0x");
+ write2HexDigits(m_formatVersion);
+ writeString(", qt_resource_struct, qt_resource_name, qt_resource_data)\n\n");
+ writeString("qInitResources()\n");
}
return true;
}
diff --git a/src/designer/src/lib/shared/rcc_p.h b/src/designer/src/lib/shared/rcc_p.h
index bd7e1c44c..82d17c875 100644
--- a/src/designer/src/lib/shared/rcc_p.h
+++ b/src/designer/src/lib/shared/rcc_p.h
@@ -1,30 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// Copyright (C) 2018 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -40,9 +16,11 @@
#ifndef RCC_H
#define RCC_H
-#include <QtCore/qstringlist.h>
-#include <QtCore/qhash.h>
-#include <QtCore/qstring.h>
+#include <qstringlist.h>
+#include <qhash.h>
+#include <qstring.h>
+
+typedef struct ZSTD_CCtx_s ZSTD_CCtx;
QT_BEGIN_NAMESPACE
@@ -57,14 +35,14 @@ class RCCResourceLibrary
RCCResourceLibrary &operator=(const RCCResourceLibrary &);
public:
- RCCResourceLibrary();
+ RCCResourceLibrary(quint8 formatVersion);
~RCCResourceLibrary();
- bool output(QIODevice &out, QIODevice &errorDevice);
+ bool output(QIODevice &outDevice, QIODevice &tempDevice, QIODevice &errorDevice);
- bool readFiles(bool ignoreErrors, QIODevice &errorDevice);
+ bool readFiles(bool listMode, QIODevice &errorDevice);
- enum Format { Binary, C_Code };
+ enum Format { Binary, C_Code, Pass1, Pass2, Python_Code };
void setFormat(Format f) { m_format = f; }
Format format() const { return m_format; }
@@ -83,6 +61,22 @@ public:
void setInitName(const QString &name) { m_initName = name; }
QString initName() const { return m_initName; }
+ void setOutputName(const QString &name) { m_outputName = name; }
+ QString outputName() const { return m_outputName; }
+
+ enum class CompressionAlgorithm {
+ Zlib,
+ Zstd,
+
+ Best = 99,
+ None = -1
+ };
+
+ static CompressionAlgorithm parseCompressionAlgorithm(QStringView algo, QString *errorMsg);
+ void setCompressionAlgorithm(CompressionAlgorithm algo) { m_compressionAlgo = algo; }
+ CompressionAlgorithm compressionAlgorithm() const { return m_compressionAlgo; }
+
+ static int parseCompressionLevel(CompressionAlgorithm algo, const QString &level, QString *errorMsg);
void setCompressLevel(int c) { m_compressLevel = c; }
int compressLevel() const { return m_compressLevel; }
@@ -97,6 +91,11 @@ public:
QStringList failedResources() const { return m_failedResources; }
+ int formatVersion() const { return m_formatVersion; }
+
+ void setNoZstd(bool v) { m_noZstd = v; }
+ bool noZstd() const { return m_noZstd; }
+
private:
struct Strings {
Strings();
@@ -106,14 +105,16 @@ private:
const QString ATTRIBUTE_LANG;
const QString ATTRIBUTE_PREFIX;
const QString ATTRIBUTE_ALIAS;
+ const QString ATTRIBUTE_EMPTY;
const QString ATTRIBUTE_THRESHOLD;
const QString ATTRIBUTE_COMPRESS;
+ const QString ATTRIBUTE_COMPRESSALGO;
};
friend class RCCFileInfo;
void reset();
- bool addFile(const QString &alias, const RCCFileInfo &file);
+ bool addFile(const QString &alias, RCCFileInfo file);
bool interpretResourceFile(QIODevice *inputDevice, const QString &file,
- QString currentPath = QString(), bool ignoreErrors = false);
+ QString currentPath = QString(), bool listMode = false);
bool writeHeader();
bool writeDataBlobs();
bool writeDataNames();
@@ -121,29 +122,43 @@ private:
bool writeInitializer();
void writeMangleNamespaceFunction(const QByteArray &name);
void writeAddNamespaceFunction(const QByteArray &name);
+ void writeDecimal(int value);
void writeHex(quint8 number);
+ void write2HexDigits(quint8 number);
void writeNumber2(quint16 number);
void writeNumber4(quint32 number);
+ void writeNumber8(quint64 number);
void writeChar(char c) { m_out.append(c); }
void writeByteArray(const QByteArray &);
void write(const char *, int len);
+ void writeString(const char *s) { write(s, static_cast<int>(strlen(s))); }
+
+#if QT_CONFIG(zstd)
+ ZSTD_CCtx *m_zstdCCtx;
+#endif
const Strings m_strings;
RCCFileInfo *m_root;
QStringList m_fileNames;
QString m_resourceRoot;
QString m_initName;
+ QString m_outputName;
Format m_format;
bool m_verbose;
+ CompressionAlgorithm m_compressionAlgo;
int m_compressLevel;
int m_compressThreshold;
int m_treeOffset;
int m_namesOffset;
int m_dataOffset;
+ quint32 m_overallFlags;
bool m_useNameSpace;
QStringList m_failedResources;
QIODevice *m_errorDevice;
+ QIODevice *m_outDevice;
QByteArray m_out;
+ quint8 m_formatVersion;
+ bool m_noZstd;
};
QT_END_NAMESPACE
diff --git a/src/designer/src/lib/shared/richtexteditor.cpp b/src/designer/src/lib/shared/richtexteditor.cpp
index 3818de6f7..e6b414149 100644
--- a/src/designer/src/lib/shared/richtexteditor.cpp
+++ b/src/designer/src/lib/shared/richtexteditor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "richtexteditor_p.h"
#include "htmlhighlighter_p.h"
@@ -61,11 +36,15 @@
#include <QtCore/qpointer.h>
#include <QtCore/qxmlstream.h>
+#include <algorithm>
+
QT_BEGIN_NAMESPACE
-static const char RichTextDialogGroupC[] = "RichTextDialog";
-static const char GeometryKeyC[] = "Geometry";
-static const char TabKeyC[] = "Tab";
+using namespace Qt::StringLiterals;
+
+static constexpr auto RichTextDialogGroupC = "RichTextDialog"_L1;
+static constexpr auto GeometryKeyC = "Geometry"_L1;
+static constexpr auto TabKeyC = "Tab"_L1;
const bool simplifyRichTextDefault = true;
@@ -74,7 +53,7 @@ namespace qdesigner_internal {
// Richtext simplification filter helpers: Elements to be discarded
static inline bool filterElement(QStringView name)
{
- return name != QStringLiteral("meta") && name != QStringLiteral("style");
+ return name != "meta"_L1 && name != "style"_L1;
}
// Richtext simplification filter helpers: Filter attributes of elements
@@ -86,15 +65,15 @@ static inline void filterAttributes(QStringView name,
return;
// No style attributes for <body>
- if (name == QStringLiteral("body")) {
+ if (name == "body"_L1) {
atts->clear();
return;
}
// Clean out everything except 'align' for 'p'
- if (name == QStringLiteral("p")) {
+ if (name == "p"_L1) {
for (auto it = atts->begin(); it != atts->end(); ) {
- if (it->name() == QStringLiteral("align")) {
+ if (it->name() == "align"_L1) {
++it;
*paragraphAlignmentFound = true;
} else {
@@ -108,11 +87,8 @@ static inline void filterAttributes(QStringView name,
// Richtext simplification filter helpers: Check for blank QStringView.
static inline bool isWhiteSpace(QStringView in)
{
- const int count = in.size();
- for (int i = 0; i < count; i++)
- if (!in.at(i).isSpace())
- return false;
- return true;
+ return std::all_of(in.cbegin(), in.cend(),
+ [](QChar c) { return c.isSpace(); });
}
// Richtext simplification filter: Remove hard-coded font settings,
@@ -169,6 +145,8 @@ public:
QToolBar *createToolBar(QDesignerFormEditorInterface *core, QWidget *parent = nullptr);
+ QString text(Qt::TextFormat format) const;
+
bool simplifyRichText() const { return m_simplifyRichText; }
public slots:
@@ -176,7 +154,6 @@ public slots:
void setFontPointSize(double);
void setText(const QString &text);
void setSimplifyRichText(bool v);
- QString text(Qt::TextFormat format) const;
signals:
void stateChanged();
@@ -201,17 +178,15 @@ public slots:
private:
RichTextEditor *m_editor;
- Ui::AddLinkDialog *m_ui;
+ QT_PREPEND_NAMESPACE(Ui)::AddLinkDialog *m_ui;
};
AddLinkDialog::AddLinkDialog(RichTextEditor *editor, QWidget *parent) :
QDialog(parent),
- m_ui(new Ui::AddLinkDialog)
+ m_ui(new QT_PREPEND_NAMESPACE(Ui)::AddLinkDialog)
{
m_ui->setupUi(this);
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
-
m_editor = editor;
}
@@ -240,12 +215,7 @@ void AddLinkDialog::accept()
const QString url = m_ui->urlInput->text();
if (!title.isEmpty()) {
- QString html = QStringLiteral("<a href=\"");
- html += url;
- html += QStringLiteral("\">");
- html += title;
- html += QStringLiteral("</a>");
-
+ const QString html = "<a href=\""_L1 + url + "\">"_L1 + title + "</a>"_L1;
m_editor->insertHtml(html);
}
@@ -290,9 +260,9 @@ void HtmlTextEdit::contextMenuEvent(QContextMenuEvent *event)
};
for (const Entry &e : entries) {
- QAction *entityAction = new QAction(QLatin1String(e.text),
+ QAction *entityAction = new QAction(QLatin1StringView(e.text),
htmlMenu);
- entityAction->setData(QLatin1String(e.entity));
+ entityAction->setData(QLatin1StringView(e.entity));
htmlMenu->addAction(entityAction);
}
@@ -401,7 +371,6 @@ private:
};
static QAction *createCheckableAction(const QIcon &icon, const QString &text,
- QObject *receiver, const char *slot,
QObject *parent = nullptr)
{
QAction *result = new QAction(parent);
@@ -409,8 +378,6 @@ static QAction *createCheckableAction(const QIcon &icon, const QString &text,
result->setText(text);
result->setCheckable(true);
result->setChecked(false);
- if (slot)
- QObject::connect(result, SIGNAL(triggered(bool)), receiver, slot);
return result;
}
@@ -440,20 +407,23 @@ RichTextEditorToolBar::RichTextEditorToolBar(QDesignerFormEditorInterface *core,
// Bold, italic and underline buttons
m_bold_action = createCheckableAction(
- createIconSet(QStringLiteral("textbold.png")),
- tr("Bold"), editor, SLOT(setFontBold(bool)), this);
+ createIconSet(QIcon::ThemeIcon::FormatTextBold,
+ "textbold.png"_L1), tr("Bold"), this);
+ connect(m_bold_action, &QAction::triggered, editor, &RichTextEditor::setFontBold);
m_bold_action->setShortcut(tr("CTRL+B"));
addAction(m_bold_action);
m_italic_action = createCheckableAction(
- createIconSet(QStringLiteral("textitalic.png")),
- tr("Italic"), editor, SLOT(setFontItalic(bool)), this);
+ createIconSet(QIcon::ThemeIcon::FormatTextItalic,
+ "textitalic.png"_L1), tr("Italic"), this);
+ connect(m_italic_action, &QAction::triggered, editor, &RichTextEditor::setFontItalic);
m_italic_action->setShortcut(tr("CTRL+I"));
addAction(m_italic_action);
m_underline_action = createCheckableAction(
- createIconSet(QStringLiteral("textunder.png")),
- tr("Underline"), editor, SLOT(setFontUnderline(bool)), this);
+ createIconSet(QIcon::ThemeIcon::FormatTextUnderline,
+ "textunder.png"_L1), tr("Underline"), this);
+ connect(m_underline_action, &QAction::triggered, editor, &RichTextEditor::setFontUnderline);
m_underline_action->setShortcut(tr("CTRL+U"));
addAction(m_underline_action);
@@ -466,28 +436,30 @@ RichTextEditorToolBar::RichTextEditorToolBar(QDesignerFormEditorInterface *core,
this, &RichTextEditorToolBar::alignmentActionTriggered);
m_align_left_action = createCheckableAction(
- createIconSet(QStringLiteral("textleft.png")),
- tr("Left Align"), editor, nullptr, alignment_group);
+ createIconSet(QIcon::ThemeIcon::FormatJustifyLeft,
+ "textleft.png"_L1), tr("Left Align"), alignment_group);
addAction(m_align_left_action);
m_align_center_action = createCheckableAction(
- createIconSet(QStringLiteral("textcenter.png")),
- tr("Center"), editor, nullptr, alignment_group);
+ createIconSet(QIcon::ThemeIcon::FormatJustifyCenter,
+ "textcenter.png"_L1), tr("Center"), alignment_group);
addAction(m_align_center_action);
m_align_right_action = createCheckableAction(
- createIconSet(QStringLiteral("textright.png")),
- tr("Right Align"), editor, nullptr, alignment_group);
+ createIconSet(QIcon::ThemeIcon::FormatJustifyRight,
+ "textright.png"_L1), tr("Right Align"), alignment_group);
addAction(m_align_right_action);
m_align_justify_action = createCheckableAction(
- createIconSet(QStringLiteral("textjustify.png")),
- tr("Justify"), editor, nullptr, alignment_group);
+ createIconSet(QIcon::ThemeIcon::FormatJustifyFill,
+ "textjustify.png"_L1), tr("Justify"), alignment_group);
addAction(m_align_justify_action);
m_layoutDirectionAction = createCheckableAction(
- createIconSet(QStringLiteral("righttoleft.png")),
- tr("Right to Left"), this, SLOT(layoutDirectionChanged()));
+ createIconSet(QIcon::ThemeIcon::FormatTextDirectionRtl,
+ "righttoleft.png"_L1), tr("Right to Left"));
+ connect(m_layoutDirectionAction, &QAction::triggered,
+ this, &RichTextEditorToolBar::layoutDirectionChanged);
addAction(m_layoutDirectionAction);
addSeparator();
@@ -495,27 +467,27 @@ RichTextEditorToolBar::RichTextEditorToolBar(QDesignerFormEditorInterface *core,
// Superscript and subscript buttons
m_valign_sup_action = createCheckableAction(
- createIconSet(QStringLiteral("textsuperscript.png")),
- tr("Superscript"),
- this, SLOT(setVAlignSuper(bool)), this);
+ createIconSet("textsuperscript.png"_L1), tr("Superscript"), this);
+ connect(m_valign_sup_action, &QAction::triggered,
+ this, &RichTextEditorToolBar::setVAlignSuper);
addAction(m_valign_sup_action);
m_valign_sub_action = createCheckableAction(
- createIconSet(QStringLiteral("textsubscript.png")),
- tr("Subscript"),
- this, SLOT(setVAlignSub(bool)), this);
+ createIconSet("textsubscript.png"_L1), tr("Subscript"), this);
+ connect(m_valign_sub_action, &QAction::triggered,
+ this, &RichTextEditorToolBar::setVAlignSub);
addAction(m_valign_sub_action);
addSeparator();
// Insert hyperlink and image buttons
- m_link_action->setIcon(createIconSet(QStringLiteral("textanchor.png")));
+ m_link_action->setIcon(createIconSet("textanchor.png"_L1));
m_link_action->setText(tr("Insert &Link"));
connect(m_link_action, &QAction::triggered, this, &RichTextEditorToolBar::insertLink);
addAction(m_link_action);
- m_image_action->setIcon(createIconSet(QStringLiteral("insertimage.png")));
+ m_image_action->setIcon(createIconSet("insertimage.png"_L1));
m_image_action->setText(tr("Insert &Image"));
connect(m_image_action, &QAction::triggered, this, &RichTextEditorToolBar::insertImage);
addAction(m_image_action);
@@ -531,8 +503,9 @@ RichTextEditorToolBar::RichTextEditorToolBar(QDesignerFormEditorInterface *core,
// Simplify rich text
m_simplify_richtext_action
- = createCheckableAction(createIconSet(QStringLiteral("simplifyrichtext.png")),
- tr("Simplify Rich Text"), m_editor, SLOT(setSimplifyRichText(bool)));
+ = createCheckableAction(createIconSet("simplifyrichtext.png"_L1), tr("Simplify Rich Text"));
+ connect(m_simplify_richtext_action, &QAction::triggered,
+ m_editor, &RichTextEditor::setSimplifyRichText);
m_simplify_richtext_action->setChecked(m_editor->simplifyRichText());
connect(m_editor.data(), &RichTextEditor::simplifyRichTextChanged,
m_simplify_richtext_action, &QAction::setChecked);
@@ -761,13 +734,12 @@ RichTextEditorDialog::RichTextEditorDialog(QDesignerFormEditorInterface *core, Q
m_initialTab(RichTextIndex)
{
setWindowTitle(tr("Edit text"));
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
// Read settings
const QDesignerSettingsInterface *settings = core->settingsManager();
- const QString rootKey = QLatin1String(RichTextDialogGroupC) + QLatin1Char('/');
- const QByteArray lastGeometry = settings->value(rootKey + QLatin1String(GeometryKeyC)).toByteArray();
- const int initialTab = settings->value(rootKey + QLatin1String(TabKeyC), QVariant(m_initialTab)).toInt();
+ const QString rootKey = RichTextDialogGroupC + u'/';
+ const QByteArray lastGeometry = settings->value(rootKey + GeometryKeyC).toByteArray();
+ const int initialTab = settings->value(rootKey + TabKeyC, QVariant(m_initialTab)).toInt();
if (initialTab == RichTextIndex || initialTab == SourceIndex)
m_initialTab = initialTab;
@@ -817,10 +789,10 @@ RichTextEditorDialog::RichTextEditorDialog(QDesignerFormEditorInterface *core, Q
RichTextEditorDialog::~RichTextEditorDialog()
{
QDesignerSettingsInterface *settings = m_core->settingsManager();
- settings->beginGroup(QLatin1String(RichTextDialogGroupC));
+ settings->beginGroup(RichTextDialogGroupC);
- settings->setValue(QLatin1String(GeometryKeyC), saveGeometry());
- settings->setValue(QLatin1String(TabKeyC), m_tab_widget->currentIndex());
+ settings->setValue(GeometryKeyC, saveGeometry());
+ settings->setValue(TabKeyC, m_tab_widget->currentIndex());
settings->endGroup();
}
diff --git a/src/designer/src/lib/shared/richtexteditor_p.h b/src/designer/src/lib/shared/richtexteditor_p.h
index 4fc166e3c..18a710a5c 100644
--- a/src/designer/src/lib/shared/richtexteditor_p.h
+++ b/src/designer/src/lib/shared/richtexteditor_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/selectsignaldialog.cpp b/src/designer/src/lib/shared/selectsignaldialog.cpp
index 576dd0bdb..1938046f4 100644
--- a/src/designer/src/lib/shared/selectsignaldialog.cpp
+++ b/src/designer/src/lib/shared/selectsignaldialog.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "selectsignaldialog_p.h"
@@ -59,10 +34,9 @@ using Methods = QList<SelectSignalDialog::Method>;
SelectSignalDialog::SelectSignalDialog(QWidget *parent)
: QDialog(parent)
- , m_ui(new Ui::SelectSignalDialog)
+ , m_ui(new QT_PREPEND_NAMESPACE(Ui)::SelectSignalDialog)
, m_model(new QStandardItemModel(0, 1, this))
{
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_ui->setupUi(this);
m_okButton = m_ui->buttonBox->button(QDialogButtonBox::Ok);
@@ -116,7 +90,7 @@ static void appendClass(const QString &className, Methods methods, QStandardItem
std::sort(methods.begin(), methods.end(), signatureLessThan);
QStandardItem *topLevelItem = createTopLevelItem(className);
model->appendRow(topLevelItem);
- for (const SelectSignalDialog::Method &m : qAsConst(methods)) {
+ for (const SelectSignalDialog::Method &m : std::as_const(methods)) {
QStandardItem *item = new QStandardItem(m.signature);
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
item->setData(QVariant::fromValue(m), MethodRole);
diff --git a/src/designer/src/lib/shared/selectsignaldialog_p.h b/src/designer/src/lib/shared/selectsignaldialog_p.h
index ab94fb1ec..01f4afe25 100644
--- a/src/designer/src/lib/shared/selectsignaldialog_p.h
+++ b/src/designer/src/lib/shared/selectsignaldialog_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -84,7 +59,7 @@ private:
Method methodFromIndex(const QModelIndex &) const;
void populateModel(QDesignerFormEditorInterface *core, QObject *object);
- Ui::SelectSignalDialog *m_ui;
+ QT_PREPEND_NAMESPACE(Ui)::SelectSignalDialog *m_ui;
QPushButton *m_okButton;
QStandardItemModel *m_model;
};
diff --git a/src/designer/src/lib/shared/shared.qrc b/src/designer/src/lib/shared/shared.qrc
deleted file mode 100644
index 734ef391f..000000000
--- a/src/designer/src/lib/shared/shared.qrc
+++ /dev/null
@@ -1,20 +0,0 @@
-<RCC>
- <qresource prefix="/qt-project.org/designer">
- <file>defaultgradients.xml</file>
- <!-- Templates -->
- <file>templates/forms/Dialog_with_Buttons_Bottom.ui</file>
- <file>templates/forms/240x320/Dialog_with_Buttons_Bottom.ui</file>
- <file>templates/forms/320x240/Dialog_with_Buttons_Bottom.ui</file>
- <file>templates/forms/480x640/Dialog_with_Buttons_Bottom.ui</file>
- <file>templates/forms/640x480/Dialog_with_Buttons_Bottom.ui</file>
- <file>templates/forms/Dialog_with_Buttons_Right.ui</file>
- <file>templates/forms/240x320/Dialog_with_Buttons_Right.ui</file>
- <file>templates/forms/320x240/Dialog_with_Buttons_Right.ui</file>
- <file>templates/forms/480x640/Dialog_with_Buttons_Right.ui</file>
- <file>templates/forms/640x480/Dialog_with_Buttons_Right.ui</file>
- <file>templates/forms/Dialog_without_Buttons.ui</file>
- <file>templates/forms/Widget.ui</file>
- <file>templates/forms/Main_Window.ui</file>
- </qresource>
-</RCC>
-
diff --git a/src/designer/src/lib/shared/shared_enums_p.h b/src/designer/src/lib/shared/shared_enums_p.h
index d9c3dc007..246f202de 100644
--- a/src/designer/src/lib/shared/shared_enums_p.h
+++ b/src/designer/src/lib/shared/shared_enums_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/shared_global_p.h b/src/designer/src/lib/shared/shared_global_p.h
index 3609e5b87..0f1db097e 100644
--- a/src/designer/src/lib/shared/shared_global_p.h
+++ b/src/designer/src/lib/shared/shared_global_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/shared_settings.cpp b/src/designer/src/lib/shared/shared_settings.cpp
index 6b91cff7a..aec4e59ca 100644
--- a/src/designer/src/lib/shared/shared_settings.cpp
+++ b/src/designer/src/lib/shared/shared_settings.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "shared_settings_p.h"
#include "grid_p.h"
@@ -44,22 +19,22 @@
QT_BEGIN_NAMESPACE
-static const char *defaultGridKey = "defaultGrid";
-static const char *previewKey = "Preview";
-static const char *enabledKey = "Enabled";
-static const char *userDeviceSkinsKey= "UserDeviceSkins";
-static const char *zoomKey = "zoom";
-static const char *zoomEnabledKey = "zoomEnabled";
-static const char *deviceProfileIndexKey = "DeviceProfileIndex";
-static const char *deviceProfilesKey = "DeviceProfiles";
-static const char *formTemplatePathsKey = "FormTemplatePaths";
-static const char *formTemplateKey = "FormTemplate";
-static const char *newFormSizeKey = "NewFormSize";
-static inline QString namingModeKey() { return QStringLiteral("naming"); }
-static inline QString underScoreNamingMode() { return QStringLiteral("underscore"); }
-static inline QString camelCaseNamingMode() { return QStringLiteral("camelcase"); }
-
-using namespace qdesigner_internal;
+using namespace Qt::StringLiterals;
+
+static constexpr auto defaultGridKey = "defaultGrid"_L1;
+static constexpr auto previewKey = "Preview"_L1;
+static constexpr auto enabledKey = "Enabled"_L1;
+static constexpr auto userDeviceSkinsKey= "UserDeviceSkins"_L1;
+static constexpr auto zoomKey = "zoom"_L1;
+static constexpr auto zoomEnabledKey = "zoomEnabled"_L1;
+static constexpr auto deviceProfileIndexKey = "DeviceProfileIndex"_L1;
+static constexpr auto deviceProfilesKey = "DeviceProfiles"_L1;
+static constexpr auto formTemplatePathsKey = "FormTemplatePaths"_L1;
+static constexpr auto formTemplateKey = "FormTemplate"_L1;
+static constexpr auto newFormSizeKey = "NewFormSize"_L1;
+static constexpr auto namingModeKey = "naming"_L1;
+static constexpr auto underScoreNamingMode = "underscore"_L1;
+static constexpr auto camelCaseNamingMode = "camelcase"_L1;
static bool checkTemplatePath(const QString &path, bool create)
{
@@ -88,7 +63,7 @@ Grid QDesignerSharedSettings::defaultGrid() const
{
Grid grid;
const QVariantMap defaultGridMap
- = m_settings->value(QLatin1String(defaultGridKey), QVariantMap()).toMap();
+ = m_settings->value(defaultGridKey, QVariantMap()).toMap();
if (!defaultGridMap.isEmpty())
grid.fromVariantMap(defaultGridMap);
return grid;
@@ -96,7 +71,7 @@ Grid QDesignerSharedSettings::defaultGrid() const
void QDesignerSharedSettings::setDefaultGrid(const Grid &grid)
{
- m_settings->setValue(QLatin1String(defaultGridKey), grid.toVariantMap());
+ m_settings->setValue(defaultGridKey, grid.toVariantMap());
}
const QStringList &QDesignerSharedSettings::defaultFormTemplatePaths()
@@ -104,7 +79,7 @@ const QStringList &QDesignerSharedSettings::defaultFormTemplatePaths()
static QStringList rc;
if (rc.isEmpty()) {
// Ensure default form template paths
- const QString templatePath = QStringLiteral("/templates");
+ const auto templatePath = "/templates"_L1;
// home
QString path = dataDirectory() + templatePath;
if (checkTemplatePath(path, true))
@@ -123,7 +98,7 @@ const QStringList &QDesignerSharedSettings::defaultFormTemplatePaths()
// ### FIXME Qt 8: Remove (QTBUG-96005)
void QDesignerSharedSettings::migrateTemplates()
{
- const QString templatePath = u"/templates"_qs;
+ const QString templatePath = u"/templates"_s;
QString path = dataDirectory() + templatePath;
if (QFileInfo::exists(path))
return;
@@ -141,23 +116,23 @@ void QDesignerSharedSettings::migrateTemplates()
QStringList QDesignerSharedSettings::formTemplatePaths() const
{
- return m_settings->value(QLatin1String(formTemplatePathsKey),
+ return m_settings->value(formTemplatePathsKey,
defaultFormTemplatePaths()).toStringList();
}
void QDesignerSharedSettings::setFormTemplatePaths(const QStringList &paths)
{
- m_settings->setValue(QLatin1String(formTemplatePathsKey), paths);
+ m_settings->setValue(formTemplatePathsKey, paths);
}
QString QDesignerSharedSettings::formTemplate() const
{
- return m_settings->value(QLatin1String(formTemplateKey)).toString();
+ return m_settings->value(formTemplateKey).toString();
}
void QDesignerSharedSettings::setFormTemplate(const QString &t)
{
- m_settings->setValue(QLatin1String(formTemplateKey), t);
+ m_settings->setValue(formTemplateKey, t);
}
void QDesignerSharedSettings::setAdditionalFormTemplatePaths(const QStringList &additionalPaths)
@@ -182,15 +157,15 @@ QStringList QDesignerSharedSettings::additionalFormTemplatePaths() const
QSize QDesignerSharedSettings::newFormSize() const
{
- return m_settings->value(QLatin1String(newFormSizeKey), QSize(0, 0)).toSize();
+ return m_settings->value(newFormSizeKey, QSize(0, 0)).toSize();
}
void QDesignerSharedSettings::setNewFormSize(const QSize &s)
{
if (s.isNull()) {
- m_settings->remove(QLatin1String(newFormSizeKey));
+ m_settings->remove(newFormSizeKey);
} else {
- m_settings->setValue(QLatin1String(newFormSizeKey), s);
+ m_settings->setValue(newFormSizeKey, s);
}
}
@@ -198,78 +173,78 @@ void QDesignerSharedSettings::setNewFormSize(const QSize &s)
PreviewConfiguration QDesignerSharedSettings::customPreviewConfiguration() const
{
PreviewConfiguration configuration;
- configuration.fromSettings(QLatin1String(previewKey), m_settings);
+ configuration.fromSettings(previewKey, m_settings);
return configuration;
}
void QDesignerSharedSettings::setCustomPreviewConfiguration(const PreviewConfiguration &configuration)
{
- configuration.toSettings(QLatin1String(previewKey), m_settings);
+ configuration.toSettings(previewKey, m_settings);
}
bool QDesignerSharedSettings::isCustomPreviewConfigurationEnabled() const
{
- m_settings->beginGroup(QLatin1String(previewKey));
- bool isEnabled = m_settings->value(QLatin1String(enabledKey), false).toBool();
+ m_settings->beginGroup(previewKey);
+ bool isEnabled = m_settings->value(enabledKey, false).toBool();
m_settings->endGroup();
return isEnabled;
}
void QDesignerSharedSettings::setCustomPreviewConfigurationEnabled(bool enabled)
{
- m_settings->beginGroup(QLatin1String(previewKey));
- m_settings->setValue(QLatin1String(enabledKey), enabled);
+ m_settings->beginGroup(previewKey);
+ m_settings->setValue(enabledKey, enabled);
m_settings->endGroup();
}
QStringList QDesignerSharedSettings::userDeviceSkins() const
{
- m_settings->beginGroup(QLatin1String(previewKey));
+ m_settings->beginGroup(previewKey);
QStringList userDeviceSkins
- = m_settings->value(QLatin1String(userDeviceSkinsKey), QStringList()).toStringList();
+ = m_settings->value(userDeviceSkinsKey, QStringList()).toStringList();
m_settings->endGroup();
return userDeviceSkins;
}
void QDesignerSharedSettings::setUserDeviceSkins(const QStringList &userDeviceSkins)
{
- m_settings->beginGroup(QLatin1String(previewKey));
- m_settings->setValue(QLatin1String(userDeviceSkinsKey), userDeviceSkins);
+ m_settings->beginGroup(previewKey);
+ m_settings->setValue(userDeviceSkinsKey, userDeviceSkins);
m_settings->endGroup();
}
int QDesignerSharedSettings::zoom() const
{
- return m_settings->value(QLatin1String(zoomKey), 100).toInt();
+ return m_settings->value(zoomKey, 100).toInt();
}
void QDesignerSharedSettings::setZoom(int z)
{
- m_settings->setValue(QLatin1String(zoomKey), QVariant(z));
+ m_settings->setValue(zoomKey, QVariant(z));
}
ObjectNamingMode QDesignerSharedSettings::objectNamingMode() const
{
- const QString value = m_settings->value(namingModeKey()).toString();
- return value == camelCaseNamingMode()
+ const QString value = m_settings->value(namingModeKey).toString();
+ return value == camelCaseNamingMode
? qdesigner_internal::CamelCase : qdesigner_internal::Underscore;
}
void QDesignerSharedSettings::setObjectNamingMode(ObjectNamingMode n)
{
const QString value = n == qdesigner_internal::CamelCase
- ? camelCaseNamingMode() : underScoreNamingMode();
- m_settings->setValue(namingModeKey(), QVariant(value));
+ ? camelCaseNamingMode : underScoreNamingMode;
+ m_settings->setValue(namingModeKey, QVariant(value));
}
bool QDesignerSharedSettings::zoomEnabled() const
{
- return m_settings->value(QLatin1String(zoomEnabledKey), false).toBool();
+ return m_settings->value(zoomEnabledKey, false).toBool();
}
void QDesignerSharedSettings::setZoomEnabled(bool v)
{
- m_settings->setValue(QLatin1String(zoomEnabledKey), v);
+ m_settings->setValue(zoomEnabledKey, v);
}
DeviceProfile QDesignerSharedSettings::currentDeviceProfile() const
@@ -279,12 +254,12 @@ DeviceProfile QDesignerSharedSettings::currentDeviceProfile() const
void QDesignerSharedSettings::setCurrentDeviceProfileIndex(int i)
{
- m_settings->setValue(QLatin1String(deviceProfileIndexKey), i);
+ m_settings->setValue(deviceProfileIndexKey, i);
}
int QDesignerSharedSettings::currentDeviceProfileIndex() const
{
- return m_settings->value(QLatin1String(deviceProfileIndexKey), -1).toInt();
+ return m_settings->value(deviceProfileIndexKey, -1).toInt();
}
static inline QString msgWarnDeviceProfileXml(const QString &msg)
@@ -310,7 +285,7 @@ DeviceProfile QDesignerSharedSettings::deviceProfileAt(int idx) const
QStringList QDesignerSharedSettings::deviceProfileXml() const
{
- return m_settings->value(QLatin1String(deviceProfilesKey), QStringList()).toStringList();
+ return m_settings->value(deviceProfilesKey, QStringList()).toStringList();
}
QDesignerSharedSettings::DeviceProfileList QDesignerSharedSettings::deviceProfiles() const
@@ -322,9 +297,8 @@ QDesignerSharedSettings::DeviceProfileList QDesignerSharedSettings::deviceProfil
// De-serialize
QString errorMessage;
DeviceProfile dp;
- const QStringList::const_iterator scend = xmls.constEnd();
- for (QStringList::const_iterator it = xmls.constBegin(); it != scend; ++it) {
- if (dp.fromXml(*it, &errorMessage)) {
+ for (const auto &xml : xmls) {
+ if (dp.fromXml(xml, &errorMessage)) {
rc.push_back(dp);
} else {
designerWarning(msgWarnDeviceProfileXml(errorMessage));
@@ -333,13 +307,12 @@ QDesignerSharedSettings::DeviceProfileList QDesignerSharedSettings::deviceProfil
return rc;
}
-void QDesignerSharedSettings::setDeviceProfiles(const DeviceProfileList &dp)
+void QDesignerSharedSettings::setDeviceProfiles(const DeviceProfileList &dpl)
{
QStringList l;
- const DeviceProfileList::const_iterator dcend = dp.constEnd();
- for (DeviceProfileList::const_iterator it = dp.constBegin(); it != dcend; ++it)
- l.push_back(it->toXml());
- m_settings->setValue(QLatin1String(deviceProfilesKey), l);
+ for (const auto &dp : dpl)
+ l.push_back(dp.toXml());
+ m_settings->setValue(deviceProfilesKey, l);
}
}
diff --git a/src/designer/src/lib/shared/shared_settings_p.h b/src/designer/src/lib/shared/shared_settings_p.h
index 1427a7687..7cf5b4c85 100644
--- a/src/designer/src/lib/shared/shared_settings_p.h
+++ b/src/designer/src/lib/shared/shared_settings_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/sheet_delegate.cpp b/src/designer/src/lib/shared/sheet_delegate.cpp
index 31afad7f8..77a2a1b96 100644
--- a/src/designer/src/lib/shared/sheet_delegate.cpp
+++ b/src/designer/src/lib/shared/sheet_delegate.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "sheet_delegate_p.h"
diff --git a/src/designer/src/lib/shared/sheet_delegate_p.h b/src/designer/src/lib/shared/sheet_delegate_p.h
index f896643f0..c58ebc5c4 100644
--- a/src/designer/src/lib/shared/sheet_delegate_p.h
+++ b/src/designer/src/lib/shared/sheet_delegate_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/signalslotdialog.cpp b/src/designer/src/lib/shared/signalslotdialog.cpp
index 65297030d..f4857b416 100644
--- a/src/designer/src/lib/shared/signalslotdialog.cpp
+++ b/src/designer/src/lib/shared/signalslotdialog.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "signalslotdialog_p.h"
#include "ui_signalslotdialog.h"
@@ -53,19 +28,21 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
// Regexp to match a function signature, arguments potentially
// with namespace colons.
-static const char *signatureRegExp = "^[\\w+_]+\\(([\\w+:]\\*?,?)*\\)$";
-static const char *methodNameRegExp = "^[\\w+_]+$";
+static constexpr auto signatureRegExp = "^[\\w+_]+\\(([\\w+:]\\*?,?)*\\)$"_L1;
+static constexpr auto methodNameRegExp = "^[\\w+_]+$"_L1;
-static QStandardItem *createEditableItem(const QString &text)
+static QStandardItem *createEditableItem(const QString &text)
{
QStandardItem *rc = new QStandardItem(text);
rc->setFlags(Qt::ItemIsEnabled|Qt::ItemIsEditable|Qt::ItemIsSelectable);
return rc;
}
-static QStandardItem *createDisabledItem(const QString &text)
+static QStandardItem *createDisabledItem(const QString &text)
{
QStandardItem *rc = new QStandardItem(text);
Qt::ItemFlags flags = rc->flags();
@@ -73,48 +50,6 @@ static QStandardItem *createDisabledItem(const QString &text)
return rc;
}
-static void fakeMethodsFromMetaDataBase(QDesignerFormEditorInterface *core, QObject *o, QStringList &slotList, QStringList &signalList)
-{
- slotList.clear();
- signalList.clear();
- if (qdesigner_internal::MetaDataBase *metaDataBase = qobject_cast<qdesigner_internal::MetaDataBase *>(core->metaDataBase()))
- if (const qdesigner_internal::MetaDataBaseItem *item = metaDataBase->metaDataBaseItem(o)) {
- slotList = item->fakeSlots();
- signalList = item->fakeSignals();
- }
-}
-
-static void fakeMethodsToMetaDataBase(QDesignerFormEditorInterface *core, QObject *o, const QStringList &slotList, const QStringList &signalList)
-{
- if (qdesigner_internal::MetaDataBase *metaDataBase = qobject_cast<qdesigner_internal::MetaDataBase *>(core->metaDataBase())) {
- qdesigner_internal::MetaDataBaseItem *item = metaDataBase->metaDataBaseItem(o);
- Q_ASSERT(item);
- item->setFakeSlots(slotList);
- item->setFakeSignals(signalList);
- }
-}
-
-static void existingMethodsFromMemberSheet(QDesignerFormEditorInterface *core,
- QObject *o,
- QStringList &slotList, QStringList &signalList)
-{
- slotList.clear();
- signalList.clear();
-
- QDesignerMemberSheetExtension *msheet = qt_extension<QDesignerMemberSheetExtension*>(core->extensionManager(), o);
- if (!msheet)
- return;
-
- for (int i = 0, count = msheet->count(); i < count; ++i)
- if (msheet->isVisible(i)) {
- if (msheet->isSlot(i))
- slotList += msheet->signature(i);
- else
- if (msheet->isSignal(i))
- signalList += msheet->signature(i);
- }
-}
-
namespace {
// Internal helper class: A Delegate that validates using RegExps and additionally checks
// on closing (adds missing parentheses).
@@ -131,8 +66,8 @@ namespace {
SignatureDelegate::SignatureDelegate(QObject * parent) :
QItemDelegate(parent),
- m_signatureRegexp(QLatin1String(signatureRegExp)),
- m_methodNameRegexp(QLatin1String(methodNameRegExp))
+ m_signatureRegexp(signatureRegExp),
+ m_methodNameRegexp(methodNameRegExp)
{
Q_ASSERT(m_signatureRegexp.isValid());
Q_ASSERT(m_methodNameRegexp.isValid());
@@ -155,7 +90,7 @@ namespace {
QString signature = le->text();
if (!m_signatureRegexp.match(signature).hasMatch()) {
if (m_methodNameRegexp.match(signature).hasMatch()) {
- signature += QStringLiteral("()");
+ signature += "()"_L1;
le->setText(signature);
} else {
return;
@@ -175,9 +110,15 @@ namespace {
const QStringList &newFakeSlots, const QStringList &newFakeSignals);
void undo() override
- { fakeMethodsToMetaDataBase(core(), m_object, m_oldFakeSlots, m_oldFakeSignals); }
+ {
+ qdesigner_internal::SignalSlotDialog::fakeMethodsToMetaDataBase(core(), m_object,
+ m_oldFakeSlots, m_oldFakeSignals);
+ }
void redo() override
- { fakeMethodsToMetaDataBase(core(), m_object, m_newFakeSlots, m_newFakeSignals); }
+ {
+ qdesigner_internal::SignalSlotDialog::fakeMethodsToMetaDataBase(core(), m_object,
+ m_newFakeSlots, m_newFakeSignals);
+ }
private:
QObject *m_object;
@@ -266,12 +207,11 @@ void SignaturePanel::slotAdd()
m_listView->selectionModel()->clearSelection();
// find unique name
for (int i = 1; ; i++) {
- QString newSlot = m_newPrefix;
- newSlot += QString::number(i); // Always add number, Avoid setting 'slot' for first entry
- newSlot += QLatin1Char('(');
+ // Always add number, Avoid setting 'slot' for first entry
+ QString newSlot = m_newPrefix + QString::number(i) + u'(';
// check for function name independent of parameters
if (m_model->findItems(newSlot, Qt::MatchStartsWith, 0).isEmpty()) {
- newSlot += QLatin1Char(')');
+ newSlot += u')';
QStandardItem * item = createEditableItem(newSlot);
m_model->appendRow(item);
const QModelIndex index = m_model->indexFromItem (item);
@@ -298,8 +238,8 @@ void SignaturePanel::slotRemove()
if (const int row = selectedIndexes.constFirst().row())
m_listView->setCurrentIndex (selectedIndexes.constFirst().sibling(row - 1, 0));
- for (int i = selectedIndexes.size() - 1; i >= 0; i--)
- qDeleteAll(m_model->takeRow(selectedIndexes[i].row()));
+ for (auto i = selectedIndexes.size() - 1; i >= 0; --i)
+ qDeleteAll(m_model->takeRow(selectedIndexes.at(i).row()));
}
void SignaturePanel::slotSelectionChanged(const QItemSelection &selected, const QItemSelection &)
@@ -346,21 +286,23 @@ void SignaturePanel::closeEditor()
SignalSlotDialog::SignalSlotDialog(QDesignerDialogGuiInterface *dialogGui, QWidget *parent, FocusMode mode) :
QDialog(parent),
m_focusMode(mode),
- m_ui(new Ui::SignalSlotDialogClass),
+ m_ui(new QT_PREPEND_NAMESPACE(Ui)::SignalSlotDialogClass),
m_dialogGui(dialogGui)
{
setModal(true);
m_ui->setupUi(this);
- const QIcon plusIcon = qdesigner_internal::createIconSet(QString::fromUtf8("plus.png"));
- const QIcon minusIcon = qdesigner_internal::createIconSet(QString::fromUtf8("minus.png"));
+ const QIcon plusIcon = qdesigner_internal::createIconSet("plus.png"_L1);
+ const QIcon minusIcon = qdesigner_internal::createIconSet("minus.png"_L1);
m_ui->addSlotButton->setIcon(plusIcon);
m_ui->removeSlotButton->setIcon(minusIcon);
m_ui->addSignalButton->setIcon(plusIcon);
m_ui->removeSignalButton->setIcon(minusIcon);
- m_slotPanel = new SignaturePanel(this, m_ui->slotListView, m_ui->addSlotButton, m_ui->removeSlotButton, QStringLiteral("slot"));
- m_signalPanel = new SignaturePanel(this, m_ui->signalListView, m_ui->addSignalButton, m_ui->removeSignalButton, QStringLiteral("signal"));
+ m_slotPanel = new SignaturePanel(this, m_ui->slotListView, m_ui->addSlotButton,
+ m_ui->removeSlotButton, u"slot"_s);
+ m_signalPanel = new SignaturePanel(this, m_ui->signalListView, m_ui->addSignalButton,
+ m_ui->removeSignalButton, u"signal"_s);
connect(m_slotPanel, &SignaturePanel::checkSignature,
this, &SignalSlotDialog::slotCheckSignature);
connect(m_signalPanel, &SignaturePanel::checkSignature,
@@ -512,6 +454,51 @@ bool SignalSlotDialog::editPromotedClass(QDesignerFormEditorInterface *core, con
return true;
}
+void SignalSlotDialog::fakeMethodsFromMetaDataBase(QDesignerFormEditorInterface *core, QObject *o,
+ QStringList &slotList, QStringList &signalList)
+{
+ slotList.clear();
+ signalList.clear();
+ if (auto *metaDB = qobject_cast<qdesigner_internal::MetaDataBase *>(core->metaDataBase())) {
+ if (const auto *item = metaDB->metaDataBaseItem(o)) {
+ slotList = item->fakeSlots();
+ signalList = item->fakeSignals();
+ }
+ }
+}
+
+void SignalSlotDialog::fakeMethodsToMetaDataBase(QDesignerFormEditorInterface *core, QObject *o,
+ const QStringList &slotList,
+ const QStringList &signalList)
+{
+ if (auto *metaDB = qobject_cast<qdesigner_internal::MetaDataBase *>(core->metaDataBase())) {
+ if (auto *item = metaDB->metaDataBaseItem(o)) {
+ item->setFakeSlots(slotList);
+ item->setFakeSignals(signalList);
+ }
+ }
+}
+
+void SignalSlotDialog::existingMethodsFromMemberSheet(QDesignerFormEditorInterface *core, QObject *o,
+ QStringList &slotList, QStringList &signalList)
+{
+ slotList.clear();
+ signalList.clear();
+
+ auto *msheet = qt_extension<QDesignerMemberSheetExtension*>(core->extensionManager(), o);
+ if (!msheet)
+ return;
+
+ for (qsizetype i = 0, count = msheet->count(); i < count; ++i) {
+ if (msheet->isVisible(i)) {
+ if (msheet->isSlot(i))
+ slotList += msheet->signature(i);
+ else if (msheet->isSignal(i))
+ signalList += msheet->signature(i);
+ }
+ }
+}
+
}
QT_END_NAMESPACE
diff --git a/src/designer/src/lib/shared/signalslotdialog_p.h b/src/designer/src/lib/shared/signalslotdialog_p.h
index e0253bcc5..748123b9a 100644
--- a/src/designer/src/lib/shared/signalslotdialog_p.h
+++ b/src/designer/src/lib/shared/signalslotdialog_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -140,6 +115,14 @@ public:
// Edit fake methods of a promoted class stored in WidgetDataBase on a base class instance.
static bool editPromotedClass(QDesignerFormEditorInterface *core, QObject *baseObject, QWidget *parent = nullptr, FocusMode m = FocusSlots);
+ static void fakeMethodsFromMetaDataBase(QDesignerFormEditorInterface *core, QObject *o,
+ QStringList &slotList, QStringList &signalList);
+ static void fakeMethodsToMetaDataBase(QDesignerFormEditorInterface *core, QObject *o,
+ const QStringList &slotList, const QStringList &signalList);
+ static void existingMethodsFromMemberSheet(QDesignerFormEditorInterface *core, QObject *o,
+ QStringList &slotList, QStringList &signalList);
+
+
private slots:
void slotCheckSignature(const QString &signature, bool *ok);
@@ -148,7 +131,7 @@ private:
static bool editPromotedClass(QDesignerFormEditorInterface *core, const QString &promotedClassName, QObject *baseObject, QWidget *parent, FocusMode m);
const FocusMode m_focusMode;
- Ui::SignalSlotDialogClass *m_ui;
+ QT_PREPEND_NAMESPACE(Ui)::SignalSlotDialogClass *m_ui;
QDesignerDialogGuiInterface *m_dialogGui;
SignaturePanel *m_slotPanel;
SignaturePanel *m_signalPanel;
diff --git a/src/designer/src/lib/shared/spacer_widget.cpp b/src/designer/src/lib/shared/spacer_widget.cpp
index 15daa9d8c..ac08a67be 100644
--- a/src/designer/src/lib/shared/spacer_widget.cpp
+++ b/src/designer/src/lib/shared/spacer_widget.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "spacer_widget_p.h"
#include "layoutinfo_p.h"
@@ -41,6 +16,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
// The Spacer widget is Designer representation of QLayoutItem.
// It uses QLayoutItem's sizeHint property as QWidget
// sizeHint and the QLayoutItem's sizeType property as QWidget size policy.
@@ -152,7 +129,7 @@ void Spacer::resizeEvent(QResizeEvent* e)
const QSize oldSize = e->oldSize();
if (oldSize.isNull() || oldSize.width() <= m_SizeOffset.width() || oldSize.height() <= m_SizeOffset.height())
if (QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(m_formWindow->core()->extensionManager(), this))
- sheet->setChanged(sheet->indexOf(QStringLiteral("sizeHint")), true);
+ sheet->setChanged(sheet->indexOf(u"sizeHint"_s), true);
}
updateMask();
diff --git a/src/designer/src/lib/shared/spacer_widget_p.h b/src/designer/src/lib/shared/spacer_widget_p.h
index cbb9dd6d7..fb99316b1 100644
--- a/src/designer/src/lib/shared/spacer_widget_p.h
+++ b/src/designer/src/lib/shared/spacer_widget_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/stylesheeteditor.cpp b/src/designer/src/lib/shared/stylesheeteditor.cpp
index 2956d1abc..da15f6bf1 100644
--- a/src/designer/src/lib/shared/stylesheeteditor.cpp
+++ b/src/designer/src/lib/shared/stylesheeteditor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "stylesheeteditor_p.h"
#include "csshighlighter_p.h"
@@ -60,18 +35,36 @@
QT_BEGIN_NAMESPACE
-static const char *styleSheetProperty = "styleSheet";
-static const char *StyleSheetDialogC = "StyleSheetDialog";
-static const char *Geometry = "Geometry";
+using namespace Qt::StringLiterals;
+
+static constexpr auto styleSheetProperty = "styleSheet"_L1;
+static constexpr auto StyleSheetDialogC = "StyleSheetDialog"_L1;
+static constexpr auto seGeometry = "Geometry"_L1;
namespace qdesigner_internal {
StyleSheetEditor::StyleSheetEditor(QWidget *parent)
: QTextEdit(parent)
{
- setTabStopDistance(fontMetrics().horizontalAdvance(QLatin1Char(' ')) * 4);
+ enum : int { DarkThreshold = 200 }; // Observed 239 on KDE/Dark
+
+ setTabStopDistance(fontMetrics().horizontalAdvance(u' ') * 4);
setAcceptRichText(false);
- new CssHighlighter(document());
+
+ const QColor textColor = palette().color(QPalette::WindowText);
+ const bool darkMode = textColor.red() > DarkThreshold
+ && textColor.green() > DarkThreshold
+ && textColor.blue() > DarkThreshold;
+
+ CssHighlightColors colors;
+ colors.selector = darkMode ? QColor(Qt::red).lighter() : QColor(Qt::darkRed);
+ const QColor blue(Qt::blue);
+ colors.property = darkMode ? blue.lighter() : blue;
+ colors.pseudo1 = colors.pseudo2 = colors.value = textColor;
+ colors.quote = darkMode ? Qt::magenta : Qt::darkMagenta;
+ colors.comment = darkMode ? Qt::green : Qt::darkGreen;
+
+ new CssHighlighter(colors, document());
}
// --- StyleSheetEditorDialog
@@ -88,7 +81,6 @@ StyleSheetEditorDialog::StyleSheetEditorDialog(QDesignerFormEditorInterface *cor
m_addFontAction(new QAction(tr("Add Font..."), this))
{
setWindowTitle(tr("Edit Style Sheet"));
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
connect(m_buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(m_buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
@@ -150,13 +142,13 @@ StyleSheetEditorDialog::StyleSheetEditorDialog(QDesignerFormEditorInterface *cor
QMenu *colorActionMenu = new QMenu(this);
for (int resourceProperty = 0; resourceProperties[resourceProperty]; ++resourceProperty) {
- const QString resourcePropertyName = QLatin1String(resourceProperties[resourceProperty]);
+ const QString resourcePropertyName = QLatin1StringView(resourceProperties[resourceProperty]);
resourceActionMenu->addAction(resourcePropertyName,
this, [this, resourcePropertyName] { this->slotAddResource(resourcePropertyName); });
}
for (int colorProperty = 0; colorProperties[colorProperty]; ++colorProperty) {
- const QString colorPropertyName = QLatin1String(colorProperties[colorProperty]);
+ const QString colorPropertyName = QLatin1StringView(colorProperties[colorProperty]);
colorActionMenu->addAction(colorPropertyName,
this, [this, colorPropertyName] { this->slotAddColor(colorPropertyName); });
gradientActionMenu->addAction(colorPropertyName,
@@ -178,10 +170,10 @@ StyleSheetEditorDialog::StyleSheetEditorDialog(QDesignerFormEditorInterface *cor
m_editor->setFocus();
QDesignerSettingsInterface *settings = core->settingsManager();
- settings->beginGroup(QLatin1String(StyleSheetDialogC));
+ settings->beginGroup(StyleSheetDialogC);
- if (settings->contains(QLatin1String(Geometry)))
- restoreGeometry(settings->value(QLatin1String(Geometry)).toByteArray());
+ if (settings->contains(seGeometry))
+ restoreGeometry(settings->value(seGeometry).toByteArray());
settings->endGroup();
}
@@ -189,9 +181,9 @@ StyleSheetEditorDialog::StyleSheetEditorDialog(QDesignerFormEditorInterface *cor
StyleSheetEditorDialog::~StyleSheetEditorDialog()
{
QDesignerSettingsInterface *settings = m_core->settingsManager();
- settings->beginGroup(QLatin1String(StyleSheetDialogC));
+ settings->beginGroup(StyleSheetDialogC);
- settings->setValue(QLatin1String(Geometry), saveGeometry());
+ settings->setValue(seGeometry, saveGeometry());
settings->endGroup();
}
@@ -218,7 +210,7 @@ void StyleSheetEditorDialog::slotAddResource(const QString &property)
{
const QString path = IconSelector::choosePixmapResource(m_core, m_core->resourceModel(), QString(), this);
if (!path.isEmpty())
- insertCssProperty(property, QString(QStringLiteral("url(%1)")).arg(path));
+ insertCssProperty(property, "url("_L1 + path + u')');
}
void StyleSheetEditorDialog::slotAddGradient(const QString &property)
@@ -238,11 +230,12 @@ void StyleSheetEditorDialog::slotAddColor(const QString &property)
QString colorStr;
if (color.alpha() == 255) {
- colorStr = QString(QStringLiteral("rgb(%1, %2, %3)")).arg(
- color.red()).arg(color.green()).arg(color.blue());
+ colorStr = QString::asprintf("rgb(%d, %d, %d)",
+ color.red(), color.green(), color.blue());
} else {
- colorStr = QString(QStringLiteral("rgba(%1, %2, %3, %4)")).arg(
- color.red()).arg(color.green()).arg(color.blue()).arg(color.alpha());
+ colorStr = QString::asprintf("rgba(%d, %d, %d, %d)",
+ color.red(), color.green(), color.blue(),
+ color.alpha());
}
insertCssProperty(property, colorStr);
@@ -254,36 +247,34 @@ void StyleSheetEditorDialog::slotAddFont()
QFont font = QFontDialog::getFont(&ok, this);
if (ok) {
QString fontStr;
- if (font.weight() != QFont::Normal) {
- fontStr += QString::number(font.weight());
- fontStr += QLatin1Char(' ');
- }
+ if (font.weight() != QFont::Normal)
+ fontStr += QString::number(font.weight()) + u' ';
switch (font.style()) {
case QFont::StyleItalic:
- fontStr += QStringLiteral("italic ");
+ fontStr += "italic "_L1;
break;
case QFont::StyleOblique:
- fontStr += QStringLiteral("oblique ");
+ fontStr += "oblique "_L1;
break;
default:
break;
}
fontStr += QString::number(font.pointSize());
- fontStr += QStringLiteral("pt \"");
+ fontStr += "pt \""_L1;
fontStr += font.family();
- fontStr += QLatin1Char('"');
+ fontStr += u'"';
- insertCssProperty(QStringLiteral("font"), fontStr);
+ insertCssProperty(u"font"_s, fontStr);
QString decoration;
if (font.underline())
- decoration += QStringLiteral("underline");
+ decoration += "underline"_L1;
if (font.strikeOut()) {
if (!decoration.isEmpty())
- decoration += QLatin1Char(' ');
- decoration += QStringLiteral("line-through");
+ decoration += u' ';
+ decoration += "line-through"_L1;
}
- insertCssProperty(QStringLiteral("text-decoration"), decoration);
+ insertCssProperty(u"text-decoration"_s, decoration);
}
}
@@ -298,19 +289,19 @@ void StyleSheetEditorDialog::insertCssProperty(const QString &name, const QStrin
// Simple check to see if we're in a selector scope
const QTextDocument *doc = m_editor->document();
- const QTextCursor closing = doc->find(QStringLiteral("}"), cursor, QTextDocument::FindBackward);
- const QTextCursor opening = doc->find(QStringLiteral("{"), cursor, QTextDocument::FindBackward);
+ const QTextCursor closing = doc->find(u"}"_s, cursor, QTextDocument::FindBackward);
+ const QTextCursor opening = doc->find(u"{"_s, cursor, QTextDocument::FindBackward);
const bool inSelector = !opening.isNull() && (closing.isNull() ||
closing.position() < opening.position());
QString insertion;
if (m_editor->textCursor().block().length() != 1)
- insertion += QLatin1Char('\n');
+ insertion += u'\n';
if (inSelector)
- insertion += QLatin1Char('\t');
+ insertion += u'\t';
insertion += name;
- insertion += QStringLiteral(": ");
+ insertion += ": "_L1;
insertion += value;
- insertion += QLatin1Char(';');
+ insertion += u';';
cursor.insertText(insertion);
cursor.endEditBlock();
} else {
@@ -321,8 +312,8 @@ void StyleSheetEditorDialog::insertCssProperty(const QString &name, const QStrin
void StyleSheetEditorDialog::slotRequestHelp()
{
- m_core->integration()->emitHelpRequested(QStringLiteral("qtwidgets"),
- QStringLiteral("stylesheet-reference.html"));
+ m_core->integration()->emitHelpRequested(u"qtwidgets"_s,
+ u"stylesheet-reference.html"_s);
}
// See QDialog::keyPressEvent()
@@ -363,10 +354,7 @@ bool StyleSheetEditorDialog::isStyleSheetValid(const QString &styleSheet)
QCss::StyleSheet sheet;
if (parser.parse(&sheet))
return true;
- QString fullSheet = QStringLiteral("* { ");
- fullSheet += styleSheet;
- fullSheet += QLatin1Char('}');
- QCss::Parser parser2(fullSheet);
+ QCss::Parser parser2("* { "_L1 + styleSheet + '}'_L1);
return parser2.parse(&sheet);
}
@@ -376,10 +364,10 @@ void StyleSheetEditorDialog::validateStyleSheet()
setOkButtonEnabled(valid);
if (valid) {
m_validityLabel->setText(tr("Valid Style Sheet"));
- m_validityLabel->setStyleSheet(QStringLiteral("color: green"));
+ m_validityLabel->setStyleSheet(u"color: green"_s);
} else {
m_validityLabel->setText(tr("Invalid Style Sheet"));
- m_validityLabel->setStyleSheet(QStringLiteral("color: red"));
+ m_validityLabel->setStyleSheet(u"color: red"_s);
}
}
@@ -402,7 +390,7 @@ StyleSheetPropertyEditorDialog::StyleSheetPropertyEditorDialog(QWidget *parent,
QDesignerPropertySheetExtension *sheet =
qt_extension<QDesignerPropertySheetExtension*>(m_fw->core()->extensionManager(), m_widget);
Q_ASSERT(sheet != nullptr);
- const int index = sheet->indexOf(QLatin1String(styleSheetProperty));
+ const int index = sheet->indexOf(styleSheetProperty);
const PropertySheetStringValue value = qvariant_cast<PropertySheetStringValue>(sheet->property(index));
setText(value.value());
}
@@ -410,7 +398,7 @@ StyleSheetPropertyEditorDialog::StyleSheetPropertyEditorDialog(QWidget *parent,
void StyleSheetPropertyEditorDialog::applyStyleSheet()
{
const PropertySheetStringValue value(text(), false);
- m_fw->cursor()->setWidgetProperty(m_widget, QLatin1String(styleSheetProperty), QVariant::fromValue(value));
+ m_fw->cursor()->setWidgetProperty(m_widget, styleSheetProperty, QVariant::fromValue(value));
}
} // namespace qdesigner_internal
diff --git a/src/designer/src/lib/shared/stylesheeteditor_p.h b/src/designer/src/lib/shared/stylesheeteditor_p.h
index ee6c3bc84..9943b4fa6 100644
--- a/src/designer/src/lib/shared/stylesheeteditor_p.h
+++ b/src/designer/src/lib/shared/stylesheeteditor_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/shared/textpropertyeditor.cpp b/src/designer/src/lib/shared/textpropertyeditor.cpp
index e78cb81b4..e345580ba 100644
--- a/src/designer/src/lib/shared/textpropertyeditor.cpp
+++ b/src/designer/src/lib/shared/textpropertyeditor.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "textpropertyeditor_p.h"
#include "propertylineedit_p.h"
@@ -42,9 +17,11 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace {
- const QChar NewLineChar(QLatin1Char('\n'));
- const QLatin1String EscapedNewLine("\\n");
+ const QChar NewLineChar(u'\n');
+ const auto EscapedNewLine = "\\n"_L1;
// A validator that replaces offending strings
class ReplacementValidator : public QValidator {
@@ -155,7 +132,7 @@ namespace {
QUrl UrlValidator::guessUrlFromString(const QString &string) const
{
const QString urlStr = string.trimmed();
- const QRegularExpression qualifiedUrl(QStringLiteral("^[a-zA-Z]+\\:.*$"));
+ const QRegularExpression qualifiedUrl(u"^[a-zA-Z]+\\:.*$"_s);
Q_ASSERT(qualifiedUrl.isValid());
// Check if it looks like a qualified URL. Try parsing it and see.
@@ -167,8 +144,8 @@ namespace {
}
// Might be a Qt resource
- if (string.startsWith(QStringLiteral(":/")))
- return QUrl(QStringLiteral("qrc") + string);
+ if (string.startsWith(":/"_L1))
+ return QUrl("qrc"_L1 + string);
// Might be a file.
if (QFile::exists(urlStr))
@@ -176,15 +153,15 @@ namespace {
// Might be a short url - try to detect the schema.
if (!hasSchema) {
- const int dotIndex = urlStr.indexOf(QLatin1Char('.'));
+ const int dotIndex = urlStr.indexOf(u'.');
if (dotIndex != -1) {
const QString prefix = urlStr.left(dotIndex).toLower();
QString urlString;
- if (prefix == QStringLiteral("ftp"))
+ if (prefix == "ftp"_L1)
urlString += prefix;
else
- urlString += QStringLiteral("http");
- urlString += QStringLiteral("://");
+ urlString += "http"_L1;
+ urlString += "://"_L1;
urlString += urlStr;
const QUrl url(urlString, QUrl::TolerantMode);
if (url.isValid())
@@ -246,30 +223,29 @@ namespace qdesigner_internal {
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->setValidator(new ReplacementValidator(m_lineEdit, NewLineChar, QString(u' ')));
m_lineEdit->setCompleter(nullptr);
break;
case ValidationObjectName:
- setRegularExpressionValidator(QStringLiteral("^[_a-zA-Z][_a-zA-Z0-9]{1,1023}$"));
+ setRegularExpressionValidator(u"^[_a-zA-Z][_a-zA-Z0-9]{1,1023}$"_s);
m_lineEdit->setCompleter(nullptr);
break;
case ValidationObjectNameScope:
- setRegularExpressionValidator(QStringLiteral("^[_a-zA-Z:][_a-zA-Z0-9:]{1,1023}$"));
+ setRegularExpressionValidator(u"^[_a-zA-Z:][_a-zA-Z0-9:]{1,1023}$"_s);
m_lineEdit->setCompleter(nullptr);
break;
case ValidationURL: {
- static QStringList urlCompletions;
- if (urlCompletions.isEmpty()) {
- urlCompletions.push_back(QStringLiteral("about:blank"));
- urlCompletions.push_back(QStringLiteral("http://"));
- urlCompletions.push_back(QStringLiteral("http://www."));
- urlCompletions.push_back(QStringLiteral("http://qt.io"));
- urlCompletions.push_back(QStringLiteral("file://"));
- urlCompletions.push_back(QStringLiteral("ftp://"));
- urlCompletions.push_back(QStringLiteral("data:"));
- urlCompletions.push_back(QStringLiteral("data:text/html,"));
- urlCompletions.push_back(QStringLiteral("qrc:/"));
- }
+ static const QStringList urlCompletions = {
+ u"about:blank"_s,
+ u"http://"_s,
+ u"http://www."_s,
+ u"http://qt.io"_s,
+ u"file://"_s,
+ u"ftp://"_s,
+ u"data:"_s,
+ u"data:text/html,"_s,
+ u"qrc:/"_s,
+ };
QCompleter *completer = new QCompleter(urlCompletions, m_lineEdit);
m_lineEdit->setCompleter(completer);
m_lineEdit->setValidator(new UrlValidator(completer, m_lineEdit));
@@ -376,9 +352,9 @@ namespace qdesigner_internal {
QString rc(s);
// protect backslashes
- rc.replace(QLatin1Char('\\'), QStringLiteral("\\\\"));
+ rc.replace('\\'_L1, "\\\\"_L1);
// escape newlines
- rc.replace(NewLineChar, QString(EscapedNewLine));
+ rc.replace(u'\n', EscapedNewLine);
return rc;
}
@@ -392,14 +368,14 @@ namespace qdesigner_internal {
return s;
QString rc(s);
- for (int pos = 0; (pos = rc.indexOf(QLatin1Char('\\'),pos)) >= 0 ; ) {
+ for (qsizetype pos = 0; (pos = rc.indexOf(u'\\', pos)) >= 0 ; ) {
// found an escaped character. If not a newline or at end of string, leave as is, else insert '\n'
- const int nextpos = pos + 1;
- if (nextpos >= rc.length()) // trailing '\\'
+ const qsizetype nextpos = pos + 1;
+ if (nextpos >= rc.size()) // trailing '\\'
break;
// Escaped NewLine
- if (rc.at(nextpos) == QChar(QLatin1Char('n')))
- rc[nextpos] = NewLineChar;
+ if (rc.at(nextpos) == u'n')
+ rc[nextpos] = u'\n';
// Remove escape, go past escaped
rc.remove(pos,1);
pos++;
diff --git a/src/designer/src/lib/shared/textpropertyeditor_p.h b/src/designer/src/lib/shared/textpropertyeditor_p.h
index fa899ed9e..3d32e9d6e 100644
--- a/src/designer/src/lib/shared/textpropertyeditor_p.h
+++ b/src/designer/src/lib/shared/textpropertyeditor_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -56,8 +31,6 @@ namespace qdesigner_internal {
// corresponds to that of QLineEdit.
class QDESIGNER_SHARED_EXPORT TextPropertyEditor : public QWidget
{
- TextPropertyEditor(const TextPropertyEditor &);
- TextPropertyEditor& operator=(const TextPropertyEditor &);
Q_OBJECT
Q_PROPERTY(QString text READ text WRITE setText USER true)
public:
diff --git a/src/designer/src/lib/shared/widgetdatabase.cpp b/src/designer/src/lib/shared/widgetdatabase.cpp
index 8621f2840..97df98f4d 100644
--- a/src/designer/src/lib/shared/widgetdatabase.cpp
+++ b/src/designer/src/lib/shared/widgetdatabase.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "widgetdatabase_p.h"
#include "widgetfactory_p.h"
@@ -40,23 +15,34 @@
#include <QtDesigner/abstractformeditor.h>
#include <QtUiPlugin/customwidget.h>
+#include <QtWidgets/QtWidgets>
+#ifdef QT_OPENGLWIDGETS_LIB
+#include <QtOpenGLWidgets/qopenglwidget.h>
+#endif
#include <QtCore/qxmlstream.h>
+#include <QtCore/qcoreapplication.h>
#include <QtCore/qscopedpointer.h>
#include <QtCore/qdebug.h>
#include <QtCore/qmetaobject.h>
+#include <QtCore/qset.h>
+#include <QtCore/qstring.h>
#include <QtCore/qtextstream.h>
#include <QtCore/qcoreapplication.h>
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace {
enum { debugWidgetDataBase = 0 };
}
namespace qdesigner_internal {
+using namespace Qt::StringLiterals;
+
// ----------------------------------------------------------
WidgetDataBaseItem::WidgetDataBaseItem(const QString &name, const QString &group)
: m_name(name),
@@ -247,6 +233,27 @@ WidgetDataBaseItem *WidgetDataBaseItem::clone(const QDesignerWidgetDataBaseItemI
return rc;
}
+QString WidgetDataBaseItem::baseClassName() const
+{
+ return m_extends.isEmpty() ? m_baseClassName : m_extends;
+}
+
+void WidgetDataBaseItem::setBaseClassName(const QString &b)
+{
+ m_baseClassName = b;
+}
+
+static void addWidgetItem(WidgetDataBase *wdb, const char *name, const QMetaObject &mo,
+ const char *comment)
+{
+ auto *item = new WidgetDataBaseItem(QString::fromUtf8(name));
+ if (auto *base = mo.superClass())
+ item->setBaseClassName(QString::fromUtf8(base->className()));
+ if (comment[0])
+ item->setToolTip(QString::fromUtf8(comment));
+ wdb->append(item);
+}
+
// ----------------------------------------------------------
WidgetDataBase::WidgetDataBase(QDesignerFormEditorInterface *core, QObject *parent)
: QDesignerWidgetDataBaseInterface(parent),
@@ -254,7 +261,7 @@ WidgetDataBase::WidgetDataBase(QDesignerFormEditorInterface *core, QObject *pare
{
#define DECLARE_LAYOUT(L, C)
#define DECLARE_COMPAT_WIDGET(W, C) DECLARE_WIDGET(W, C)
-#define DECLARE_WIDGET(W, C) append(new WidgetDataBaseItem(QString::fromUtf8(#W)));
+#define DECLARE_WIDGET(W, C) addWidgetItem(this, #W, W::staticMetaObject, C);
#include <widgets.table>
@@ -263,47 +270,65 @@ WidgetDataBase::WidgetDataBase(QDesignerFormEditorInterface *core, QObject *pare
#undef DECLARE_WIDGET
#undef DECLARE_WIDGET_1
- append(new WidgetDataBaseItem(QString::fromUtf8("Line")));
- append(new WidgetDataBaseItem(QString::fromUtf8("Spacer")));
- append(new WidgetDataBaseItem(QString::fromUtf8("QSplitter")));
- append(new WidgetDataBaseItem(QString::fromUtf8("QLayoutWidget")));
+ const QString msgAbstractClass =
+ QCoreApplication::translate("WidgetDataBase",
+ "Abstract base class that cannot be instantiated. For promotion/custom widget usage only.");
+
+#if QT_CONFIG(abstractbutton)
+ auto *abItem = new WidgetDataBaseItem(u"QAbstractButton"_s);
+ abItem->setToolTip(msgAbstractClass);
+ abItem->setBaseClassName(u"QWidget"_s);
+ append(abItem);
+#endif // QT_CONFIG(abstractbutton)
+
+#if QT_CONFIG(itemviews)
+ auto *aivItem = new WidgetDataBaseItem(u"QAbstractItemView"_s);
+ aivItem->setBaseClassName(u"QAbstractScrollArea"_s);
+ aivItem->setToolTip(msgAbstractClass);
+ append(aivItem);
+#endif // QT_CONFIG(itemviews)
+
+ append(new WidgetDataBaseItem(u"Line"_s));
+ append(new WidgetDataBaseItem(u"Spacer"_s));
+ append(new WidgetDataBaseItem(u"QSplitter"_s));
+ append(new WidgetDataBaseItem(u"QLayoutWidget"_s));
// QDesignerWidget is used as central widget and as container for tab widgets, etc.
- WidgetDataBaseItem *designerWidgetItem = new WidgetDataBaseItem(QString::fromUtf8("QDesignerWidget"));
+ WidgetDataBaseItem *designerWidgetItem = new WidgetDataBaseItem(u"QDesignerWidget"_s);
designerWidgetItem->setContainer(true);
append(designerWidgetItem);
- append(new WidgetDataBaseItem(QString::fromUtf8("QDesignerDialog")));
- append(new WidgetDataBaseItem(QString::fromUtf8("QDesignerMenu")));
- append(new WidgetDataBaseItem(QString::fromUtf8("QDesignerMenuBar")));
- append(new WidgetDataBaseItem(QString::fromUtf8("QDesignerDockWidget")));
- append(new WidgetDataBaseItem(QString::fromUtf8("QAction")));
- append(new WidgetDataBaseItem(QString::fromUtf8("QButtonGroup")));
+ append(new WidgetDataBaseItem(u"QDesignerDialog"_s));
+ append(new WidgetDataBaseItem(u"QDesignerMenu"_s));
+ append(new WidgetDataBaseItem(u"QDesignerMenuBar"_s));
+ append(new WidgetDataBaseItem(u"QDesignerDockWidget"_s));
+ append(new WidgetDataBaseItem(u"QAction"_s));
+ append(new WidgetDataBaseItem(u"QButtonGroup"_s));
// ### remove me
// ### check the casts
#if 0 // ### enable me after 4.1
- item(indexOfClassName(QStringLiteral("QToolBar")))->setContainer(true);
+ item(indexOfClassName(u"QToolBar"_s))->setContainer(true);
#endif
- item(indexOfClassName(QStringLiteral("QTabWidget")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QGroupBox")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QScrollArea")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QStackedWidget")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QToolBox")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QFrame")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QLayoutWidget")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QDesignerWidget")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QDesignerDialog")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QSplitter")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QMainWindow")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QDockWidget")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QDesignerDockWidget")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QMdiArea")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QWizard")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QWizardPage")))->setContainer(true);
-
- item(indexOfClassName(QStringLiteral("QWidget")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QDialog")))->setContainer(true);
+ item(indexOfClassName(u"QTabWidget"_s))->setContainer(true);
+ item(indexOfClassName(u"QGroupBox"_s))->setContainer(true);
+ item(indexOfClassName(u"QScrollArea"_s))->setContainer(true);
+ item(indexOfClassName(u"QStackedWidget"_s))->setContainer(true);
+ item(indexOfClassName(u"QToolBox"_s))->setContainer(true);
+ item(indexOfClassName(u"QFrame"_s))->setContainer(true);
+ item(indexOfClassName(u"QLayoutWidget"_s))->setContainer(true);
+ item(indexOfClassName(u"QDesignerWidget"_s))->setContainer(true);
+ item(indexOfClassName(u"QDesignerDialog"_s))->setContainer(true);
+ item(indexOfClassName(u"QSplitter"_s))->setContainer(true);
+ item(indexOfClassName(u"QMainWindow"_s))->setContainer(true);
+ item(indexOfClassName(u"QDockWidget"_s))->setContainer(true);
+ item(indexOfClassName(u"QDesignerDockWidget"_s))->setContainer(true);
+ item(indexOfClassName(u"QMdiArea"_s))->setContainer(true);
+ item(indexOfClassName(u"QWizard"_s))->setContainer(true);
+ item(indexOfClassName(u"QWizardPage"_s))->setContainer(true);
+
+ item(indexOfClassName(u"QWidget"_s))->setContainer(true);
+ item(indexOfClassName(u"QDialog"_s))->setContainer(true);
}
WidgetDataBase::~WidgetDataBase() = default;
@@ -347,22 +372,18 @@ static WidgetDataBaseItem *createCustomWidgetItem(const QDesignerCustomWidgetInt
void WidgetDataBase::loadPlugins()
{
- typedef QMap<QString, int> NameIndexMap;
- using ItemList = QList<QDesignerWidgetDataBaseItemInterface *>;
- using NameSet = QSet<QString>;
// 1) create a map of existing custom classes
- NameIndexMap existingCustomClasses;
- NameSet nonCustomClasses;
- const int count = m_items.size();
- for (int i = 0; i < count; i++) {
- const QDesignerWidgetDataBaseItemInterface* item = m_items[i];
+ QMap<QString, qsizetype> existingCustomClasses;
+ QSet<QString> nonCustomClasses;
+ for (qsizetype i = 0, count = m_items.size(); i < count; ++i) {
+ const QDesignerWidgetDataBaseItemInterface* item = m_items.at(i);
if (item->isCustom() && !item->isPromoted())
existingCustomClasses.insert(item->name(), i);
else
nonCustomClasses.insert(item->name());
}
// 2) create a list plugins
- ItemList pluginList;
+ QList<QDesignerWidgetDataBaseItemInterface *> pluginList;
const QDesignerPluginManager *pm = m_core->pluginManager();
const auto &customWidgets = pm->registeredCustomWidgets();
for (QDesignerCustomWidgetInterface* c : customWidgets)
@@ -374,10 +395,10 @@ void WidgetDataBase::loadPlugins()
unsigned addedPlugins = 0;
unsigned removedPlugins = 0;
if (!pluginList.isEmpty()) {
- for (QDesignerWidgetDataBaseItemInterface *pluginItem : qAsConst(pluginList)) {
+ for (QDesignerWidgetDataBaseItemInterface *pluginItem : std::as_const(pluginList)) {
const QString pluginName = pluginItem->name();
- NameIndexMap::iterator existingIt = existingCustomClasses.find(pluginName);
- if (existingIt == existingCustomClasses.end()) {
+ const auto existingIt = existingCustomClasses.constFind(pluginName);
+ if (existingIt == existingCustomClasses.cend()) {
// Add new class.
if (nonCustomClasses.contains(pluginName)) {
designerWarning(tr("A custom widget plugin whose class name (%1) matches that of an existing class has been found.").arg(pluginName));
@@ -387,7 +408,7 @@ void WidgetDataBase::loadPlugins()
}
} else {
// replace existing info
- const int existingIndex = existingIt.value();
+ const auto existingIndex = existingIt.value();
delete m_items[existingIndex];
m_items[existingIndex] = pluginItem;
existingCustomClasses.erase(existingIt);
@@ -397,16 +418,14 @@ void WidgetDataBase::loadPlugins()
}
}
// 4) remove classes that have not been matched. The stored indexes become invalid while deleting.
- if (!existingCustomClasses.isEmpty()) {
- NameIndexMap::const_iterator cend = existingCustomClasses.constEnd();
- for (NameIndexMap::const_iterator it = existingCustomClasses.constBegin();it != cend; ++it ) {
- const int index = indexOfClassName(it.key());
- if (index != -1) {
- remove(index);
- removedPlugins++;
- }
+ for (auto it = existingCustomClasses.cbegin(), cend = existingCustomClasses.cend(); it != cend; ++it ) {
+ const int index = indexOfClassName(it.key());
+ if (index != -1) {
+ remove(index);
+ removedPlugins++;
}
}
+
if (debugWidgetDataBase)
qDebug() << "WidgetDataBase::loadPlugins(): " << addedPlugins << " added, " << replacedPlugins << " replaced, " << removedPlugins << "deleted.";
}
@@ -456,7 +475,6 @@ void WidgetDataBase::grabStandardWidgetBoxIcons()
// At this point, grab the default icons for the non-custom widgets from
// the widget box. They will show up in the object inspector.
if (const QDesignerWidgetBox *wb = qobject_cast<const QDesignerWidgetBox *>(m_core->widgetBox())) {
- const QString qWidgetClass = QStringLiteral("QWidget");
const int itemCount = count();
for (int i = 0; i < itemCount; ++i) {
QDesignerWidgetDataBaseItemInterface *dbItem = item(i);
@@ -464,8 +482,8 @@ void WidgetDataBase::grabStandardWidgetBoxIcons()
// Careful not to catch the layout icons when looking for
// QWidget
const QString name = dbItem->name();
- if (name == qWidgetClass) {
- dbItem->setIcon(wb->iconForWidget(name, QStringLiteral("Containers")));
+ if (name == "QWidget"_L1) {
+ dbItem->setIcon(wb->iconForWidget(name, u"Containers"_s));
} else {
dbItem->setIcon(wb->iconForWidget(name));
}
@@ -481,7 +499,7 @@ enum { NewFormWidth = 400, NewFormHeight = 300 };
// Check if class is suitable to generate a form from
static inline bool isExistingTemplate(const QString &className)
{
- return className == QStringLiteral("QWidget") || className == QStringLiteral("QDialog") || className == QStringLiteral("QMainWindow");
+ return className == "QWidget"_L1 || className == "QDialog"_L1 || className == "QMainWindow"_L1;
}
// Check if class is suitable to generate a form from
@@ -489,9 +507,9 @@ static inline bool suitableForNewForm(const QString &className)
{
if (className.isEmpty()) // Missing custom widget information
return false;
- if (className == QStringLiteral("QSplitter"))
+ if (className == "QSplitter"_L1)
return false;
- if (className.startsWith(QStringLiteral("QDesigner")) || className.startsWith(QStringLiteral("QLayout")))
+ if (className.startsWith("QDesigner"_L1) || className.startsWith("QLayout"_L1))
return false;
return true;
}
@@ -537,8 +555,6 @@ QStringList WidgetDataBase::customFormWidgetClasses(const QDesignerFormEditorInt
// properties to be suitable for new forms
static QString xmlFromWidgetBox(const QDesignerFormEditorInterface *core, const QString &className, const QString &objectName)
{
- using PropertyList = QList<DomProperty *>;
-
QDesignerWidgetBoxInterface::Widget widget;
const bool found = QDesignerWidgetBox::findWidget(core->widgetBox(), className, QString(), &widget);
if (!found)
@@ -546,22 +562,20 @@ static QString xmlFromWidgetBox(const QDesignerFormEditorInterface *core, const
QScopedPointer<DomUI> domUI(QDesignerWidgetBox::xmlToUi(className, widget.domXml(), false));
if (domUI.isNull())
return QString();
- domUI->setAttributeVersion(QStringLiteral("4.0"));
+ domUI->setAttributeVersion(u"4.0"_s);
DomWidget *domWidget = domUI->elementWidget();
if (!domWidget)
return QString();
// Properties: Remove the "objectName" property in favour of the name attribute and check geometry.
domWidget->setAttributeName(objectName);
- const QString geometryProperty = QStringLiteral("geometry");
- const QString objectNameProperty = QStringLiteral("objectName");
- PropertyList properties = domWidget->elementProperty();
- for (PropertyList::iterator it = properties.begin(); it != properties.end(); ) {
+ QList<DomProperty *> properties = domWidget->elementProperty();
+ for (auto it = properties.begin(); it != properties.end(); ) {
DomProperty *property = *it;
- if (property->attributeName() == objectNameProperty) { // remove "objectName"
+ if (property->attributeName() == "objectName"_L1) { // remove "objectName"
it = properties.erase(it);
delete property;
} else {
- if (property->attributeName() == geometryProperty) { // Make sure form is at least 400, 300
+ if (property->attributeName() == "geometry"_L1) { // Make sure form is at least 400, 300
if (DomRect *geom = property->elementRect()) {
if (geom->elementWidth() < NewFormWidth)
geom->setElementWidth(NewFormWidth);
@@ -576,7 +590,7 @@ static QString xmlFromWidgetBox(const QDesignerFormEditorInterface *core, const
DomString *windowTitleString = new DomString;
windowTitleString->setText(objectName);
DomProperty *windowTitleProperty = new DomProperty;
- windowTitleProperty->setAttributeName(QStringLiteral("windowTitle"));
+ windowTitleProperty->setAttributeName(u"windowTitle"_s);
windowTitleProperty->setElementString(windowTitleString);
properties.push_back(windowTitleProperty);
// ------
@@ -607,11 +621,11 @@ static QString generateNewFormXML(const QString &className, const QString &simil
<< NewFormWidth << "</width><height>" << NewFormHeight << "</height></rect></property>"
<< R"(<property name="windowTitle"><string>)" << name << "</string></property>\n";
- if (similarClassName == QLatin1String("QMainWindow")) {
+ if (similarClassName == "QMainWindow"_L1) {
str << R"(<widget class="QWidget" name="centralwidget"/>)";
- } else if (similarClassName == QLatin1String("QWizard")) {
+ } else if (similarClassName == "QWizard"_L1) {
str << R"(<widget class="QWizardPage" name="wizardPage1"/><widget class="QWizardPage" name="wizardPage2"/>)";
- } else if (similarClassName == QLatin1String("QDockWidget")) {
+ } else if (similarClassName == "QDockWidget"_L1) {
str << R"(<widget class="QWidget" name="dockWidgetContents"/>)";
}
str << "</widget></ui>\n";
@@ -629,7 +643,7 @@ QString WidgetDataBase::formTemplate(const QDesignerFormEditorInterface *core, c
// 2) If that fails, only custom main windows, custom dialogs and unsupported Qt Widgets should
// be left over. Generate something that is similar to the default templates. Find a similar class.
const QDesignerWidgetDataBaseInterface *wdb = core->widgetDataBase();
- QString similarClass = QStringLiteral("QWidget");
+ QString similarClass = u"QWidget"_s;
const int index = wdb->indexOfClassName(className);
if (index != -1) {
const QDesignerWidgetDataBaseItemInterface *item = wdb->item(index);
@@ -643,16 +657,16 @@ QString WidgetDataBase::formTemplate(const QDesignerFormEditorInterface *core, c
// Set a fixed size on a XML template
QString WidgetDataBase::scaleFormTemplate(const QString &xml, const QSize &size, bool fixed)
{
- QScopedPointer<DomUI> domUI(QDesignerWidgetBox::xmlToUi(QStringLiteral("Form"), xml, false));
+ QScopedPointer<DomUI> domUI(QDesignerWidgetBox::xmlToUi(u"Form"_s, xml, false));
if (!domUI)
return QString();
DomWidget *domWidget = domUI->elementWidget();
if (!domWidget)
return QString();
// Properties: Find/Ensure the geometry, minimum and maximum sizes properties
- const QString geometryPropertyName = QStringLiteral("geometry");
- const QString minimumSizePropertyName = QStringLiteral("minimumSize");
- const QString maximumSizePropertyName = QStringLiteral("maximumSize");
+ const QString geometryPropertyName = u"geometry"_s;
+ const QString minimumSizePropertyName = u"minimumSize"_s;
+ const QString maximumSizePropertyName = u"maximumSize"_s;
DomProperty *geomProperty = nullptr;
DomProperty *minimumSizeProperty = nullptr;
DomProperty *maximumSizeProperty = nullptr;
@@ -662,13 +676,10 @@ QString WidgetDataBase::scaleFormTemplate(const QString &xml, const QSize &size,
const QString name = p->attributeName();
if (name == geometryPropertyName) {
geomProperty = p;
- } else {
- if (name == minimumSizePropertyName) {
- minimumSizeProperty = p;
- } else {
- if (name == maximumSizePropertyName)
- maximumSizeProperty = p;
- }
+ } else if (name == minimumSizePropertyName) {
+ minimumSizeProperty = p;
+ } else if (name == maximumSizePropertyName) {
+ maximumSizeProperty = p;
}
}
if (!geomProperty) {
@@ -727,20 +738,19 @@ QString WidgetDataBase::scaleFormTemplate(const QString &xml, const QSize &size,
// ---- free functions
QDESIGNER_SHARED_EXPORT IncludeSpecification includeSpecification(QString includeFile)
{
- const bool global = !includeFile.isEmpty() &&
- includeFile[0] == QLatin1Char('<') &&
- includeFile[includeFile.size() - 1] == QLatin1Char('>');
+ const bool global = includeFile.startsWith(u'<') && includeFile.endsWith(u'>');
if (global) {
- includeFile.remove(includeFile.size() - 1, 1);
+ includeFile.chop(1);
includeFile.remove(0, 1);
}
return IncludeSpecification(includeFile, global ? IncludeGlobal : IncludeLocal);
}
-QDESIGNER_SHARED_EXPORT QString buildIncludeFile(QString includeFile, IncludeType includeType) {
+QDESIGNER_SHARED_EXPORT QString buildIncludeFile(QString includeFile, IncludeType includeType)
+{
if (includeType == IncludeGlobal && !includeFile.isEmpty()) {
- includeFile.append(QLatin1Char('>'));
- includeFile.insert(0, QLatin1Char('<'));
+ includeFile.append(u'>');
+ includeFile.prepend(u'<');
}
return includeFile;
}
@@ -803,8 +813,7 @@ QDESIGNER_SHARED_EXPORT QDesignerWidgetDataBaseItemInterface *
derivedItem = WidgetDataBaseItem::clone(baseItem);
// Sort of hack: If base class is QWidget, we most likely
// do not want to inherit the container attribute.
- static const QString qWidgetName = QStringLiteral("QWidget");
- if (baseItem->name() == qWidgetName)
+ if (baseItem->name() == "QWidget"_L1)
derivedItem->setContainer(false);
// set new props
derivedItem->setName(className);
diff --git a/src/designer/src/lib/shared/widgetdatabase_p.h b/src/designer/src/lib/shared/widgetdatabase_p.h
index 73f00b6b6..10c3af61e 100644
--- a/src/designer/src/lib/shared/widgetdatabase_p.h
+++ b/src/designer/src/lib/shared/widgetdatabase_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -106,6 +81,9 @@ public:
static WidgetDataBaseItem *clone(const QDesignerWidgetDataBaseItemInterface *item);
+ QString baseClassName() const; // FIXME Qt 7: Move to QDesignerWidgetDataBaseItemInterface
+ void setBaseClassName(const QString &b);
+
QStringList fakeSlots() const;
void setFakeSlots(const QStringList &);
@@ -117,6 +95,7 @@ public:
private:
QString m_name;
+ QString m_baseClassName;
QString m_group;
QString m_toolTip;
QString m_whatsThis;
@@ -136,7 +115,7 @@ private:
enum IncludeType { IncludeLocal, IncludeGlobal };
-using IncludeSpecification = QPair<QString, IncludeType>;
+using IncludeSpecification = std::pair<QString, IncludeType>;
QDESIGNER_SHARED_EXPORT IncludeSpecification includeSpecification(QString includeFile);
QDESIGNER_SHARED_EXPORT QString buildIncludeFile(QString includeFile, IncludeType includeType);
diff --git a/src/designer/src/lib/shared/widgetfactory.cpp b/src/designer/src/lib/shared/widgetfactory.cpp
index 34253b32b..537ecf8a9 100644
--- a/src/designer/src/lib/shared/widgetfactory.cpp
+++ b/src/designer/src/lib/shared/widgetfactory.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "widgetfactory_p.h"
#include "widgetdatabase_p.h"
@@ -71,17 +46,27 @@
#include <QtCore/qmetaobject.h>
#include <QtCore/qpointer.h>
+#if QT_CONFIG(abstractbutton)
+# include <QtWidgets/qabstractbutton.h>
+#endif
+
+#if QT_CONFIG(itemviews)
+# include <QtWidgets/qabstractitemview.h>
+#endif
+
#ifdef QT_OPENGLWIDGETS_LIB
# include <QtOpenGLWidgets/qopenglwidget.h>
#endif
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
#ifdef Q_OS_WIN
static inline bool isAxWidget(const QObject *o)
{
// Is it one of QDesignerAxWidget/QDesignerAxPluginWidget?
- static const char *axWidgetName = "QDesignerAx";
+ static const char axWidgetName[] = "QDesignerAx";
static const size_t axWidgetNameLen = qstrlen(axWidgetName);
return qstrncmp(o->metaObject()->className(), axWidgetName, axWidgetNameLen) == 0;
}
@@ -90,10 +75,63 @@ static inline bool isAxWidget(const QObject *o)
/* Dynamic boolean property indicating object was created by the factory
* for the form editor. */
-static const char *formEditorDynamicProperty = "_q_formEditorObject";
+static const char formEditorDynamicProperty[] = "_q_formEditorObject";
namespace qdesigner_internal {
+#if QT_CONFIG(abstractbutton)
+
+class QDesignerAbstractButton : public QAbstractButton
+{
+public:
+ using QAbstractButton::QAbstractButton;
+
+protected:
+ void paintEvent(QPaintEvent *) override {}
+};
+
+#endif
+
+#if QT_CONFIG(itemviews)
+
+class QDesignerAbstractItemView : public QAbstractItemView
+{
+public:
+ using QAbstractItemView::QAbstractItemView;
+
+ QRect visualRect(const QModelIndex &) const override
+ {
+ return QRect(QPoint(), QSize(10, 10));
+ }
+
+ void scrollTo(const QModelIndex &, ScrollHint = EnsureVisible) override {}
+
+ QModelIndex indexAt(const QPoint &) const override
+ {
+ return {};
+ }
+
+protected:
+ QModelIndex moveCursor(CursorAction, Qt::KeyboardModifiers) override
+ {
+ return {};
+ }
+
+ int horizontalOffset() const override { return 0; }
+ int verticalOffset() const override { return 0; }
+
+ bool isIndexHidden(const QModelIndex &) const override { return false; }
+
+ void setSelection(const QRect &, QItemSelectionModel::SelectionFlags) override {}
+
+ QRegion visualRegionForSelection(const QItemSelection &) const override
+ {
+ return QRegion(QRect(QPoint(), QSize(10, 10)));
+ }
+};
+
+#endif // QT_CONFIG(itemviews)
+
// A friendly SpinBox that grants access to its QLineEdit
class FriendlySpinBox : public QAbstractSpinBox {
public:
@@ -163,35 +201,6 @@ void WizardPageChangeWatcher::pageChanged()
}
}
-// ---------------- WidgetFactory::Strings
-WidgetFactory::Strings::Strings() :
- m_alignment(QStringLiteral("alignment")),
- m_bottomMargin(QStringLiteral("bottomMargin")),
- m_geometry(QStringLiteral("geometry")),
- m_leftMargin(QStringLiteral("leftMargin")),
- m_line(QStringLiteral("Line")),
- m_objectName(QStringLiteral("objectName")),
- m_spacerName(QStringLiteral("spacerName")),
- m_orientation(QStringLiteral("orientation")),
- m_qAction(QStringLiteral("QAction")),
- m_qButtonGroup(QStringLiteral("QButtonGroup")),
- m_qAxWidget(QStringLiteral("QAxWidget")),
- m_qDialog(QStringLiteral("QDialog")),
- m_qDockWidget(QStringLiteral("QDockWidget")),
- m_qLayoutWidget(QStringLiteral("QLayoutWidget")),
- m_qMenu(QStringLiteral("QMenu")),
- m_qMenuBar(QStringLiteral("QMenuBar")),
- m_qWidget(QStringLiteral("QWidget")),
- m_rightMargin(QStringLiteral("rightMargin")),
- m_sizeHint(QStringLiteral("sizeHint")),
- m_spacer(QStringLiteral("Spacer")),
- m_text(QStringLiteral("text")),
- m_title(QStringLiteral("title")),
- m_topMargin(QStringLiteral("topMargin")),
- m_windowIcon(QStringLiteral("windowIcon")),
- m_windowTitle(QStringLiteral("windowTitle"))
-{
-}
// ---------------- WidgetFactory
const char *WidgetFactory::disableStyleCustomPaintingPropertyC = "_q_custom_style_disabled";
@@ -228,9 +237,9 @@ QObject* WidgetFactory::createObject(const QString &className, QObject* parent)
qWarning("** WARNING %s called with an empty class name", Q_FUNC_INFO);
return nullptr;
}
- if (className == m_strings.m_qAction)
+ if (className == "QAction"_L1)
return new QAction(parent);
- if (className == m_strings.m_qButtonGroup)
+ if (className == "QButtonGroup"_L1)
return new QButtonGroup(parent);
return nullptr;
}
@@ -257,11 +266,11 @@ static bool classNameMatches(const QObject *created, const QString &className)
QWidget* WidgetFactory::createCustomWidget(const QString &className, QWidget *parentWidget, bool *creationError) const
{
*creationError = false;
- CustomWidgetFactoryMap::const_iterator it = m_customFactory.constFind(className);
- if (it == m_customFactory.constEnd())
+
+ auto *factory = m_customFactory.value(className, nullptr);
+ if (factory == nullptr)
return nullptr;
- QDesignerCustomWidgetInterface *factory = it.value();
QWidget *rc = factory->createWidget(parentWidget);
// shouldn't happen
if (!rc) {
@@ -332,25 +341,33 @@ QWidget *WidgetFactory::createWidget(const QString &widgetName, QWidget *parentW
return nullptr;
// 2) Special widgets
- if (widgetName == m_strings.m_line) {
+ if (widgetName == "Line"_L1) {
w = new Line(parentWidget);
- } else if (widgetName == m_strings.m_qDockWidget) {
+#if QT_CONFIG(abstractbutton)
+ } else if (widgetName == u"QAbstractButton") {
+ w = new QDesignerAbstractButton(parentWidget);
+#endif
+#if QT_CONFIG(itemviews)
+ } else if (widgetName == u"QAbstractItemView") {
+ w = new QDesignerAbstractItemView(parentWidget);
+#endif
+ } else if (widgetName == "QDockWidget"_L1) {
w = new QDesignerDockWidget(parentWidget);
- } else if (widgetName == m_strings.m_qMenuBar) {
+ } else if (widgetName == "QMenuBar"_L1) {
w = new QDesignerMenuBar(parentWidget);
- } else if (widgetName == m_strings.m_qMenu) {
+ } else if (widgetName == "QMenu"_L1) {
w = new QDesignerMenu(parentWidget);
- } else if (widgetName == m_strings.m_spacer) {
+ } else if (widgetName == "Spacer"_L1) {
w = new Spacer(parentWidget);
- } else if (widgetName == m_strings.m_qLayoutWidget) {
+ } else if (widgetName == "QLayoutWidget"_L1) {
w = fw ? new QLayoutWidget(fw, parentWidget) : new QWidget(parentWidget);
- } else if (widgetName == m_strings.m_qDialog) {
+ } else if (widgetName == "QDialog"_L1) {
if (fw) {
w = new QDesignerDialog(fw, parentWidget);
} else {
w = new QDialog(parentWidget);
}
- } else if (widgetName == m_strings.m_qWidget) {
+ } else if (widgetName == "QWidget"_L1) {
/* We want a 'QDesignerWidget' that draws a grid only for widget
* forms and container extension pages (not for preview and not
* for normal QWidget children on forms (legacy) */
@@ -390,13 +407,13 @@ QWidget *WidgetFactory::createWidget(const QString &widgetName, QWidget *parentW
if (w)
break;
// 4) fallBack
- const QString fallBackBaseClass = m_strings.m_qWidget;
+ const QString fallBackBaseClass = "QWidget"_L1;
QDesignerWidgetDataBaseInterface *db = core()->widgetDataBase();
QDesignerWidgetDataBaseItemInterface *item = db->item(db->indexOfClassName(widgetName));
if (item == nullptr) {
// Emergency: Create, derived from QWidget
QString includeFile = widgetName.toLower();
- includeFile += QStringLiteral(".h");
+ includeFile += ".h"_L1;
item = appendDerived(db,widgetName, tr("%1 Widget").arg(widgetName),fallBackBaseClass,
includeFile, true, true);
Q_ASSERT(item);
@@ -431,27 +448,27 @@ QString WidgetFactory::classNameOf(QDesignerFormEditorInterface *c, const QObjec
const char *className = o->metaObject()->className();
if (!o->isWidgetType())
- return QLatin1String(className);
+ return QLatin1StringView(className);
const QWidget *w = static_cast<const QWidget*>(o);
// check promoted before designer special
const QString customClassName = promotedCustomClassName(c, const_cast<QWidget*>(w));
if (!customClassName.isEmpty())
return customClassName;
if (qobject_cast<const QDesignerMenuBar*>(w))
- return QStringLiteral("QMenuBar");
+ return u"QMenuBar"_s;
if (qobject_cast<const QDesignerMenu*>(w))
- return QStringLiteral("QMenu");
+ return u"QMenu"_s;
if (qobject_cast<const QDesignerDockWidget*>(w))
- return QStringLiteral("QDockWidget");
+ return u"QDockWidget"_s;
if (qobject_cast<const QDesignerDialog*>(w))
- return QStringLiteral("QDialog");
+ return u"QDialog"_s;
if (qobject_cast<const QDesignerWidget*>(w))
- return QStringLiteral("QWidget");
+ return u"QWidget"_s;
#ifdef Q_OS_WIN
if (isAxWidget(w))
- return QStringLiteral("QAxWidget");
+ return u"QAxWidget"_s;
#endif
- return QLatin1String(className);
+ return QLatin1StringView(className);
}
QLayout *WidgetFactory::createUnmanagedLayout(QWidget *parentWidget, int type)
@@ -508,15 +525,15 @@ QLayout *WidgetFactory::createLayout(QWidget *widget, QLayout *parentLayout, int
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), layout);
if (sheet) {
- sheet->setChanged(sheet->indexOf(m_strings.m_objectName), true);
+ sheet->setChanged(sheet->indexOf(u"objectName"_s), true);
if (widget->inherits("QLayoutWidget")) {
- sheet->setProperty(sheet->indexOf(m_strings.m_leftMargin), 0);
- sheet->setProperty(sheet->indexOf(m_strings.m_topMargin), 0);
- sheet->setProperty(sheet->indexOf(m_strings.m_rightMargin), 0);
- sheet->setProperty(sheet->indexOf(m_strings.m_bottomMargin), 0);
+ sheet->setProperty(sheet->indexOf(u"leftMargin"_s), 0);
+ sheet->setProperty(sheet->indexOf(u"topMargin"_s), 0);
+ sheet->setProperty(sheet->indexOf(u"rightMargin"_s), 0);
+ sheet->setProperty(sheet->indexOf(u"bottomMargin"_s), 0);
}
- const int index = sheet->indexOf(m_strings.m_alignment);
+ const int index = sheet->indexOf(u"alignment"_s);
if (index != -1)
sheet->setChanged(index, true);
}
@@ -615,11 +632,11 @@ void WidgetFactory::initialize(QObject *object) const
if (!sheet)
return;
- sheet->setChanged(sheet->indexOf(m_strings.m_objectName), true);
+ sheet->setChanged(sheet->indexOf(u"objectName"_s), true);
if (!object->isWidgetType()) {
if (qobject_cast<QAction*>(object))
- sheet->setChanged(sheet->indexOf(m_strings.m_text), true);
+ sheet->setChanged(sheet->indexOf(u"text"_s), true);
return;
}
@@ -631,32 +648,32 @@ void WidgetFactory::initialize(QObject *object) const
widget->setFocusPolicy((isMenu || isMenuBar) ? Qt::StrongFocus : Qt::NoFocus);
if (!isMenu)
- sheet->setChanged(sheet->indexOf(m_strings.m_geometry), true);
+ sheet->setChanged(sheet->indexOf(u"geometry"_s), true);
if (qobject_cast<Spacer*>(widget)) {
- sheet->setChanged(sheet->indexOf(m_strings.m_spacerName), true);
+ sheet->setChanged(sheet->indexOf(u"spacerName"_s), true);
return;
}
- const int o = sheet->indexOf(m_strings.m_orientation);
+ const int o = sheet->indexOf(u"orientation"_s);
if (o != -1 && widget->inherits("QSplitter"))
sheet->setChanged(o, true);
if (QToolBar *toolBar = qobject_cast<QToolBar*>(widget)) {
ToolBarEventFilter::install(toolBar);
- sheet->setVisible(sheet->indexOf(m_strings.m_windowTitle), true);
+ sheet->setVisible(sheet->indexOf(u"windowTitle"_s), true);
toolBar->setFloatable(false); // prevent toolbars from being dragged off
return;
}
if (qobject_cast<QDockWidget*>(widget)) {
- sheet->setVisible(sheet->indexOf(m_strings.m_windowTitle), true);
- sheet->setVisible(sheet->indexOf(m_strings.m_windowIcon), true);
+ sheet->setVisible(sheet->indexOf(u"windowTitle"_s), true);
+ sheet->setVisible(sheet->indexOf(u"windowIcon"_s), true);
return;
}
if (isMenu) {
- sheet->setChanged(sheet->indexOf(m_strings.m_title), true);
+ sheet->setChanged(sheet->indexOf(u"title"_s), true);
return;
}
// helpers
@@ -694,7 +711,7 @@ void WidgetFactory::initialize(QObject *object) const
static inline QString classNameOfStyle(const QStyle *s)
{
- return QLatin1String(s->metaObject()->className());
+ return QLatin1StringView(s->metaObject()->className());
}
QString WidgetFactory::styleName() const
@@ -722,7 +739,7 @@ QStyle *WidgetFactory::getStyle(const QString &styleName)
if (isApplicationStyle(styleName))
return qApp->style();
- StyleCache::iterator it = m_styleCache.find(styleName);
+ auto it = m_styleCache.find(styleName);
if (it == m_styleCache.end()) {
QStyle *style = QStyleFactory::create(styleName);
if (!style) {
@@ -752,9 +769,8 @@ void WidgetFactory::applyStyleToTopLevel(QStyle *style, QWidget *widget)
widget->setStyle(style);
widget->setPalette(standardPalette);
const QWidgetList lst = widget->findChildren<QWidget*>();
- const QWidgetList::const_iterator cend = lst.constEnd();
- for (QWidgetList::const_iterator it = lst.constBegin(); it != cend; ++it)
- (*it)->setStyle(style);
+ for (auto *w : lst)
+ w->setStyle(style);
}
// Check for 'interactor' click on a tab bar,
@@ -791,9 +807,6 @@ static bool isTabBarInteractor(const QTabBar *tabBar)
static bool isPassiveInteractorHelper(const QWidget *widget)
{
- static const QString qtPassive = QStringLiteral("__qt__passive_");
- static const QString qtMainWindowSplitter = QStringLiteral("qt_qmainwindow_extended_splitter");
-
if (qobject_cast<const QMenuBar*>(widget)
#if QT_CONFIG(sizegrip)
|| qobject_cast<const QSizeGrip*>(widget)
@@ -813,10 +826,8 @@ static bool isPassiveInteractorHelper(const QWidget *widget)
} else if (qobject_cast<const QScrollBar*>(widget)) {
// A scroll bar is an interactor on a QAbstractScrollArea only.
if (auto parent = widget->parentWidget()) {
- const QString objectName = parent->objectName();
- static const QString scrollAreaVContainer = QStringLiteral("qt_scrollarea_vcontainer");
- static const QString scrollAreaHContainer = QStringLiteral("qt_scrollarea_hcontainer");
- if (objectName == scrollAreaVContainer || objectName == scrollAreaHContainer)
+ const QString &objectName = parent->objectName();
+ if (objectName == "qt_scrollarea_vcontainer"_L1 || objectName == "qt_scrollarea_hcontainer"_L1)
return true;
}
} else if (qstrcmp(widget->metaObject()->className(), "QDockWidgetTitle") == 0) {
@@ -825,7 +836,8 @@ static bool isPassiveInteractorHelper(const QWidget *widget)
return true;
}
const QString &name = widget->objectName();
- return name.startsWith(qtPassive) || name == qtMainWindowSplitter;
+ return name.startsWith("__qt__passive_"_L1)
+ || name == "qt_qmainwindow_extended_splitter"_L1;
}
bool WidgetFactory::isPassiveInteractor(QWidget *widget)
diff --git a/src/designer/src/lib/shared/widgetfactory_p.h b/src/designer/src/lib/shared/widgetfactory_p.h
index e9fd4bfe6..6844ed578 100644
--- a/src/designer/src/lib/shared/widgetfactory_p.h
+++ b/src/designer/src/lib/shared/widgetfactory_p.h
@@ -1,30 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+
+
+
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
@@ -119,49 +97,17 @@ public slots:
void formWindowAdded(QDesignerFormWindowInterface *formWindow);
private:
- struct Strings { // Reduce string allocations by storing predefined strings
- Strings();
- const QString m_alignment;
- const QString m_bottomMargin;
- const QString m_geometry;
- const QString m_leftMargin;
- const QString m_line;
- const QString m_objectName;
- const QString m_spacerName;
- const QString m_orientation;
- const QString m_qAction;
- const QString m_qButtonGroup;
- const QString m_qAxWidget;
- const QString m_qDialog;
- const QString m_qDockWidget;
- const QString m_qLayoutWidget;
- const QString m_qMenu;
- const QString m_qMenuBar;
- const QString m_qWidget;
- const QString m_rightMargin;
- const QString m_sizeHint;
- const QString m_spacer;
- const QString m_text;
- const QString m_title;
- const QString m_topMargin;
- const QString m_windowIcon;
- const QString m_windowTitle;
- };
-
QWidget* createCustomWidget(const QString &className, QWidget *parentWidget, bool *creationError) const;
QDesignerFormWindowInterface *findFormWindow(QWidget *parentWidget) const;
void setFormWindowStyle(QDesignerFormWindowInterface *formWindow);
- const Strings m_strings;
QDesignerFormEditorInterface *m_core;
- using CustomWidgetFactoryMap = QMap<QString, QDesignerCustomWidgetInterface*>;
- CustomWidgetFactoryMap m_customFactory;
+ QMap<QString, QDesignerCustomWidgetInterface *> m_customFactory;
QDesignerFormWindowInterface *m_formWindow;
// Points to the cached style or 0 if the default (qApp) is active
QStyle *m_currentStyle;
- using StyleCache = QHash<QString, QStyle *>;
- StyleCache m_styleCache;
+ QHash<QString, QStyle *> m_styleCache;
};
} // namespace qdesigner_internal
diff --git a/src/designer/src/lib/shared/zoomwidget.cpp b/src/designer/src/lib/shared/zoomwidget.cpp
index 6c947f4ac..57968920c 100644
--- a/src/designer/src/lib/shared/zoomwidget.cpp
+++ b/src/designer/src/lib/shared/zoomwidget.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "zoomwidget_p.h"
@@ -44,6 +19,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
enum { debugZoomWidget = 0 };
static const int menuZoomList[] = { 100, 25, 50, 75, 125, 150 , 175, 200 };
@@ -249,7 +226,7 @@ QVariant ZoomProxyWidget::itemChange(GraphicsItemChange change, const QVariant &
* It redirects the events to another handler of ZoomWidget as its
* base class QScrollArea also implements eventFilter() for its viewport. */
-static const char *zoomedEventFilterRedirectorNameC = "__qt_ZoomedEventFilterRedirector";
+static constexpr auto zoomedEventFilterRedirectorNameC = "__qt_ZoomedEventFilterRedirector"_L1;
class ZoomedEventFilterRedirector : public QObject {
Q_DISABLE_COPY_MOVE(ZoomedEventFilterRedirector)
@@ -266,7 +243,7 @@ ZoomedEventFilterRedirector::ZoomedEventFilterRedirector(ZoomWidget *zw, QObject
QObject(parent),
m_zw(zw)
{
- setObjectName(QLatin1String(zoomedEventFilterRedirectorNameC));
+ setObjectName(zoomedEventFilterRedirectorNameC);
}
bool ZoomedEventFilterRedirector::eventFilter(QObject *watched, QEvent *event)
@@ -293,7 +270,7 @@ void ZoomWidget::setWidget(QWidget *w, Qt::WindowFlags wFlags)
scene().removeItem(m_proxy);
if (QWidget *w = m_proxy->widget()) {
// remove the event filter
- if (QObject *evf = w->findChild<QObject*>(QLatin1String(zoomedEventFilterRedirectorNameC)))
+ if (QObject *evf = w->findChild<QObject*>(zoomedEventFilterRedirectorNameC))
w->removeEventFilter(evf);
}
m_proxy->deleteLater();
diff --git a/src/designer/src/lib/shared/zoomwidget_p.h b/src/designer/src/lib/shared/zoomwidget_p.h
index 1830be4be..0e8a602eb 100644
--- a/src/designer/src/lib/shared/zoomwidget_p.h
+++ b/src/designer/src/lib/shared/zoomwidget_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
//
// W A R N I N G
diff --git a/src/designer/src/lib/uilib/abstractformbuilder.cpp b/src/designer/src/lib/uilib/abstractformbuilder.cpp
index d460c013c..01feb1a7c 100644
--- a/src/designer/src/lib/uilib/abstractformbuilder.cpp
+++ b/src/designer/src/lib/uilib/abstractformbuilder.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "abstractformbuilder.h"
#include "formbuilderextra_p.h"
@@ -92,14 +56,23 @@
Q_DECLARE_METATYPE(QWidgetList)
-static const char *buttonGroupPropertyC = "buttonGroup";
-
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
+static constexpr auto buttonGroupPropertyC = "buttonGroup"_L1;
+
#ifdef QFORMINTERNAL_NAMESPACE
using namespace QFormInternal;
#endif
+using QFBE = QFormBuilderExtra;
+
+static inline DomProperty *currentIndexProperty(const QList<DomProperty*> &properties)
+{
+ return QFBE::propertyByName(properties, "currentIndex");
+}
+
class QFriendlyLayout: public QLayout
{
public:
@@ -127,7 +100,7 @@ public:
QFormBuilder class to create user interfaces from UI files at
run-time. For example:
- \snippet lib/tools_designer_src_lib_uilib_abstractformbuilder.cpp 0
+ \snippet lib/tools_designer_src_lib_uilib_formbuilder.cpp 0
To override certain aspects of the form builder's behavior,
subclass QAbstractFormBuilder and reimplement the relevant virtual
@@ -188,8 +161,6 @@ QWidget *QAbstractFormBuilder::load(QIODevice *dev, QWidget *parentWidget)
*/
QWidget *QAbstractFormBuilder::create(DomUI *ui, QWidget *parentWidget)
{
- using ButtonGroupHash = QFormBuilderExtra::ButtonGroupHash;
-
d->clear();
if (const DomLayoutDefault *def = ui->elementLayoutDefault()) {
d->m_defaultMargin = def->hasAttributeMargin() ? def->attributeMargin() : INT_MIN;
@@ -207,12 +178,9 @@ QWidget *QAbstractFormBuilder::create(DomUI *ui, QWidget *parentWidget)
if (QWidget *widget = create(ui_widget, parentWidget)) {
// Reparent button groups that were actually created to main container for them to be found in the signal/slot part
- const ButtonGroupHash &buttonGroups = d->buttonGroups();
- if (!buttonGroups.isEmpty()) {
- const ButtonGroupHash::const_iterator cend = buttonGroups.constEnd();
- for (ButtonGroupHash::const_iterator it = buttonGroups.constBegin(); it != cend; ++it)
- if (it.value().second)
- it.value().second->setParent(widget);
+ for (const auto &bg : std::as_const(d->buttonGroups())) {
+ if (bg.second)
+ bg.second->setParent(widget);
}
createConnections(ui->elementConnections(), widget);
createResources(ui->elementResources()); // maybe this should go first, before create()...
@@ -287,10 +255,9 @@ QWidget *QAbstractFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidge
const auto &addActions = ui_widget->elementAddAction();
if (!addActions.isEmpty()) {
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
for (DomActionRef *ui_action_ref : addActions) {
const QString name = ui_action_ref->attributeName();
- if (name == strings.separator) {
+ if (name == "separator"_L1) {
QAction *sep = new QAction(w);
sep->setSeparator(true);
w->addAction(sep);
@@ -372,8 +339,9 @@ QActionGroup *QAbstractFormBuilder::create(DomActionGroup *ui_action_group, QObj
// figure out the toolbar area of a DOM attrib list.
// By legacy, it is stored as an integer. As of 4.3.0, it is the enumeration value.
-Qt::ToolBarArea QAbstractFormBuilder::toolbarAreaFromDOMAttributes(const DomPropertyHash &attributes) {
- const DomProperty *attr = attributes.value(QFormBuilderStrings::instance().toolBarAreaAttribute);
+Qt::ToolBarArea QAbstractFormBuilder::toolbarAreaFromDOMAttributes(const DomPropertyHash &attributes)
+{
+ const DomProperty *attr = attributes.value("toolBarArea"_L1);
if (!attr)
return Qt::TopToolBarArea;
switch(attr->kind()) {
@@ -393,13 +361,12 @@ Qt::ToolBarArea QAbstractFormBuilder::toolbarAreaFromDOMAttributes(const DomProp
*/
bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidget *parentWidget)
{
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
const DomPropertyHash attributes = propertyMap(ui_widget->elementAttribute());
if (parentWidget == nullptr)
return true;
// Check special cases. First: Custom container
- const QString className = QLatin1String(parentWidget->metaObject()->className());
+ const QString className = QLatin1StringView(parentWidget->metaObject()->className());
const QString addPageMethod = d->customWidgetAddPageMethod(className);
if (!addPageMethod.isEmpty()) {
// If this fails ( non-existent or non-slot), use ContainerExtension in Designer, else it can't be helped
@@ -421,8 +388,8 @@ bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidge
if (QToolBar *toolBar = qobject_cast<QToolBar*>(widget)) {
mw->addToolBar(toolbarAreaFromDOMAttributes(attributes), toolBar);
// check break
- if (const DomProperty *attr = attributes.value(strings.toolBarBreakAttribute))
- if (attr->elementBool() == strings.trueValue)
+ if (const DomProperty *attr = attributes.value("toolBarBreak"_L1))
+ if (attr->elementBool() == "true"_L1)
mw->insertToolBarBreak (toolBar);
return true;
@@ -440,7 +407,7 @@ bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidge
#if QT_CONFIG(dockwidget)
// apply the dockwidget's attributes
if (QDockWidget *dockWidget = qobject_cast<QDockWidget*>(widget)) {
- if (const DomProperty *attr = attributes.value(strings.dockWidgetAreaAttribute)) {
+ if (const DomProperty *attr = attributes.value("dockWidgetArea"_L1)) {
Qt::DockWidgetArea area = static_cast<Qt::DockWidgetArea>(attr->elementNumber());
if (!dockWidget->isAreaAllowed(area)) {
if (dockWidget->isAreaAllowed(Qt::LeftDockWidgetArea))
@@ -471,25 +438,25 @@ bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidge
widget->setParent(nullptr);
const int tabIndex = tabWidget->count();
- if (const DomProperty *titleP = attributes.value(strings.titleAttribute, 0))
+ if (auto *titleP = attributes.value(QFormBuilderStrings::titleAttribute))
tabWidget->addTab(widget, toString(titleP->elementString()));
else
- tabWidget->addTab(widget, strings.defaultTitle);
+ tabWidget->addTab(widget, "Page"_L1);
- if (DomProperty *picon = attributes.value(strings.iconAttribute)) {
+ if (const auto *picon = attributes.value(QFormBuilderStrings::iconAttribute)) {
QVariant v = resourceBuilder()->loadResource(workingDirectory(), picon);
QVariant nativeValue = resourceBuilder()->toNativeValue(v);
tabWidget->setTabIcon(tabIndex, qvariant_cast<QIcon>(nativeValue));
}
#if QT_CONFIG(tooltip)
- if (const DomProperty *ptoolTip = attributes.value(strings.toolTipAttribute)) {
+ if (const auto *ptoolTip = attributes.value(QFormBuilderStrings::toolTipAttribute)) {
tabWidget->setTabToolTip(tabIndex, toString(ptoolTip->elementString()));
}
#endif
#if QT_CONFIG(whatsthis)
- if (const DomProperty *pwhatsThis = attributes.value(strings.whatsThisAttribute)) {
+ if (const auto *pwhatsThis = attributes.value(QFormBuilderStrings::whatsThisAttribute)) {
tabWidget->setTabWhatsThis(tabIndex, toString(pwhatsThis->elementString()));
}
#endif
@@ -501,19 +468,19 @@ bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidge
#if QT_CONFIG(toolbox)
else if (QToolBox *toolBox = qobject_cast<QToolBox*>(parentWidget)) {
const int tabIndex = toolBox->count();
- if (const DomProperty *labelP = attributes.value(strings.labelAttribute, 0))
+ if (const auto *labelP = attributes.value(QFormBuilderStrings::labelAttribute))
toolBox->addItem(widget, toString(labelP->elementString()));
else
- toolBox->addItem(widget, strings.defaultTitle);
+ toolBox->addItem(widget, "Page"_L1);
- if (DomProperty *picon = attributes.value(strings.iconAttribute)) {
+ if (const auto *picon = attributes.value(QFormBuilderStrings::iconAttribute)) {
QVariant v = resourceBuilder()->loadResource(workingDirectory(), picon);
QVariant nativeValue = resourceBuilder()->toNativeValue(v);
toolBox->setItemIcon(tabIndex, qvariant_cast<QIcon>(nativeValue));
}
#if QT_CONFIG(tooltip)
- if (const DomProperty *ptoolTip = attributes.value(strings.toolTipAttribute)) {
+ if (const auto *ptoolTip = attributes.value(QFormBuilderStrings::toolTipAttribute)) {
toolBox->setItemToolTip(tabIndex, toString(ptoolTip->elementString()));
}
#endif
@@ -577,15 +544,13 @@ bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidge
void QAbstractFormBuilder::layoutInfo(DomLayout *ui_layout, QObject *parent, int *margin, int *spacing)
{
Q_UNUSED(parent);
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
- const DomPropertyHash properties = propertyMap(ui_layout->elementProperty());
+ auto properties = ui_layout->elementProperty();
int mar = INT_MIN;
int spac = INT_MIN;
- if (const DomProperty *p = properties.value(strings.marginProperty, 0))
+ if (const DomProperty *p = QFBE::propertyByName(properties, "margin"))
mar = p->elementNumber();
-
- if (const DomProperty *p = properties.value(strings.spacingProperty, 0))
+ if (const DomProperty *p = QFBE::propertyByName(properties, "spacing"))
spac = p->elementNumber();
#ifdef Q_OS_MACOS
@@ -598,11 +563,10 @@ void QAbstractFormBuilder::layoutInfo(DomLayout *ui_layout, QObject *parent, int
spac = INT_MIN;
if (mar == INT_MIN || spac == INT_MIN) {
- auto properties = ui_layout->elementProperty();
for (auto it = properties.begin(); it != properties.end(); ) {
DomProperty *prop = *it;
- if ((mar == INT_MIN && prop->attributeName() == strings.marginProperty)
- || (spac == INT_MIN && prop->attributeName() == strings.spacingProperty)) {
+ if ((mar == INT_MIN && prop->attributeName() == "margin"_L1)
+ || (spac == INT_MIN && prop->attributeName() == "spacing"_L1)) {
delete prop;
it = properties.erase(it);
} else {
@@ -663,25 +627,10 @@ QLayout *QAbstractFormBuilder::create(DomLayout *ui_layout, QLayout *parentLayou
if (margin != INT_MIN) {
layout->setContentsMargins(margin, margin, margin, margin);
} else {
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
- int left, top, right, bottom;
- left = top = right = bottom = -1;
+ int left = -1, top = -1, right = -1, bottom = -1;
layout->getContentsMargins(&left, &top, &right, &bottom);
-
- const DomPropertyHash properties = propertyMap(ui_layout->elementProperty());
-
- if (const DomProperty *p = properties.value(strings.leftMarginProperty, 0))
- left = p->elementNumber();
-
- if (const DomProperty *p = properties.value(strings.topMarginProperty, 0))
- top = p->elementNumber();
-
- if (const DomProperty *p = properties.value(strings.rightMarginProperty, 0))
- right = p->elementNumber();
-
- if (const DomProperty *p = properties.value(strings.bottomMarginProperty, 0))
- bottom = p->elementNumber();
-
+ QFormBuilderExtra::getLayoutMargins(ui_layout->elementProperty(),
+ &left, &top, &right, &bottom);
layout->setContentsMargins(left, top, right, bottom);
}
@@ -690,12 +639,10 @@ QLayout *QAbstractFormBuilder::create(DomLayout *ui_layout, QLayout *parentLayou
} else {
QGridLayout *grid = qobject_cast<QGridLayout *>(layout);
if (grid) {
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
- const DomPropertyHash properties = propertyMap(ui_layout->elementProperty());
-
- if (const DomProperty *p = properties.value(strings.horizontalSpacingProperty, 0))
+ const auto &properties = ui_layout->elementProperty();
+ if (const auto *p = QFBE::propertyByName(properties, "horizontalSpacing"))
grid->setHorizontalSpacing(p->elementNumber());
- if (const DomProperty *p = properties.value(strings.verticalSpacingProperty, 0))
+ if (const auto *p = QFBE::propertyByName(properties, "verticalSpacing"))
grid->setVerticalSpacing(p->elementNumber());
}
}
@@ -745,61 +692,55 @@ static inline QFormLayout::ItemRole formLayoutRole(int column, int colspan)
static inline QString alignmentValue(Qt::Alignment a)
{
- QString h,v;
+ QLatin1StringView h;
+ QLatin1StringView v;
switch (a & Qt::AlignHorizontal_Mask) {
case Qt::AlignLeft:
- h = QStringLiteral("Qt::AlignLeft");
+ h = "Qt::AlignmentFlag::AlignLeft"_L1;
break;
case Qt::AlignRight:
- h = QStringLiteral("Qt::AlignRight");
+ h = "Qt::AlignmentFlag::AlignRight"_L1;
break;
case Qt::AlignHCenter:
- h = QStringLiteral("Qt::AlignHCenter");
+ h = "Qt::AlignmentFlag::AlignHCenter"_L1;
break;
case Qt::AlignJustify:
- h = QStringLiteral("Qt::AlignJustify");
+ h = "Qt::AlignmentFlag::AlignJustify"_L1;
break;
}
switch (a & Qt::AlignVertical_Mask) {
case Qt::AlignTop:
- v = QStringLiteral("Qt::AlignTop");
+ v = "Qt::AlignmentFlag::AlignTop"_L1;
break;
case Qt::AlignBottom:
- v = QStringLiteral("Qt::AlignBottom");
+ v = "Qt::AlignmentFlag::AlignBottom"_L1;
break;
case Qt::AlignVCenter:
- v = QStringLiteral("Qt::AlignVCenter");
+ v = "Qt::AlignmentFlag::AlignVCenter"_L1;
break;
}
- if (h.isEmpty() && v.isEmpty())
- return QString();
- if (!v.isEmpty()) {
- if (!h.isEmpty())
- h += QLatin1Char('|');
- h += v;
- }
- return h;
+
+ return h + (v.isEmpty() || h.isEmpty() ? ""_L1 : "|"_L1) + v;
}
static inline Qt::Alignment alignmentFromDom(const QString &in)
{
Qt::Alignment rc;
if (!in.isEmpty()) {
- const auto flags = QStringView{in}.split(QLatin1Char('|'));
- for (const auto &f : flags) {
- if (f == QStringLiteral("Qt::AlignLeft")) {
+ for (const auto &f : qTokenize(in, u'|')) {
+ if (f.endsWith("::AlignLeft"_L1)) {
rc |= Qt::AlignLeft;
- } else if (f == QStringLiteral("Qt::AlignRight")) {
+ } else if (f.endsWith("::AlignRight"_L1)) {
rc |= Qt::AlignRight;
- } else if (f == QStringLiteral("Qt::AlignHCenter")) {
+ } else if (f.endsWith("::AlignHCenter"_L1)) {
rc |= Qt::AlignHCenter;
- } else if (f == QStringLiteral("Qt::AlignJustify")) {
+ } else if (f.endsWith("::AlignJustify"_L1)) {
rc |= Qt::AlignJustify;
- } else if (f == QStringLiteral("Qt::AlignTop")) {
+ } else if (f.endsWith("::AlignTop"_L1)) {
rc |= Qt::AlignTop;
- } else if (f == QStringLiteral("Qt::AlignBottom")) {
+ } else if (f.endsWith("::AlignBottom"_L1)) {
rc |= Qt::AlignBottom;
- } else if (f == QStringLiteral("Qt::AlignVCenter")) {
+ } else if (f.endsWith("::AlignVCenter"_L1)) {
rc |= Qt::AlignVCenter;
}
}
@@ -871,16 +812,15 @@ QLayoutItem *QAbstractFormBuilder::create(DomLayoutItem *ui_layoutItem, QLayout
const DomSpacer *ui_spacer = ui_layoutItem->elementSpacer();
const auto &spacerProperties = ui_spacer->elementProperty();
if (!spacerProperties.isEmpty()) {
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
for (DomProperty *p : spacerProperties) {
const QVariant v = toVariant(&QAbstractFormBuilderGadget::staticMetaObject, p); // ### remove me
if (v.isNull())
continue;
- if (p->attributeName() == strings.sizeHintProperty && p->kind() == DomProperty::Size) {
+ if (p->attributeName() == "sizeHint"_L1 && p->kind() == DomProperty::Size) {
size = v.toSize(); // ### remove me
- } else if (p->attributeName() == strings.sizeTypeProperty && p->kind() == DomProperty::Enum) {
+ } else if (p->attributeName() == "sizeType"_L1 && p->kind() == DomProperty::Enum) {
sizeType = static_cast<QSizePolicy::Policy>(v.toInt());
- } else if (p->attributeName() == strings.orientationProperty && p->kind() == DomProperty::Enum) {
+ } else if (p->attributeName() == "orientation"_L1 && p->kind() == DomProperty::Enum) {
const Qt::Orientation o = static_cast<Qt::Orientation>(v.toInt());
isVspacer = (o == Qt::Vertical);
}
@@ -913,8 +853,8 @@ void QAbstractFormBuilder::applyProperties(QObject *o, const QList<DomProperty*>
const QVariant v = toVariant(o->metaObject(), p);
if (!v.isNull()) {
QString attributeName = p->attributeName();
- if (attributeName == QLatin1String("numDigits") && o->inherits("QLCDNumber")) // Deprecated in Qt 4, removed in Qt 5.
- attributeName = QLatin1String("digitCount");
+ if (attributeName == "numDigits"_L1 && o->inherits("QLCDNumber")) // Deprecated in Qt 4, removed in Qt 5.
+ attributeName = u"digitCount"_s;
if (!d->applyPropertyInternally(o, attributeName, v))
o->setProperty(attributeName.toUtf8(), v);
}
@@ -1021,7 +961,7 @@ 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
+ \note Unlike when saving a form in \QD, 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
@@ -1044,7 +984,7 @@ void QAbstractFormBuilder::save(QIODevice *dev, QWidget *widget)
Q_ASSERT( ui_widget != nullptr );
DomUI *ui = new DomUI();
- ui->setAttributeVersion(QStringLiteral("4.0"));
+ ui->setAttributeVersion(u"4.0"_s);
ui->setElementWidget(ui_widget);
saveDom(ui, widget);
@@ -1102,7 +1042,7 @@ DomConnections *QAbstractFormBuilder::saveConnections()
DomWidget *QAbstractFormBuilder::createDom(QWidget *widget, DomWidget *ui_parentWidget, bool recursive)
{
DomWidget *ui_widget = new DomWidget();
- ui_widget->setAttributeClass(QLatin1String(widget->metaObject()->className()));
+ ui_widget->setAttributeClass(QLatin1StringView(widget->metaObject()->className()));
ui_widget->setAttributeName(widget->objectName());
ui_widget->setElementProperty(computeProperties(widget));
@@ -1157,7 +1097,7 @@ DomWidget *QAbstractFormBuilder::createDom(QWidget *widget, DomWidget *ui_parent
}
}
- for (QObject *obj : qAsConst(children)) {
+ for (QObject *obj : std::as_const(children)) {
if (QWidget *childWidget = qobject_cast<QWidget*>(obj)) {
if (d->m_laidout.contains(childWidget) || !recursive)
continue;
@@ -1217,16 +1157,14 @@ DomWidget *QAbstractFormBuilder::createDom(QWidget *widget, DomWidget *ui_parent
*/
DomActionRef *QAbstractFormBuilder::createActionRefDom(QAction *action)
{
- QString name = action->objectName();
-
- if (action->menu() != nullptr)
- name = action->menu()->objectName();
-
DomActionRef *ui_action_ref = new DomActionRef();
- if (action->isSeparator())
- ui_action_ref->setAttributeName(QFormBuilderStrings::instance().separator);
- else
- ui_action_ref->setAttributeName(name);
+ if (action->isSeparator()) {
+ ui_action_ref->setAttributeName("separator"_L1);
+ } else {
+ ui_action_ref->setAttributeName(action->menu() != nullptr
+ ? action->menu()->objectName()
+ : action->objectName());
+ }
return ui_action_ref;
}
@@ -1328,7 +1266,7 @@ DomLayout *QAbstractFormBuilder::createDom(QLayout *layout, DomLayout *ui_layout
{
Q_UNUSED(ui_layout);
DomLayout *lay = new DomLayout();
- lay->setAttributeClass(QLatin1String(layout->metaObject()->className()));
+ lay->setAttributeClass(QLatin1StringView(layout->metaObject()->className()));
const QString objectName = layout->objectName();
if (!objectName.isEmpty())
lay->setAttributeName(objectName);
@@ -1347,7 +1285,7 @@ DomLayout *QAbstractFormBuilder::createDom(QLayout *layout, DomLayout *ui_layout
QList<DomLayoutItem *> ui_items;
ui_items.reserve(newList.size());
- for (const FormBuilderSaveLayoutEntry &item : qAsConst(newList)) {
+ for (const FormBuilderSaveLayoutEntry &item : std::as_const(newList)) {
if (DomLayoutItem *ui_item = createDom(item.item, lay, ui_parentWidget)) {
if (item.row >= 0)
ui_item->setAttributeRow(item.row);
@@ -1399,10 +1337,9 @@ DomSpacer *QAbstractFormBuilder::createDom(QSpacerItem *spacer, DomLayout *ui_la
QList<DomProperty*> properties;
DomProperty *prop = nullptr;
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
// sizeHint property
prop = new DomProperty();
- prop->setAttributeName(strings.sizeHintProperty);
+ prop->setAttributeName("sizeHint"_L1);
prop->setElementSize(new DomSize());
prop->elementSize()->setElementWidth(spacer->sizeHint().width());
prop->elementSize()->setElementHeight(spacer->sizeHint().height());
@@ -1410,8 +1347,9 @@ DomSpacer *QAbstractFormBuilder::createDom(QSpacerItem *spacer, DomLayout *ui_la
// orientation property
prop = new DomProperty(); // ### we don't implemented the case where expandingDirections() is both Vertical and Horizontal
- prop->setAttributeName(strings.orientationProperty);
- prop->setElementEnum((spacer->expandingDirections() & Qt::Horizontal) ? strings.qtHorizontal : strings.qtVertical);
+ prop->setAttributeName("orientation"_L1);
+ prop->setElementEnum((spacer->expandingDirections() & Qt::Horizontal) != 0 ?
+ "Qt:::Orientation::Horizontal"_L1 : "Qt:::Orientation::Vertical"_L1);
properties.append(prop);
ui_spacer->setElementProperty(properties);
@@ -1450,7 +1388,7 @@ QList<DomProperty*> QAbstractFormBuilder::computeProperties(QObject *obj)
const QString pname = QString::fromUtf8(propertyNames.at(i));
const QMetaProperty prop = meta->property(meta->indexOfProperty(pname.toUtf8()));
- if (!prop.isWritable() || !checkProperty(obj, QLatin1String(prop.name())))
+ if (!prop.isWritable() || !checkProperty(obj, QLatin1StringView(prop.name())))
continue;
const QVariant v = prop.read(obj);
@@ -1465,7 +1403,7 @@ QList<DomProperty*> QAbstractFormBuilder::computeProperties(QObject *obj)
if (prop.isEnumType()) {
QString scope = QString::fromUtf8(prop.enumerator().scope());
if (scope.size())
- scope += QString::fromUtf8("::");
+ scope += "::"_L1;
const QString e = QString::fromUtf8(prop.enumerator().valueToKey(v.toInt()));
if (e.size())
dom_prop->setElementEnum(scope + e);
@@ -1611,13 +1549,12 @@ public:
template<class T>
static void storeItemFlags(const T *item, QList<DomProperty*> *properties)
{
- static const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
static const Qt::ItemFlags defaultFlags = T().flags();
static const QMetaEnum itemFlags_enum = metaEnum<QAbstractFormBuilderGadget>("itemFlags");
if (item->flags() != defaultFlags) {
DomProperty *p = new DomProperty;
- p->setAttributeName(strings.flagsAttribute);
+ p->setAttributeName(QFormBuilderStrings::flagsAttribute);
p->setElementSet(QString::fromLatin1(itemFlags_enum.valueToKeys(item->flags())));
properties->append(p);
}
@@ -1695,13 +1632,12 @@ template<class T>
static void loadItemPropsNFlags(QAbstractFormBuilder *abstractFormBuilder, T *item,
const QHash<QString, DomProperty*> &properties)
{
- static const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
static const QMetaEnum itemFlags_enum = metaEnum<QAbstractFormBuilderGadget>("itemFlags");
loadItemProps<T>(abstractFormBuilder, item, properties);
- DomProperty *p;
- if ((p = properties.value(strings.flagsAttribute)) && p->kind() == DomProperty::Set)
+ DomProperty *p = properties.value(QFormBuilderStrings::flagsAttribute);
+ if (p != nullptr && p->kind() == DomProperty::Set)
item->setFlags(enumKeysToValue<Qt::ItemFlags>(itemFlags_enum, p->elementSet().toLatin1()));
}
@@ -1725,10 +1661,10 @@ void QAbstractFormBuilder::saveTreeWidgetExtraInfo(QTreeWidget *treeWidget, DomW
for (const QFormBuilderStrings::TextRoleNName &it : strings.itemTextRoles) {
p = saveText(it.second, treeWidget->headerItem()->data(c, it.first.second));
// Prevent uic 4.4.X from crashing if it cannot find a column text
- if (!p && it.first.first == Qt::EditRole && it.second == QStringLiteral("text")) {
+ if (!p && it.first.first == Qt::EditRole && it.second == "text"_L1) {
DomString *defaultHeader = new DomString;
defaultHeader->setText(QString::number(c + 1));
- defaultHeader->setAttributeNotr(QStringLiteral("true"));
+ defaultHeader->setAttributeNotr(u"true"_s);
p = new DomProperty;
p->setAttributeName(it.second);
p->setElementString(defaultHeader);
@@ -1753,12 +1689,12 @@ void QAbstractFormBuilder::saveTreeWidgetExtraInfo(QTreeWidget *treeWidget, DomW
auto items = ui_widget->elementItem();
- QQueue<QPair<QTreeWidgetItem *, DomItem *> > pendingQueue;
+ QQueue<std::pair<QTreeWidgetItem *, DomItem *> > pendingQueue;
for (int i = 0; i < treeWidget->topLevelItemCount(); i++)
- pendingQueue.enqueue(qMakePair(treeWidget->topLevelItem(i), nullptr));
+ pendingQueue.enqueue(std::make_pair(treeWidget->topLevelItem(i), nullptr));
while (!pendingQueue.isEmpty()) {
- const QPair<QTreeWidgetItem *, DomItem *> pair = pendingQueue.dequeue();
+ const std::pair<QTreeWidgetItem *, DomItem *> pair = pendingQueue.dequeue();
QTreeWidgetItem *item = pair.first;
DomItem *parentDomItem = pair.second;
@@ -1789,7 +1725,7 @@ void QAbstractFormBuilder::saveTreeWidgetExtraInfo(QTreeWidget *treeWidget, DomW
items.append(currentDomItem);
for (int i = 0; i < item->childCount(); i++)
- pendingQueue.enqueue(qMakePair(item->child(i), currentDomItem));
+ pendingQueue.enqueue(std::make_pair(item->child(i), currentDomItem));
}
ui_widget->setElementItem(items);
@@ -1883,7 +1819,7 @@ void QAbstractFormBuilder::saveComboBoxExtraInfo(QComboBox *comboBox, DomWidget
for (int i=0; i < count; ++i) {
// We might encounter items for which both builders return 0 in Designer
// (indicating a custom combo adding items in the constructor). Ignore those.
- DomProperty *textProperty = saveText(QFormBuilderStrings::instance().textAttribute,
+ DomProperty *textProperty = saveText(QFormBuilderStrings::textAttribute,
comboBox->itemData(i, Qt::DisplayPropertyRole));
DomProperty *iconProperty = saveResource(comboBox->itemData(i, Qt::DecorationPropertyRole));
if (textProperty || iconProperty) {
@@ -1914,15 +1850,32 @@ void QAbstractFormBuilder::saveButtonExtraInfo(const QAbstractButton *widget, Do
DomPropertyList attributes = ui_widget->elementAttribute();
DomString *domString = new DomString();
domString->setText(buttonGroup->objectName());
- domString->setAttributeNotr(QStringLiteral("true"));
+ domString->setAttributeNotr(u"true"_s);
DomProperty *domProperty = new DomProperty();
- domProperty->setAttributeName(QLatin1String(buttonGroupPropertyC));
+ domProperty->setAttributeName(buttonGroupPropertyC);
domProperty->setElementString(domString);
attributes += domProperty;
ui_widget->setElementAttribute(attributes);
}
}
+static const QLatin1StringView tableHeaderPrefixes[] = {
+ "horizontalHeader"_L1,
+ "verticalHeader"_L1,
+};
+
+static constexpr QLatin1StringView itemViewHeaderRealPropertyNames[] =
+{
+ // Special handling for qtableview/qtreeview fake header attributes
+ "visible"_L1,
+ "cascadingSectionResizes"_L1,
+ "minimumSectionSize"_L1, // before defaultSectionSize
+ "defaultSectionSize"_L1,
+ "highlightSections"_L1,
+ "showSortIndicator"_L1,
+ "stretchLastSection"_L1
+};
+
/*!
\internal
\since 4.5
@@ -1930,26 +1883,13 @@ void QAbstractFormBuilder::saveButtonExtraInfo(const QAbstractButton *widget, Do
void QAbstractFormBuilder::saveItemViewExtraInfo(const QAbstractItemView *itemView,
DomWidget *ui_widget, DomWidget *)
{
- //
- // Special handling for qtableview/qtreeview fake header attributes
- //
- static const QLatin1String realPropertyNames[] = {
- QLatin1String("visible"),
- QLatin1String("cascadingSectionResizes"),
- QLatin1String("minimumSectionSize"), // before defaultSectionSize
- QLatin1String("defaultSectionSize"),
- QLatin1String("highlightSections"),
- QLatin1String("showSortIndicator"),
- QLatin1String("stretchLastSection"),
- };
-
if (const QTreeView *treeView = qobject_cast<const QTreeView*>(itemView)) {
auto viewProperties = ui_widget->elementAttribute();
const auto &headerProperties = computeProperties(treeView->header());
- for (QString realPropertyName : realPropertyNames) {
- const QString upperPropertyName = realPropertyName.at(0).toUpper()
+ for (const QLatin1StringView realPropertyName : itemViewHeaderRealPropertyNames) {
+ const QString upperPropertyName = QChar(realPropertyName.at(0)).toUpper()
+ realPropertyName.mid(1);
- const QString fakePropertyName = QStringLiteral("header") + upperPropertyName;
+ const QString fakePropertyName = "header"_L1 + upperPropertyName;
for (DomProperty *property : headerProperties) {
if (property->attributeName() == realPropertyName) {
property->setAttributeName(fakePropertyName);
@@ -1959,20 +1899,16 @@ void QAbstractFormBuilder::saveItemViewExtraInfo(const QAbstractItemView *itemVi
}
ui_widget->setElementAttribute(viewProperties);
} else if (const QTableView *tableView = qobject_cast<const QTableView*>(itemView)) {
- static const QStringList headerPrefixes =
- (QStringList() << QStringLiteral("horizontalHeader")
- << QStringLiteral("verticalHeader"));
-
auto viewProperties = ui_widget->elementAttribute();
- for (const QString &headerPrefix : headerPrefixes) {
- const auto &headerProperties = headerPrefix == QStringLiteral("horizontalHeader")
+ for (QLatin1StringView headerPrefix : tableHeaderPrefixes) {
+ const auto &headerProperties = headerPrefix == "horizontalHeader"_L1
? computeProperties(tableView->horizontalHeader())
: computeProperties(tableView->verticalHeader());
- for (QString realPropertyName : realPropertyNames) {
- const QString upperPropertyName = realPropertyName.at(0).toUpper()
+ for (const QLatin1StringView realPropertyName : itemViewHeaderRealPropertyNames) {
+ const QString upperPropertyName = QChar(realPropertyName.at(0)).toUpper()
+ realPropertyName.mid(1);
const QString fakePropertyName = headerPrefix + upperPropertyName;
- for (DomProperty *property : qAsConst(headerProperties)) {
+ for (DomProperty *property : std::as_const(headerProperties)) {
if (property->attributeName() == realPropertyName) {
property->setAttributeName(fakePropertyName);
viewProperties << property;
@@ -2053,8 +1989,6 @@ void QAbstractFormBuilder::saveExtraInfo(QWidget *widget, DomWidget *ui_widget,
void QAbstractFormBuilder::loadListWidgetExtraInfo(DomWidget *ui_widget, QListWidget *listWidget, QWidget *parentWidget)
{
Q_UNUSED(parentWidget);
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
-
const auto &elementItem = ui_widget->elementItem();
for (DomItem *ui_item : elementItem) {
const DomPropertyHash properties = propertyMap(ui_item->elementProperty());
@@ -2062,8 +1996,7 @@ void QAbstractFormBuilder::loadListWidgetExtraInfo(DomWidget *ui_widget, QListWi
loadItemPropsNFlags<QListWidgetItem>(this, item, properties);
}
- DomProperty *currentRow = propertyMap(ui_widget->elementProperty()).value(strings.currentRowProperty);
- if (currentRow)
+ if (auto *currentRow = QFBE::propertyByName(ui_widget->elementProperty(), "currentRow"))
listWidget->setCurrentRow(currentRow->elementNumber());
}
@@ -2076,10 +2009,10 @@ void QAbstractFormBuilder::loadTreeWidgetExtraInfo(DomWidget *ui_widget, QTreeWi
const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
const QMetaEnum itemFlags_enum = metaEnum<QAbstractFormBuilderGadget>("itemFlags");
const auto &columns = ui_widget->elementColumn();
- if (columns.count() > 0)
- treeWidget->setColumnCount(columns.count());
+ if (!columns.isEmpty())
+ treeWidget->setColumnCount(columns.size());
- for (int i = 0; i<columns.count(); ++i) {
+ for (qsizetype i = 0, size = columns.size(); i < size; ++i) {
const DomColumn *c = columns.at(i);
const DomPropertyHash properties = propertyMap(c->elementProperty());
@@ -2099,7 +2032,7 @@ void QAbstractFormBuilder::loadTreeWidgetExtraInfo(DomWidget *ui_widget, QTreeWi
treeWidget->headerItem()->setData(i, it.first.second, v);
}
- if ((p = properties.value(strings.iconAttribute))) {
+ if ((p = properties.value(QFormBuilderStrings::iconAttribute))) {
v = resourceBuilder()->loadResource(workingDirectory(), p);
QVariant nativeValue = resourceBuilder()->toNativeValue(v);
treeWidget->headerItem()->setIcon(i, qvariant_cast<QIcon>(nativeValue));
@@ -2107,13 +2040,13 @@ void QAbstractFormBuilder::loadTreeWidgetExtraInfo(DomWidget *ui_widget, QTreeWi
}
}
- QQueue<QPair<DomItem *, QTreeWidgetItem *> > pendingQueue;
+ QQueue<std::pair<DomItem *, QTreeWidgetItem *> > pendingQueue;
const auto &widgetElementItem = ui_widget->elementItem();
for (DomItem *ui_item : widgetElementItem)
- pendingQueue.enqueue(qMakePair(ui_item, nullptr));
+ pendingQueue.enqueue(std::make_pair(ui_item, nullptr));
while (!pendingQueue.isEmpty()) {
- const QPair<DomItem *, QTreeWidgetItem *> pair = pendingQueue.dequeue();
+ const std::pair<DomItem *, QTreeWidgetItem *> pair = pendingQueue.dequeue();
const DomItem *domItem = pair.first;
QTreeWidgetItem *parentItem = pair.second;
@@ -2127,16 +2060,18 @@ void QAbstractFormBuilder::loadTreeWidgetExtraInfo(DomWidget *ui_widget, QTreeWi
const auto &properties = domItem->elementProperty();
int col = -1;
for (DomProperty *property : properties) {
- if (property->attributeName() == strings.flagsAttribute && !property->elementSet().isEmpty()) {
+ if (property->attributeName() == QFormBuilderStrings::flagsAttribute
+ && !property->elementSet().isEmpty()) {
currentItem->setFlags(enumKeysToValue<Qt::ItemFlags>(itemFlags_enum, property->elementSet().toLatin1()));
- } else if (property->attributeName() == strings.textAttribute && property->elementString()) {
+ } else if (property->attributeName() == QFormBuilderStrings::textAttribute
+ && property->elementString()) {
col++;
QVariant textV = textBuilder()->loadText(property);
QVariant nativeValue = textBuilder()->toNativeValue(textV);
currentItem->setText(col, qvariant_cast<QString>(nativeValue));
currentItem->setData(col, Qt::DisplayPropertyRole, textV);
} else if (col >= 0) {
- if (property->attributeName() == strings.iconAttribute) {
+ if (property->attributeName() == QFormBuilderStrings::iconAttribute) {
QVariant v = resourceBuilder()->loadResource(workingDirectory(), property);
if (v.isValid()) {
QVariant nativeValue = resourceBuilder()->toNativeValue(v);
@@ -2150,9 +2085,9 @@ void QAbstractFormBuilder::loadTreeWidgetExtraInfo(DomWidget *ui_widget, QTreeWi
if ((v = toVariant(&QAbstractFormBuilderGadget::staticMetaObject, property)).isValid())
currentItem->setData(col, role, v);
} else {
- QPair<Qt::ItemDataRole, Qt::ItemDataRole> rolePair =
+ std::pair<Qt::ItemDataRole, Qt::ItemDataRole> rolePair =
strings.treeItemTextRoleHash.value(property->attributeName(),
- qMakePair((Qt::ItemDataRole)-1, (Qt::ItemDataRole)-1));
+ std::make_pair((Qt::ItemDataRole)-1, (Qt::ItemDataRole)-1));
if (rolePair.first >= 0) {
QVariant textV = textBuilder()->loadText(property);
QVariant nativeValue = textBuilder()->toNativeValue(textV);
@@ -2166,7 +2101,7 @@ void QAbstractFormBuilder::loadTreeWidgetExtraInfo(DomWidget *ui_widget, QTreeWi
const auto &elementItem = domItem->elementItem();
for (DomItem *childItem : elementItem)
- pendingQueue.enqueue(qMakePair(childItem, currentItem));
+ pendingQueue.enqueue(std::make_pair(childItem, currentItem));
}
}
@@ -2179,9 +2114,9 @@ void QAbstractFormBuilder::loadTableWidgetExtraInfo(DomWidget *ui_widget, QTable
Q_UNUSED(parentWidget);
const auto &columns = ui_widget->elementColumn();
- if (columns.count() > 0)
- tableWidget->setColumnCount(columns.count());
- for (int i = 0; i< columns.count(); i++) {
+ if (!columns.isEmpty())
+ tableWidget->setColumnCount(columns.size());
+ for (qsizetype i = 0, size = columns.size(); i < size; ++i) {
DomColumn *c = columns.at(i);
const DomPropertyHash properties = propertyMap(c->elementProperty());
@@ -2193,9 +2128,9 @@ void QAbstractFormBuilder::loadTableWidgetExtraInfo(DomWidget *ui_widget, QTable
}
const auto &rows = ui_widget->elementRow();
- if (rows.count() > 0)
- tableWidget->setRowCount(rows.count());
- for (int i = 0; i< rows.count(); i++) {
+ if (!rows.isEmpty())
+ tableWidget->setRowCount(rows.size());
+ for (qsizetype i = 0, size = rows.size(); i < size; ++i) {
const DomRow *r = rows.at(i);
const DomPropertyHash properties = propertyMap(r->elementProperty());
@@ -2223,24 +2158,21 @@ void QAbstractFormBuilder::loadTableWidgetExtraInfo(DomWidget *ui_widget, QTable
void QAbstractFormBuilder::loadComboBoxExtraInfo(DomWidget *ui_widget, QComboBox *comboBox, QWidget *parentWidget)
{
Q_UNUSED(parentWidget);
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
const auto &elementItem = ui_widget->elementItem();
for (DomItem *ui_item : elementItem) {
- const DomPropertyHash properties = propertyMap(ui_item->elementProperty());
+ const auto &properties = ui_item->elementProperty();
QString text;
QIcon icon;
QVariant textData;
QVariant iconData;
- DomProperty *p = nullptr;
-
- p = properties.value(strings.textAttribute);
+ DomProperty *p = QFBE::propertyByName(properties, QFormBuilderStrings::textAttribute);
if (p && p->elementString()) {
textData = textBuilder()->loadText(p);
text = qvariant_cast<QString>(textBuilder()->toNativeValue(textData));
}
- p = properties.value(strings.iconAttribute);
+ p = QFBE::propertyByName(properties, QFormBuilderStrings::iconAttribute);
if (p) {
iconData = resourceBuilder()->loadResource(workingDirectory(), p);
icon = qvariant_cast<QIcon>(resourceBuilder()->toNativeValue(iconData));
@@ -2251,8 +2183,7 @@ void QAbstractFormBuilder::loadComboBoxExtraInfo(DomWidget *ui_widget, QComboBox
comboBox->setItemData((comboBox->count()-1), textData, Qt::DisplayPropertyRole);
}
- DomProperty *currentIndex = propertyMap(ui_widget->elementProperty()).value(strings.currentIndexProperty);
- if (currentIndex)
+ if (auto *currentIndex = currentIndexProperty(ui_widget->elementProperty()))
comboBox->setCurrentIndex(currentIndex->elementNumber());
}
@@ -2262,7 +2193,7 @@ static QString buttonGroupName(const DomWidget *ui_widget)
const auto &attributes = ui_widget->elementAttribute();
if (attributes.isEmpty())
return QString();
- const QString buttonGroupProperty = QLatin1String(buttonGroupPropertyC);
+ const QString buttonGroupProperty = buttonGroupPropertyC;
for (const DomProperty *p : attributes) {
if (p->attributeName() == buttonGroupProperty)
return p->elementString()->text();
@@ -2284,7 +2215,7 @@ void QAbstractFormBuilder::loadButtonExtraInfo(const DomWidget *ui_widget, QAbst
return;
// Find entry
ButtonGroupHash &buttonGroups = d->buttonGroups();
- ButtonGroupHash::iterator it = buttonGroups.find(groupName);
+ const auto it = buttonGroups.find(groupName);
if (it == buttonGroups.end()) {
#ifdef QFORMINTERNAL_NAMESPACE // Suppress the warning when copying in Designer
uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "Invalid QButtonGroup reference '%1' referenced by '%2'.").arg(groupName, button->objectName()));
@@ -2308,26 +2239,13 @@ void QAbstractFormBuilder::loadButtonExtraInfo(const DomWidget *ui_widget, QAbst
void QAbstractFormBuilder::loadItemViewExtraInfo(DomWidget *ui_widget, QAbstractItemView *itemView,
QWidget *)
{
- //
- // Special handling for qtableview/qtreeview fake header attributes
- //
- static const QLatin1String realPropertyNames[] = {
- QLatin1String("visible"),
- QLatin1String("cascadingSectionResizes"),
- QLatin1String("minimumSectionSize"), // before defaultSectionSize
- QLatin1String("defaultSectionSize"),
- QLatin1String("highlightSections"),
- QLatin1String("showSortIndicator"),
- QLatin1String("stretchLastSection"),
- };
-
if (QTreeView *treeView = qobject_cast<QTreeView*>(itemView)) {
const auto &allAttributes = ui_widget->elementAttribute();
QList<DomProperty *> headerProperties;
- for (QString realPropertyName : realPropertyNames) {
- const QString upperPropertyName = realPropertyName.at(0).toUpper()
+ for (QLatin1StringView realPropertyName : itemViewHeaderRealPropertyNames) {
+ const QString upperPropertyName = QChar(realPropertyName.at(0)).toUpper()
+ realPropertyName.mid(1);
- const QString fakePropertyName = QStringLiteral("header") + upperPropertyName;
+ const QString fakePropertyName = "header"_L1 + upperPropertyName;
for (DomProperty *attr : allAttributes) {
if (attr->attributeName() == fakePropertyName) {
attr->setAttributeName(realPropertyName);
@@ -2337,15 +2255,11 @@ void QAbstractFormBuilder::loadItemViewExtraInfo(DomWidget *ui_widget, QAbstract
}
applyProperties(treeView->header(), headerProperties);
} else if (QTableView *tableView = qobject_cast<QTableView*>(itemView)) {
- static const QStringList headerPrefixes =
- (QStringList() << QStringLiteral("horizontalHeader")
- << QStringLiteral("verticalHeader"));
-
const auto &allAttributes = ui_widget->elementAttribute();
- for (const QString &headerPrefix : headerPrefixes) {
+ for (QLatin1StringView headerPrefix : tableHeaderPrefixes) {
QList<DomProperty*> headerProperties;
- for (QString realPropertyName : realPropertyNames) {
- const QString upperPropertyName = realPropertyName.at(0).toUpper()
+ for (QLatin1StringView realPropertyName : itemViewHeaderRealPropertyNames) {
+ const QString upperPropertyName = QChar(realPropertyName.at(0)).toUpper()
+ realPropertyName.mid(1);
const QString fakePropertyName = headerPrefix + upperPropertyName;
for (DomProperty *attr : allAttributes) {
@@ -2355,7 +2269,7 @@ void QAbstractFormBuilder::loadItemViewExtraInfo(DomWidget *ui_widget, QAbstract
}
}
}
- if (headerPrefix == QStringLiteral("horizontalHeader"))
+ if (headerPrefix == "horizontalHeader"_L1)
applyProperties(tableView->horizontalHeader(), headerProperties);
else
applyProperties(tableView->verticalHeader(), headerProperties);
@@ -2368,7 +2282,6 @@ void QAbstractFormBuilder::loadItemViewExtraInfo(DomWidget *ui_widget, QAbstract
*/
void QAbstractFormBuilder::loadExtraInfo(DomWidget *ui_widget, QWidget *widget, QWidget *parentWidget)
{
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
if (false) {
#if QT_CONFIG(listwidget)
} else if (QListWidget *listWidget = qobject_cast<QListWidget*>(widget)) {
@@ -2389,23 +2302,19 @@ void QAbstractFormBuilder::loadExtraInfo(DomWidget *ui_widget, QWidget *widget,
#endif
#if QT_CONFIG(tabwidget)
} else if (QTabWidget *tabWidget = qobject_cast<QTabWidget*>(widget)) {
- const DomProperty *currentIndex = propertyMap(ui_widget->elementProperty()).value(strings.currentIndexProperty);
- if (currentIndex)
+ if (auto *currentIndex = currentIndexProperty(ui_widget->elementProperty()))
tabWidget->setCurrentIndex(currentIndex->elementNumber());
#endif
#if QT_CONFIG(stackedwidget)
} else if (QStackedWidget *stackedWidget = qobject_cast<QStackedWidget*>(widget)) {
- const DomProperty *currentIndex = propertyMap(ui_widget->elementProperty()).value(strings.currentIndexProperty);
- if (currentIndex)
+ if (auto *currentIndex = currentIndexProperty(ui_widget->elementProperty()))
stackedWidget->setCurrentIndex(currentIndex->elementNumber());
#endif
#if QT_CONFIG(toolbox)
} else if (QToolBox *toolBox = qobject_cast<QToolBox*>(widget)) {
- const DomProperty *currentIndex = propertyMap(ui_widget->elementProperty()).value(strings.currentIndexProperty);
- if (currentIndex)
+ if (auto *currentIndex = currentIndexProperty(ui_widget->elementProperty()))
toolBox->setCurrentIndex(currentIndex->elementNumber());
- const DomProperty *tabSpacing = propertyMap(ui_widget->elementProperty()).value(strings.tabSpacingProperty);
- if (tabSpacing)
+ if (auto *tabSpacing = QFBE::propertyByName(ui_widget->elementProperty(), "tabSpacing"))
toolBox->layout()->setSpacing(tabSpacing->elementNumber());
#endif
} else if (QAbstractButton *ab = qobject_cast<QAbstractButton *>(widget)) {
@@ -2442,7 +2351,7 @@ void QAbstractFormBuilder::setWorkingDirectory(const QDir &directory)
*/
DomAction *QAbstractFormBuilder::createDom(QAction *action)
{
- if (action->parentWidget() == action->menu() || action->isSeparator())
+ if (action->parent() == action->menu() || action->isSeparator())
return nullptr;
DomAction *ui_action = new DomAction;
@@ -2460,7 +2369,7 @@ DomAction *QAbstractFormBuilder::createDom(QAction *action)
DomButtonGroup *QAbstractFormBuilder::createDom(QButtonGroup *buttonGroup)
{
- if (buttonGroup->buttons().count() == 0) // Empty group left over on form?
+ if (buttonGroup->buttons().isEmpty()) // Empty group left over on form?
return nullptr;
DomButtonGroup *domButtonGroup = new DomButtonGroup;
domButtonGroup->setAttributeName(buttonGroup->objectName());
@@ -2539,7 +2448,7 @@ void QAbstractFormBuilder::setIconProperty(DomProperty &p, const IconPaths &ip)
*/
dpi->setText(ip.first);
- p.setAttributeName(QFormBuilderStrings::instance().iconAttribute);
+ p.setAttributeName(QFormBuilderStrings::iconAttribute);
p.setElementIconSet(dpi);
}
@@ -2565,7 +2474,7 @@ DomProperty *QAbstractFormBuilder::saveResource(const QVariant &v) const
DomProperty *p = resourceBuilder()->saveResource(workingDirectory(), v);
if (p)
- p->setAttributeName(QFormBuilderStrings::instance().iconAttribute);
+ p->setAttributeName(QFormBuilderStrings::iconAttribute);
return p;
}
diff --git a/src/designer/src/lib/uilib/abstractformbuilder.h b/src/designer/src/lib/uilib/abstractformbuilder.h
index 41982edf0..e5073e6fc 100644
--- a/src/designer/src/lib/uilib/abstractformbuilder.h
+++ b/src/designer/src/lib/uilib/abstractformbuilder.h
@@ -1,45 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ABSTRACTFORMBUILDER_H
#define ABSTRACTFORMBUILDER_H
+#if 0
+# pragma qt_sync_skip_header_check
+#endif
+
#include "uilib_global.h"
#include <QtCore/qlist.h>
@@ -230,7 +198,7 @@ protected:
// Icon/pixmap stuff
//
// A Pair of icon path/qrc path.
- using IconPaths = QPair<QString, QString>;
+ using IconPaths = std::pair<QString, QString>;
void setIconProperty(DomProperty &, const IconPaths &) const;
void setPixmapProperty(DomProperty &, const IconPaths &) const;
diff --git a/src/designer/src/lib/uilib/formbuilder.cpp b/src/designer/src/lib/uilib/formbuilder.cpp
index 4b5e99c69..ca1c1ee54 100644
--- a/src/designer/src/lib/uilib/formbuilder.cpp
+++ b/src/designer/src/lib/uilib/formbuilder.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "formbuilder.h"
#include "formbuilderextra_p.h"
@@ -50,6 +14,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
#ifdef QFORMINTERNAL_NAMESPACE
namespace QFormInternal {
#endif
@@ -122,7 +88,7 @@ QWidget *QFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidget)
// Is this a QLayoutWidget with a margin of 0: Not a known page-based
// container and no method for adding pages registered.
d->setProcessingLayoutWidget(false);
- if (ui_widget->attributeClass() == QFormBuilderStrings::instance().qWidgetClass && !ui_widget->hasAttributeNative()
+ if (ui_widget->attributeClass() == "QWidget"_L1 && !ui_widget->hasAttributeNative()
&& parentWidget
#if QT_CONFIG(mainwindow)
&& !qobject_cast<QMainWindow *>(parentWidget)
@@ -146,7 +112,7 @@ QWidget *QFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidget)
&& !qobject_cast<QDockWidget *>(parentWidget)
#endif
) {
- const QString parentClassName = QLatin1String(parentWidget->metaObject()->className());
+ const QString parentClassName = QLatin1StringView(parentWidget->metaObject()->className());
if (!d->isCustomWidgetContainer(parentClassName))
d->setProcessingLayoutWidget(true);
}
@@ -182,7 +148,7 @@ QWidget *QFormBuilder::createWidget(const QString &widgetName, QWidget *parentWi
// ### special-casing for Line (QFrame) -- fix for 4.2
do {
- if (widgetName == QFormBuilderStrings::instance().lineClass) {
+ if (widgetName == "Line"_L1) {
w = new QFrame(parentWidget);
static_cast<QFrame*>(w)->setFrameStyle(QFrame::HLine | QFrame::Sunken);
break;
@@ -250,7 +216,7 @@ QLayout *QFormBuilder::createLayout(const QString &layoutName, QObject *parent,
#define DECLARE_COMPAT_WIDGET(W, C)
#define DECLARE_LAYOUT(L, C) \
- if (layoutName == QLatin1String(#L)) { \
+ if (layoutName == QLatin1StringView(#L)) { \
Q_ASSERT(l == 0); \
l = parentLayout \
? new L() \
@@ -352,23 +318,9 @@ QLayout *QFormBuilder::create(DomLayout *ui_layout, QLayout *layout, QWidget *pa
bool layoutWidget = d->processingLayoutWidget();
QLayout *l = QAbstractFormBuilder::create(ui_layout, layout, parentWidget);
if (layoutWidget) {
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
- int left, top, right, bottom;
- left = top = right = bottom = 0;
- const DomPropertyHash properties = propertyMap(ui_layout->elementProperty());
-
- if (DomProperty *prop = properties.value(strings.leftMarginProperty))
- left = prop->elementNumber();
-
- if (DomProperty *prop = properties.value(strings.topMarginProperty))
- top = prop->elementNumber();
-
- if (DomProperty *prop = properties.value(strings.rightMarginProperty))
- right = prop->elementNumber();
-
- if (DomProperty *prop = properties.value(strings.bottomMarginProperty))
- bottom = prop->elementNumber();
-
+ int left = 0, top = 0, right = 0, bottom = 0;
+ QFormBuilderExtra::getLayoutMargins(ui_layout->elementProperty(),
+ &left, &top, &right, &bottom);
l->setContentsMargins(left, top, right, bottom);
d->setProcessingLayoutWidget(false);
}
@@ -468,7 +420,7 @@ void QFormBuilder::updateCustomWidgets()
d->m_customWidgets.clear();
#if QT_CONFIG(library)
- for (const QString &path : qAsConst(d->m_pluginPaths)) {
+ for (const QString &path : std::as_const(d->m_pluginPaths)) {
const QDir dir(path);
const QStringList candidates = dir.entryList(QDir::Files);
@@ -476,11 +428,7 @@ void QFormBuilder::updateCustomWidgets()
if (!QLibrary::isLibrary(plugin))
continue;
- QString loaderPath = path;
- loaderPath += QLatin1Char('/');
- loaderPath += plugin;
-
- QPluginLoader loader(loaderPath);
+ QPluginLoader loader(path + u'/' + plugin);
if (loader.load())
insertPlugins(loader.instance(), &d->m_customWidgets);
}
@@ -513,8 +461,6 @@ void QFormBuilder::applyProperties(QObject *o, const QList<DomProperty*> &proper
if (properties.isEmpty())
return;
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
-
for (DomProperty *p : properties) {
const QVariant v = toVariant(o->metaObject(), p);
if (!v.isValid()) // QTBUG-33130, do not fall for QVariant(QString()).isNull() == true.
@@ -522,11 +468,12 @@ void QFormBuilder::applyProperties(QObject *o, const QList<DomProperty*> &proper
const QString attributeName = p->attributeName();
const bool isWidget = o->isWidgetType();
- if (isWidget && o->parent() == d->parentWidget() && attributeName == strings.geometryProperty) {
+ if (isWidget && o->parent() == d->parentWidget() && attributeName == "geometry"_L1) {
// apply only the size part of a geometry for the root widget
static_cast<QWidget*>(o)->resize(qvariant_cast<QRect>(v).size());
} else if (d->applyPropertyInternally(o, attributeName, v)) {
- } else if (isWidget && !qstrcmp("QFrame", o->metaObject()->className ()) && attributeName == strings.orientationProperty) {
+ } else if (isWidget && qstrcmp("QFrame", o->metaObject()->className()) == 0
+ && attributeName == "orientation"_L1) {
// ### special-casing for Line (QFrame) -- try to fix me
o->setProperty("frameShape", v); // v is of QFrame::Shape enum
} else {
diff --git a/src/designer/src/lib/uilib/formbuilder.h b/src/designer/src/lib/uilib/formbuilder.h
index 79013d221..7b4f8e1fd 100644
--- a/src/designer/src/lib/uilib/formbuilder.h
+++ b/src/designer/src/lib/uilib/formbuilder.h
@@ -1,54 +1,18 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef FORMBUILDER_H
#define FORMBUILDER_H
+#if 0
+# pragma qt_class(QFormBuilder)
+# pragma qt_sync_skip_header_check
+#endif
+
#include "uilib_global.h"
#include "abstractformbuilder.h"
QT_BEGIN_NAMESPACE
-#if 0
-// pragma for syncqt, don't remove.
-
-#pragma qt_class(QFormBuilder)
-#endif
class QDesignerCustomWidgetInterface;
diff --git a/src/designer/src/lib/uilib/formbuilderextra.cpp b/src/designer/src/lib/uilib/formbuilderextra.cpp
index 1dbed5348..aae8ec0a0 100644
--- a/src/designer/src/lib/uilib/formbuilderextra.cpp
+++ b/src/designer/src/lib/uilib/formbuilderextra.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "formbuilderextra_p.h"
#include "abstractformbuilder.h"
@@ -59,6 +23,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
#ifdef QFORMINTERNAL_NAMESPACE
namespace QFormInternal {
#endif
@@ -80,7 +46,7 @@ QFormBuilderExtra::CustomWidgetData::CustomWidgetData(const DomCustomWidget *dcw
QFormBuilderExtra::QFormBuilderExtra() :
m_defaultMargin(INT_MIN),
m_defaultSpacing(INT_MIN),
- m_language(QStringLiteral("c++"))
+ m_language(u"c++"_s)
{
}
@@ -112,7 +78,6 @@ static inline QString msgXmlError(const QXmlStreamReader &reader)
static bool inline readUiAttributes(QXmlStreamReader &reader, const QString &language,
QString *errorMessage)
{
- const QString uiElement = QStringLiteral("ui");
// Read up to first element
while (!reader.atEnd()) {
switch (reader.readNext()) {
@@ -120,9 +85,9 @@ static bool inline readUiAttributes(QXmlStreamReader &reader, const QString &lan
*errorMessage = msgXmlError(reader);
return false;
case QXmlStreamReader::StartElement:
- if (reader.name().compare(uiElement, Qt::CaseInsensitive) == 0) {
- const QString versionAttribute = QStringLiteral("version");
- const QString languageAttribute = QStringLiteral("language");
+ if (reader.name().compare("ui"_L1, Qt::CaseInsensitive) == 0) {
+ const QString versionAttribute = u"version"_s;
+ const QString languageAttribute = u"language"_s;
const QXmlStreamAttributes attributes = reader.attributes();
if (attributes.hasAttribute(versionAttribute)) {
const QVersionNumber version =
@@ -187,7 +152,7 @@ bool QFormBuilderExtra::applyPropertyInternally(QObject *o, const QString &prope
{
// Store buddies and apply them later on as the widgets might not exist yet.
QLabel *label = qobject_cast<QLabel*>(o);
- if (!label || propertyName != QFormBuilderStrings::instance().buddyProperty)
+ if (label == nullptr || propertyName != "buddy"_L1)
return false;
m_buddies.insert(label, value.toString());
@@ -196,11 +161,7 @@ bool QFormBuilderExtra::applyPropertyInternally(QObject *o, const QString &prope
void QFormBuilderExtra::applyInternalProperties() const
{
- if (m_buddies.isEmpty())
- return;
-
- const BuddyHash::const_iterator cend = m_buddies.constEnd();
- for (BuddyHash::const_iterator it = m_buddies.constBegin(); it != cend; ++it )
+ for (auto it = m_buddies.cbegin(), cend = m_buddies.cend(); it != cend; ++it )
applyBuddy(it.value(), BuddyApplyAll, it.key());
}
@@ -217,10 +178,9 @@ bool QFormBuilderExtra::applyBuddy(const QString &buddyName, BuddyMode applyMode
return false;
}
- const QWidgetList::const_iterator cend = widgets.constEnd();
- for ( QWidgetList::const_iterator it = widgets.constBegin(); it != cend; ++it) {
- if (applyMode == BuddyApplyAll || !(*it)->isHidden()) {
- label->setBuddy(*it);
+ for (auto *w : widgets) {
+ if (applyMode == BuddyApplyAll || !w->isHidden()) {
+ label->setBuddy(w);
return true;
}
}
@@ -254,15 +214,15 @@ void QFormBuilderExtra::storeCustomWidgetData(const QString &className, const Do
QString QFormBuilderExtra::customWidgetBaseClass(const QString &className) const
{
- const QHash<QString, CustomWidgetData>::const_iterator it = m_customWidgetDataHash.constFind(className);
+ const auto it = m_customWidgetDataHash.constFind(className);
if (it != m_customWidgetDataHash.constEnd())
- return it.value().baseClass;
+ return it.value().baseClass;
return QString();
}
QString QFormBuilderExtra::customWidgetAddPageMethod(const QString &className) const
{
- const QHash<QString, CustomWidgetData>::const_iterator it = m_customWidgetDataHash.constFind(className);
+ const auto it = m_customWidgetDataHash.constFind(className);
if (it != m_customWidgetDataHash.constEnd())
return it.value().addPageMethod;
return QString();
@@ -270,7 +230,7 @@ QString QFormBuilderExtra::customWidgetAddPageMethod(const QString &className) c
bool QFormBuilderExtra::isCustomWidgetContainer(const QString &className) const
{
- const QHash<QString, CustomWidgetData>::const_iterator it = m_customWidgetDataHash.constFind(className);
+ const auto it = m_customWidgetDataHash.constFind(className);
if (it != m_customWidgetDataHash.constEnd())
return it.value().isContainer;
return false;
@@ -350,7 +310,7 @@ inline QString perCellPropertyToString(const Layout *l, int count, int (Layout::
QTextStream str(&rc);
for (int i = 0; i < count; i++) {
if (i)
- str << QLatin1Char(',');
+ str << ',';
str << (l->*getter)(i);
}
}
@@ -375,7 +335,7 @@ inline bool parsePerCellProperty(Layout *l, int count, void (Layout::*setter)(in
clearPerCellValue(l, count, setter, defaultValue);
return true;
}
- const auto list = QStringView{s}.split(QLatin1Char(','));
+ const auto list = QStringView{s}.split(u',');
if (list.isEmpty()) {
clearPerCellValue(l, count, setter, defaultValue);
return true;
@@ -403,6 +363,19 @@ static QString msgInvalidStretch(const QString &objectName, const QString &stret
return QCoreApplication::translate("FormBuilder", "Invalid stretch value for '%1': '%2'").arg(objectName, stretch);
}
+void QFormBuilderExtra::getLayoutMargins(const QList<DomProperty*> &properties,
+ int *left, int *top, int *right, int *bottom)
+{
+ if (const auto *p = propertyByName(properties, "leftMargin"))
+ *left = p->elementNumber();
+ if (const auto *p = propertyByName(properties, "topMargin"))
+ *top = p->elementNumber();
+ if (const auto *p = propertyByName(properties, "rightMargin"))
+ *right = p->elementNumber();
+ if (const auto *p = propertyByName(properties, "bottomMargin"))
+ *bottom = p->elementNumber();
+}
+
QString QFormBuilderExtra::boxLayoutStretch(const QBoxLayout *box)
{
return perCellPropertyToString(box, box->count(), &QBoxLayout::stretch);
@@ -501,7 +474,7 @@ void QFormBuilderExtra::clearGridLayoutColumnMinimumWidth(QGridLayout *grid)
clearPerCellValue(grid, grid->columnCount(), &QGridLayout::setColumnMinimumWidth);
}
-void QFormBuilderExtra::setPixmapProperty(DomProperty *p, const QPair<QString, QString> &ip)
+void QFormBuilderExtra::setPixmapProperty(DomProperty *p, const std::pair<QString, QString> &ip)
{
DomResourcePixmap *pix = new DomResourcePixmap;
if (!ip.second.isEmpty())
@@ -509,7 +482,7 @@ void QFormBuilderExtra::setPixmapProperty(DomProperty *p, const QPair<QString, Q
pix->setText(ip.first);
- p->setAttributeName(QFormBuilderStrings::instance().pixmapAttribute);
+ p->setAttributeName("pixmap"_L1);
p->setElementPixmap(pix);
}
@@ -548,14 +521,13 @@ DomColorGroup *QFormBuilderExtra::saveColorGroup(const QPalette &palette,
DomColorGroup *group = new DomColorGroup();
QList<DomColorRole *> colorRoles;
- const uint mask = palette.resolveMask();
- for (int role = QPalette::WindowText; role < QPalette::NColorRoles; ++role) {
- if (mask & (1 << role)) {
- const QBrush &br = palette.brush(colorGroup, QPalette::ColorRole(role));
-
+ for (int r = QPalette::WindowText; r < QPalette::NColorRoles; ++r) {
+ const auto role = static_cast<QPalette::ColorRole>(r);
+ if (palette.isBrushSet(colorGroup, role)) {
+ const QBrush &br = palette.brush(colorGroup, role);
DomColorRole *colorRole = new DomColorRole();
colorRole->setElementBrush(saveBrush(br));
- colorRole->setAttributeRole(QLatin1String(colorRole_enum.valueToKey(role)));
+ colorRole->setAttributeRole(QLatin1StringView(colorRole_enum.valueToKey(role)));
colorRoles.append(colorRole);
}
}
@@ -661,7 +633,7 @@ DomBrush *QFormBuilderExtra::saveBrush(const QBrush &br)
DomBrush *brush = new DomBrush();
const Qt::BrushStyle style = br.style();
- brush->setAttributeBrushStyle(QLatin1String(brushStyle_enum.valueToKey(style)));
+ brush->setAttributeBrushStyle(QLatin1StringView(brushStyle_enum.valueToKey(style)));
if (style == Qt::LinearGradientPattern ||
style == Qt::RadialGradientPattern ||
style == Qt::ConicalGradientPattern) {
@@ -672,9 +644,9 @@ DomBrush *QFormBuilderExtra::saveBrush(const QBrush &br)
DomGradient *gradient = new DomGradient();
const QGradient *gr = br.gradient();
const QGradient::Type type = gr->type();
- gradient->setAttributeType(QLatin1String(gradientType_enum.valueToKey(type)));
- gradient->setAttributeSpread(QLatin1String(gradientSpread_enum.valueToKey(gr->spread())));
- gradient->setAttributeCoordinateMode(QLatin1String(gradientCoordinate_enum.valueToKey(gr->coordinateMode())));
+ gradient->setAttributeType(QLatin1StringView(gradientType_enum.valueToKey(type)));
+ gradient->setAttributeSpread(QLatin1StringView(gradientSpread_enum.valueToKey(gr->spread())));
+ gradient->setAttributeCoordinateMode(QLatin1StringView(gradientCoordinate_enum.valueToKey(gr->coordinateMode())));
QList<DomGradientStop *> stops;
const QGradientStops st = gr->stops();
for (const QGradientStop &pair : st) {
@@ -729,69 +701,35 @@ DomBrush *QFormBuilderExtra::saveBrush(const QBrush &br)
return brush;
}
+DomProperty *QFormBuilderExtra::propertyByName(const QList<DomProperty*> &properties,
+ QAnyStringView needle)
+{
+ auto it = std::find_if(properties.cbegin(), properties.cend(),
+ [needle](const DomProperty *p) {
+ return p->attributeName() == needle; });
+ return it != properties.cend() ? *it : nullptr;
+}
+
// ------------ QFormBuilderStrings
QFormBuilderStrings::QFormBuilderStrings() :
- buddyProperty(QStringLiteral("buddy")),
- cursorProperty(QStringLiteral("cursor")),
- objectNameProperty(QStringLiteral("objectName")),
- trueValue(QStringLiteral("true")),
- falseValue(QStringLiteral("false")),
- horizontalPostFix(QStringLiteral("Horizontal")),
- separator(QStringLiteral("separator")),
- defaultTitle(QStringLiteral("Page")),
- titleAttribute(QStringLiteral("title")),
- labelAttribute(QStringLiteral("label")),
- toolTipAttribute(QStringLiteral("toolTip")),
- whatsThisAttribute(QStringLiteral("whatsThis")),
- flagsAttribute(QStringLiteral("flags")),
- iconAttribute(QStringLiteral("icon")),
- pixmapAttribute(QStringLiteral("pixmap")),
- textAttribute(QStringLiteral("text")),
- currentIndexProperty(QStringLiteral("currentIndex")),
- toolBarAreaAttribute(QStringLiteral("toolBarArea")),
- toolBarBreakAttribute(QStringLiteral("toolBarBreak")),
- dockWidgetAreaAttribute(QStringLiteral("dockWidgetArea")),
- marginProperty(QStringLiteral("margin")),
- spacingProperty(QStringLiteral("spacing")),
- leftMarginProperty(QStringLiteral("leftMargin")),
- topMarginProperty(QStringLiteral("topMargin")),
- rightMarginProperty(QStringLiteral("rightMargin")),
- bottomMarginProperty(QStringLiteral("bottomMargin")),
- horizontalSpacingProperty(QStringLiteral("horizontalSpacing")),
- verticalSpacingProperty(QStringLiteral("verticalSpacing")),
- sizeHintProperty(QStringLiteral("sizeHint")),
- sizeTypeProperty(QStringLiteral("sizeType")),
- orientationProperty(QStringLiteral("orientation")),
- styleSheetProperty(QStringLiteral("styleSheet")),
- qtHorizontal(QStringLiteral("Qt::Horizontal")),
- qtVertical(QStringLiteral("Qt::Vertical")),
- currentRowProperty(QStringLiteral("currentRow")),
- tabSpacingProperty(QStringLiteral("tabSpacing")),
- qWidgetClass(QStringLiteral("QWidget")),
- lineClass(QStringLiteral("Line")),
- geometryProperty(QStringLiteral("geometry")),
- scriptWidgetVariable(QStringLiteral("widget")),
- scriptChildWidgetsVariable(QStringLiteral("childWidgets"))
-{
- itemRoles.append(qMakePair(Qt::FontRole, QString::fromLatin1("font")));
- itemRoles.append(qMakePair(Qt::TextAlignmentRole, QString::fromLatin1("textAlignment")));
- itemRoles.append(qMakePair(Qt::BackgroundRole, QString::fromLatin1("background")));
- itemRoles.append(qMakePair(Qt::ForegroundRole, QString::fromLatin1("foreground")));
- itemRoles.append(qMakePair(Qt::CheckStateRole, QString::fromLatin1("checkState")));
-
- for (const RoleNName &it : qAsConst(itemRoles))
+ itemRoles {
+ {Qt::FontRole, "font"_L1},
+ {Qt::TextAlignmentRole, "textAlignment"_L1},
+ {Qt::BackgroundRole, "background"_L1},
+ {Qt::ForegroundRole, "foreground"_L1},
+ {Qt::CheckStateRole, "checkState"_L1}
+ },
+ itemTextRoles { // This must be first for the loop below
+ { {Qt::EditRole, Qt::DisplayPropertyRole}, textAttribute},
+ { {Qt::ToolTipRole, Qt::ToolTipPropertyRole}, toolTipAttribute},
+ { {Qt::StatusTipRole, Qt::StatusTipPropertyRole}, "statusTip"_L1},
+ { {Qt::WhatsThisRole, Qt::WhatsThisPropertyRole}, whatsThisAttribute}
+ }
+{
+ for (const RoleNName &it : std::as_const(itemRoles))
treeItemRoleHash.insert(it.second, it.first);
- itemTextRoles.append(qMakePair(qMakePair(Qt::EditRole, Qt::DisplayPropertyRole),
- textAttribute)); // This must be first for the loop below
- itemTextRoles.append(qMakePair(qMakePair(Qt::ToolTipRole, Qt::ToolTipPropertyRole),
- toolTipAttribute));
- itemTextRoles.append(qMakePair(qMakePair(Qt::StatusTipRole, Qt::StatusTipPropertyRole),
- QString::fromLatin1("statusTip")));
- itemTextRoles.append(qMakePair(qMakePair(Qt::WhatsThisRole, Qt::WhatsThisPropertyRole),
- whatsThisAttribute));
-
// Note: this skips the first item!
auto it = itemTextRoles.constBegin();
const auto end = itemTextRoles.constEnd();
diff --git a/src/designer/src/lib/uilib/formbuilderextra_p.h b/src/designer/src/lib/uilib/formbuilderextra_p.h
index 94b0c2231..f55945e81 100644
--- a/src/designer/src/lib/uilib/formbuilderextra_p.h
+++ b/src/designer/src/lib/uilib/formbuilderextra_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ABSTRACTFORMBUILDERPRIVATE_H
#define ABSTRACTFORMBUILDERPRIVATE_H
@@ -95,6 +59,8 @@ class QTextBuilder;
class QDESIGNER_UILIB_EXPORT QFormBuilderExtra
{
public:
+ Q_DISABLE_COPY_MOVE(QFormBuilderExtra);
+
QFormBuilderExtra();
~QFormBuilderExtra();
@@ -141,11 +107,14 @@ 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);
- using ButtonGroupEntry = QPair<DomButtonGroup *, QButtonGroup*>;
+ using ButtonGroupEntry = std::pair<DomButtonGroup *, QButtonGroup *>;
using ButtonGroupHash = QHash<QString, ButtonGroupEntry>;
const ButtonGroupHash &buttonGroups() const { return m_buttonGroups; }
ButtonGroupHash &buttonGroups() { return m_buttonGroups; }
+ static void getLayoutMargins(const QList<DomProperty*> &properties,
+ int *left, int *top, int *right, int *bottom);
+
// return stretch as a comma-separated list
static QString boxLayoutStretch(const QBoxLayout*);
// apply stretch
@@ -169,7 +138,7 @@ public:
static bool setGridLayoutColumnMinimumWidth(const QString &, QGridLayout *);
static void clearGridLayoutColumnMinimumWidth(QGridLayout *);
- static void setPixmapProperty(DomProperty *p, const QPair<QString, QString> &ip);
+ static void setPixmapProperty(DomProperty *p, const std::pair<QString, QString> &ip);
static QPalette loadPalette(const DomPalette *dom);
static void setupColorGroup(QPalette *palette, QPalette::ColorGroup colorGroup,
const DomColorGroup *group);
@@ -179,6 +148,9 @@ public:
static QBrush setupBrush(const DomBrush *brush);
static DomBrush *saveBrush(const QBrush &br);
+ static DomProperty *propertyByName(const QList<DomProperty*> &properties,
+ QAnyStringView needle);
+
QStringList m_pluginPaths;
QMap<QString, QDesignerCustomWidgetInterface*> m_customWidgets;
@@ -195,8 +167,7 @@ private:
void clearResourceBuilder();
void clearTextBuilder();
- using BuddyHash = QHash<QLabel*, QString>;
- BuddyHash m_buddies;
+ QHash<QLabel *, QString> m_buddies;
QHash<QString, CustomWidgetData> m_customWidgetDataHash;
@@ -218,58 +189,24 @@ struct QDESIGNER_UILIB_EXPORT QFormBuilderStrings {
static const QFormBuilderStrings &instance();
- const QString buddyProperty;
- const QString cursorProperty;
- const QString objectNameProperty;
- const QString trueValue;
- const QString falseValue;
- const QString horizontalPostFix;
- const QString separator;
- const QString defaultTitle;
- const QString titleAttribute;
- const QString labelAttribute;
- const QString toolTipAttribute;
- const QString whatsThisAttribute;
- const QString flagsAttribute;
- const QString iconAttribute;
- const QString pixmapAttribute;
- const QString textAttribute;
- const QString currentIndexProperty;
- const QString toolBarAreaAttribute;
- const QString toolBarBreakAttribute;
- const QString dockWidgetAreaAttribute;
- const QString marginProperty;
- const QString spacingProperty;
- const QString leftMarginProperty;
- const QString topMarginProperty;
- const QString rightMarginProperty;
- const QString bottomMarginProperty;
- const QString horizontalSpacingProperty;
- const QString verticalSpacingProperty;
- const QString sizeHintProperty;
- const QString sizeTypeProperty;
- const QString orientationProperty;
- const QString styleSheetProperty;
- const QString qtHorizontal;
- const QString qtVertical;
- const QString currentRowProperty;
- const QString tabSpacingProperty;
- const QString qWidgetClass;
- const QString lineClass;
- const QString geometryProperty;
- const QString scriptWidgetVariable;
- const QString scriptChildWidgetsVariable;
-
- using RoleNName = QPair<Qt::ItemDataRole, QString>;
+ static constexpr auto titleAttribute = QLatin1StringView("title");
+ static constexpr auto labelAttribute = QLatin1StringView("label");
+ static constexpr auto toolTipAttribute = QLatin1StringView("toolTip");
+ static constexpr auto whatsThisAttribute = QLatin1StringView("whatsThis");
+ static constexpr auto flagsAttribute = QLatin1StringView("flags");
+ static constexpr auto iconAttribute = QLatin1StringView("icon");
+ static constexpr auto textAttribute = QLatin1StringView("text") ;
+
+ using RoleNName = std::pair<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.
- using TextRoleNName = QPair<QPair<Qt::ItemDataRole, Qt::ItemDataRole>, QString>;
+ using TextRoleNName = std::pair<std::pair<Qt::ItemDataRole, Qt::ItemDataRole>, QString>;
QList<TextRoleNName> itemTextRoles;
- QHash<QString, QPair<Qt::ItemDataRole, Qt::ItemDataRole> > treeItemTextRoleHash;
+ QHash<QString, std::pair<Qt::ItemDataRole, Qt::ItemDataRole> > treeItemTextRoleHash;
};
#ifdef QFORMINTERNAL_NAMESPACE
}
diff --git a/src/designer/src/lib/uilib/properties.cpp b/src/designer/src/lib/uilib/properties.cpp
index d7ba8cef1..872e8975f 100644
--- a/src/designer/src/lib/uilib/properties.cpp
+++ b/src/designer/src/lib/uilib/properties.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "properties_p.h"
#include "ui4_p.h"
@@ -53,21 +17,17 @@
#include <QtWidgets/qframe.h>
#include <QtWidgets/qabstractscrollarea.h>
+#include <limits>
+
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
#ifdef QFORMINTERNAL_NAMESPACE
namespace QFormInternal
{
#endif
-static inline void fixEnum(QString &s)
-{
- int qualifierIndex = s.lastIndexOf(QLatin1Char(':'));
- if (qualifierIndex == -1)
- qualifierIndex = s.lastIndexOf(QLatin1Char('.'));
- if (qualifierIndex != -1)
- s.remove(0, qualifierIndex + 1);
-}
// Convert complex DOM types with the help of QAbstractFormBuilder
QVariant domPropertyToVariant(QAbstractFormBuilder *afb,const QMetaObject *meta,const DomProperty *p)
{
@@ -107,29 +67,44 @@ QVariant domPropertyToVariant(QAbstractFormBuilder *afb,const QMetaObject *meta,
const QMetaEnum e = meta->property(index).enumerator();
Q_ASSERT(e.isFlag() == true);
- return QVariant(e.keysToValue(p->elementSet().toUtf8()));
+ bool ok{};
+ QVariant result(e.keysToValue(p->elementSet().toUtf8().constData(), &ok));
+ if (!ok) {
+ uiLibWarning(QCoreApplication::translate("QFormBuilder",
+ "The value \"%1\" of the set-type property %2 could not be read.").
+ arg(p->attributeName(), p->elementSet()));
+ return {};
+ }
+ return result;
}
case DomProperty::Enum: {
const QByteArray pname = p->attributeName().toUtf8();
const int index = meta->indexOfProperty(pname);
- QString enumValue = p->elementEnum();
+ const auto &enumValue = p->elementEnum();
// Triggers in case of objects in Designer like Spacer/Line for which properties
// are serialized using language introspection. On preview, however, these objects are
// emulated by hacks in the formbuilder (size policy/orientation)
- fixEnum(enumValue);
if (index == -1) {
// ### special-casing for Line (QFrame) -- fix for 4.2. Jambi hack for enumerations
if (!qstrcmp(meta->className(), "QFrame")
&& (pname == QByteArray("orientation"))) {
- return QVariant(enumValue == QFormBuilderStrings::instance().horizontalPostFix ? QFrame::HLine : QFrame::VLine);
+ return QVariant(enumValue.endsWith("Horizontal"_L1) ? QFrame::HLine : QFrame::VLine);
}
uiLibWarning(QCoreApplication::translate("QFormBuilder", "The enumeration-type property %1 could not be read.").arg(p->attributeName()));
return QVariant();
}
const QMetaEnum e = meta->property(index).enumerator();
- return QVariant(e.keyToValue(enumValue.toUtf8()));
+ bool ok{};
+ QVariant result(e.keyToValue(enumValue.toUtf8().constData(), &ok));
+ if (!ok) {
+ uiLibWarning(QCoreApplication::translate("QFormBuilder",
+ "The value \"%1\" of the enum-type property %2 could not be read.").
+ arg(p->attributeName(), enumValue));
+ return {};
+ }
+ return result;
}
case DomProperty::Brush:
return QVariant::fromValue(afb->setupBrush(p->elementBrush()));
@@ -145,13 +120,22 @@ QVariant domPropertyToVariant(QAbstractFormBuilder *afb,const QMetaObject *meta,
return domPropertyToVariant(p);
}
+// Convert a legacy Qt 4 integer font weight to the closes enumeration value
+
+static inline QMetaEnum fontWeightMetaEnum()
+{
+ const QMetaEnum result = metaEnum<QAbstractFormBuilderGadget>("fontWeight");
+ Q_ASSERT(result.isValid());
+ return result;
+}
+
// Convert simple DOM types
QVariant domPropertyToVariant(const DomProperty *p)
{
// requires non-const virtual nameToIcon, etc.
switch(p->kind()) {
case DomProperty::Bool:
- return QVariant(p->elementBool() == QFormBuilderStrings::instance().trueValue);
+ return QVariant(p->elementBool() == "true"_L1);
case DomProperty::Cstring:
return QVariant(p->elementCstring().toUtf8());
@@ -230,8 +214,6 @@ QVariant domPropertyToVariant(const DomProperty *p)
f.setPointSize(font->elementPointSize());
if (font->hasElementItalic())
f.setItalic(font->elementItalic());
- if (font->hasElementBold())
- f.setBold(font->elementBold());
if (font->hasElementUnderline())
f.setUnderline(font->elementUnderline());
if (font->hasElementStrikeOut())
@@ -244,6 +226,19 @@ QVariant domPropertyToVariant(const DomProperty *p)
f.setStyleStrategy(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QFont::StyleStrategy>("styleStrategy",
font->elementStyleStrategy().toLatin1().constData()));
}
+ if (font->hasElementHintingPreference()) {
+ f.setHintingPreference(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QFont::HintingPreference>("hintingPreference",
+ font->elementHintingPreference().toLatin1().constData()));
+ }
+
+ if (font->hasElementFontWeight()) {
+ f.setWeight(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QFont::Weight>(
+ "fontWeight",
+ font->elementFontWeight().toLatin1().constData()));
+ } else if (font->hasElementBold()) {
+ f.setBold(font->elementBold());
+ }
+
return QVariant::fromValue(f);
}
@@ -282,8 +277,8 @@ QVariant domPropertyToVariant(const DomProperty *p)
const DomLocale *locale = p->elementLocale();
return QVariant::fromValue(QLocale(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Language>("language",
locale->attributeLanguage().toLatin1().constData()),
- enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Country>("country",
- locale->attributeCountry().toLatin1().constData())));
+ enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Territory>("country",
+ locale->attributeCountry().toLatin1().constData())));
}
case DomProperty::SizePolicy: {
const DomSizePolicy *sizep = p->elementSizePolicy();
@@ -330,7 +325,7 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
DomString *str = new DomString();
str->setText(v.toString());
if (!translateString)
- str->setAttributeNotr(QStringLiteral("true"));
+ str->setAttributeNotr(u"true"_s);
dom_prop->setElementString(str);
}
return true;
@@ -360,7 +355,7 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
return true;
case QMetaType::Bool:
- dom_prop->setElementBool(v.toBool() ? QFormBuilderStrings::instance().trueValue : QFormBuilderStrings::instance().falseValue);
+ dom_prop->setElementBool(v.toBool() ? "true"_L1 : "false"_L1);
return true;
case QMetaType::QChar: {
@@ -446,9 +441,23 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
DomFont *fnt = new DomFont();
const QFont font = qvariant_cast<QFont>(v);
const uint mask = font.resolveMask();
- if (mask & QFont::WeightResolved)
- fnt->setElementBold(font.bold());
- if (mask & QFont::FamilyResolved)
+ if (mask & QFont::WeightResolved) {
+ switch (font.weight()) {
+ case QFont::Normal:
+ fnt->setElementBold(false);
+ break;
+ case QFont::Bold:
+ fnt->setElementBold(true);
+ break;
+ default: {
+ const QMetaEnum me = fontWeightMetaEnum();
+ const QString ws = QLatin1StringView(me.valueToKey(font.weight()));
+ fnt->setElementFontWeight(ws);
+ }
+ break;
+ }
+ }
+ if ((mask & (QFont::FamilyResolved | QFont::FamiliesResolved)) != 0)
fnt->setElementFamily(font.family());
if (mask & QFont::StyleResolved)
fnt->setElementItalic(font.italic());
@@ -462,8 +471,13 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
fnt->setElementKerning(font.kerning());
if (mask & QFont::StyleStrategyResolved) {
const QMetaEnum styleStrategy_enum = metaEnum<QAbstractFormBuilderGadget>("styleStrategy");
- fnt->setElementStyleStrategy(QLatin1String(styleStrategy_enum.valueToKey(font.styleStrategy())));
+ fnt->setElementStyleStrategy(QLatin1StringView(styleStrategy_enum.valueToKey(font.styleStrategy())));
+ }
+ if (mask & QFont::HintingPreferenceResolved) {
+ const QMetaEnum hintingPreference_enum = metaEnum<QAbstractFormBuilderGadget>("hintingPreference");
+ fnt->setElementHintingPreference(QLatin1StringView(hintingPreference_enum.valueToKey(font.hintingPreference())));
}
+
dom_prop->setElementFont(fnt);
}
return true;
@@ -471,7 +485,7 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
#if QT_CONFIG(cursor)
case QMetaType::QCursor: {
const QMetaEnum cursorShape_enum = metaEnum<QAbstractFormBuilderGadget>("cursorShape");
- dom_prop->setElementCursorShape(QLatin1String(cursorShape_enum.valueToKey(qvariant_cast<QCursor>(v).shape())));
+ dom_prop->setElementCursorShape(QLatin1StringView(cursorShape_enum.valueToKey(qvariant_cast<QCursor>(v).shape())));
}
return true;
#endif
@@ -488,10 +502,10 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
const QLocale locale = qvariant_cast<QLocale>(v);
const QMetaEnum language_enum = metaEnum<QAbstractFormBuilderGadget>("language");
- const QMetaEnum country_enum = metaEnum<QAbstractFormBuilderGadget>("country");
+ const QMetaEnum territory_enum = metaEnum<QAbstractFormBuilderGadget>("country");
- dom->setAttributeLanguage(QLatin1String(language_enum.valueToKey(locale.language())));
- dom->setAttributeCountry(QLatin1String(country_enum.valueToKey(locale.country())));
+ dom->setAttributeLanguage(QLatin1StringView(language_enum.valueToKey(locale.language())));
+ dom->setAttributeCountry(QLatin1StringView(territory_enum.valueToKey(locale.territory())));
dom_prop->setElementLocale(dom);
}
@@ -506,8 +520,8 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
const QMetaEnum sizeType_enum = metaEnum<QAbstractFormBuilderGadget>("sizeType");
- dom->setAttributeHSizeType(QLatin1String(sizeType_enum.valueToKey(sizePolicy.horizontalPolicy())));
- dom->setAttributeVSizeType(QLatin1String(sizeType_enum.valueToKey(sizePolicy.verticalPolicy())));
+ dom->setAttributeHSizeType(QLatin1StringView(sizeType_enum.valueToKey(sizePolicy.horizontalPolicy())));
+ dom->setAttributeVSizeType(QLatin1StringView(sizeType_enum.valueToKey(sizePolicy.verticalPolicy())));
dom_prop->setElementSizePolicy(dom);
}
@@ -580,7 +594,7 @@ static bool applySimpleProperty(const QVariant &v, bool translateString, DomProp
static QString msgCannotWriteProperty(const QString &pname, const QVariant &v)
{
return QCoreApplication::translate("QFormBuilder", "The property %1 could not be written. The type %2 is not supported yet.").
- arg(pname).arg(QLatin1String(v.typeName()));
+ arg(pname).arg(QLatin1StringView(v.typeName()));
}
@@ -595,10 +609,9 @@ static bool isOfType(const QMetaObject *what, const QMetaObject *type)
static bool isTranslatable(const QString &pname, const QVariant &v, const QMetaObject *meta)
{
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
- if (pname == strings.objectNameProperty)
+ if (pname == "objectName"_L1)
return false;
- if (pname == strings.styleSheetProperty && v.metaType().id() == QMetaType::QString
+ if (pname == "styleSheet"_L1 && v.metaType().id() == QMetaType::QString
&& isOfType(meta, &QWidget::staticMetaObject)) {
return false;
}
@@ -610,8 +623,6 @@ static bool isTranslatable(const QString &pname, const QVariant &v, const QMetaO
DomProperty *variantToDomProperty(QAbstractFormBuilder *afb, const QMetaObject *meta,
const QString &pname, const QVariant &v)
{
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
-
DomProperty *dom_prop = new DomProperty();
dom_prop->setAttributeName(pname);
@@ -626,8 +637,11 @@ DomProperty *variantToDomProperty(QAbstractFormBuilder *afb, const QMetaObject *
dom_prop->setElementEnum(QString::fromLatin1(e.valueToKey(v.toInt())));
return dom_prop;
}
- if (!meta_property.hasStdCppSet() || (isOfType(meta, &QAbstractScrollArea::staticMetaObject) && pname == strings.cursorProperty))
+ if (!meta_property.hasStdCppSet()
+ || (isOfType(meta, &QAbstractScrollArea::staticMetaObject)
+ && pname == "cursor"_L1)) {
dom_prop->setAttributeStdset(0);
+ }
}
// Try simple properties
diff --git a/src/designer/src/lib/uilib/properties_p.h b/src/designer/src/lib/uilib/properties_p.h
index 7fa8e052f..3b94253a4 100644
--- a/src/designer/src/lib/uilib/properties_p.h
+++ b/src/designer/src/lib/uilib/properties_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
//
// W A R N I N G
@@ -91,6 +55,8 @@ class QAbstractFormBuilderGadget: public QWidget
Q_PROPERTY(QPalette::ColorRole colorRole READ fakeColorRole)
Q_PROPERTY(QPalette::ColorGroup colorGroup READ fakeColorGroup)
Q_PROPERTY(QFont::StyleStrategy styleStrategy READ fakeStyleStrategy)
+ Q_PROPERTY(QFont::HintingPreference hintingPreference READ fakeHintingPreference)
+ Q_PROPERTY(QFont::Weight fontWeight READ fakeFontWeight)
Q_PROPERTY(Qt::CursorShape cursorShape READ fakeCursorShape)
Q_PROPERTY(Qt::BrushStyle brushStyle READ fakeBrushStyle)
Q_PROPERTY(Qt::ToolBarArea toolBarArea READ fakeToolBarArea)
@@ -107,6 +73,8 @@ public:
QPalette::ColorGroup fakeColorGroup() const { Q_ASSERT(0); return static_cast<QPalette::ColorGroup>(0); }
QPalette::ColorRole fakeColorRole() const { Q_ASSERT(0); return static_cast<QPalette::ColorRole>(0); }
QFont::StyleStrategy fakeStyleStrategy() const { Q_ASSERT(0); return QFont::PreferDefault; }
+ QFont::HintingPreference fakeHintingPreference() const { Q_ASSERT(0); return QFont::PreferDefaultHinting; }
+ QFont::Weight fakeFontWeight() const { Q_ASSERT(0); return QFont::Weight::Normal; }
Qt::CursorShape fakeCursorShape() const { Q_ASSERT(0); return Qt::ArrowCursor; }
Qt::BrushStyle fakeBrushStyle() const { Q_ASSERT(0); return Qt::NoBrush; }
Qt::ToolBarArea fakeToolBarArea() const { Q_ASSERT(0); return Qt::NoToolBarArea; }
@@ -128,7 +96,7 @@ inline EnumType enumKeyToValue(const QMetaEnum &metaEnum,const char *key, const
if (val == -1) {
uiLibWarning(QCoreApplication::translate("QFormBuilder", "The enumeration-value '%1' is invalid. The default value '%2' will be used instead.")
- .arg(QString::fromUtf8(key)).arg(QString::fromUtf8(metaEnum.key(0))));
+ .arg(QString::fromUtf8(key), QString::fromUtf8(metaEnum.key(0))));
val = metaEnum.value(0);
}
return static_cast<EnumType>(val);
diff --git a/src/designer/src/lib/uilib/resourcebuilder.cpp b/src/designer/src/lib/uilib/resourcebuilder.cpp
index eb9cb2728..5afd25439 100644
--- a/src/designer/src/lib/uilib/resourcebuilder.cpp
+++ b/src/designer/src/lib/uilib/resourcebuilder.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "resourcebuilder_p.h"
#include "ui4_p.h"
@@ -48,6 +12,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
#ifdef QFORMINTERNAL_NAMESPACE
namespace QFormInternal {
#endif
@@ -61,7 +27,8 @@ QResourceBuilder::~QResourceBuilder() = default;
int QResourceBuilder::iconStateFlags(const DomResourceIcon *dpi)
{
int rc = 0;
- if (dpi->hasElementNormalOff())
+ // Fix form files broken by QTBUG-115465
+ if (dpi->hasElementNormalOff() && dpi->elementNormalOff()->text() != "."_L1)
rc |= NormalOff;
if (dpi->hasElementNormalOn())
rc |= NormalOn;
@@ -92,11 +59,17 @@ QVariant QResourceBuilder::loadResource(const QDir &workingDirectory, const DomP
const DomResourceIcon *dpi = property->elementIconSet();
if (!dpi->attributeTheme().isEmpty()) {
const QString theme = dpi->attributeTheme();
+ const qsizetype themeEnum = theme.at(0).isUpper()
+ ? themeIconNames().indexOf(theme) : -1;
+ if (themeEnum != -1) {
+ const auto themeEnumE = static_cast<QIcon::ThemeIcon>(themeEnum);
+ return QVariant::fromValue(QIcon::fromTheme(themeEnumE));
+ }
const bool known = QIcon::hasThemeIcon(theme);
if (themeDebug)
qDebug("Theme %s known %d", qPrintable(theme), known);
if (known)
- return QVariant::fromValue(QIcon::fromTheme(dpi->attributeTheme()));
+ return QVariant::fromValue(QIcon::fromTheme(theme));
} // non-empty theme
if (const int flags = iconStateFlags(dpi)) { // new, post 4.4 format
QIcon icon;
@@ -165,6 +138,96 @@ bool QResourceBuilder::isResourceType(const QVariant &value) const
return false;
}
+const QStringList &QResourceBuilder::themeIconNames()
+{
+ static const QStringList result = {
+ "AddressBookNew"_L1, "ApplicationExit"_L1, "AppointmentNew"_L1,
+ "CallStart"_L1, "CallStop"_L1, "ContactNew"_L1,
+ "DocumentNew"_L1, "DocumentOpen"_L1, "DocumentOpenRecent"_L1,
+ "DocumentPageSetup"_L1, "DocumentPrint"_L1, "DocumentPrintPreview"_L1,
+ "DocumentProperties"_L1, "DocumentRevert"_L1, "DocumentSave"_L1,
+ "DocumentSaveAs"_L1, "DocumentSend"_L1,
+ "EditClear"_L1, "EditCopy"_L1, "EditCut"_L1, "EditDelete"_L1,
+ "EditFind"_L1, "EditPaste"_L1,
+ "EditRedo"_L1, "EditSelectAll"_L1, "EditUndo"_L1,
+ "FolderNew"_L1,
+ "FormatIndentLess"_L1, "FormatIndentMore"_L1,
+ "FormatJustifyCenter"_L1, "FormatJustifyFill"_L1,
+ "FormatJustifyLeft"_L1, "FormatJustifyRight"_L1,
+ "FormatTextDirectionLtr"_L1, "FormatTextDirectionRtl"_L1,
+ "FormatTextBold"_L1, "FormatTextItalic"_L1,
+ "FormatTextUnderline"_L1, "FormatTextStrikethrough"_L1,
+ "GoDown"_L1, "GoHome"_L1, "GoNext"_L1, "GoPrevious"_L1, "GoUp"_L1,
+ "HelpAbout"_L1, "HelpFaq"_L1,
+ "InsertImage"_L1, "InsertLink"_L1, "InsertText"_L1,
+ "ListAdd"_L1, "ListRemove"_L1,
+ "MailForward"_L1, "MailMarkImportant"_L1, "MailMarkRead"_L1, "MailMarkUnread"_L1,
+ "MailMessageNew"_L1, "MailReplyAll"_L1, "MailReplySender"_L1,
+ "MailSend"_L1,
+ "MediaEject"_L1, "MediaPlaybackPause"_L1, "MediaPlaybackStart"_L1,
+ "MediaPlaybackStop"_L1, "MediaRecord"_L1, "MediaSeekBackward"_L1,
+ "MediaSeekForward"_L1, "MediaSkipBackward"_L1,
+ "MediaSkipForward"_L1,
+ "ObjectRotateLeft"_L1, "ObjectRotateRight"_L1,
+ "ProcessStop"_L1,
+ "SystemLockScreen"_L1, "SystemLogOut"_L1,
+ "SystemSearch"_L1, "SystemReboot"_L1, "SystemShutdown"_L1,
+ "ToolsCheckSpelling"_L1,
+ "ViewFullscreen"_L1, "ViewRefresh"_L1, "ViewRestore"_L1,
+ "WindowClose"_L1, "WindowNew"_L1,
+ "ZoomFitBest"_L1, "ZoomIn"_L1, "ZoomOut"_L1,
+ "AudioCard"_L1, "AudioInputMicrophone"_L1,
+ "Battery"_L1,
+ "CameraPhoto"_L1, "CameraVideo"_L1, "CameraWeb"_L1,
+ "Computer"_L1, "DriveHarddisk"_L1, "DriveOptical"_L1,
+ "InputGaming"_L1, "InputKeyboard"_L1, "InputMouse"_L1,
+ "InputTablet"_L1,
+ "MediaFlash"_L1, "MediaOptical"_L1,
+ "MediaTape"_L1,
+ "MultimediaPlayer"_L1,
+ "NetworkWired"_L1, "NetworkWireless"_L1,
+ "Phone"_L1, "Printer"_L1, "Scanner"_L1, "VideoDisplay"_L1,
+ "AppointmentMissed"_L1, "AppointmentSoon"_L1,
+ "AudioVolumeHigh"_L1, "AudioVolumeLow"_L1, "AudioVolumeMedium"_L1,
+ "AudioVolumeMuted"_L1,
+ "BatteryCaution"_L1, "BatteryLow"_L1,
+ "DialogError"_L1, "DialogInformation"_L1, "DialogPassword"_L1,
+ "DialogQuestion"_L1, "DialogWarning"_L1,
+ "FolderDragAccept"_L1, "FolderOpen"_L1, "FolderVisiting"_L1,
+ "ImageLoading"_L1, "ImageMissing"_L1,
+ "MailAttachment"_L1, "MailUnread"_L1, "MailRead"_L1,
+ "MailReplied"_L1,
+ "MediaPlaylistRepeat"_L1, "MediaPlaylistShuffle"_L1,
+ "NetworkOffline"_L1,
+ "PrinterPrinting"_L1,
+ "SecurityHigh"_L1, "SecurityLow"_L1,
+ "SoftwareUpdateAvailable"_L1, "SoftwareUpdateUrgent"_L1,
+ "SyncError"_L1, "SyncSynchronizing"_L1,
+ "UserAvailable"_L1,
+ "UserOffline"_L1,
+ "WeatherClear"_L1, "WeatherClearNight"_L1, "WeatherFewClouds"_L1,
+ "WeatherFewCloudsNight"_L1, "WeatherFog"_L1, "WeatherShowers"_L1,
+ "WeatherSnow"_L1, "WeatherStorm"_L1
+ };
+
+ return result;
+};
+
+int QResourceBuilder::themeIconIndex(QStringView name)
+{
+ const auto lastQual = name.lastIndexOf("::"_L1);
+ const auto result = lastQual != -1
+ ? themeIconNames().indexOf(name.sliced(lastQual + 2))
+ : themeIconNames().indexOf(name);
+ return int(result);
+}
+
+QString QResourceBuilder::fullyQualifiedThemeIconName(int i)
+{
+ return i >= 0 && i < themeIconNames().size()
+ ? "QIcon::ThemeIcon::"_L1 + themeIconNames().at(i) : QString{};
+}
+
#ifdef QFORMINTERNAL_NAMESPACE
} // namespace QFormInternal
#endif
diff --git a/src/designer/src/lib/uilib/resourcebuilder_p.h b/src/designer/src/lib/uilib/resourcebuilder_p.h
index a5fb6b37c..721a92541 100644
--- a/src/designer/src/lib/uilib/resourcebuilder_p.h
+++ b/src/designer/src/lib/uilib/resourcebuilder_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef RESOURCEBUILDER_H
#define RESOURCEBUILDER_H
@@ -79,6 +43,11 @@ public:
QResourceBuilder();
virtual ~QResourceBuilder();
+ // Icon names matching QIcon::ThemeIcon
+ static const QStringList &themeIconNames();
+ static int themeIconIndex(QStringView name);
+ static QString fullyQualifiedThemeIconName(int i);
+
virtual QVariant loadResource(const QDir &workingDirectory, const DomProperty *property) const;
virtual QVariant toNativeValue(const QVariant &value) const;
diff --git a/src/designer/src/lib/uilib/textbuilder.cpp b/src/designer/src/lib/uilib/textbuilder.cpp
index 96d453ee3..b2bd20008 100644
--- a/src/designer/src/lib/uilib/textbuilder.cpp
+++ b/src/designer/src/lib/uilib/textbuilder.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "textbuilder_p.h"
#include "ui4_p.h"
diff --git a/src/designer/src/lib/uilib/textbuilder_p.h b/src/designer/src/lib/uilib/textbuilder_p.h
index 7944c6f7e..541c4583d 100644
--- a/src/designer/src/lib/uilib/textbuilder_p.h
+++ b/src/designer/src/lib/uilib/textbuilder_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef TEXTBUILDER_H
#define TEXTBUILDER_H
diff --git a/src/designer/src/lib/uilib/ui4.cpp b/src/designer/src/lib/uilib/ui4.cpp
index 1a3738ce1..fcff2ea9d 100644
--- a/src/designer/src/lib/uilib/ui4.cpp
+++ b/src/designer/src/lib/uilib/ui4.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT!
@@ -43,6 +7,9 @@
QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
#ifdef QFORMINTERNAL_NAMESPACE
using namespace QFormInternal;
#endif
@@ -71,133 +38,133 @@ void DomUI::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("version")) {
+ if (name == u"version"_s) {
setAttributeVersion(attribute.value().toString());
continue;
}
- if (name == QLatin1String("language")) {
+ if (name == u"language"_s) {
setAttributeLanguage(attribute.value().toString());
continue;
}
- if (name == QLatin1String("displayname")) {
+ if (name == u"displayname"_s) {
setAttributeDisplayname(attribute.value().toString());
continue;
}
- if (name == QLatin1String("idbasedtr")) {
- setAttributeIdbasedtr(attribute.value() == QLatin1String("true"));
+ if (name == u"idbasedtr"_s) {
+ setAttributeIdbasedtr(attribute.value() == u"true"_s);
continue;
}
- if (name == QLatin1String("connectslotsbyname")) {
- setAttributeConnectslotsbyname(attribute.value() == QLatin1String("true"));
+ if (name == u"connectslotsbyname"_s) {
+ setAttributeConnectslotsbyname(attribute.value() == u"true"_s);
continue;
}
- if (name == QLatin1String("stdsetdef")) {
+ if (name == u"stdsetdef"_s) {
setAttributeStdsetdef(attribute.value().toInt());
continue;
}
- if (name == QLatin1String("stdSetDef")) {
+ if (name == u"stdSetDef"_s) {
setAttributeStdSetDef(attribute.value().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("author"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"author"_s, Qt::CaseInsensitive)) {
setElementAuthor(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("comment"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"comment"_s, Qt::CaseInsensitive)) {
setElementComment(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("exportmacro"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"exportmacro"_s, Qt::CaseInsensitive)) {
setElementExportMacro(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("class"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
setElementClass(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("widget"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
auto *v = new DomWidget();
v->read(reader);
setElementWidget(v);
continue;
}
- if (!tag.compare(QLatin1String("layoutdefault"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"layoutdefault"_s, Qt::CaseInsensitive)) {
auto *v = new DomLayoutDefault();
v->read(reader);
setElementLayoutDefault(v);
continue;
}
- if (!tag.compare(QLatin1String("layoutfunction"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"layoutfunction"_s, Qt::CaseInsensitive)) {
auto *v = new DomLayoutFunction();
v->read(reader);
setElementLayoutFunction(v);
continue;
}
- if (!tag.compare(QLatin1String("pixmapfunction"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"pixmapfunction"_s, Qt::CaseInsensitive)) {
setElementPixmapFunction(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("customwidgets"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"customwidgets"_s, Qt::CaseInsensitive)) {
auto *v = new DomCustomWidgets();
v->read(reader);
setElementCustomWidgets(v);
continue;
}
- if (!tag.compare(QLatin1String("tabstops"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"tabstops"_s, Qt::CaseInsensitive)) {
auto *v = new DomTabStops();
v->read(reader);
setElementTabStops(v);
continue;
}
- if (!tag.compare(QLatin1String("images"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"images"_s, Qt::CaseInsensitive)) {
qWarning("Omitting deprecated element <images>.");
reader.skipCurrentElement();
continue;
}
- if (!tag.compare(QLatin1String("includes"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"includes"_s, Qt::CaseInsensitive)) {
auto *v = new DomIncludes();
v->read(reader);
setElementIncludes(v);
continue;
}
- if (!tag.compare(QLatin1String("resources"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"resources"_s, Qt::CaseInsensitive)) {
auto *v = new DomResources();
v->read(reader);
setElementResources(v);
continue;
}
- if (!tag.compare(QLatin1String("connections"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"connections"_s, Qt::CaseInsensitive)) {
auto *v = new DomConnections();
v->read(reader);
setElementConnections(v);
continue;
}
- if (!tag.compare(QLatin1String("designerdata"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"designerdata"_s, Qt::CaseInsensitive)) {
auto *v = new DomDesignerData();
v->read(reader);
setElementDesignerdata(v);
continue;
}
- if (!tag.compare(QLatin1String("slots"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"slots"_s, Qt::CaseInsensitive)) {
auto *v = new DomSlots();
v->read(reader);
setElementSlots(v);
continue;
}
- if (!tag.compare(QLatin1String("buttongroups"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"buttongroups"_s, Qt::CaseInsensitive)) {
auto *v = new DomButtonGroups();
v->read(reader);
setElementButtonGroups(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -213,73 +180,73 @@ void DomUI::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("ui") : tagName.toLower());
if (hasAttributeVersion())
- writer.writeAttribute(QStringLiteral("version"), attributeVersion());
+ writer.writeAttribute(u"version"_s, attributeVersion());
if (hasAttributeLanguage())
- writer.writeAttribute(QStringLiteral("language"), attributeLanguage());
+ writer.writeAttribute(u"language"_s, attributeLanguage());
if (hasAttributeDisplayname())
- writer.writeAttribute(QStringLiteral("displayname"), attributeDisplayname());
+ writer.writeAttribute(u"displayname"_s, attributeDisplayname());
if (hasAttributeIdbasedtr())
- writer.writeAttribute(QStringLiteral("idbasedtr"), (attributeIdbasedtr() ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeAttribute(u"idbasedtr"_s, (attributeIdbasedtr() ? u"true"_s : u"false"_s));
if (hasAttributeConnectslotsbyname())
- writer.writeAttribute(QStringLiteral("connectslotsbyname"), (attributeConnectslotsbyname() ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeAttribute(u"connectslotsbyname"_s, (attributeConnectslotsbyname() ? u"true"_s : u"false"_s));
if (hasAttributeStdsetdef())
- writer.writeAttribute(QStringLiteral("stdsetdef"), QString::number(attributeStdsetdef()));
+ writer.writeAttribute(u"stdsetdef"_s, QString::number(attributeStdsetdef()));
if (hasAttributeStdSetDef())
- writer.writeAttribute(QStringLiteral("stdsetdef"), QString::number(attributeStdSetDef()));
+ writer.writeAttribute(u"stdsetdef"_s, QString::number(attributeStdSetDef()));
if (m_children & Author)
- writer.writeTextElement(QStringLiteral("author"), m_author);
+ writer.writeTextElement(u"author"_s, m_author);
if (m_children & Comment)
- writer.writeTextElement(QStringLiteral("comment"), m_comment);
+ writer.writeTextElement(u"comment"_s, m_comment);
if (m_children & ExportMacro)
- writer.writeTextElement(QStringLiteral("exportmacro"), m_exportMacro);
+ writer.writeTextElement(u"exportmacro"_s, m_exportMacro);
if (m_children & Class)
- writer.writeTextElement(QStringLiteral("class"), m_class);
+ writer.writeTextElement(u"class"_s, m_class);
if (m_children & Widget)
- m_widget->write(writer, QStringLiteral("widget"));
+ m_widget->write(writer, u"widget"_s);
if (m_children & LayoutDefault)
- m_layoutDefault->write(writer, QStringLiteral("layoutdefault"));
+ m_layoutDefault->write(writer, u"layoutdefault"_s);
if (m_children & LayoutFunction)
- m_layoutFunction->write(writer, QStringLiteral("layoutfunction"));
+ m_layoutFunction->write(writer, u"layoutfunction"_s);
if (m_children & PixmapFunction)
- writer.writeTextElement(QStringLiteral("pixmapfunction"), m_pixmapFunction);
+ writer.writeTextElement(u"pixmapfunction"_s, m_pixmapFunction);
if (m_children & CustomWidgets)
- m_customWidgets->write(writer, QStringLiteral("customwidgets"));
+ m_customWidgets->write(writer, u"customwidgets"_s);
if (m_children & TabStops)
- m_tabStops->write(writer, QStringLiteral("tabstops"));
+ m_tabStops->write(writer, u"tabstops"_s);
if (m_children & Includes)
- m_includes->write(writer, QStringLiteral("includes"));
+ m_includes->write(writer, u"includes"_s);
if (m_children & Resources)
- m_resources->write(writer, QStringLiteral("resources"));
+ m_resources->write(writer, u"resources"_s);
if (m_children & Connections)
- m_connections->write(writer, QStringLiteral("connections"));
+ m_connections->write(writer, u"connections"_s);
if (m_children & Designerdata)
- m_designerdata->write(writer, QStringLiteral("designerdata"));
+ m_designerdata->write(writer, u"designerdata"_s);
if (m_children & Slots)
- m_slots->write(writer, QStringLiteral("slots"));
+ m_slots->write(writer, u"slots"_s);
if (m_children & ButtonGroups)
- m_buttonGroups->write(writer, QStringLiteral("buttongroups"));
+ m_buttonGroups->write(writer, u"buttongroups"_s);
writer.writeEndElement();
}
@@ -593,13 +560,13 @@ void DomIncludes::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("include"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"include"_s, Qt::CaseInsensitive)) {
auto *v = new DomInclude();
v->read(reader);
m_include.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -615,7 +582,7 @@ void DomIncludes::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("includes") : tagName.toLower());
for (DomInclude *v : m_include)
- v->write(writer, QStringLiteral("include"));
+ v->write(writer, u"include"_s);
writer.writeEndElement();
}
@@ -633,22 +600,22 @@ void DomInclude::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("location")) {
+ if (name == u"location"_s) {
setAttributeLocation(attribute.value().toString());
continue;
}
- if (name == QLatin1String("impldecl")) {
+ if (name == u"impldecl"_s) {
setAttributeImpldecl(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -668,10 +635,10 @@ void DomInclude::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("include") : tagName.toLower());
if (hasAttributeLocation())
- writer.writeAttribute(QStringLiteral("location"), attributeLocation());
+ writer.writeAttribute(u"location"_s, attributeLocation());
if (hasAttributeImpldecl())
- writer.writeAttribute(QStringLiteral("impldecl"), attributeImpldecl());
+ writer.writeAttribute(u"impldecl"_s, attributeImpldecl());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -690,24 +657,24 @@ void DomResources::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == u"name"_s) {
setAttributeName(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("include"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"include"_s, Qt::CaseInsensitive)) {
auto *v = new DomResource();
v->read(reader);
m_include.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -723,10 +690,10 @@ void DomResources::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("resources") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QStringLiteral("name"), attributeName());
+ writer.writeAttribute(u"name"_s, attributeName());
for (DomResource *v : m_include)
- v->write(writer, QStringLiteral("include"));
+ v->write(writer, u"include"_s);
writer.writeEndElement();
}
@@ -744,18 +711,18 @@ void DomResource::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("location")) {
+ if (name == u"location"_s) {
setAttributeLocation(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -771,7 +738,7 @@ void DomResource::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("resource") : tagName.toLower());
if (hasAttributeLocation())
- writer.writeAttribute(QStringLiteral("location"), attributeLocation());
+ writer.writeAttribute(u"location"_s, attributeLocation());
writer.writeEndElement();
}
@@ -793,42 +760,42 @@ void DomActionGroup::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == u"name"_s) {
setAttributeName(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("action"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"action"_s, Qt::CaseInsensitive)) {
auto *v = new DomAction();
v->read(reader);
m_action.append(v);
continue;
}
- if (!tag.compare(QLatin1String("actiongroup"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"actiongroup"_s, Qt::CaseInsensitive)) {
auto *v = new DomActionGroup();
v->read(reader);
m_actionGroup.append(v);
continue;
}
- if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- if (!tag.compare(QLatin1String("attribute"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_attribute.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -844,19 +811,19 @@ void DomActionGroup::write(QXmlStreamWriter &writer, const QString &tagName) con
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("actiongroup") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QStringLiteral("name"), attributeName());
+ writer.writeAttribute(u"name"_s, attributeName());
for (DomAction *v : m_action)
- v->write(writer, QStringLiteral("action"));
+ v->write(writer, u"action"_s);
for (DomActionGroup *v : m_actionGroup)
- v->write(writer, QStringLiteral("actiongroup"));
+ v->write(writer, u"actiongroup"_s);
for (DomProperty *v : m_property)
- v->write(writer, QStringLiteral("property"));
+ v->write(writer, u"property"_s);
for (DomProperty *v : m_attribute)
- v->write(writer, QStringLiteral("attribute"));
+ v->write(writer, u"attribute"_s);
writer.writeEndElement();
}
@@ -898,34 +865,34 @@ void DomAction::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == u"name"_s) {
setAttributeName(attribute.value().toString());
continue;
}
- if (name == QLatin1String("menu")) {
+ if (name == u"menu"_s) {
setAttributeMenu(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- if (!tag.compare(QLatin1String("attribute"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_attribute.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -941,16 +908,16 @@ void DomAction::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("action") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QStringLiteral("name"), attributeName());
+ writer.writeAttribute(u"name"_s, attributeName());
if (hasAttributeMenu())
- writer.writeAttribute(QStringLiteral("menu"), attributeMenu());
+ writer.writeAttribute(u"menu"_s, attributeMenu());
for (DomProperty *v : m_property)
- v->write(writer, QStringLiteral("property"));
+ v->write(writer, u"property"_s);
for (DomProperty *v : m_attribute)
- v->write(writer, QStringLiteral("attribute"));
+ v->write(writer, u"attribute"_s);
writer.writeEndElement();
}
@@ -974,18 +941,18 @@ void DomActionRef::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == u"name"_s) {
setAttributeName(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1001,7 +968,7 @@ void DomActionRef::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("actionref") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QStringLiteral("name"), attributeName());
+ writer.writeAttribute(u"name"_s, attributeName());
writer.writeEndElement();
}
@@ -1019,30 +986,30 @@ void DomButtonGroup::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == u"name"_s) {
setAttributeName(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- if (!tag.compare(QLatin1String("attribute"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_attribute.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1058,13 +1025,13 @@ void DomButtonGroup::write(QXmlStreamWriter &writer, const QString &tagName) con
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("buttongroup") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QStringLiteral("name"), attributeName());
+ writer.writeAttribute(u"name"_s, attributeName());
for (DomProperty *v : m_property)
- v->write(writer, QStringLiteral("property"));
+ v->write(writer, u"property"_s);
for (DomProperty *v : m_attribute)
- v->write(writer, QStringLiteral("attribute"));
+ v->write(writer, u"attribute"_s);
writer.writeEndElement();
}
@@ -1093,13 +1060,13 @@ void DomButtonGroups::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("buttongroup"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"buttongroup"_s, Qt::CaseInsensitive)) {
auto *v = new DomButtonGroup();
v->read(reader);
m_buttonGroup.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1115,7 +1082,7 @@ void DomButtonGroups::write(QXmlStreamWriter &writer, const QString &tagName) co
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("buttongroups") : tagName.toLower());
for (DomButtonGroup *v : m_buttonGroup)
- v->write(writer, QStringLiteral("buttongroup"));
+ v->write(writer, u"buttongroup"_s);
writer.writeEndElement();
}
@@ -1138,13 +1105,13 @@ void DomCustomWidgets::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("customwidget"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"customwidget"_s, Qt::CaseInsensitive)) {
auto *v = new DomCustomWidget();
v->read(reader);
m_customWidget.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1160,7 +1127,7 @@ void DomCustomWidgets::write(QXmlStreamWriter &writer, const QString &tagName) c
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("customwidgets") : tagName.toLower());
for (DomCustomWidget *v : m_customWidget)
- v->write(writer, QStringLiteral("customwidget"));
+ v->write(writer, u"customwidget"_s);
writer.writeEndElement();
}
@@ -1178,18 +1145,18 @@ void DomHeader::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("location")) {
+ if (name == u"location"_s) {
setAttributeLocation(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1209,7 +1176,7 @@ void DomHeader::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("header") : tagName.toLower());
if (hasAttributeLocation())
- writer.writeAttribute(QStringLiteral("location"), attributeLocation());
+ writer.writeAttribute(u"location"_s, attributeLocation());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -1231,66 +1198,66 @@ void DomCustomWidget::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("class"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
setElementClass(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("extends"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"extends"_s, Qt::CaseInsensitive)) {
setElementExtends(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("header"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"header"_s, Qt::CaseInsensitive)) {
auto *v = new DomHeader();
v->read(reader);
setElementHeader(v);
continue;
}
- if (!tag.compare(QLatin1String("sizehint"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"sizehint"_s, Qt::CaseInsensitive)) {
auto *v = new DomSize();
v->read(reader);
setElementSizeHint(v);
continue;
}
- if (!tag.compare(QLatin1String("addpagemethod"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"addpagemethod"_s, Qt::CaseInsensitive)) {
setElementAddPageMethod(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("container"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"container"_s, Qt::CaseInsensitive)) {
setElementContainer(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("sizepolicy"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"sizepolicy"_s, Qt::CaseInsensitive)) {
qWarning("Omitting deprecated element <sizepolicy>.");
reader.skipCurrentElement();
continue;
}
- if (!tag.compare(QLatin1String("pixmap"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"pixmap"_s, Qt::CaseInsensitive)) {
setElementPixmap(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("script"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"script"_s, Qt::CaseInsensitive)) {
qWarning("Omitting deprecated element <script>.");
reader.skipCurrentElement();
continue;
}
- if (!tag.compare(QLatin1String("properties"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"properties"_s, Qt::CaseInsensitive)) {
qWarning("Omitting deprecated element <properties>.");
reader.skipCurrentElement();
continue;
}
- if (!tag.compare(QLatin1String("slots"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"slots"_s, Qt::CaseInsensitive)) {
auto *v = new DomSlots();
v->read(reader);
setElementSlots(v);
continue;
}
- if (!tag.compare(QLatin1String("propertyspecifications"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"propertyspecifications"_s, Qt::CaseInsensitive)) {
auto *v = new DomPropertySpecifications();
v->read(reader);
setElementPropertyspecifications(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1306,31 +1273,31 @@ void DomCustomWidget::write(QXmlStreamWriter &writer, const QString &tagName) co
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("customwidget") : tagName.toLower());
if (m_children & Class)
- writer.writeTextElement(QStringLiteral("class"), m_class);
+ writer.writeTextElement(u"class"_s, m_class);
if (m_children & Extends)
- writer.writeTextElement(QStringLiteral("extends"), m_extends);
+ writer.writeTextElement(u"extends"_s, m_extends);
if (m_children & Header)
- m_header->write(writer, QStringLiteral("header"));
+ m_header->write(writer, u"header"_s);
if (m_children & SizeHint)
- m_sizeHint->write(writer, QStringLiteral("sizehint"));
+ m_sizeHint->write(writer, u"sizehint"_s);
if (m_children & AddPageMethod)
- writer.writeTextElement(QStringLiteral("addpagemethod"), m_addPageMethod);
+ writer.writeTextElement(u"addpagemethod"_s, m_addPageMethod);
if (m_children & Container)
- writer.writeTextElement(QStringLiteral("container"), QString::number(m_container));
+ writer.writeTextElement(u"container"_s, QString::number(m_container));
if (m_children & Pixmap)
- writer.writeTextElement(QStringLiteral("pixmap"), m_pixmap);
+ writer.writeTextElement(u"pixmap"_s, m_pixmap);
if (m_children & Slots)
- m_slots->write(writer, QStringLiteral("slots"));
+ m_slots->write(writer, u"slots"_s);
if (m_children & Propertyspecifications)
- m_propertyspecifications->write(writer, QStringLiteral("propertyspecifications"));
+ m_propertyspecifications->write(writer, u"propertyspecifications"_s);
writer.writeEndElement();
}
@@ -1485,22 +1452,22 @@ void DomLayoutDefault::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("spacing")) {
+ if (name == u"spacing"_s) {
setAttributeSpacing(attribute.value().toInt());
continue;
}
- if (name == QLatin1String("margin")) {
+ if (name == u"margin"_s) {
setAttributeMargin(attribute.value().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1516,10 +1483,10 @@ void DomLayoutDefault::write(QXmlStreamWriter &writer, const QString &tagName) c
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("layoutdefault") : tagName.toLower());
if (hasAttributeSpacing())
- writer.writeAttribute(QStringLiteral("spacing"), QString::number(attributeSpacing()));
+ writer.writeAttribute(u"spacing"_s, QString::number(attributeSpacing()));
if (hasAttributeMargin())
- writer.writeAttribute(QStringLiteral("margin"), QString::number(attributeMargin()));
+ writer.writeAttribute(u"margin"_s, QString::number(attributeMargin()));
writer.writeEndElement();
}
@@ -1531,22 +1498,22 @@ void DomLayoutFunction::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("spacing")) {
+ if (name == u"spacing"_s) {
setAttributeSpacing(attribute.value().toString());
continue;
}
- if (name == QLatin1String("margin")) {
+ if (name == u"margin"_s) {
setAttributeMargin(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1562,10 +1529,10 @@ void DomLayoutFunction::write(QXmlStreamWriter &writer, const QString &tagName)
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("layoutfunction") : tagName.toLower());
if (hasAttributeSpacing())
- writer.writeAttribute(QStringLiteral("spacing"), attributeSpacing());
+ writer.writeAttribute(u"spacing"_s, attributeSpacing());
if (hasAttributeMargin())
- writer.writeAttribute(QStringLiteral("margin"), attributeMargin());
+ writer.writeAttribute(u"margin"_s, attributeMargin());
writer.writeEndElement();
}
@@ -1581,11 +1548,11 @@ void DomTabStops::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("tabstop"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"tabstop"_s, Qt::CaseInsensitive)) {
m_tabStop.append(reader.readElementText());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1601,7 +1568,7 @@ void DomTabStops::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("tabstops") : tagName.toLower());
for (const QString &v : m_tabStop)
- writer.writeTextElement(QStringLiteral("tabstop"), v);
+ writer.writeTextElement(u"tabstop"_s, v);
writer.writeEndElement();
}
@@ -1627,60 +1594,60 @@ void DomLayout::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("class")) {
+ if (name == u"class"_s) {
setAttributeClass(attribute.value().toString());
continue;
}
- if (name == QLatin1String("name")) {
+ if (name == u"name"_s) {
setAttributeName(attribute.value().toString());
continue;
}
- if (name == QLatin1String("stretch")) {
+ if (name == u"stretch"_s) {
setAttributeStretch(attribute.value().toString());
continue;
}
- if (name == QLatin1String("rowstretch")) {
+ if (name == u"rowstretch"_s) {
setAttributeRowStretch(attribute.value().toString());
continue;
}
- if (name == QLatin1String("columnstretch")) {
+ if (name == u"columnstretch"_s) {
setAttributeColumnStretch(attribute.value().toString());
continue;
}
- if (name == QLatin1String("rowminimumheight")) {
+ if (name == u"rowminimumheight"_s) {
setAttributeRowMinimumHeight(attribute.value().toString());
continue;
}
- if (name == QLatin1String("columnminimumwidth")) {
+ if (name == u"columnminimumwidth"_s) {
setAttributeColumnMinimumWidth(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- if (!tag.compare(QLatin1String("attribute"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_attribute.append(v);
continue;
}
- if (!tag.compare(QLatin1String("item"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"item"_s, Qt::CaseInsensitive)) {
auto *v = new DomLayoutItem();
v->read(reader);
m_item.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1696,34 +1663,34 @@ void DomLayout::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("layout") : tagName.toLower());
if (hasAttributeClass())
- writer.writeAttribute(QStringLiteral("class"), attributeClass());
+ writer.writeAttribute(u"class"_s, attributeClass());
if (hasAttributeName())
- writer.writeAttribute(QStringLiteral("name"), attributeName());
+ writer.writeAttribute(u"name"_s, attributeName());
if (hasAttributeStretch())
- writer.writeAttribute(QStringLiteral("stretch"), attributeStretch());
+ writer.writeAttribute(u"stretch"_s, attributeStretch());
if (hasAttributeRowStretch())
- writer.writeAttribute(QStringLiteral("rowstretch"), attributeRowStretch());
+ writer.writeAttribute(u"rowstretch"_s, attributeRowStretch());
if (hasAttributeColumnStretch())
- writer.writeAttribute(QStringLiteral("columnstretch"), attributeColumnStretch());
+ writer.writeAttribute(u"columnstretch"_s, attributeColumnStretch());
if (hasAttributeRowMinimumHeight())
- writer.writeAttribute(QStringLiteral("rowminimumheight"), attributeRowMinimumHeight());
+ writer.writeAttribute(u"rowminimumheight"_s, attributeRowMinimumHeight());
if (hasAttributeColumnMinimumWidth())
- writer.writeAttribute(QStringLiteral("columnminimumwidth"), attributeColumnMinimumWidth());
+ writer.writeAttribute(u"columnminimumwidth"_s, attributeColumnMinimumWidth());
for (DomProperty *v : m_property)
- v->write(writer, QStringLiteral("property"));
+ v->write(writer, u"property"_s);
for (DomProperty *v : m_attribute)
- v->write(writer, QStringLiteral("attribute"));
+ v->write(writer, u"attribute"_s);
for (DomLayoutItem *v : m_item)
- v->write(writer, QStringLiteral("item"));
+ v->write(writer, u"item"_s);
writer.writeEndElement();
}
@@ -1771,52 +1738,52 @@ void DomLayoutItem::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("row")) {
+ if (name == u"row"_s) {
setAttributeRow(attribute.value().toInt());
continue;
}
- if (name == QLatin1String("column")) {
+ if (name == u"column"_s) {
setAttributeColumn(attribute.value().toInt());
continue;
}
- if (name == QLatin1String("rowspan")) {
+ if (name == u"rowspan"_s) {
setAttributeRowSpan(attribute.value().toInt());
continue;
}
- if (name == QLatin1String("colspan")) {
+ if (name == u"colspan"_s) {
setAttributeColSpan(attribute.value().toInt());
continue;
}
- if (name == QLatin1String("alignment")) {
+ if (name == u"alignment"_s) {
setAttributeAlignment(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("widget"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
auto *v = new DomWidget();
v->read(reader);
setElementWidget(v);
continue;
}
- if (!tag.compare(QLatin1String("layout"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"layout"_s, Qt::CaseInsensitive)) {
auto *v = new DomLayout();
v->read(reader);
setElementLayout(v);
continue;
}
- if (!tag.compare(QLatin1String("spacer"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"spacer"_s, Qt::CaseInsensitive)) {
auto *v = new DomSpacer();
v->read(reader);
setElementSpacer(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1832,34 +1799,34 @@ void DomLayoutItem::write(QXmlStreamWriter &writer, const QString &tagName) cons
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("layoutitem") : tagName.toLower());
if (hasAttributeRow())
- writer.writeAttribute(QStringLiteral("row"), QString::number(attributeRow()));
+ writer.writeAttribute(u"row"_s, QString::number(attributeRow()));
if (hasAttributeColumn())
- writer.writeAttribute(QStringLiteral("column"), QString::number(attributeColumn()));
+ writer.writeAttribute(u"column"_s, QString::number(attributeColumn()));
if (hasAttributeRowSpan())
- writer.writeAttribute(QStringLiteral("rowspan"), QString::number(attributeRowSpan()));
+ writer.writeAttribute(u"rowspan"_s, QString::number(attributeRowSpan()));
if (hasAttributeColSpan())
- writer.writeAttribute(QStringLiteral("colspan"), QString::number(attributeColSpan()));
+ writer.writeAttribute(u"colspan"_s, QString::number(attributeColSpan()));
if (hasAttributeAlignment())
- writer.writeAttribute(QStringLiteral("alignment"), attributeAlignment());
+ writer.writeAttribute(u"alignment"_s, attributeAlignment());
switch (kind()) {
case Widget:
if (m_widget != nullptr)
- m_widget->write(writer, QStringLiteral("widget"));
+ m_widget->write(writer, u"widget"_s);
break;
case Layout:
if (m_layout != nullptr)
- m_layout->write(writer, QStringLiteral("layout"));
+ m_layout->write(writer, u"layout"_s);
break;
case Spacer:
if (m_spacer != nullptr)
- m_spacer->write(writer, QStringLiteral("spacer"));
+ m_spacer->write(writer, u"spacer"_s);
break;
default:
@@ -1922,13 +1889,13 @@ void DomRow::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1944,7 +1911,7 @@ void DomRow::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("row") : tagName.toLower());
for (DomProperty *v : m_property)
- v->write(writer, QStringLiteral("property"));
+ v->write(writer, u"property"_s);
writer.writeEndElement();
}
@@ -1967,13 +1934,13 @@ void DomColumn::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -1989,7 +1956,7 @@ void DomColumn::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("column") : tagName.toLower());
for (DomProperty *v : m_property)
- v->write(writer, QStringLiteral("property"));
+ v->write(writer, u"property"_s);
writer.writeEndElement();
}
@@ -2013,34 +1980,34 @@ void DomItem::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("row")) {
+ if (name == u"row"_s) {
setAttributeRow(attribute.value().toInt());
continue;
}
- if (name == QLatin1String("column")) {
+ if (name == u"column"_s) {
setAttributeColumn(attribute.value().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- if (!tag.compare(QLatin1String("item"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"item"_s, Qt::CaseInsensitive)) {
auto *v = new DomItem();
v->read(reader);
m_item.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2056,16 +2023,16 @@ void DomItem::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("item") : tagName.toLower());
if (hasAttributeRow())
- writer.writeAttribute(QStringLiteral("row"), QString::number(attributeRow()));
+ writer.writeAttribute(u"row"_s, QString::number(attributeRow()));
if (hasAttributeColumn())
- writer.writeAttribute(QStringLiteral("column"), QString::number(attributeColumn()));
+ writer.writeAttribute(u"column"_s, QString::number(attributeColumn()));
for (DomProperty *v : m_property)
- v->write(writer, QStringLiteral("property"));
+ v->write(writer, u"property"_s);
for (DomItem *v : m_item)
- v->write(writer, QStringLiteral("item"));
+ v->write(writer, u"item"_s);
writer.writeEndElement();
}
@@ -2113,104 +2080,104 @@ void DomWidget::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("class")) {
+ if (name == u"class"_s) {
setAttributeClass(attribute.value().toString());
continue;
}
- if (name == QLatin1String("name")) {
+ if (name == u"name"_s) {
setAttributeName(attribute.value().toString());
continue;
}
- if (name == QLatin1String("native")) {
- setAttributeNative(attribute.value() == QLatin1String("true"));
+ if (name == u"native"_s) {
+ setAttributeNative(attribute.value() == u"true"_s);
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("class"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
m_class.append(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- if (!tag.compare(QLatin1String("script"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"script"_s, Qt::CaseInsensitive)) {
qWarning("Omitting deprecated element <script>.");
reader.skipCurrentElement();
continue;
}
- if (!tag.compare(QLatin1String("widgetdata"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"widgetdata"_s, Qt::CaseInsensitive)) {
qWarning("Omitting deprecated element <widgetdata>.");
reader.skipCurrentElement();
continue;
}
- if (!tag.compare(QLatin1String("attribute"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_attribute.append(v);
continue;
}
- if (!tag.compare(QLatin1String("row"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"row"_s, Qt::CaseInsensitive)) {
auto *v = new DomRow();
v->read(reader);
m_row.append(v);
continue;
}
- if (!tag.compare(QLatin1String("column"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"column"_s, Qt::CaseInsensitive)) {
auto *v = new DomColumn();
v->read(reader);
m_column.append(v);
continue;
}
- if (!tag.compare(QLatin1String("item"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"item"_s, Qt::CaseInsensitive)) {
auto *v = new DomItem();
v->read(reader);
m_item.append(v);
continue;
}
- if (!tag.compare(QLatin1String("layout"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"layout"_s, Qt::CaseInsensitive)) {
auto *v = new DomLayout();
v->read(reader);
m_layout.append(v);
continue;
}
- if (!tag.compare(QLatin1String("widget"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
auto *v = new DomWidget();
v->read(reader);
m_widget.append(v);
continue;
}
- if (!tag.compare(QLatin1String("action"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"action"_s, Qt::CaseInsensitive)) {
auto *v = new DomAction();
v->read(reader);
m_action.append(v);
continue;
}
- if (!tag.compare(QLatin1String("actiongroup"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"actiongroup"_s, Qt::CaseInsensitive)) {
auto *v = new DomActionGroup();
v->read(reader);
m_actionGroup.append(v);
continue;
}
- if (!tag.compare(QLatin1String("addaction"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"addaction"_s, Qt::CaseInsensitive)) {
auto *v = new DomActionRef();
v->read(reader);
m_addAction.append(v);
continue;
}
- if (!tag.compare(QLatin1String("zorder"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"zorder"_s, Qt::CaseInsensitive)) {
m_zOrder.append(reader.readElementText());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2226,49 +2193,49 @@ void DomWidget::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("widget") : tagName.toLower());
if (hasAttributeClass())
- writer.writeAttribute(QStringLiteral("class"), attributeClass());
+ writer.writeAttribute(u"class"_s, attributeClass());
if (hasAttributeName())
- writer.writeAttribute(QStringLiteral("name"), attributeName());
+ writer.writeAttribute(u"name"_s, attributeName());
if (hasAttributeNative())
- writer.writeAttribute(QStringLiteral("native"), (attributeNative() ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeAttribute(u"native"_s, (attributeNative() ? u"true"_s : u"false"_s));
for (const QString &v : m_class)
- writer.writeTextElement(QStringLiteral("class"), v);
+ writer.writeTextElement(u"class"_s, v);
for (DomProperty *v : m_property)
- v->write(writer, QStringLiteral("property"));
+ v->write(writer, u"property"_s);
for (DomProperty *v : m_attribute)
- v->write(writer, QStringLiteral("attribute"));
+ v->write(writer, u"attribute"_s);
for (DomRow *v : m_row)
- v->write(writer, QStringLiteral("row"));
+ v->write(writer, u"row"_s);
for (DomColumn *v : m_column)
- v->write(writer, QStringLiteral("column"));
+ v->write(writer, u"column"_s);
for (DomItem *v : m_item)
- v->write(writer, QStringLiteral("item"));
+ v->write(writer, u"item"_s);
for (DomLayout *v : m_layout)
- v->write(writer, QStringLiteral("layout"));
+ v->write(writer, u"layout"_s);
for (DomWidget *v : m_widget)
- v->write(writer, QStringLiteral("widget"));
+ v->write(writer, u"widget"_s);
for (DomAction *v : m_action)
- v->write(writer, QStringLiteral("action"));
+ v->write(writer, u"action"_s);
for (DomActionGroup *v : m_actionGroup)
- v->write(writer, QStringLiteral("actiongroup"));
+ v->write(writer, u"actiongroup"_s);
for (DomActionRef *v : m_addAction)
- v->write(writer, QStringLiteral("addaction"));
+ v->write(writer, u"addaction"_s);
for (const QString &v : m_zOrder)
- writer.writeTextElement(QStringLiteral("zorder"), v);
+ writer.writeTextElement(u"zorder"_s, v);
writer.writeEndElement();
}
@@ -2356,24 +2323,24 @@ void DomSpacer::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == u"name"_s) {
setAttributeName(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2389,10 +2356,10 @@ void DomSpacer::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("spacer") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QStringLiteral("name"), attributeName());
+ writer.writeAttribute(u"name"_s, attributeName());
for (DomProperty *v : m_property)
- v->write(writer, QStringLiteral("property"));
+ v->write(writer, u"property"_s);
writer.writeEndElement();
}
@@ -2410,30 +2377,30 @@ void DomColor::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("alpha")) {
+ if (name == u"alpha"_s) {
setAttributeAlpha(attribute.value().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("red"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"red"_s, Qt::CaseInsensitive)) {
setElementRed(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("green"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"green"_s, Qt::CaseInsensitive)) {
setElementGreen(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("blue"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"blue"_s, Qt::CaseInsensitive)) {
setElementBlue(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2449,16 +2416,16 @@ void DomColor::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("color") : tagName.toLower());
if (hasAttributeAlpha())
- writer.writeAttribute(QStringLiteral("alpha"), QString::number(attributeAlpha()));
+ writer.writeAttribute(u"alpha"_s, QString::number(attributeAlpha()));
if (m_children & Red)
- writer.writeTextElement(QStringLiteral("red"), QString::number(m_red));
+ writer.writeTextElement(u"red"_s, QString::number(m_red));
if (m_children & Green)
- writer.writeTextElement(QStringLiteral("green"), QString::number(m_green));
+ writer.writeTextElement(u"green"_s, QString::number(m_green));
if (m_children & Blue)
- writer.writeTextElement(QStringLiteral("blue"), QString::number(m_blue));
+ writer.writeTextElement(u"blue"_s, QString::number(m_blue));
writer.writeEndElement();
}
@@ -2506,24 +2473,24 @@ void DomGradientStop::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("position")) {
+ if (name == u"position"_s) {
setAttributePosition(attribute.value().toDouble());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("color"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
auto *v = new DomColor();
v->read(reader);
setElementColor(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2539,10 +2506,10 @@ void DomGradientStop::write(QXmlStreamWriter &writer, const QString &tagName) co
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("gradientstop") : tagName.toLower());
if (hasAttributePosition())
- writer.writeAttribute(QStringLiteral("position"), QString::number(attributePosition(), 'f', 15));
+ writer.writeAttribute(u"position"_s, QString::number(attributePosition(), 'f', 15));
if (m_children & Color)
- m_color->write(writer, QStringLiteral("color"));
+ m_color->write(writer, u"color"_s);
writer.writeEndElement();
}
@@ -2580,72 +2547,72 @@ void DomGradient::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("startx")) {
+ if (name == u"startx"_s) {
setAttributeStartX(attribute.value().toDouble());
continue;
}
- if (name == QLatin1String("starty")) {
+ if (name == u"starty"_s) {
setAttributeStartY(attribute.value().toDouble());
continue;
}
- if (name == QLatin1String("endx")) {
+ if (name == u"endx"_s) {
setAttributeEndX(attribute.value().toDouble());
continue;
}
- if (name == QLatin1String("endy")) {
+ if (name == u"endy"_s) {
setAttributeEndY(attribute.value().toDouble());
continue;
}
- if (name == QLatin1String("centralx")) {
+ if (name == u"centralx"_s) {
setAttributeCentralX(attribute.value().toDouble());
continue;
}
- if (name == QLatin1String("centraly")) {
+ if (name == u"centraly"_s) {
setAttributeCentralY(attribute.value().toDouble());
continue;
}
- if (name == QLatin1String("focalx")) {
+ if (name == u"focalx"_s) {
setAttributeFocalX(attribute.value().toDouble());
continue;
}
- if (name == QLatin1String("focaly")) {
+ if (name == u"focaly"_s) {
setAttributeFocalY(attribute.value().toDouble());
continue;
}
- if (name == QLatin1String("radius")) {
+ if (name == u"radius"_s) {
setAttributeRadius(attribute.value().toDouble());
continue;
}
- if (name == QLatin1String("angle")) {
+ if (name == u"angle"_s) {
setAttributeAngle(attribute.value().toDouble());
continue;
}
- if (name == QLatin1String("type")) {
+ if (name == u"type"_s) {
setAttributeType(attribute.value().toString());
continue;
}
- if (name == QLatin1String("spread")) {
+ if (name == u"spread"_s) {
setAttributeSpread(attribute.value().toString());
continue;
}
- if (name == QLatin1String("coordinatemode")) {
+ if (name == u"coordinatemode"_s) {
setAttributeCoordinateMode(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("gradientstop"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"gradientstop"_s, Qt::CaseInsensitive)) {
auto *v = new DomGradientStop();
v->read(reader);
m_gradientStop.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2661,46 +2628,46 @@ void DomGradient::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("gradient") : tagName.toLower());
if (hasAttributeStartX())
- writer.writeAttribute(QStringLiteral("startx"), QString::number(attributeStartX(), 'f', 15));
+ writer.writeAttribute(u"startx"_s, QString::number(attributeStartX(), 'f', 15));
if (hasAttributeStartY())
- writer.writeAttribute(QStringLiteral("starty"), QString::number(attributeStartY(), 'f', 15));
+ writer.writeAttribute(u"starty"_s, QString::number(attributeStartY(), 'f', 15));
if (hasAttributeEndX())
- writer.writeAttribute(QStringLiteral("endx"), QString::number(attributeEndX(), 'f', 15));
+ writer.writeAttribute(u"endx"_s, QString::number(attributeEndX(), 'f', 15));
if (hasAttributeEndY())
- writer.writeAttribute(QStringLiteral("endy"), QString::number(attributeEndY(), 'f', 15));
+ writer.writeAttribute(u"endy"_s, QString::number(attributeEndY(), 'f', 15));
if (hasAttributeCentralX())
- writer.writeAttribute(QStringLiteral("centralx"), QString::number(attributeCentralX(), 'f', 15));
+ writer.writeAttribute(u"centralx"_s, QString::number(attributeCentralX(), 'f', 15));
if (hasAttributeCentralY())
- writer.writeAttribute(QStringLiteral("centraly"), QString::number(attributeCentralY(), 'f', 15));
+ writer.writeAttribute(u"centraly"_s, QString::number(attributeCentralY(), 'f', 15));
if (hasAttributeFocalX())
- writer.writeAttribute(QStringLiteral("focalx"), QString::number(attributeFocalX(), 'f', 15));
+ writer.writeAttribute(u"focalx"_s, QString::number(attributeFocalX(), 'f', 15));
if (hasAttributeFocalY())
- writer.writeAttribute(QStringLiteral("focaly"), QString::number(attributeFocalY(), 'f', 15));
+ writer.writeAttribute(u"focaly"_s, QString::number(attributeFocalY(), 'f', 15));
if (hasAttributeRadius())
- writer.writeAttribute(QStringLiteral("radius"), QString::number(attributeRadius(), 'f', 15));
+ writer.writeAttribute(u"radius"_s, QString::number(attributeRadius(), 'f', 15));
if (hasAttributeAngle())
- writer.writeAttribute(QStringLiteral("angle"), QString::number(attributeAngle(), 'f', 15));
+ writer.writeAttribute(u"angle"_s, QString::number(attributeAngle(), 'f', 15));
if (hasAttributeType())
- writer.writeAttribute(QStringLiteral("type"), attributeType());
+ writer.writeAttribute(u"type"_s, attributeType());
if (hasAttributeSpread())
- writer.writeAttribute(QStringLiteral("spread"), attributeSpread());
+ writer.writeAttribute(u"spread"_s, attributeSpread());
if (hasAttributeCoordinateMode())
- writer.writeAttribute(QStringLiteral("coordinatemode"), attributeCoordinateMode());
+ writer.writeAttribute(u"coordinatemode"_s, attributeCoordinateMode());
for (DomGradientStop *v : m_gradientStop)
- v->write(writer, QStringLiteral("gradientstop"));
+ v->write(writer, u"gradientstop"_s);
writer.writeEndElement();
}
@@ -2736,36 +2703,36 @@ void DomBrush::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("brushstyle")) {
+ if (name == u"brushstyle"_s) {
setAttributeBrushStyle(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("color"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
auto *v = new DomColor();
v->read(reader);
setElementColor(v);
continue;
}
- if (!tag.compare(QLatin1String("texture"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"texture"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
setElementTexture(v);
continue;
}
- if (!tag.compare(QLatin1String("gradient"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"gradient"_s, Qt::CaseInsensitive)) {
auto *v = new DomGradient();
v->read(reader);
setElementGradient(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2781,22 +2748,22 @@ void DomBrush::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("brush") : tagName.toLower());
if (hasAttributeBrushStyle())
- writer.writeAttribute(QStringLiteral("brushstyle"), attributeBrushStyle());
+ writer.writeAttribute(u"brushstyle"_s, attributeBrushStyle());
switch (kind()) {
case Color:
if (m_color != nullptr)
- m_color->write(writer, QStringLiteral("color"));
+ m_color->write(writer, u"color"_s);
break;
case Texture:
if (m_texture != nullptr)
- m_texture->write(writer, QStringLiteral("texture"));
+ m_texture->write(writer, u"texture"_s);
break;
case Gradient:
if (m_gradient != nullptr)
- m_gradient->write(writer, QStringLiteral("gradient"));
+ m_gradient->write(writer, u"gradient"_s);
break;
default:
@@ -2857,24 +2824,24 @@ void DomColorRole::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("role")) {
+ if (name == u"role"_s) {
setAttributeRole(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("brush"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"brush"_s, Qt::CaseInsensitive)) {
auto *v = new DomBrush();
v->read(reader);
setElementBrush(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2890,10 +2857,10 @@ void DomColorRole::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("colorrole") : tagName.toLower());
if (hasAttributeRole())
- writer.writeAttribute(QStringLiteral("role"), attributeRole());
+ writer.writeAttribute(u"role"_s, attributeRole());
if (m_children & Brush)
- m_brush->write(writer, QStringLiteral("brush"));
+ m_brush->write(writer, u"brush"_s);
writer.writeEndElement();
}
@@ -2934,19 +2901,19 @@ void DomColorGroup::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("colorrole"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"colorrole"_s, Qt::CaseInsensitive)) {
auto *v = new DomColorRole();
v->read(reader);
m_colorRole.append(v);
continue;
}
- if (!tag.compare(QLatin1String("color"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
auto *v = new DomColor();
v->read(reader);
m_color.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -2962,10 +2929,10 @@ void DomColorGroup::write(QXmlStreamWriter &writer, const QString &tagName) cons
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("colorgroup") : tagName.toLower());
for (DomColorRole *v : m_colorRole)
- v->write(writer, QStringLiteral("colorrole"));
+ v->write(writer, u"colorrole"_s);
for (DomColor *v : m_color)
- v->write(writer, QStringLiteral("color"));
+ v->write(writer, u"color"_s);
writer.writeEndElement();
}
@@ -2995,25 +2962,25 @@ void DomPalette::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("active"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"active"_s, Qt::CaseInsensitive)) {
auto *v = new DomColorGroup();
v->read(reader);
setElementActive(v);
continue;
}
- if (!tag.compare(QLatin1String("inactive"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"inactive"_s, Qt::CaseInsensitive)) {
auto *v = new DomColorGroup();
v->read(reader);
setElementInactive(v);
continue;
}
- if (!tag.compare(QLatin1String("disabled"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"disabled"_s, Qt::CaseInsensitive)) {
auto *v = new DomColorGroup();
v->read(reader);
setElementDisabled(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3029,13 +2996,13 @@ void DomPalette::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("palette") : tagName.toLower());
if (m_children & Active)
- m_active->write(writer, QStringLiteral("active"));
+ m_active->write(writer, u"active"_s);
if (m_children & Inactive)
- m_inactive->write(writer, QStringLiteral("inactive"));
+ m_inactive->write(writer, u"inactive"_s);
if (m_children & Disabled)
- m_disabled->write(writer, QStringLiteral("disabled"));
+ m_disabled->write(writer, u"disabled"_s);
writer.writeEndElement();
}
@@ -3114,47 +3081,55 @@ void DomFont::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("family"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"family"_s, Qt::CaseInsensitive)) {
setElementFamily(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("pointsize"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"pointsize"_s, Qt::CaseInsensitive)) {
setElementPointSize(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("weight"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"weight"_s, Qt::CaseInsensitive)) {
setElementWeight(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("italic"), Qt::CaseInsensitive)) {
- setElementItalic(reader.readElementText() == QLatin1String("true"));
+ if (!tag.compare(u"italic"_s, Qt::CaseInsensitive)) {
+ setElementItalic(reader.readElementText() == u"true"_s);
continue;
}
- if (!tag.compare(QLatin1String("bold"), Qt::CaseInsensitive)) {
- setElementBold(reader.readElementText() == QLatin1String("true"));
+ if (!tag.compare(u"bold"_s, Qt::CaseInsensitive)) {
+ setElementBold(reader.readElementText() == u"true"_s);
continue;
}
- if (!tag.compare(QLatin1String("underline"), Qt::CaseInsensitive)) {
- setElementUnderline(reader.readElementText() == QLatin1String("true"));
+ if (!tag.compare(u"underline"_s, Qt::CaseInsensitive)) {
+ setElementUnderline(reader.readElementText() == u"true"_s);
continue;
}
- if (!tag.compare(QLatin1String("strikeout"), Qt::CaseInsensitive)) {
- setElementStrikeOut(reader.readElementText() == QLatin1String("true"));
+ if (!tag.compare(u"strikeout"_s, Qt::CaseInsensitive)) {
+ setElementStrikeOut(reader.readElementText() == u"true"_s);
continue;
}
- if (!tag.compare(QLatin1String("antialiasing"), Qt::CaseInsensitive)) {
- setElementAntialiasing(reader.readElementText() == QLatin1String("true"));
+ if (!tag.compare(u"antialiasing"_s, Qt::CaseInsensitive)) {
+ setElementAntialiasing(reader.readElementText() == u"true"_s);
continue;
}
- if (!tag.compare(QLatin1String("stylestrategy"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"stylestrategy"_s, Qt::CaseInsensitive)) {
setElementStyleStrategy(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("kerning"), Qt::CaseInsensitive)) {
- setElementKerning(reader.readElementText() == QLatin1String("true"));
+ if (!tag.compare(u"kerning"_s, Qt::CaseInsensitive)) {
+ setElementKerning(reader.readElementText() == u"true"_s);
+ continue;
+ }
+ if (!tag.compare(u"hintingpreference"_s, Qt::CaseInsensitive)) {
+ setElementHintingPreference(reader.readElementText());
+ continue;
+ }
+ if (!tag.compare(u"fontweight"_s, Qt::CaseInsensitive)) {
+ setElementFontWeight(reader.readElementText());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3170,34 +3145,40 @@ void DomFont::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("font") : tagName.toLower());
if (m_children & Family)
- writer.writeTextElement(QStringLiteral("family"), m_family);
+ writer.writeTextElement(u"family"_s, m_family);
if (m_children & PointSize)
- writer.writeTextElement(QStringLiteral("pointsize"), QString::number(m_pointSize));
+ writer.writeTextElement(u"pointsize"_s, QString::number(m_pointSize));
if (m_children & Weight)
- writer.writeTextElement(QStringLiteral("weight"), QString::number(m_weight));
+ writer.writeTextElement(u"weight"_s, QString::number(m_weight));
if (m_children & Italic)
- writer.writeTextElement(QStringLiteral("italic"), (m_italic ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeTextElement(u"italic"_s, (m_italic ? u"true"_s : u"false"_s));
if (m_children & Bold)
- writer.writeTextElement(QStringLiteral("bold"), (m_bold ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeTextElement(u"bold"_s, (m_bold ? u"true"_s : u"false"_s));
if (m_children & Underline)
- writer.writeTextElement(QStringLiteral("underline"), (m_underline ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeTextElement(u"underline"_s, (m_underline ? u"true"_s : u"false"_s));
if (m_children & StrikeOut)
- writer.writeTextElement(QStringLiteral("strikeout"), (m_strikeOut ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeTextElement(u"strikeout"_s, (m_strikeOut ? u"true"_s : u"false"_s));
if (m_children & Antialiasing)
- writer.writeTextElement(QStringLiteral("antialiasing"), (m_antialiasing ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeTextElement(u"antialiasing"_s, (m_antialiasing ? u"true"_s : u"false"_s));
if (m_children & StyleStrategy)
- writer.writeTextElement(QStringLiteral("stylestrategy"), m_styleStrategy);
+ writer.writeTextElement(u"stylestrategy"_s, m_styleStrategy);
if (m_children & Kerning)
- writer.writeTextElement(QStringLiteral("kerning"), (m_kerning ? QLatin1String("true") : QLatin1String("false")));
+ writer.writeTextElement(u"kerning"_s, (m_kerning ? u"true"_s : u"false"_s));
+
+ if (m_children & HintingPreference)
+ writer.writeTextElement(u"hintingpreference"_s, m_hintingPreference);
+
+ if (m_children & FontWeight)
+ writer.writeTextElement(u"fontweight"_s, m_fontWeight);
writer.writeEndElement();
}
@@ -3262,6 +3243,18 @@ void DomFont::setElementKerning(bool a)
m_kerning = a;
}
+void DomFont::setElementHintingPreference(const QString &a)
+{
+ m_children |= HintingPreference;
+ m_hintingPreference = a;
+}
+
+void DomFont::setElementFontWeight(const QString &a)
+{
+ m_children |= FontWeight;
+ m_fontWeight = a;
+}
+
void DomFont::clearElementFamily()
{
m_children &= ~Family;
@@ -3312,6 +3305,16 @@ void DomFont::clearElementKerning()
m_children &= ~Kerning;
}
+void DomFont::clearElementHintingPreference()
+{
+ m_children &= ~HintingPreference;
+}
+
+void DomFont::clearElementFontWeight()
+{
+ m_children &= ~FontWeight;
+}
+
DomPoint::~DomPoint() = default;
void DomPoint::read(QXmlStreamReader &reader)
@@ -3320,15 +3323,15 @@ void DomPoint::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("x"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
setElementX(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("y"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
setElementY(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3344,10 +3347,10 @@ void DomPoint::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("point") : tagName.toLower());
if (m_children & X)
- writer.writeTextElement(QString(QLatin1Char('x')), QString::number(m_x));
+ writer.writeTextElement(u"x"_s, QString::number(m_x));
if (m_children & Y)
- writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y));
+ writer.writeTextElement(u"y"_s, QString::number(m_y));
writer.writeEndElement();
}
@@ -3382,23 +3385,23 @@ void DomRect::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("x"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
setElementX(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("y"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
setElementY(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("width"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
setElementWidth(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("height"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
setElementHeight(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3414,16 +3417,16 @@ void DomRect::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("rect") : tagName.toLower());
if (m_children & X)
- writer.writeTextElement(QString(QLatin1Char('x')), QString::number(m_x));
+ writer.writeTextElement(u"x"_s, QString::number(m_x));
if (m_children & Y)
- writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y));
+ writer.writeTextElement(u"y"_s, QString::number(m_y));
if (m_children & Width)
- writer.writeTextElement(QStringLiteral("width"), QString::number(m_width));
+ writer.writeTextElement(u"width"_s, QString::number(m_width));
if (m_children & Height)
- writer.writeTextElement(QStringLiteral("height"), QString::number(m_height));
+ writer.writeTextElement(u"height"_s, QString::number(m_height));
writer.writeEndElement();
}
@@ -3479,22 +3482,22 @@ void DomLocale::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("language")) {
+ if (name == u"language"_s) {
setAttributeLanguage(attribute.value().toString());
continue;
}
- if (name == QLatin1String("country")) {
+ if (name == u"country"_s) {
setAttributeCountry(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3510,10 +3513,10 @@ void DomLocale::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("locale") : tagName.toLower());
if (hasAttributeLanguage())
- writer.writeAttribute(QStringLiteral("language"), attributeLanguage());
+ writer.writeAttribute(u"language"_s, attributeLanguage());
if (hasAttributeCountry())
- writer.writeAttribute(QStringLiteral("country"), attributeCountry());
+ writer.writeAttribute(u"country"_s, attributeCountry());
writer.writeEndElement();
}
@@ -3525,38 +3528,38 @@ void DomSizePolicy::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("hsizetype")) {
+ if (name == u"hsizetype"_s) {
setAttributeHSizeType(attribute.value().toString());
continue;
}
- if (name == QLatin1String("vsizetype")) {
+ if (name == u"vsizetype"_s) {
setAttributeVSizeType(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("hsizetype"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"hsizetype"_s, Qt::CaseInsensitive)) {
setElementHSizeType(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("vsizetype"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"vsizetype"_s, Qt::CaseInsensitive)) {
setElementVSizeType(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("horstretch"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"horstretch"_s, Qt::CaseInsensitive)) {
setElementHorStretch(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("verstretch"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"verstretch"_s, Qt::CaseInsensitive)) {
setElementVerStretch(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3572,22 +3575,22 @@ void DomSizePolicy::write(QXmlStreamWriter &writer, const QString &tagName) cons
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("sizepolicy") : tagName.toLower());
if (hasAttributeHSizeType())
- writer.writeAttribute(QStringLiteral("hsizetype"), attributeHSizeType());
+ writer.writeAttribute(u"hsizetype"_s, attributeHSizeType());
if (hasAttributeVSizeType())
- writer.writeAttribute(QStringLiteral("vsizetype"), attributeVSizeType());
+ writer.writeAttribute(u"vsizetype"_s, attributeVSizeType());
if (m_children & HSizeType)
- writer.writeTextElement(QStringLiteral("hsizetype"), QString::number(m_hSizeType));
+ writer.writeTextElement(u"hsizetype"_s, QString::number(m_hSizeType));
if (m_children & VSizeType)
- writer.writeTextElement(QStringLiteral("vsizetype"), QString::number(m_vSizeType));
+ writer.writeTextElement(u"vsizetype"_s, QString::number(m_vSizeType));
if (m_children & HorStretch)
- writer.writeTextElement(QStringLiteral("horstretch"), QString::number(m_horStretch));
+ writer.writeTextElement(u"horstretch"_s, QString::number(m_horStretch));
if (m_children & VerStretch)
- writer.writeTextElement(QStringLiteral("verstretch"), QString::number(m_verStretch));
+ writer.writeTextElement(u"verstretch"_s, QString::number(m_verStretch));
writer.writeEndElement();
}
@@ -3644,15 +3647,15 @@ void DomSize::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("width"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
setElementWidth(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("height"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
setElementHeight(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3668,10 +3671,10 @@ void DomSize::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("size") : tagName.toLower());
if (m_children & Width)
- writer.writeTextElement(QStringLiteral("width"), QString::number(m_width));
+ writer.writeTextElement(u"width"_s, QString::number(m_width));
if (m_children & Height)
- writer.writeTextElement(QStringLiteral("height"), QString::number(m_height));
+ writer.writeTextElement(u"height"_s, QString::number(m_height));
writer.writeEndElement();
}
@@ -3706,19 +3709,19 @@ void DomDate::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("year"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"year"_s, Qt::CaseInsensitive)) {
setElementYear(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("month"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"month"_s, Qt::CaseInsensitive)) {
setElementMonth(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("day"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"day"_s, Qt::CaseInsensitive)) {
setElementDay(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3734,13 +3737,13 @@ void DomDate::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("date") : tagName.toLower());
if (m_children & Year)
- writer.writeTextElement(QStringLiteral("year"), QString::number(m_year));
+ writer.writeTextElement(u"year"_s, QString::number(m_year));
if (m_children & Month)
- writer.writeTextElement(QStringLiteral("month"), QString::number(m_month));
+ writer.writeTextElement(u"month"_s, QString::number(m_month));
if (m_children & Day)
- writer.writeTextElement(QStringLiteral("day"), QString::number(m_day));
+ writer.writeTextElement(u"day"_s, QString::number(m_day));
writer.writeEndElement();
}
@@ -3786,19 +3789,19 @@ void DomTime::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("hour"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"hour"_s, Qt::CaseInsensitive)) {
setElementHour(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("minute"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"minute"_s, Qt::CaseInsensitive)) {
setElementMinute(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("second"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"second"_s, Qt::CaseInsensitive)) {
setElementSecond(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3814,13 +3817,13 @@ void DomTime::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("time") : tagName.toLower());
if (m_children & Hour)
- writer.writeTextElement(QStringLiteral("hour"), QString::number(m_hour));
+ writer.writeTextElement(u"hour"_s, QString::number(m_hour));
if (m_children & Minute)
- writer.writeTextElement(QStringLiteral("minute"), QString::number(m_minute));
+ writer.writeTextElement(u"minute"_s, QString::number(m_minute));
if (m_children & Second)
- writer.writeTextElement(QStringLiteral("second"), QString::number(m_second));
+ writer.writeTextElement(u"second"_s, QString::number(m_second));
writer.writeEndElement();
}
@@ -3866,31 +3869,31 @@ void DomDateTime::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("hour"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"hour"_s, Qt::CaseInsensitive)) {
setElementHour(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("minute"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"minute"_s, Qt::CaseInsensitive)) {
setElementMinute(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("second"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"second"_s, Qt::CaseInsensitive)) {
setElementSecond(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("year"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"year"_s, Qt::CaseInsensitive)) {
setElementYear(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("month"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"month"_s, Qt::CaseInsensitive)) {
setElementMonth(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("day"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"day"_s, Qt::CaseInsensitive)) {
setElementDay(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -3906,22 +3909,22 @@ void DomDateTime::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("datetime") : tagName.toLower());
if (m_children & Hour)
- writer.writeTextElement(QStringLiteral("hour"), QString::number(m_hour));
+ writer.writeTextElement(u"hour"_s, QString::number(m_hour));
if (m_children & Minute)
- writer.writeTextElement(QStringLiteral("minute"), QString::number(m_minute));
+ writer.writeTextElement(u"minute"_s, QString::number(m_minute));
if (m_children & Second)
- writer.writeTextElement(QStringLiteral("second"), QString::number(m_second));
+ writer.writeTextElement(u"second"_s, QString::number(m_second));
if (m_children & Year)
- writer.writeTextElement(QStringLiteral("year"), QString::number(m_year));
+ writer.writeTextElement(u"year"_s, QString::number(m_year));
if (m_children & Month)
- writer.writeTextElement(QStringLiteral("month"), QString::number(m_month));
+ writer.writeTextElement(u"month"_s, QString::number(m_month));
if (m_children & Day)
- writer.writeTextElement(QStringLiteral("day"), QString::number(m_day));
+ writer.writeTextElement(u"day"_s, QString::number(m_day));
writer.writeEndElement();
}
@@ -4002,34 +4005,34 @@ void DomStringList::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("notr")) {
+ if (name == u"notr"_s) {
setAttributeNotr(attribute.value().toString());
continue;
}
- if (name == QLatin1String("comment")) {
+ if (name == u"comment"_s) {
setAttributeComment(attribute.value().toString());
continue;
}
- if (name == QLatin1String("extracomment")) {
+ if (name == u"extracomment"_s) {
setAttributeExtraComment(attribute.value().toString());
continue;
}
- if (name == QLatin1String("id")) {
+ if (name == u"id"_s) {
setAttributeId(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("string"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"string"_s, Qt::CaseInsensitive)) {
m_string.append(reader.readElementText());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -4045,19 +4048,19 @@ void DomStringList::write(QXmlStreamWriter &writer, const QString &tagName) cons
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("stringlist") : tagName.toLower());
if (hasAttributeNotr())
- writer.writeAttribute(QStringLiteral("notr"), attributeNotr());
+ writer.writeAttribute(u"notr"_s, attributeNotr());
if (hasAttributeComment())
- writer.writeAttribute(QStringLiteral("comment"), attributeComment());
+ writer.writeAttribute(u"comment"_s, attributeComment());
if (hasAttributeExtraComment())
- writer.writeAttribute(QStringLiteral("extracomment"), attributeExtraComment());
+ writer.writeAttribute(u"extracomment"_s, attributeExtraComment());
if (hasAttributeId())
- writer.writeAttribute(QStringLiteral("id"), attributeId());
+ writer.writeAttribute(u"id"_s, attributeId());
for (const QString &v : m_string)
- writer.writeTextElement(QStringLiteral("string"), v);
+ writer.writeTextElement(u"string"_s, v);
writer.writeEndElement();
}
@@ -4075,22 +4078,22 @@ void DomResourcePixmap::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("resource")) {
+ if (name == u"resource"_s) {
setAttributeResource(attribute.value().toString());
continue;
}
- if (name == QLatin1String("alias")) {
+ if (name == u"alias"_s) {
setAttributeAlias(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -4110,10 +4113,10 @@ void DomResourcePixmap::write(QXmlStreamWriter &writer, const QString &tagName)
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("resourcepixmap") : tagName.toLower());
if (hasAttributeResource())
- writer.writeAttribute(QStringLiteral("resource"), attributeResource());
+ writer.writeAttribute(u"resource"_s, attributeResource());
if (hasAttributeAlias())
- writer.writeAttribute(QStringLiteral("alias"), attributeAlias());
+ writer.writeAttribute(u"alias"_s, attributeAlias());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -4138,70 +4141,70 @@ void DomResourceIcon::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("theme")) {
+ if (name == u"theme"_s) {
setAttributeTheme(attribute.value().toString());
continue;
}
- if (name == QLatin1String("resource")) {
+ if (name == u"resource"_s) {
setAttributeResource(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("normaloff"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"normaloff"_s, Qt::CaseInsensitive)) {
auto *v = new DomResourcePixmap();
v->read(reader);
setElementNormalOff(v);
continue;
}
- if (!tag.compare(QLatin1String("normalon"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"normalon"_s, Qt::CaseInsensitive)) {
auto *v = new DomResourcePixmap();
v->read(reader);
setElementNormalOn(v);
continue;
}
- if (!tag.compare(QLatin1String("disabledoff"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"disabledoff"_s, Qt::CaseInsensitive)) {
auto *v = new DomResourcePixmap();
v->read(reader);
setElementDisabledOff(v);
continue;
}
- if (!tag.compare(QLatin1String("disabledon"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"disabledon"_s, Qt::CaseInsensitive)) {
auto *v = new DomResourcePixmap();
v->read(reader);
setElementDisabledOn(v);
continue;
}
- if (!tag.compare(QLatin1String("activeoff"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"activeoff"_s, Qt::CaseInsensitive)) {
auto *v = new DomResourcePixmap();
v->read(reader);
setElementActiveOff(v);
continue;
}
- if (!tag.compare(QLatin1String("activeon"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"activeon"_s, Qt::CaseInsensitive)) {
auto *v = new DomResourcePixmap();
v->read(reader);
setElementActiveOn(v);
continue;
}
- if (!tag.compare(QLatin1String("selectedoff"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"selectedoff"_s, Qt::CaseInsensitive)) {
auto *v = new DomResourcePixmap();
v->read(reader);
setElementSelectedOff(v);
continue;
}
- if (!tag.compare(QLatin1String("selectedon"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"selectedon"_s, Qt::CaseInsensitive)) {
auto *v = new DomResourcePixmap();
v->read(reader);
setElementSelectedOn(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -4221,34 +4224,34 @@ void DomResourceIcon::write(QXmlStreamWriter &writer, const QString &tagName) co
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("resourceicon") : tagName.toLower());
if (hasAttributeTheme())
- writer.writeAttribute(QStringLiteral("theme"), attributeTheme());
+ writer.writeAttribute(u"theme"_s, attributeTheme());
if (hasAttributeResource())
- writer.writeAttribute(QStringLiteral("resource"), attributeResource());
+ writer.writeAttribute(u"resource"_s, attributeResource());
if (m_children & NormalOff)
- m_normalOff->write(writer, QStringLiteral("normaloff"));
+ m_normalOff->write(writer, u"normaloff"_s);
if (m_children & NormalOn)
- m_normalOn->write(writer, QStringLiteral("normalon"));
+ m_normalOn->write(writer, u"normalon"_s);
if (m_children & DisabledOff)
- m_disabledOff->write(writer, QStringLiteral("disabledoff"));
+ m_disabledOff->write(writer, u"disabledoff"_s);
if (m_children & DisabledOn)
- m_disabledOn->write(writer, QStringLiteral("disabledon"));
+ m_disabledOn->write(writer, u"disabledon"_s);
if (m_children & ActiveOff)
- m_activeOff->write(writer, QStringLiteral("activeoff"));
+ m_activeOff->write(writer, u"activeoff"_s);
if (m_children & ActiveOn)
- m_activeOn->write(writer, QStringLiteral("activeon"));
+ m_activeOn->write(writer, u"activeon"_s);
if (m_children & SelectedOff)
- m_selectedOff->write(writer, QStringLiteral("selectedoff"));
+ m_selectedOff->write(writer, u"selectedoff"_s);
if (m_children & SelectedOn)
- m_selectedOn->write(writer, QStringLiteral("selectedon"));
+ m_selectedOn->write(writer, u"selectedon"_s);
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -4439,30 +4442,30 @@ void DomString::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("notr")) {
+ if (name == u"notr"_s) {
setAttributeNotr(attribute.value().toString());
continue;
}
- if (name == QLatin1String("comment")) {
+ if (name == u"comment"_s) {
setAttributeComment(attribute.value().toString());
continue;
}
- if (name == QLatin1String("extracomment")) {
+ if (name == u"extracomment"_s) {
setAttributeExtraComment(attribute.value().toString());
continue;
}
- if (name == QLatin1String("id")) {
+ if (name == u"id"_s) {
setAttributeId(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -4482,16 +4485,16 @@ void DomString::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("string") : tagName.toLower());
if (hasAttributeNotr())
- writer.writeAttribute(QStringLiteral("notr"), attributeNotr());
+ writer.writeAttribute(u"notr"_s, attributeNotr());
if (hasAttributeComment())
- writer.writeAttribute(QStringLiteral("comment"), attributeComment());
+ writer.writeAttribute(u"comment"_s, attributeComment());
if (hasAttributeExtraComment())
- writer.writeAttribute(QStringLiteral("extracomment"), attributeExtraComment());
+ writer.writeAttribute(u"extracomment"_s, attributeExtraComment());
if (hasAttributeId())
- writer.writeAttribute(QStringLiteral("id"), attributeId());
+ writer.writeAttribute(u"id"_s, attributeId());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
@@ -4507,15 +4510,15 @@ void DomPointF::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("x"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
setElementX(reader.readElementText().toDouble());
continue;
}
- if (!tag.compare(QLatin1String("y"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
setElementY(reader.readElementText().toDouble());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -4531,10 +4534,10 @@ void DomPointF::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("pointf") : tagName.toLower());
if (m_children & X)
- writer.writeTextElement(QString(QLatin1Char('x')), QString::number(m_x, 'f', 15));
+ writer.writeTextElement(u"x"_s, QString::number(m_x, 'f', 15));
if (m_children & Y)
- writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y, 'f', 15));
+ writer.writeTextElement(u"y"_s, QString::number(m_y, 'f', 15));
writer.writeEndElement();
}
@@ -4569,23 +4572,23 @@ void DomRectF::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("x"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
setElementX(reader.readElementText().toDouble());
continue;
}
- if (!tag.compare(QLatin1String("y"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
setElementY(reader.readElementText().toDouble());
continue;
}
- if (!tag.compare(QLatin1String("width"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
setElementWidth(reader.readElementText().toDouble());
continue;
}
- if (!tag.compare(QLatin1String("height"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
setElementHeight(reader.readElementText().toDouble());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -4601,16 +4604,16 @@ void DomRectF::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("rectf") : tagName.toLower());
if (m_children & X)
- writer.writeTextElement(QString(QLatin1Char('x')), QString::number(m_x, 'f', 15));
+ writer.writeTextElement(u"x"_s, QString::number(m_x, 'f', 15));
if (m_children & Y)
- writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y, 'f', 15));
+ writer.writeTextElement(u"y"_s, QString::number(m_y, 'f', 15));
if (m_children & Width)
- writer.writeTextElement(QStringLiteral("width"), QString::number(m_width, 'f', 15));
+ writer.writeTextElement(u"width"_s, QString::number(m_width, 'f', 15));
if (m_children & Height)
- writer.writeTextElement(QStringLiteral("height"), QString::number(m_height, 'f', 15));
+ writer.writeTextElement(u"height"_s, QString::number(m_height, 'f', 15));
writer.writeEndElement();
}
@@ -4667,15 +4670,15 @@ void DomSizeF::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("width"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
setElementWidth(reader.readElementText().toDouble());
continue;
}
- if (!tag.compare(QLatin1String("height"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
setElementHeight(reader.readElementText().toDouble());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -4691,10 +4694,10 @@ void DomSizeF::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("sizef") : tagName.toLower());
if (m_children & Width)
- writer.writeTextElement(QStringLiteral("width"), QString::number(m_width, 'f', 15));
+ writer.writeTextElement(u"width"_s, QString::number(m_width, 'f', 15));
if (m_children & Height)
- writer.writeTextElement(QStringLiteral("height"), QString::number(m_height, 'f', 15));
+ writer.writeTextElement(u"height"_s, QString::number(m_height, 'f', 15));
writer.writeEndElement();
}
@@ -4729,11 +4732,11 @@ void DomChar::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("unicode"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"unicode"_s, Qt::CaseInsensitive)) {
setElementUnicode(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -4749,7 +4752,7 @@ void DomChar::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("char") : tagName.toLower());
if (m_children & Unicode)
- writer.writeTextElement(QStringLiteral("unicode"), QString::number(m_unicode));
+ writer.writeTextElement(u"unicode"_s, QString::number(m_unicode));
writer.writeEndElement();
}
@@ -4776,13 +4779,13 @@ void DomUrl::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("string"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"string"_s, Qt::CaseInsensitive)) {
auto *v = new DomString();
v->read(reader);
setElementString(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -4798,7 +4801,7 @@ void DomUrl::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("url") : tagName.toLower());
if (m_children & String)
- m_string->write(writer, QStringLiteral("string"));
+ m_string->write(writer, u"string"_s);
writer.writeEndElement();
}
@@ -4911,196 +4914,196 @@ void DomProperty::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == u"name"_s) {
setAttributeName(attribute.value().toString());
continue;
}
- if (name == QLatin1String("stdset")) {
+ if (name == u"stdset"_s) {
setAttributeStdset(attribute.value().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("bool"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"bool"_s, Qt::CaseInsensitive)) {
setElementBool(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("color"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
auto *v = new DomColor();
v->read(reader);
setElementColor(v);
continue;
}
- if (!tag.compare(QLatin1String("cstring"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"cstring"_s, Qt::CaseInsensitive)) {
setElementCstring(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("cursor"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"cursor"_s, Qt::CaseInsensitive)) {
setElementCursor(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("cursorshape"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"cursorshape"_s, Qt::CaseInsensitive)) {
setElementCursorShape(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("enum"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"enum"_s, Qt::CaseInsensitive)) {
setElementEnum(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("font"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"font"_s, Qt::CaseInsensitive)) {
auto *v = new DomFont();
v->read(reader);
setElementFont(v);
continue;
}
- if (!tag.compare(QLatin1String("iconset"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"iconset"_s, Qt::CaseInsensitive)) {
auto *v = new DomResourceIcon();
v->read(reader);
setElementIconSet(v);
continue;
}
- if (!tag.compare(QLatin1String("pixmap"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"pixmap"_s, Qt::CaseInsensitive)) {
auto *v = new DomResourcePixmap();
v->read(reader);
setElementPixmap(v);
continue;
}
- if (!tag.compare(QLatin1String("palette"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"palette"_s, Qt::CaseInsensitive)) {
auto *v = new DomPalette();
v->read(reader);
setElementPalette(v);
continue;
}
- if (!tag.compare(QLatin1String("point"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"point"_s, Qt::CaseInsensitive)) {
auto *v = new DomPoint();
v->read(reader);
setElementPoint(v);
continue;
}
- if (!tag.compare(QLatin1String("rect"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"rect"_s, Qt::CaseInsensitive)) {
auto *v = new DomRect();
v->read(reader);
setElementRect(v);
continue;
}
- if (!tag.compare(QLatin1String("set"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"set"_s, Qt::CaseInsensitive)) {
setElementSet(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("locale"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"locale"_s, Qt::CaseInsensitive)) {
auto *v = new DomLocale();
v->read(reader);
setElementLocale(v);
continue;
}
- if (!tag.compare(QLatin1String("sizepolicy"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"sizepolicy"_s, Qt::CaseInsensitive)) {
auto *v = new DomSizePolicy();
v->read(reader);
setElementSizePolicy(v);
continue;
}
- if (!tag.compare(QLatin1String("size"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"size"_s, Qt::CaseInsensitive)) {
auto *v = new DomSize();
v->read(reader);
setElementSize(v);
continue;
}
- if (!tag.compare(QLatin1String("string"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"string"_s, Qt::CaseInsensitive)) {
auto *v = new DomString();
v->read(reader);
setElementString(v);
continue;
}
- if (!tag.compare(QLatin1String("stringlist"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"stringlist"_s, Qt::CaseInsensitive)) {
auto *v = new DomStringList();
v->read(reader);
setElementStringList(v);
continue;
}
- if (!tag.compare(QLatin1String("number"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"number"_s, Qt::CaseInsensitive)) {
setElementNumber(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("float"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"float"_s, Qt::CaseInsensitive)) {
setElementFloat(reader.readElementText().toFloat());
continue;
}
- if (!tag.compare(QLatin1String("double"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"double"_s, Qt::CaseInsensitive)) {
setElementDouble(reader.readElementText().toDouble());
continue;
}
- if (!tag.compare(QLatin1String("date"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"date"_s, Qt::CaseInsensitive)) {
auto *v = new DomDate();
v->read(reader);
setElementDate(v);
continue;
}
- if (!tag.compare(QLatin1String("time"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"time"_s, Qt::CaseInsensitive)) {
auto *v = new DomTime();
v->read(reader);
setElementTime(v);
continue;
}
- if (!tag.compare(QLatin1String("datetime"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"datetime"_s, Qt::CaseInsensitive)) {
auto *v = new DomDateTime();
v->read(reader);
setElementDateTime(v);
continue;
}
- if (!tag.compare(QLatin1String("pointf"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"pointf"_s, Qt::CaseInsensitive)) {
auto *v = new DomPointF();
v->read(reader);
setElementPointF(v);
continue;
}
- if (!tag.compare(QLatin1String("rectf"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"rectf"_s, Qt::CaseInsensitive)) {
auto *v = new DomRectF();
v->read(reader);
setElementRectF(v);
continue;
}
- if (!tag.compare(QLatin1String("sizef"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"sizef"_s, Qt::CaseInsensitive)) {
auto *v = new DomSizeF();
v->read(reader);
setElementSizeF(v);
continue;
}
- if (!tag.compare(QLatin1String("longlong"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"longlong"_s, Qt::CaseInsensitive)) {
setElementLongLong(reader.readElementText().toLongLong());
continue;
}
- if (!tag.compare(QLatin1String("char"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"char"_s, Qt::CaseInsensitive)) {
auto *v = new DomChar();
v->read(reader);
setElementChar(v);
continue;
}
- if (!tag.compare(QLatin1String("url"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"url"_s, Qt::CaseInsensitive)) {
auto *v = new DomUrl();
v->read(reader);
setElementUrl(v);
continue;
}
- if (!tag.compare(QLatin1String("uint"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"uint"_s, Qt::CaseInsensitive)) {
setElementUInt(reader.readElementText().toUInt());
continue;
}
- if (!tag.compare(QLatin1String("ulonglong"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"ulonglong"_s, Qt::CaseInsensitive)) {
setElementULongLong(reader.readElementText().toULongLong());
continue;
}
- if (!tag.compare(QLatin1String("brush"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"brush"_s, Qt::CaseInsensitive)) {
auto *v = new DomBrush();
v->read(reader);
setElementBrush(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -5116,163 +5119,163 @@ void DomProperty::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("property") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QStringLiteral("name"), attributeName());
+ writer.writeAttribute(u"name"_s, attributeName());
if (hasAttributeStdset())
- writer.writeAttribute(QStringLiteral("stdset"), QString::number(attributeStdset()));
+ writer.writeAttribute(u"stdset"_s, QString::number(attributeStdset()));
switch (kind()) {
case Bool:
- writer.writeTextElement(QStringLiteral("bool"), elementBool());
+ writer.writeTextElement(u"bool"_s, elementBool());
break;
case Color:
if (m_color != nullptr)
- m_color->write(writer, QStringLiteral("color"));
+ m_color->write(writer, u"color"_s);
break;
case Cstring:
- writer.writeTextElement(QStringLiteral("cstring"), elementCstring());
+ writer.writeTextElement(u"cstring"_s, elementCstring());
break;
case Cursor:
- writer.writeTextElement(QStringLiteral("cursor"), QString::number(elementCursor()));
+ writer.writeTextElement(u"cursor"_s, QString::number(elementCursor()));
break;
case CursorShape:
- writer.writeTextElement(QStringLiteral("cursorShape"), elementCursorShape());
+ writer.writeTextElement(u"cursorShape"_s, elementCursorShape());
break;
case Enum:
- writer.writeTextElement(QStringLiteral("enum"), elementEnum());
+ writer.writeTextElement(u"enum"_s, elementEnum());
break;
case Font:
if (m_font != nullptr)
- m_font->write(writer, QStringLiteral("font"));
+ m_font->write(writer, u"font"_s);
break;
case IconSet:
if (m_iconSet != nullptr)
- m_iconSet->write(writer, QStringLiteral("iconset"));
+ m_iconSet->write(writer, u"iconset"_s);
break;
case Pixmap:
if (m_pixmap != nullptr)
- m_pixmap->write(writer, QStringLiteral("pixmap"));
+ m_pixmap->write(writer, u"pixmap"_s);
break;
case Palette:
if (m_palette != nullptr)
- m_palette->write(writer, QStringLiteral("palette"));
+ m_palette->write(writer, u"palette"_s);
break;
case Point:
if (m_point != nullptr)
- m_point->write(writer, QStringLiteral("point"));
+ m_point->write(writer, u"point"_s);
break;
case Rect:
if (m_rect != nullptr)
- m_rect->write(writer, QStringLiteral("rect"));
+ m_rect->write(writer, u"rect"_s);
break;
case Set:
- writer.writeTextElement(QStringLiteral("set"), elementSet());
+ writer.writeTextElement(u"set"_s, elementSet());
break;
case Locale:
if (m_locale != nullptr)
- m_locale->write(writer, QStringLiteral("locale"));
+ m_locale->write(writer, u"locale"_s);
break;
case SizePolicy:
if (m_sizePolicy != nullptr)
- m_sizePolicy->write(writer, QStringLiteral("sizepolicy"));
+ m_sizePolicy->write(writer, u"sizepolicy"_s);
break;
case Size:
if (m_size != nullptr)
- m_size->write(writer, QStringLiteral("size"));
+ m_size->write(writer, u"size"_s);
break;
case String:
if (m_string != nullptr)
- m_string->write(writer, QStringLiteral("string"));
+ m_string->write(writer, u"string"_s);
break;
case StringList:
if (m_stringList != nullptr)
- m_stringList->write(writer, QStringLiteral("stringlist"));
+ m_stringList->write(writer, u"stringlist"_s);
break;
case Number:
- writer.writeTextElement(QStringLiteral("number"), QString::number(elementNumber()));
+ writer.writeTextElement(u"number"_s, QString::number(elementNumber()));
break;
case Float:
- writer.writeTextElement(QStringLiteral("float"), QString::number(elementFloat(), 'f', 8));
+ writer.writeTextElement(u"float"_s, QString::number(elementFloat(), 'f', 8));
break;
case Double:
- writer.writeTextElement(QStringLiteral("double"), QString::number(elementDouble(), 'f', 15));
+ writer.writeTextElement(u"double"_s, QString::number(elementDouble(), 'f', 15));
break;
case Date:
if (m_date != nullptr)
- m_date->write(writer, QStringLiteral("date"));
+ m_date->write(writer, u"date"_s);
break;
case Time:
if (m_time != nullptr)
- m_time->write(writer, QStringLiteral("time"));
+ m_time->write(writer, u"time"_s);
break;
case DateTime:
if (m_dateTime != nullptr)
- m_dateTime->write(writer, QStringLiteral("datetime"));
+ m_dateTime->write(writer, u"datetime"_s);
break;
case PointF:
if (m_pointF != nullptr)
- m_pointF->write(writer, QStringLiteral("pointf"));
+ m_pointF->write(writer, u"pointf"_s);
break;
case RectF:
if (m_rectF != nullptr)
- m_rectF->write(writer, QStringLiteral("rectf"));
+ m_rectF->write(writer, u"rectf"_s);
break;
case SizeF:
if (m_sizeF != nullptr)
- m_sizeF->write(writer, QStringLiteral("sizef"));
+ m_sizeF->write(writer, u"sizef"_s);
break;
case LongLong:
- writer.writeTextElement(QStringLiteral("longLong"), QString::number(elementLongLong()));
+ writer.writeTextElement(u"longLong"_s, QString::number(elementLongLong()));
break;
case Char:
if (m_char != nullptr)
- m_char->write(writer, QStringLiteral("char"));
+ m_char->write(writer, u"char"_s);
break;
case Url:
if (m_url != nullptr)
- m_url->write(writer, QStringLiteral("url"));
+ m_url->write(writer, u"url"_s);
break;
case UInt:
- writer.writeTextElement(QStringLiteral("UInt"), QString::number(elementUInt()));
+ writer.writeTextElement(u"UInt"_s, QString::number(elementUInt()));
break;
case ULongLong:
- writer.writeTextElement(QStringLiteral("uLongLong"), QString::number(elementULongLong()));
+ writer.writeTextElement(u"uLongLong"_s, QString::number(elementULongLong()));
break;
case Brush:
if (m_brush != nullptr)
- m_brush->write(writer, QStringLiteral("brush"));
+ m_brush->write(writer, u"brush"_s);
break;
default:
@@ -5671,13 +5674,13 @@ void DomConnections::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("connection"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"connection"_s, Qt::CaseInsensitive)) {
auto *v = new DomConnection();
v->read(reader);
m_connection.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -5693,7 +5696,7 @@ void DomConnections::write(QXmlStreamWriter &writer, const QString &tagName) con
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("connections") : tagName.toLower());
for (DomConnection *v : m_connection)
- v->write(writer, QStringLiteral("connection"));
+ v->write(writer, u"connection"_s);
writer.writeEndElement();
}
@@ -5715,29 +5718,29 @@ void DomConnection::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("sender"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"sender"_s, Qt::CaseInsensitive)) {
setElementSender(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("signal"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"signal"_s, Qt::CaseInsensitive)) {
setElementSignal(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("receiver"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"receiver"_s, Qt::CaseInsensitive)) {
setElementReceiver(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("slot"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"slot"_s, Qt::CaseInsensitive)) {
setElementSlot(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("hints"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"hints"_s, Qt::CaseInsensitive)) {
auto *v = new DomConnectionHints();
v->read(reader);
setElementHints(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -5753,19 +5756,19 @@ void DomConnection::write(QXmlStreamWriter &writer, const QString &tagName) cons
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("connection") : tagName.toLower());
if (m_children & Sender)
- writer.writeTextElement(QStringLiteral("sender"), m_sender);
+ writer.writeTextElement(u"sender"_s, m_sender);
if (m_children & Signal)
- writer.writeTextElement(QStringLiteral("signal"), m_signal);
+ writer.writeTextElement(u"signal"_s, m_signal);
if (m_children & Receiver)
- writer.writeTextElement(QStringLiteral("receiver"), m_receiver);
+ writer.writeTextElement(u"receiver"_s, m_receiver);
if (m_children & Slot)
- writer.writeTextElement(QStringLiteral("slot"), m_slot);
+ writer.writeTextElement(u"slot"_s, m_slot);
if (m_children & Hints)
- m_hints->write(writer, QStringLiteral("hints"));
+ m_hints->write(writer, u"hints"_s);
writer.writeEndElement();
}
@@ -5848,13 +5851,13 @@ void DomConnectionHints::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("hint"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"hint"_s, Qt::CaseInsensitive)) {
auto *v = new DomConnectionHint();
v->read(reader);
m_hint.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -5870,7 +5873,7 @@ void DomConnectionHints::write(QXmlStreamWriter &writer, const QString &tagName)
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("connectionhints") : tagName.toLower());
for (DomConnectionHint *v : m_hint)
- v->write(writer, QStringLiteral("hint"));
+ v->write(writer, u"hint"_s);
writer.writeEndElement();
}
@@ -5888,26 +5891,26 @@ void DomConnectionHint::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("type")) {
+ if (name == u"type"_s) {
setAttributeType(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("x"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
setElementX(reader.readElementText().toInt());
continue;
}
- if (!tag.compare(QLatin1String("y"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
setElementY(reader.readElementText().toInt());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -5923,13 +5926,13 @@ void DomConnectionHint::write(QXmlStreamWriter &writer, const QString &tagName)
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("connectionhint") : tagName.toLower());
if (hasAttributeType())
- writer.writeAttribute(QStringLiteral("type"), attributeType());
+ writer.writeAttribute(u"type"_s, attributeType());
if (m_children & X)
- writer.writeTextElement(QString(QLatin1Char('x')), QString::number(m_x));
+ writer.writeTextElement(u"x"_s, QString::number(m_x));
if (m_children & Y)
- writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y));
+ writer.writeTextElement(u"y"_s, QString::number(m_y));
writer.writeEndElement();
}
@@ -5968,13 +5971,13 @@ void DomDesignerData::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
auto *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -5990,7 +5993,7 @@ void DomDesignerData::write(QXmlStreamWriter &writer, const QString &tagName) co
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("designerdata") : tagName.toLower());
for (DomProperty *v : m_property)
- v->write(writer, QStringLiteral("property"));
+ v->write(writer, u"property"_s);
writer.writeEndElement();
}
@@ -6013,15 +6016,15 @@ void DomSlots::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("signal"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"signal"_s, Qt::CaseInsensitive)) {
m_signal.append(reader.readElementText());
continue;
}
- if (!tag.compare(QLatin1String("slot"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"slot"_s, Qt::CaseInsensitive)) {
m_slot.append(reader.readElementText());
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -6037,10 +6040,10 @@ void DomSlots::write(QXmlStreamWriter &writer, const QString &tagName) const
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("slots") : tagName.toLower());
for (const QString &v : m_signal)
- writer.writeTextElement(QStringLiteral("signal"), v);
+ writer.writeTextElement(u"signal"_s, v);
for (const QString &v : m_slot)
- writer.writeTextElement(QStringLiteral("slot"), v);
+ writer.writeTextElement(u"slot"_s, v);
writer.writeEndElement();
}
@@ -6071,19 +6074,19 @@ void DomPropertySpecifications::read(QXmlStreamReader &reader)
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- if (!tag.compare(QLatin1String("tooltip"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"tooltip"_s, Qt::CaseInsensitive)) {
auto *v = new DomPropertyToolTip();
v->read(reader);
m_tooltip.append(v);
continue;
}
- if (!tag.compare(QLatin1String("stringpropertyspecification"), Qt::CaseInsensitive)) {
+ if (!tag.compare(u"stringpropertyspecification"_s, Qt::CaseInsensitive)) {
auto *v = new DomStringPropertySpecification();
v->read(reader);
m_stringpropertyspecification.append(v);
continue;
}
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -6099,10 +6102,10 @@ void DomPropertySpecifications::write(QXmlStreamWriter &writer, const QString &t
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("propertyspecifications") : tagName.toLower());
for (DomPropertyToolTip *v : m_tooltip)
- v->write(writer, QStringLiteral("tooltip"));
+ v->write(writer, u"tooltip"_s);
for (DomStringPropertySpecification *v : m_stringpropertyspecification)
- v->write(writer, QStringLiteral("stringpropertyspecification"));
+ v->write(writer, u"stringpropertyspecification"_s);
writer.writeEndElement();
}
@@ -6126,18 +6129,18 @@ void DomPropertyToolTip::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == u"name"_s) {
setAttributeName(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -6153,7 +6156,7 @@ void DomPropertyToolTip::write(QXmlStreamWriter &writer, const QString &tagName)
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("propertytooltip") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QStringLiteral("name"), attributeName());
+ writer.writeAttribute(u"name"_s, attributeName());
writer.writeEndElement();
}
@@ -6165,26 +6168,26 @@ void DomStringPropertySpecification::read(QXmlStreamReader &reader)
const QXmlStreamAttributes &attributes = reader.attributes();
for (const QXmlStreamAttribute &attribute : attributes) {
const auto name = attribute.name();
- if (name == QLatin1String("name")) {
+ if (name == u"name"_s) {
setAttributeName(attribute.value().toString());
continue;
}
- if (name == QLatin1String("type")) {
+ if (name == u"type"_s) {
setAttributeType(attribute.value().toString());
continue;
}
- if (name == QLatin1String("notr")) {
+ if (name == u"notr"_s) {
setAttributeNotr(attribute.value().toString());
continue;
}
- reader.raiseError(QLatin1String("Unexpected attribute ") + name);
+ reader.raiseError("Unexpected attribute "_L1 + name);
}
while (!reader.hasError()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const auto tag = reader.name();
- reader.raiseError(QLatin1String("Unexpected element ") + tag);
+ reader.raiseError("Unexpected element "_L1 + tag);
}
break;
case QXmlStreamReader::EndElement :
@@ -6200,13 +6203,13 @@ void DomStringPropertySpecification::write(QXmlStreamWriter &writer, const QStri
writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("stringpropertyspecification") : tagName.toLower());
if (hasAttributeName())
- writer.writeAttribute(QStringLiteral("name"), attributeName());
+ writer.writeAttribute(u"name"_s, attributeName());
if (hasAttributeType())
- writer.writeAttribute(QStringLiteral("type"), attributeType());
+ writer.writeAttribute(u"type"_s, attributeType());
if (hasAttributeNotr())
- writer.writeAttribute(QStringLiteral("notr"), attributeNotr());
+ writer.writeAttribute(u"notr"_s, attributeNotr());
writer.writeEndElement();
}
diff --git a/src/designer/src/lib/uilib/ui4_p.h b/src/designer/src/lib/uilib/ui4_p.h
index 531f53abd..9f4816ec8 100644
--- a/src/designer/src/lib/uilib/ui4_p.h
+++ b/src/designer/src/lib/uilib/ui4_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
//
// W A R N I N G
@@ -1681,6 +1645,16 @@ public:
inline bool hasElementKerning() const { return m_children & Kerning; }
void clearElementKerning();
+ inline QString elementHintingPreference() const { return m_hintingPreference; }
+ void setElementHintingPreference(const QString &a);
+ inline bool hasElementHintingPreference() const { return m_children & HintingPreference; }
+ void clearElementHintingPreference();
+
+ inline QString elementFontWeight() const { return m_fontWeight; }
+ void setElementFontWeight(const QString &a);
+ inline bool hasElementFontWeight() const { return m_children & FontWeight; }
+ void clearElementFontWeight();
+
private:
// child element data
@@ -1695,6 +1669,8 @@ private:
bool m_antialiasing = false;
QString m_styleStrategy;
bool m_kerning = false;
+ QString m_hintingPreference;
+ QString m_fontWeight;
enum Child {
Family = 1,
@@ -1706,7 +1682,9 @@ private:
StrikeOut = 64,
Antialiasing = 128,
StyleStrategy = 256,
- Kerning = 512
+ Kerning = 512,
+ HintingPreference = 1024,
+ FontWeight = 2048
};
};
diff --git a/src/designer/src/lib/uilib/uilib_global.h b/src/designer/src/lib/uilib/uilib_global.h
index 8630b0af0..be40d96dd 100644
--- a/src/designer/src/lib/uilib/uilib_global.h
+++ b/src/designer/src/lib/uilib/uilib_global.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef UILIB_GLOBAL_H
#define UILIB_GLOBAL_H
diff --git a/src/designer/src/lib/uilib/widgets.table b/src/designer/src/lib/uilib/widgets.table
index 546197ebc..d1f9bea9d 100644
--- a/src/designer/src/lib/uilib/widgets.table
+++ b/src/designer/src/lib/uilib/widgets.table
@@ -27,8 +27,12 @@ DECLARE_WIDGET(QFrame, "")
DECLARE_WIDGET(QGroupBox, "")
#endif
#if QT_CONFIG(scrollarea)
+DECLARE_WIDGET(QAbstractScrollArea, "")
DECLARE_WIDGET(QScrollArea, "")
#endif
+#if QT_CONFIG(abstractslider)
+DECLARE_WIDGET(QAbstractSlider, "")
+#endif
#if QT_CONFIG(lcdnumber)
DECLARE_WIDGET(QLCDNumber, "")
#endif
@@ -73,6 +77,7 @@ DECLARE_WIDGET(QScrollBar, "")
DECLARE_WIDGET(QSlider, "")
#endif
#if QT_CONFIG(spinbox)
+DECLARE_WIDGET(QAbstractSpinBox, "")
DECLARE_WIDGET(QSpinBox, "")
DECLARE_WIDGET(QDoubleSpinBox, "")
#endif
diff --git a/src/designer/src/plugins/CMakeLists.txt b/src/designer/src/plugins/CMakeLists.txt
index 9534009be..35e549c3e 100644
--- a/src/designer/src/plugins/CMakeLists.txt
+++ b/src/designer/src/plugins/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from plugins.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
if(TARGET Qt::WebKitWidgets)
add_subdirectory(qwebview)
diff --git a/src/designer/src/plugins/activeqt/CMakeLists.txt b/src/designer/src/plugins/activeqt/CMakeLists.txt
index 9f7a53e74..18b98a885 100644
--- a/src/designer/src/plugins/activeqt/CMakeLists.txt
+++ b/src/designer/src/plugins/activeqt/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from activeqt.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## QAxWidgetPlugin Plugin:
@@ -22,5 +23,4 @@ qt_internal_add_plugin(QAxWidgetPlugin
Qt::Widgets
)
-#### Keys ignored in scope 1:.:.:activeqt.pro:<TRUE>:
# OTHER_FILES = "activeqt.json"
diff --git a/src/designer/src/plugins/activeqt/qaxwidgetextrainfo.cpp b/src/designer/src/plugins/activeqt/qaxwidgetextrainfo.cpp
index 299fb466c..33cee7a36 100644
--- a/src/designer/src/plugins/activeqt/qaxwidgetextrainfo.cpp
+++ b/src/designer/src/plugins/activeqt/qaxwidgetextrainfo.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qaxwidgetextrainfo.h"
#include "qdesigneraxwidget.h"
@@ -65,11 +40,10 @@ bool QAxWidgetExtraInfo::saveWidgetExtraInfo(DomWidget *ui_widget)
/* Turn off standard setters and make sure "control" is in front,
* otherwise, previews will not work as the properties are not applied via
* the caching property sheet, them. */
- typedef QList<DomProperty *> DomPropertyList;
- DomPropertyList props = ui_widget->elementProperty();
- const int size = props.size();
+ QList<DomProperty *> props = ui_widget->elementProperty();
+ const qsizetype size = props.size();
const QString controlProperty = QLatin1String(QAxWidgetPropertySheet::controlPropertyName);
- for (int i = 0; i < size; i++) {
+ for (qsizetype i = 0; i < size; ++i) {
props.at(i)->setAttributeStdset(false);
if (i > 0 && props.at(i)->attributeName() == controlProperty) {
qSwap(props[0], props[i]);
diff --git a/src/designer/src/plugins/activeqt/qaxwidgetextrainfo.h b/src/designer/src/plugins/activeqt/qaxwidgetextrainfo.h
index 1f5369595..2ab390715 100644
--- a/src/designer/src/plugins/activeqt/qaxwidgetextrainfo.h
+++ b/src/designer/src/plugins/activeqt/qaxwidgetextrainfo.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ACTIVEQT_EXTRAINFO_H
#define ACTIVEQT_EXTRAINFO_H
diff --git a/src/designer/src/plugins/activeqt/qaxwidgetplugin.cpp b/src/designer/src/plugins/activeqt/qaxwidgetplugin.cpp
index 9d28392c9..095305dee 100644
--- a/src/designer/src/plugins/activeqt/qaxwidgetplugin.cpp
+++ b/src/designer/src/plugins/activeqt/qaxwidgetplugin.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qaxwidgetplugin.h"
#include "qaxwidgetextrainfo.h"
@@ -41,6 +16,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
QAxWidgetPlugin::QAxWidgetPlugin(QObject *parent) :
QObject(parent)
{
@@ -48,12 +25,12 @@ QAxWidgetPlugin::QAxWidgetPlugin(QObject *parent) :
QString QAxWidgetPlugin::name() const
{
- return QStringLiteral("QAxWidget");
+ return u"QAxWidget"_s;
}
QString QAxWidgetPlugin::group() const
{
- return QStringLiteral("Containers");
+ return u"Containers"_s;
}
QString QAxWidgetPlugin::toolTip() const
@@ -68,7 +45,7 @@ QString QAxWidgetPlugin::whatsThis() const
QString QAxWidgetPlugin::includeFile() const
{
- return QStringLiteral("qaxwidget.h");
+ return u"qaxwidget.h"_s;
}
QIcon QAxWidgetPlugin::icon() const
diff --git a/src/designer/src/plugins/activeqt/qaxwidgetplugin.h b/src/designer/src/plugins/activeqt/qaxwidgetplugin.h
index 2d0cef249..1e2936c08 100644
--- a/src/designer/src/plugins/activeqt/qaxwidgetplugin.h
+++ b/src/designer/src/plugins/activeqt/qaxwidgetplugin.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ACTIVEXPLUGIN_H
#define ACTIVEXPLUGIN_H
diff --git a/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.cpp b/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.cpp
index f6e2e2639..0762ba927 100644
--- a/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.cpp
+++ b/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qaxwidgetpropertysheet.h"
#include "qdesigneraxwidget.h"
@@ -39,10 +14,10 @@
#include <QtCore/qdebug.h>
#include <QtCore/qtimer.h>
-static const char *geometryPropertyC = "geometry";
-
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
const char *QAxWidgetPropertySheet::controlPropertyName = "control";
static QString designerPropertyToString(const QVariant &value)
@@ -55,7 +30,7 @@ static QString designerPropertyToString(const QVariant &value)
QAxWidgetPropertySheet::QAxWidgetPropertySheet(QDesignerAxWidget *object, QObject *parent) :
QDesignerPropertySheet(object, parent),
m_controlProperty(controlPropertyName),
- m_propertyGroup(QStringLiteral("QAxWidget"))
+ m_propertyGroup(u"QAxWidget"_s)
{
if (!axWidget()->loaded()) { // For some obscure reason....
const int controlIndex = QDesignerPropertySheet::indexOf(m_controlProperty);
@@ -73,7 +48,7 @@ bool QAxWidgetPropertySheet::isEnabled(int index) const
bool QAxWidgetPropertySheet::isVisible(int index) const
{
// classContext is ulong, which the property editor does not support
- return propertyName(index) != QLatin1String("classContext");
+ return propertyName(index) != "classContext"_L1;
}
bool QAxWidgetPropertySheet::dynamicPropertiesAllowed() const
@@ -90,7 +65,7 @@ QDesignerAxWidget *QAxWidgetPropertySheet::axWidget() const
bool QAxWidgetPropertySheet::reset(int index)
{
const QString name = propertyName(index);
- QMap<QString, QVariant>::iterator it = m_currentProperties.changedProperties.find(name);
+ const auto it = m_currentProperties.changedProperties.find(name);
if (it != m_currentProperties.changedProperties.end())
m_currentProperties.changedProperties.erase(it);
if (name != m_controlProperty)
@@ -166,7 +141,7 @@ void QAxWidgetPropertySheet::reloadPropertySheet(const struct SavedProperties &p
properties.widget);
bool foundGeometry = false;
- const QString geometryProperty = QLatin1String(geometryPropertyC);
+ const QString geometryProperty = "geometry"_L1;
for (auto i = properties.changedProperties.cbegin(), cend = properties.changedProperties.cend();
i != cend; ++i) {
const QString name = i.key();
diff --git a/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.h b/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.h
index 8bea29a4e..fcb769e33 100644
--- a/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.h
+++ b/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QACTIVEXPROPERTYSHEET_H
#define QACTIVEXPROPERTYSHEET_H
@@ -72,8 +47,7 @@ private:
const QString m_propertyGroup;
int m_controlIndex;
struct SavedProperties {
- typedef QMap<QString, QVariant> NamePropertyMap;
- NamePropertyMap changedProperties;
+ QVariantMap changedProperties;
QWidget *widget;
QString clsid;
} m_currentProperties;
@@ -81,7 +55,7 @@ private:
static void reloadPropertySheet(const struct SavedProperties &properties, QDesignerFormWindowInterface *formWin);
};
-typedef QDesignerPropertySheetFactory<QDesignerAxWidget, QAxWidgetPropertySheet> ActiveXPropertySheetFactory;
+using ActiveXPropertySheetFactory = QDesignerPropertySheetFactory<QDesignerAxWidget, QAxWidgetPropertySheet>;
QT_END_NAMESPACE
diff --git a/src/designer/src/plugins/activeqt/qaxwidgettaskmenu.cpp b/src/designer/src/plugins/activeqt/qaxwidgettaskmenu.cpp
index 97594473b..03e2bcc8b 100644
--- a/src/designer/src/plugins/activeqt/qaxwidgettaskmenu.cpp
+++ b/src/designer/src/plugins/activeqt/qaxwidgettaskmenu.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qaxwidgettaskmenu.h"
#include "qdesigneraxwidget.h"
@@ -49,6 +24,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
/* SetControlCommand: An undo commands that sets a control bypassing
Designer's property system which cannot handle the changing
of the 'control' property's index and other cached information
@@ -59,8 +36,8 @@ class SetControlCommand : public QUndoCommand
public:
SetControlCommand(QDesignerAxWidget *ax, QDesignerFormWindowInterface *core, const QString &newClsid = QString());
- virtual void redo() { apply(m_newClsid); }
- virtual void undo() { apply(m_oldClsid); }
+ virtual void redo() override { apply(m_newClsid); }
+ virtual void undo() override { apply(m_oldClsid); }
private:
bool apply(const QString &clsid);
@@ -163,10 +140,8 @@ void QAxWidgetTaskMenu::setActiveXControl()
Q_ASSERT(formWin != nullptr);
QString value = clsid.toString();
- if (!key.isEmpty()) {
- value += QLatin1Char(':');
- value += key;
- }
+ if (!key.isEmpty())
+ value += u':' + key;
formWin->commandHistory()->push(new SetControlCommand(m_axwidget, formWin, value));
}
diff --git a/src/designer/src/plugins/activeqt/qaxwidgettaskmenu.h b/src/designer/src/plugins/activeqt/qaxwidgettaskmenu.h
index ea76dcd5a..144a4a573 100644
--- a/src/designer/src/plugins/activeqt/qaxwidgettaskmenu.h
+++ b/src/designer/src/plugins/activeqt/qaxwidgettaskmenu.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QACTIVEXTASKMENU_H
#define QACTIVEXTASKMENU_H
@@ -56,7 +31,7 @@ private:
QList<QAction*> m_taskActions;
};
-typedef qdesigner_internal::ExtensionFactory<QDesignerTaskMenuExtension, QDesignerAxWidget, QAxWidgetTaskMenu> ActiveXTaskMenuFactory;
+using ActiveXTaskMenuFactory = qdesigner_internal::ExtensionFactory<QDesignerTaskMenuExtension, QDesignerAxWidget, QAxWidgetTaskMenu>;
QT_END_NAMESPACE
diff --git a/src/designer/src/plugins/activeqt/qdesigneraxwidget.cpp b/src/designer/src/plugins/activeqt/qdesigneraxwidget.cpp
index a787c0852..4b6b1ca8b 100644
--- a/src/designer/src/plugins/activeqt/qdesigneraxwidget.cpp
+++ b/src/designer/src/plugins/activeqt/qdesigneraxwidget.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qdesigneraxwidget.h"
diff --git a/src/designer/src/plugins/activeqt/qdesigneraxwidget.h b/src/designer/src/plugins/activeqt/qdesigneraxwidget.h
index 8f74bfaea..ba0a8a53a 100644
--- a/src/designer/src/plugins/activeqt/qdesigneraxwidget.h
+++ b/src/designer/src/plugins/activeqt/qdesigneraxwidget.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QACTIVEXPLUGINOBJECT_H
#define QACTIVEXPLUGINOBJECT_H
@@ -67,8 +42,8 @@ public:
void setControl(const QString &clsid);
QString control() const;
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
bool loaded() { return (m_axobject != 0); }
@@ -80,7 +55,7 @@ public:
void setDrawFlags(unsigned f) { m_drawFlags = f; }
protected:
- void paintEvent(QPaintEvent *event);
+ void paintEvent(QPaintEvent *event) override;
QAxWidget *axobject() const { return m_axobject; }
private:
diff --git a/src/designer/src/plugins/qquickwidget/CMakeLists.txt b/src/designer/src/plugins/qquickwidget/CMakeLists.txt
index 66d68c256..1832a4e49 100644
--- a/src/designer/src/plugins/qquickwidget/CMakeLists.txt
+++ b/src/designer/src/plugins/qquickwidget/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qquickwidget.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## QQuickWidgetPlugin Plugin:
diff --git a/src/designer/src/plugins/qquickwidget/qquickwidget_plugin.cpp b/src/designer/src/plugins/qquickwidget/qquickwidget_plugin.cpp
index cce05023a..cfdf9d0e4 100644
--- a/src/designer/src/plugins/qquickwidget/qquickwidget_plugin.cpp
+++ b/src/designer/src/plugins/qquickwidget/qquickwidget_plugin.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickwidget_plugin.h"
@@ -40,6 +15,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
QQuickWidgetPlugin::QQuickWidgetPlugin(QObject *parent)
: QObject(parent)
{
@@ -47,17 +24,17 @@ QQuickWidgetPlugin::QQuickWidgetPlugin(QObject *parent)
QString QQuickWidgetPlugin::name() const
{
- return QStringLiteral("QQuickWidget");
+ return u"QQuickWidget"_s;
}
QString QQuickWidgetPlugin::group() const
{
- return QStringLiteral("Display Widgets");
+ return u"Display Widgets"_s;
}
QString QQuickWidgetPlugin::toolTip() const
{
- return QStringLiteral("A widget for displaying a Qt Quick 2 user interface.");
+ return u"A widget for displaying a Qt Quick 2 user interface."_s;
}
QString QQuickWidgetPlugin::whatsThis() const
@@ -67,12 +44,12 @@ QString QQuickWidgetPlugin::whatsThis() const
QString QQuickWidgetPlugin::includeFile() const
{
- return QStringLiteral("<QtQuickWidgets/QQuickWidget>");
+ return u"<QtQuickWidgets/QQuickWidget>"_s;
}
QIcon QQuickWidgetPlugin::icon() const
{
- return QIcon(QStringLiteral(":/qt-project.org/qquickwidget/images/qquickwidget.png"));
+ return QIcon(u":/qt-project.org/qquickwidget/images/qquickwidget.png"_s);
}
bool QQuickWidgetPlugin::isContainer() const
@@ -103,12 +80,6 @@ void QQuickWidgetPlugin::initialize(QDesignerFormEditorInterface * /*core*/)
QString QQuickWidgetPlugin::domXml() const
{
- const auto graphicsApi = QQuickWindow::graphicsApi();
- if (graphicsApi != QSGRendererInterface::OpenGLRhi) {
- qWarning("Qt Designer: The QQuickWidget custom widget plugin is disabled because it requires OpenGL RHI (current: %d).",
- int(graphicsApi));
- return {};
- }
return QStringLiteral(R"(
<ui language="c++">
<widget class="QQuickWidget" name="quickWidget">
diff --git a/src/designer/src/plugins/qquickwidget/qquickwidget_plugin.h b/src/designer/src/plugins/qquickwidget/qquickwidget_plugin.h
index 009492547..464deb361 100644
--- a/src/designer/src/plugins/qquickwidget/qquickwidget_plugin.h
+++ b/src/designer/src/plugins/qquickwidget/qquickwidget_plugin.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQUICKWIDGET_PLUGIN_H
#define QQUICKWIDGET_PLUGIN_H
diff --git a/src/designer/src/plugins/qquickwidget/qquickwidget_plugin.qrc b/src/designer/src/plugins/qquickwidget/qquickwidget_plugin.qrc
deleted file mode 100644
index e518aa2d9..000000000
--- a/src/designer/src/plugins/qquickwidget/qquickwidget_plugin.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/qt-project.org/qquickwidget">
- <file>images/qquickwidget.png</file>
- </qresource>
-</RCC>
diff --git a/src/designer/src/plugins/qwebview/CMakeLists.txt b/src/designer/src/plugins/qwebview/CMakeLists.txt
index 0b24f8f20..f6eeb16e1 100644
--- a/src/designer/src/plugins/qwebview/CMakeLists.txt
+++ b/src/designer/src/plugins/qwebview/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qwebview.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## QWebViewPlugin Plugin:
@@ -28,7 +29,3 @@ qt_internal_add_resource(QWebViewPlugin "qwebview_plugin"
FILES
${qwebview_plugin_resource_files}
)
-
-
-#### Keys ignored in scope 1:.:.:qwebview.pro:<TRUE>:
-# OTHER_FILES = "qwebview.json"
diff --git a/src/designer/src/plugins/qwebview/qwebview_plugin.cpp b/src/designer/src/plugins/qwebview/qwebview_plugin.cpp
index 6583ddf8b..123771497 100644
--- a/src/designer/src/plugins/qwebview/qwebview_plugin.cpp
+++ b/src/designer/src/plugins/qwebview/qwebview_plugin.cpp
@@ -1,40 +1,17 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwebview_plugin.h"
#include <QtCore/qplugin.h>
#include <QWebView>
-static const char *toolTipC = "A widget for displaying a web page, from the Qt WebKit Widgets module.";
-
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
+static constexpr auto toolTipC = "A widget for displaying a web page, from the Qt WebKit Widgets module."_L1;
+
QWebViewPlugin::QWebViewPlugin(QObject *parent) :
QObject(parent),
m_initialized(false)
@@ -43,12 +20,12 @@ QWebViewPlugin::QWebViewPlugin(QObject *parent) :
QString QWebViewPlugin::name() const
{
- return QStringLiteral("QWebView");
+ return u"QWebView"_s;
}
QString QWebViewPlugin::group() const
{
- return QStringLiteral("Display Widgets");
+ return u"Display Widgets"_s;
}
QString QWebViewPlugin::toolTip() const
@@ -63,12 +40,12 @@ QString QWebViewPlugin::whatsThis() const
QString QWebViewPlugin::includeFile() const
{
- return QStringLiteral("<QtWebKitWidgets/QWebView>");
+ return u"<QtWebKitWidgets/QWebView>"_s;
}
QIcon QWebViewPlugin::icon() const
{
- return QIcon(QStringLiteral(":/qt-project.org/qwebview/images/qwebview.png"));
+ return QIcon(u":/qt-project.org/qwebview/images/qwebview.png"_s);
}
bool QWebViewPlugin::isContainer() const
diff --git a/src/designer/src/plugins/qwebview/qwebview_plugin.h b/src/designer/src/plugins/qwebview/qwebview_plugin.h
index 53d6c9af7..80e983fe9 100644
--- a/src/designer/src/plugins/qwebview/qwebview_plugin.h
+++ b/src/designer/src/plugins/qwebview/qwebview_plugin.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWEBPAGE_PLUGIN_H
#define QWEBPAGE_PLUGIN_H
diff --git a/src/designer/src/plugins/qwebview/qwebview_plugin.qrc b/src/designer/src/plugins/qwebview/qwebview_plugin.qrc
deleted file mode 100644
index 828cab03c..000000000
--- a/src/designer/src/plugins/qwebview/qwebview_plugin.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/qt-project.org/qwebview">
- <file>images/qwebview.png</file>
- </qresource>
-</RCC>
diff --git a/src/designer/src/plugins/tools/view3d/CMakeLists.txt b/src/designer/src/plugins/tools/view3d/CMakeLists.txt
index f02221649..aa6140519 100644
--- a/src/designer/src/plugins/tools/view3d/CMakeLists.txt
+++ b/src/designer/src/plugins/tools/view3d/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from view3d.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## QView3DPlugin Plugin:
diff --git a/src/designer/src/plugins/tools/view3d/view3d.cpp b/src/designer/src/plugins/tools/view3d/view3d.cpp
index 3ae8bdf47..e25880e7f 100644
--- a/src/designer/src/plugins/tools/view3d/view3d.cpp
+++ b/src/designer/src/plugins/tools/view3d/view3d.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "abstractformeditor.h"
#include "abstractmetadatabase.h"
@@ -152,7 +127,7 @@ void QView3DWidget::addTexture(QWidget *w, const QPixmap &pm)
void QView3DWidget::addWidget(int depth, QWidget *widget)
{
- TextureMap::const_iterator it = m_texture_map.find(widget);
+ const auto it = m_texture_map.find(widget);
Q_ASSERT(it != m_texture_map.end());
makeCurrent();
@@ -188,7 +163,7 @@ void QView3DWidget::clear()
{
makeCurrent();
glDeleteLists(m_form_list_id, 1);
- for (TextureMap::iterator it = m_texture_map.begin(), end = m_texture_map.end(); it != end; ++it)
+ for (auto it = m_texture_map.begin(), end = m_texture_map.end(); it != end; ++it)
glDeleteTextures(1, &(it.value()));
m_texture_map.clear();
m_widget_name_map.clear();
@@ -399,9 +374,8 @@ static void grabWidget_helper(QWidget *widget, QPixmap &res, QPixmap &buf,
pt.drawPixmap(offset.x(), offset.y(), buf, 0, 0, r.width(), r.height());
}
- const QObjectList children = widget->children();
- for (int i = 0; i < children.size(); ++i) {
- QWidget *child = qobject_cast<QWidget*>(children.at(i));
+ for (auto *o : widget->children()) {
+ QWidget *child = qobject_cast<QWidget*>(o);
if (child == 0 || child->isWindow())
continue;
if (child->isHidden() || !child->geometry().intersects(r))
diff --git a/src/designer/src/plugins/tools/view3d/view3d.h b/src/designer/src/plugins/tools/view3d/view3d.h
index e46a7dedf..8dd0318df 100644
--- a/src/designer/src/plugins/tools/view3d/view3d.h
+++ b/src/designer/src/plugins/tools/view3d/view3d.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef VIEW3D_H
#define VIEW3D_H
diff --git a/src/designer/src/plugins/tools/view3d/view3d_global.h b/src/designer/src/plugins/tools/view3d/view3d_global.h
index 2f4c892d0..3d516744a 100644
--- a/src/designer/src/plugins/tools/view3d/view3d_global.h
+++ b/src/designer/src/plugins/tools/view3d/view3d_global.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef VIEW3D_GLOBAL_H
#define VIEW3D_GLOBAL_H
@@ -43,6 +18,6 @@ QT_BEGIN_NAMESPACE
#define VIEW3D_EXPORT
#endif
-#endif // VIEW3D_GLOBAL_H
-
QT_END_NAMESPACE
+
+#endif // VIEW3D_GLOBAL_H
diff --git a/src/designer/src/plugins/tools/view3d/view3d_plugin.cpp b/src/designer/src/plugins/tools/view3d/view3d_plugin.cpp
index 3bf356e56..c530c88c7 100644
--- a/src/designer/src/plugins/tools/view3d/view3d_plugin.cpp
+++ b/src/designer/src/plugins/tools/view3d/view3d_plugin.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "view3d_plugin.h"
#include "view3d_tool.h"
diff --git a/src/designer/src/plugins/tools/view3d/view3d_plugin.h b/src/designer/src/plugins/tools/view3d/view3d_plugin.h
index 9678609a1..cec8ea7fc 100644
--- a/src/designer/src/plugins/tools/view3d/view3d_plugin.h
+++ b/src/designer/src/plugins/tools/view3d/view3d_plugin.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef Q3VIEW3D_PLUGIN_H
#define Q3VIEW3D_PLUGIN_H
@@ -68,6 +43,6 @@ private:
QAction *m_action;
};
-#endif // QVIEW3D_PLUGIN_H
-
QT_END_NAMESPACE
+
+#endif // QVIEW3D_PLUGIN_H
diff --git a/src/designer/src/plugins/tools/view3d/view3d_tool.cpp b/src/designer/src/plugins/tools/view3d/view3d_tool.cpp
index fe52d6aed..56c5d773d 100644
--- a/src/designer/src/plugins/tools/view3d/view3d_tool.cpp
+++ b/src/designer/src/plugins/tools/view3d/view3d_tool.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "view3d_tool.h"
diff --git a/src/designer/src/plugins/tools/view3d/view3d_tool.h b/src/designer/src/plugins/tools/view3d/view3d_tool.h
index c91719822..6c408dd81 100644
--- a/src/designer/src/plugins/tools/view3d/view3d_tool.h
+++ b/src/designer/src/plugins/tools/view3d/view3d_tool.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef VIEW3D_TOOL_H
#define VIEW3D_TOOL_H
@@ -60,6 +35,6 @@ private:
QAction *m_action;
};
-#endif // VIEW3D_TOOL_H
-
QT_END_NAMESPACE
+
+#endif // VIEW3D_TOOL_H
diff --git a/src/designer/src/uiplugin/CMakeLists.txt b/src/designer/src/uiplugin/CMakeLists.txt
deleted file mode 100644
index 4fedf8e33..000000000
--- a/src/designer/src/uiplugin/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Generated from uiplugin.pro.
-
-#####################################################################
-## UiPlugin Module:
-#####################################################################
-
-qt_internal_add_module(UiPlugin
- NO_PRIVATE_MODULE
- HEADER_MODULE
- QMAKE_MODULE_CONFIG designer_defines
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-# special case begin
-set(is_plugin "$<TARGET_PROPERTY:QT_PLUGIN_CLASS_NAME>")
-target_compile_definitions(
- UiPlugin
- INTERFACE
- $<$<BOOL:${is_plugin}>:QDESIGNER_EXPORT_WIDGETS>
-)
-# special case end
-
-#### Keys ignored in scope 1:.:.:uiplugin.pro:<TRUE>:
-# MODULE_CONFIG = "designer_defines"
diff --git a/src/designer/src/uiplugin/customwidget.h b/src/designer/src/uiplugin/customwidget.h
deleted file mode 100644
index efb392009..000000000
--- a/src/designer/src/uiplugin/customwidget.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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 CUSTOMWIDGET_H
-#define CUSTOMWIDGET_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qstring.h>
-#include <QtGui/qicon.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWidget;
-class QDesignerFormEditorInterface;
-
-class QDesignerCustomWidgetInterface
-{
-public:
- virtual ~QDesignerCustomWidgetInterface() {}
-
- virtual QString name() const = 0;
- virtual QString group() const = 0;
- virtual QString toolTip() const = 0;
- virtual QString whatsThis() const = 0;
- virtual QString includeFile() const = 0;
- virtual QIcon icon() const = 0;
-
- virtual bool isContainer() const = 0;
-
- virtual QWidget *createWidget(QWidget *parent) = 0;
-
- virtual bool isInitialized() const { return false; }
- virtual void initialize(QDesignerFormEditorInterface *core) { Q_UNUSED(core); }
-
- virtual QString domXml() const
- {
- return QString::fromUtf8("<widget class=\"%1\" name=\"%2\"/>")
- .arg(name()).arg(name().toLower());
- }
-
- virtual QString codeTemplate() const { return QString(); }
-};
-
-#define QDesignerCustomWidgetInterface_iid "org.qt-project.QDesignerCustomWidgetInterface"
-
-Q_DECLARE_INTERFACE(QDesignerCustomWidgetInterface, QDesignerCustomWidgetInterface_iid)
-
-class QDesignerCustomWidgetCollectionInterface
-{
-public:
- virtual ~QDesignerCustomWidgetCollectionInterface() {}
-
- virtual QList<QDesignerCustomWidgetInterface*> customWidgets() const = 0;
-};
-
-#define QDesignerCustomWidgetCollectionInterface_iid "org.qt-project.Qt.QDesignerCustomWidgetCollectionInterface"
-
-Q_DECLARE_INTERFACE(QDesignerCustomWidgetCollectionInterface, QDesignerCustomWidgetCollectionInterface_iid)
-
-QT_END_NAMESPACE
-
-#endif // CUSTOMWIDGET_H
diff --git a/src/designer/src/uiplugin/customwidget.qdoc b/src/designer/src/uiplugin/customwidget.qdoc
deleted file mode 100644
index a63e0db7c..000000000
--- a/src/designer/src/uiplugin/customwidget.qdoc
+++ /dev/null
@@ -1,293 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \class QDesignerCustomWidgetInterface
-
- \brief The QDesignerCustomWidgetInterface class enables Qt Designer
- to access and construct custom widgets.
-
- \inmodule QtDesigner
-
- QDesignerCustomWidgetInterface provides a custom widget with an
- interface. The class contains a set of functions that must be subclassed
- to return basic information about the widget, such as its class name and
- the name of its header file. Other functions must be implemented to
- initialize the plugin when it is loaded, and to construct instances of
- the custom widget for \QD to use.
-
- When implementing a custom widget you must subclass
- QDesignerCustomWidgetInterface to expose your widget to \QD. For
- example, this is the declaration for the plugin used in the
- \l{Custom Widget Plugin Example}{Custom Widget Plugin example} that
- enables an analog clock custom widget to be used by \QD:
-
- \snippet customwidgetplugin/customwidgetplugin.h 0
-
- Note that the only part of the class definition that is specific
- to this particular custom widget is the class name. In addition,
- since we are implementing an interface, we must ensure that it's
- made known to the meta object system using the Q_INTERFACES()
- macro. This enables \QD to use the qobject_cast() function to
- query for supported interfaces using nothing but a QObject
- pointer.
-
- After \QD loads a custom widget plugin, it calls the interface's
- initialize() function to enable it to set up any resources that it
- may need. This function is called with a QDesignerFormEditorInterface
- parameter that provides the plugin with a gateway to all of \QD's API.
-
- \QD constructs instances of the custom widget by calling the plugin's
- createWidget() function with a suitable parent widget. Plugins must
- construct and return an instance of a custom widget with the specified
- parent widget.
-
- Exporting your custom widget plugin to \QD using the Q_PLUGIN_METADATA()
- macro. For example, if a library called \c libcustomwidgetplugin.so
- (on Unix) or \c libcustomwidget.dll (on Windows) contains a widget
- class called \c MyCustomWidget, we can export it by adding the
- following line to the file containing the plugin header:
-
- \snippet plugins/doc_src_qtdesigner.cpp 14
-
- This macro ensures that \QD can access and construct the custom widget.
- Without this macro, there is no way for \QD to use it.
-
- When implementing a custom widget plugin, you build it as a
- separate library. If you want to include several custom widget
- plugins in the same library, you must in addition subclass
- QDesignerCustomWidgetCollectionInterface.
-
- \warning If your custom widget plugin contains QVariant
- properties, be aware that only the following \l
- {QVariant::Type}{types} are supported:
-
- \list
- \li QVariant::ByteArray
- \li QVariant::Bool
- \li QVariant::Color
- \li QVariant::Cursor
- \li QVariant::Date
- \li QVariant::DateTime
- \li QVariant::Double
- \li QVariant::Int
- \li QVariant::Point
- \li QVariant::Rect
- \li QVariant::Size
- \li QVariant::SizePolicy
- \li QVariant::String
- \li QVariant::Time
- \li QVariant::UInt
- \endlist
-
- For a complete example using the QDesignerCustomWidgetInterface
- class, see the \l {customwidgetplugin}{Custom Widget
- Example}. The example shows how to create a custom widget plugin
- for \QD.
-
- \sa QDesignerCustomWidgetCollectionInterface, {Creating Custom Widgets for Qt Designer}
-*/
-
-/*!
- \fn QDesignerCustomWidgetInterface::~QDesignerCustomWidgetInterface()
-
- Destroys the custom widget interface.
-*/
-
-/*!
- \fn QString QDesignerCustomWidgetInterface::name() const
-
- Returns the class name of the custom widget supplied by the interface.
-
- The name returned \e must be identical to the class name used for the
- custom widget.
-*/
-
-/*!
- \fn QString QDesignerCustomWidgetInterface::group() const
-
- Returns the name of the group to which the custom widget belongs.
-*/
-
-/*!
- \fn QString QDesignerCustomWidgetInterface::toolTip() const
-
- Returns a short description of the widget that can be used by \QD
- in a tool tip.
-*/
-
-/*!
- \fn QString QDesignerCustomWidgetInterface::whatsThis() const
-
- Returns a description of the widget that can be used by \QD in
- "What's This?" help for the widget.
-*/
-
-/*!
- \fn QString QDesignerCustomWidgetInterface::includeFile() const
-
- Returns the path to the include file that \l uic uses when
- creating code for the custom widget.
-*/
-
-/*!
- \fn QIcon QDesignerCustomWidgetInterface::icon() const
-
- Returns the icon used to represent the custom widget in \QD's
- widget box.
-*/
-
-/*!
- \fn bool QDesignerCustomWidgetInterface::isContainer() const
-
- Returns true if the custom widget is intended to be used as a
- container; otherwise returns false.
-
- Most custom widgets are not used to hold other widgets, so their
- implementations of this function will return false, but custom
- containers will return true to ensure that they behave correctly
- in \QD.
-*/
-
-/*!
- \fn QWidget *QDesignerCustomWidgetInterface::createWidget(QWidget *parent)
-
- Returns a new instance of the custom widget, with the given \a
- parent.
-*/
-
-/*!
- \fn bool QDesignerCustomWidgetInterface::isInitialized() const
-
- Returns true if the widget has been initialized; otherwise returns
- false.
-
- \sa initialize()
-*/
-
-/*!
- \fn void QDesignerCustomWidgetInterface::initialize(QDesignerFormEditorInterface *formEditor)
-
- Initializes the widget for use with the specified \a formEditor
- interface.
-
- \sa isInitialized()
-*/
-
-/*!
- \fn QString QDesignerCustomWidgetInterface::domXml() const
-
- Returns the XML that is used to describe the custom widget's
- properties to \QD.
-*/
-
-/*!
- \fn QString QDesignerCustomWidgetInterface::codeTemplate() const
-
- This function is reserved for future use by \QD.
-
- \omit
- Returns the code template that \QD includes in forms that contain
- the custom widget when they are saved.
- \endomit
-*/
-
-/*!
- \macro QDESIGNER_WIDGET_EXPORT
- \relates QDesignerCustomWidgetInterface
- \since 4.1
-
- This macro is used when defining custom widgets to ensure that they are
- correctly exported from plugins for use with \QD.
-
- On some platforms, the symbols required by \QD to create new widgets
- are removed from plugins by the build system, making them unusable.
- Using this macro ensures that the symbols are retained on those platforms,
- and has no side effects on other platforms.
-
- For example, the \l{worldtimeclockplugin}{World Time Clock Plugin}
- example exports a custom widget class with the following declaration:
-
- \snippet worldtimeclockplugin/worldtimeclock.h 0
- \dots
- \snippet worldtimeclockplugin/worldtimeclock.h 2
-
- \sa {Creating Custom Widgets for Qt Designer}
-*/
-
-
-
-
-
-/*!
- \class QDesignerCustomWidgetCollectionInterface
-
- \brief The QDesignerCustomWidgetCollectionInterface class allows
- you to include several custom widgets in one single library.
-
- \inmodule QtDesigner
-
- When implementing a custom widget plugin, you build it as a
- separate library. If you want to include several custom widget
- plugins in the same library, you must in addition subclass
- QDesignerCustomWidgetCollectionInterface.
-
- QDesignerCustomWidgetCollectionInterface contains one single
- function returning a list of the collection's
- QDesignerCustomWidgetInterface objects. For example, if you have
- several custom widgets \c CustomWidgetOne, \c CustomWidgetTwo and
- \c CustomWidgetThree, the class definition may look like this:
-
- \snippet plugins/doc_src_qtdesigner.cpp 12
-
- In the class constructor you add the interfaces to your custom
- widgets to the list which you return in the customWidgets()
- function:
-
- \snippet plugins/doc_src_qtdesigner.cpp 13
-
- Note that instead of exporting each custom widget plugin using the
- Q_PLUGIN_METADATA() macro, you export the entire collection. The
- Q_PLUGIN_METADATA() macro ensures that \QD can access and construct
- the custom widgets. Without this macro, there is no way for \QD to
- use them.
-
- \sa QDesignerCustomWidgetInterface, {Creating Custom Widgets for
- Qt Designer}
-*/
-
-/*!
- \fn QDesignerCustomWidgetCollectionInterface::~QDesignerCustomWidgetCollectionInterface() {
-
- Destroys the custom widget collection interface.
-*/
-
-/*!
- \fn QList<QDesignerCustomWidgetInterface*> QDesignerCustomWidgetCollectionInterface::customWidgets() const
-
- Returns a list of interfaces to the collection's custom widgets.
-*/
diff --git a/src/designer/src/uiplugin/qdesignerexportwidget.h b/src/designer/src/uiplugin/qdesignerexportwidget.h
deleted file mode 100644
index ea62450ff..000000000
--- a/src/designer/src/uiplugin/qdesignerexportwidget.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer 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 QDESIGNEREXPORTWIDGET_H
-#define QDESIGNEREXPORTWIDGET_H
-
-#include <QtCore/qglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-#if 0
-// pragma for syncqt, don't remove.
-#pragma qt_class(QDesignerExportWidget)
-#endif
-
-#if defined(QDESIGNER_EXPORT_WIDGETS)
-# define QDESIGNER_WIDGET_EXPORT Q_DECL_EXPORT
-#else
-# define QDESIGNER_WIDGET_EXPORT Q_DECL_IMPORT
-#endif
-
-QT_END_NAMESPACE
-
-#endif //QDESIGNEREXPORTWIDGET_H
diff --git a/src/designer/src/uitools/CMakeLists.txt b/src/designer/src/uitools/CMakeLists.txt
deleted file mode 100644
index 5306fcbd5..000000000
--- a/src/designer/src/uitools/CMakeLists.txt
+++ /dev/null
@@ -1,47 +0,0 @@
-# Generated from uitools.pro.
-
-#####################################################################
-## UiTools Module:
-#####################################################################
-
-qt_internal_add_module(UiTools
- SOURCES
- ../lib/uilib/abstractformbuilder.cpp ../lib/uilib/abstractformbuilder.h
- ../lib/uilib/formbuilder.cpp ../lib/uilib/formbuilder.h
- ../lib/uilib/formbuilderextra.cpp ../lib/uilib/formbuilderextra_p.h
- ../lib/uilib/properties.cpp ../lib/uilib/properties_p.h
- ../lib/uilib/resourcebuilder.cpp ../lib/uilib/resourcebuilder_p.h
- ../lib/uilib/textbuilder.cpp ../lib/uilib/textbuilder_p.h
- ../lib/uilib/ui4.cpp ../lib/uilib/ui4_p.h
- quiloader.cpp quiloader.h
- DEFINES
- QFORMINTERNAL_NAMESPACE
- QT_DESIGNER
- QT_DESIGNER_STATIC
- QT_USE_QSTRINGBUILDER
- INCLUDE_DIRECTORIES
- ../lib/uilib
- LIBRARIES
- Qt::UiPlugin
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-## Scopes:
-#####################################################################
-
-qt_internal_extend_target(UiTools CONDITION TARGET Qt::OpenGLWidgets
- PUBLIC_LIBRARIES
- Qt::OpenGLWidgets
-)
-
-qt_internal_extend_target(UiTools CONDITION QT_FEATURE_opengl
- LIBRARIES
- Qt::OpenGL
-)
-qt_internal_add_docs(UiTools
- doc/qtuitools.qdocconf
-)
-
diff --git a/src/designer/src/uitools/doc/images/textfinder-example-find.png b/src/designer/src/uitools/doc/images/textfinder-example-find.png
deleted file mode 100644
index 886bbc110..000000000
--- a/src/designer/src/uitools/doc/images/textfinder-example-find.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/uitools/doc/images/textfinder-example-find2.png b/src/designer/src/uitools/doc/images/textfinder-example-find2.png
deleted file mode 100644
index 908f11409..000000000
--- a/src/designer/src/uitools/doc/images/textfinder-example-find2.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/uitools/doc/images/textfinder-example.png b/src/designer/src/uitools/doc/images/textfinder-example.png
deleted file mode 100644
index 87322df98..000000000
--- a/src/designer/src/uitools/doc/images/textfinder-example.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/uitools/doc/images/uitools-examples.png b/src/designer/src/uitools/doc/images/uitools-examples.png
deleted file mode 100644
index 8c85cdb76..000000000
--- a/src/designer/src/uitools/doc/images/uitools-examples.png
+++ /dev/null
Binary files differ
diff --git a/src/designer/src/uitools/doc/qtuitools.qdocconf b/src/designer/src/uitools/doc/qtuitools.qdocconf
deleted file mode 100644
index 136573ba1..000000000
--- a/src/designer/src/uitools/doc/qtuitools.qdocconf
+++ /dev/null
@@ -1,42 +0,0 @@
-include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
-include($QT_INSTALL_DOCS/config/exampleurl-qttools.qdocconf)
-
-project = QtUiTools
-description = Qt UI Tools Reference Documentation
-version = $QT_VERSION
-
-examplesinstallpath = uitools
-
-qhp.projects = QtUiTools
-
-qhp.QtUiTools.file = qtuitools.qhp
-qhp.QtUiTools.namespace = org.qt-project.qtuitools.$QT_VERSION_TAG
-qhp.QtUiTools.virtualFolder = qtuitools
-qhp.QtUiTools.indexTitle = Qt UI Tools
-qhp.QtHelp.indexRoot =
-
-qhp.QtUiTools.subprojects = classes
-qhp.QtUiTools.subprojects.classes.title = C++ Classes
-qhp.QtUiTools.subprojects.classes.indexTitle = Qt UI Tools C++ Classes
-qhp.QtUiTools.subprojects.classes.selectors = class fake:headerfile
-qhp.QtUiTools.subprojects.classes.sortPages = true
-
-language = Cpp
-
-headerdirs += ..
-
-sourcedirs = ..
-
-exampledirs = ../../../../../examples/uitools \
- snippets
-
-imagedirs = images
-
-outputdir = $QT_INSTALL_DOCS/qtuitools
-
-depends += qtdoc qtdesigner qtcore qtwidgets
-
-navigation.landingpage = "Qt UI Tools"
-navigation.cppclassespage = "Qt UI Tools C++ Classes"
-
-warninglimit = 0
diff --git a/src/designer/src/uitools/doc/snippets/quiloader/doc_src_qtuiloader.cpp b/src/designer/src/uitools/doc/snippets/quiloader/doc_src_qtuiloader.cpp
deleted file mode 100644
index 74d4ef622..000000000
--- a/src/designer/src/uitools/doc/snippets/quiloader/doc_src_qtuiloader.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [1]
-#include <QtUiTools>
-//! [1]
diff --git a/src/designer/src/uitools/doc/snippets/quiloader/doc_src_qtuiloader.pro b/src/designer/src/uitools/doc/snippets/quiloader/doc_src_qtuiloader.pro
deleted file mode 100644
index f0ee13a10..000000000
--- a/src/designer/src/uitools/doc/snippets/quiloader/doc_src_qtuiloader.pro
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#! [0]
-QT += uitools
-#! [0]
diff --git a/src/designer/src/uitools/doc/snippets/quiloader/main.cpp b/src/designer/src/uitools/doc/snippets/quiloader/main.cpp
deleted file mode 100644
index 73b66a891..000000000
--- a/src/designer/src/uitools/doc/snippets/quiloader/main.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-#include <QtUiTools>
-
-#include "mywidget.h"
-
-//! [0]
-QWidget *loadCustomWidget(QWidget *parent)
-{
- QUiLoader loader;
- QWidget *myWidget;
-
- QStringList availableWidgets = loader.availableWidgets();
-
- if (availableWidgets.contains("AnalogClock"))
- myWidget = loader.createWidget("AnalogClock", parent);
-
- return myWidget;
-}
-//! [0]
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MyWidget widget;
- widget.show();
-
- QWidget *customWidget = loadCustomWidget(0);
- customWidget->show();
- return app.exec();
-}
diff --git a/src/designer/src/uitools/doc/snippets/quiloader/myform.ui b/src/designer/src/uitools/doc/snippets/quiloader/myform.ui
deleted file mode 100644
index 00702e860..000000000
--- a/src/designer/src/uitools/doc/snippets/quiloader/myform.ui
+++ /dev/null
@@ -1,130 +0,0 @@
-<ui version="4.0" >
- <author></author>
- <comment></comment>
- <exportmacro></exportmacro>
- <class>Form</class>
- <widget class="QWidget" name="Form" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>258</width>
- <height>224</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>Export Document</string>
- </property>
- <layout class="QVBoxLayout" >
- <property name="margin" >
- <number>8</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item>
- <widget class="QGroupBox" name="groupBox" >
- <property name="title" >
- <string>Export Options</string>
- </property>
- <layout class="QGridLayout" >
- <property name="margin" >
- <number>8</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item row="1" column="0" >
- <widget class="QRadioButton" name="radioButton_2" >
- <property name="text" >
- <string>&amp;DocBook</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0" >
- <widget class="QRadioButton" name="radioButton" >
- <property name="text" >
- <string>&amp;LaTeX</string>
- </property>
- <property name="checked" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="1" >
- <widget class="QCheckBox" name="checkBox_2" >
- <property name="text" >
- <string>Include p&amp;ictures</string>
- </property>
- <property name="checked" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="5" column="0" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="0" column="1" >
- <widget class="QCheckBox" name="checkBox" >
- <property name="text" >
- <string>&amp;Compress</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0" >
- <widget class="QRadioButton" name="radioButton_2_2" >
- <property name="text" >
- <string>&amp;HTML</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0" >
- <widget class="QRadioButton" name="radioButton_3" >
- <property name="text" >
- <string>&amp;PostScript</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0" >
- <widget class="QRadioButton" name="radioButton_4" >
- <property name="text" >
- <string>PD&amp;F</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1" >
- <widget class="QCheckBox" name="checkBox_3" >
- <property name="text" >
- <string>Include &amp;metadata</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1" >
- <widget class="QCheckBox" name="checkBox_4" >
- <property name="text" >
- <string>Create inde&amp;x</string>
- </property>
- <property name="checked" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <pixmapfunction></pixmapfunction>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/designer/src/uitools/doc/snippets/quiloader/mywidget.cpp b/src/designer/src/uitools/doc/snippets/quiloader/mywidget.cpp
deleted file mode 100644
index f03fabd77..000000000
--- a/src/designer/src/uitools/doc/snippets/quiloader/mywidget.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-#include <QtUiTools>
-
-#include "mywidget.h"
-
-//! [0]
-MyWidget::MyWidget(QWidget *parent)
- : QWidget(parent)
-{
- QUiLoader loader;
- QFile file(":/forms/myform.ui");
- file.open(QFile::ReadOnly);
- QWidget *myWidget = loader.load(&file, this);
- file.close();
-
- QVBoxLayout *layout = new QVBoxLayout;
- layout->addWidget(myWidget);
- setLayout(layout);
-}
-//! [0]
diff --git a/src/designer/src/uitools/doc/snippets/quiloader/mywidget.h b/src/designer/src/uitools/doc/snippets/quiloader/mywidget.h
deleted file mode 100644
index 4bcfe5dea..000000000
--- a/src/designer/src/uitools/doc/snippets/quiloader/mywidget.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MYWIDGET_H
-#define MYWIDGET_H
-
-#include <QWidget>
-
-class MyWidget : public QWidget
-{
-public:
- MyWidget(QWidget *parent = 0);
-};
-
-#endif
diff --git a/src/designer/src/uitools/doc/snippets/quiloader/mywidget.qrc b/src/designer/src/uitools/doc/snippets/quiloader/mywidget.qrc
deleted file mode 100644
index 47684d68b..000000000
--- a/src/designer/src/uitools/doc/snippets/quiloader/mywidget.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource prefix="/forms">
-<file>myform.ui</file>
-</qresource>
-</RCC>
diff --git a/src/designer/src/uitools/doc/snippets/quiloader/quiloader.pro b/src/designer/src/uitools/doc/snippets/quiloader/quiloader.pro
deleted file mode 100644
index 31ddf3256..000000000
--- a/src/designer/src/uitools/doc/snippets/quiloader/quiloader.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-HEADERS = mywidget.h
-SOURCES = main.cpp mywidget.cpp
-RESOURCES = mywidget.qrc
-QT += uitools
diff --git a/src/designer/src/uitools/doc/src/qtuitools-examples.qdoc b/src/designer/src/uitools/doc/src/qtuitools-examples.qdoc
deleted file mode 100644
index f1e1dae53..000000000
--- a/src/designer/src/uitools/doc/src/qtuitools-examples.qdoc
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \group examples-qtuitools
- \ingroup all-examples
- \title Qt UI Tools Examples
- \brief Using Qt UI Tools to process UI forms.
-
- \image uitools-examples.png UiTools
-
- The \l{Qt UI Tools} module provides classes to handle UI forms created with
- Qt Designer. The forms are processed at run-time to dynamically generate
- user interfaces.
-
- The following examples illustrate how to use Qt UI Tools to process UI
- forms.
-*/
-
-/*
- \list
- \li \l{Multiple Inheritance Example}\raisedaster
- \li \l{Text Finder Example}\raisedaster
- \endlist
-
- Examples marked with an asterisk (*) are fully documented.
-*/
diff --git a/src/designer/src/uitools/doc/src/qtuitools-index.qdoc b/src/designer/src/uitools/doc/src/qtuitools-index.qdoc
deleted file mode 100644
index a63de0e50..000000000
--- a/src/designer/src/uitools/doc/src/qtuitools-index.qdoc
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \page qtuitools-index.html
- \title Qt UI Tools
-
- \brief Provides classes to handle forms created with Qt Designer.
-
- \section1 Getting Started
-
- Qt Designer forms are processed at run-time to produce dynamically-generated
- user interfaces. In order to generate a form at run-time, a resource
- file containing a UI file is needed. Applications that use the
- form handling classes need to be configured to be built against the
- Qt UI Tools module. This is done by including the following declaration
- in a \c qmake project file to ensure that the application is compiled
- and linked appropriately.
-
- \snippet quiloader/doc_src_qtuiloader.pro 0
-
- A form loader object, provided by the QUiLoader class, is used to construct
- the user interface. This user interface can be retrieved from any QIODevice.
- For example, a QFile object can be used to obtain a form stored in a
- project's resources. The QUiLoader::load() function takes the user interface
- description contained in the file and constructs the form widget.
-
- To include the definitions of the module's classes, use the following
- directive:
-
- \snippet quiloader/doc_src_qtuiloader.cpp 1
-
- \section1 Licenses and Attributions
-
- Qt UI Tools is available under commercial licenses from \l{The Qt Company}.
- In addition, it is available under free software licenses. Since Qt 6.0,
- these free software licenses are
- \l{GNU Lesser General Public License, version 3}, or
- the \l{GNU General Public License, version 2}.
- See \l{Qt Licensing} for further details.
-
- \section1 API Reference
- These are links to the API reference materials.
- \list
- \li \l{Qt UI Tools C++ Classes}{C++ Classes}
- \endlist
-
- \section1 Examples
- \list
- \li \l{Qt UI Tools Examples}
- \endlist
-*/
diff --git a/src/designer/src/uitools/doc/src/qtuitools-module.qdoc b/src/designer/src/uitools/doc/src/qtuitools-module.qdoc
deleted file mode 100644
index b65bd918e..000000000
--- a/src/designer/src/uitools/doc/src/qtuitools-module.qdoc
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \module QtUiTools
- \title Qt UI Tools C++ Classes
- \since 4.1
- \ingroup modules
- \qtcmakepackage UiTools
- \qtvariable uitools
-
- \brief Provides classes to handle forms created with Qt Designer.
-
- These forms are processed at run-time to produce dynamically-generated
- user interfaces. In order to generate a form at run-time, a resource
- file containing a UI file is needed. Applications that use the
- form handling classes need to be configured to be built against the
- QtUiTools module. This is done by including the following declaration
- in a \c qmake project file to ensure that the application is compiled
- and linked appropriately.
-
- \if !defined(qtforpython)
- \snippet quiloader/doc_src_qtuiloader.pro 0
- \endif
-
- A form loader object, provided by the QUiLoader class, is used to
- construct the user interface. This user interface can
- be retrieved from any QIODevice; for example, a QFile object can be
- used to obtain a form stored in a project's resources. The
- QUiLoader::load() function takes the user interface description
- contained in the file and constructs the form widget.
-
- To include the definitions of the module's classes, use the following
- directive:
-
- \snippet quiloader/doc_src_qtuiloader.cpp 1
-
-*/
diff --git a/src/designer/src/uitools/qtuitoolsglobal.h b/src/designer/src/uitools/qtuitoolsglobal.h
deleted file mode 100644
index 40827b3ab..000000000
--- a/src/designer/src/uitools/qtuitoolsglobal.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt UI Tools library of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTUITOOLSGLOBAL_H
-#define QTUITOOLSGLOBAL_H
-
-#include <QtCore/qglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_STATIC
-# if defined(QT_BUILD_UITOOLS_LIB)
-# define Q_UITOOLS_EXPORT Q_DECL_EXPORT
-# else
-# define Q_UITOOLS_EXPORT Q_DECL_IMPORT
-# endif
-#else
-# define Q_UITOOLS_EXPORT
-#endif
-
-QT_END_NAMESPACE
-
-#endif // QTUITOOLSGLOBAL_H
-
diff --git a/src/designer/src/uitools/quiloader.cpp b/src/designer/src/uitools/quiloader.cpp
deleted file mode 100644
index e0ba98a1e..000000000
--- a/src/designer/src/uitools/quiloader.cpp
+++ /dev/null
@@ -1,949 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt UI Tools library of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include "quiloader.h"
-#include "quiloader_p.h"
-
-#include <QtUiPlugin/customwidget.h>
-
-#include <formbuilder.h>
-#include <formbuilderextra_p.h>
-#include <textbuilder_p.h>
-#include <ui4_p.h>
-
-#include <QtWidgets/qapplication.h>
-#include <QtWidgets/qlayout.h>
-#include <QtWidgets/qwidget.h>
-#include <QtWidgets/qtabwidget.h>
-#include <QtWidgets/qtreewidget.h>
-#include <QtWidgets/qlistwidget.h>
-#include <QtWidgets/qtablewidget.h>
-#include <QtWidgets/qtoolbox.h>
-#include <QtWidgets/qcombobox.h>
-#include <QtWidgets/qfontcombobox.h>
-
-#include <QtGui/qaction.h>
-#include <QtGui/qactiongroup.h>
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qdatastream.h>
-#include <QtCore/qmap.h>
-#include <QtCore/qdir.h>
-#include <QtCore/qlibraryinfo.h>
-
-QT_BEGIN_NAMESPACE
-
-typedef QMap<QString, bool> widget_map;
-Q_GLOBAL_STATIC(widget_map, g_widgets)
-
-class QUiLoader;
-class QUiLoaderPrivate;
-
-#ifndef QT_NO_DATASTREAM
-// QUiTranslatableStringValue must be streamable since they become part of the QVariant-based
-// mime data when dragging items in views with QAbstractItemView::InternalMove.
-QDataStream &operator<<(QDataStream &out, const QUiTranslatableStringValue &s)
-{
- out << s.qualifier() << s.value();
- return out;
-}
-
-QDataStream &operator>>(QDataStream &in, QUiTranslatableStringValue &s)
-{
- QByteArray qualifier, value;
- in >> qualifier >> value;
- s.setQualifier(qualifier);
- s.setValue(value);
- return in;
-}
-#endif // QT_NO_DATASTREAM
-
-QString QUiTranslatableStringValue::translate(const QByteArray &className, bool idBased) const
-{
- return idBased
- ? qtTrId(m_qualifier.constData())
- : QCoreApplication::translate(className.constData(), m_value.constData(), m_qualifier.constData());
-}
-
-#ifdef QFORMINTERNAL_NAMESPACE
-namespace QFormInternal
-{
-#endif
-
-class TranslatingTextBuilder : public QTextBuilder
-{
-public:
- explicit TranslatingTextBuilder(bool idBased, bool trEnabled, const QByteArray &className) :
- m_idBased(idBased), m_trEnabled(trEnabled), m_className(className) {}
-
- QVariant loadText(const DomProperty *icon) const override;
-
- QVariant toNativeValue(const QVariant &value) const override;
-
- bool idBased() const { return m_idBased; }
-
-private:
- bool m_idBased;
- bool m_trEnabled;
- QByteArray m_className;
-};
-
-QVariant TranslatingTextBuilder::loadText(const DomProperty *text) const
-{
- const DomString *str = text->elementString();
- if (!str)
- return QVariant();
- if (str->hasAttributeNotr()) {
- const QString notr = str->attributeNotr();
- if (notr == QStringLiteral("true") || notr == QStringLiteral("yes"))
- return QVariant::fromValue(str->text());
- }
- QUiTranslatableStringValue strVal;
- strVal.setValue(str->text().toUtf8());
- if (m_idBased)
- strVal.setQualifier(str->attributeId().toUtf8());
- else if (str->hasAttributeComment())
- strVal.setQualifier(str->attributeComment().toUtf8());
- return QVariant::fromValue(strVal);
-}
-
-QVariant TranslatingTextBuilder::toNativeValue(const QVariant &value) const
-{
- if (value.canConvert<QUiTranslatableStringValue>()) {
- QUiTranslatableStringValue tsv = qvariant_cast<QUiTranslatableStringValue>(value);
- if (!m_trEnabled)
- return QString::fromUtf8(tsv.value().constData());
- return QVariant::fromValue(tsv.translate(m_className, m_idBased));
- }
- if (value.canConvert<QString>())
- return QVariant::fromValue(qvariant_cast<QString>(value));
- return value;
-}
-
-// This is "exported" to linguist
-const QUiItemRolePair qUiItemRoles[] = {
- { Qt::DisplayRole, Qt::DisplayPropertyRole },
-#if QT_CONFIG(tooltip)
- { Qt::ToolTipRole, Qt::ToolTipPropertyRole },
-#endif
-#if QT_CONFIG(statustip)
- { Qt::StatusTipRole, Qt::StatusTipPropertyRole },
-#endif
-#if QT_CONFIG(whatsthis)
- { Qt::WhatsThisRole, Qt::WhatsThisPropertyRole },
-#endif
- { -1 , -1 }
-};
-
-static void recursiveReTranslate(QTreeWidgetItem *item, const QByteArray &class_name, bool idBased)
-{
- const QUiItemRolePair *irs = qUiItemRoles;
-
- int cnt = item->columnCount();
- for (int i = 0; i < cnt; ++i) {
- for (unsigned j = 0; irs[j].shadowRole >= 0; j++) {
- QVariant v = item->data(i, irs[j].shadowRole);
- if (v.isValid()) {
- QUiTranslatableStringValue tsv = qvariant_cast<QUiTranslatableStringValue>(v);
- item->setData(i, irs[j].realRole, tsv.translate(class_name, idBased));
- }
- }
- }
-
- cnt = item->childCount();
- for (int i = 0; i < cnt; ++i)
- recursiveReTranslate(item->child(i), class_name, idBased);
-}
-
-template<typename T>
-static void reTranslateWidgetItem(T *item, const QByteArray &class_name, bool idBased)
-{
- const QUiItemRolePair *irs = qUiItemRoles;
-
- for (unsigned j = 0; irs[j].shadowRole >= 0; j++) {
- QVariant v = item->data(irs[j].shadowRole);
- if (v.isValid()) {
- QUiTranslatableStringValue tsv = qvariant_cast<QUiTranslatableStringValue>(v);
- item->setData(irs[j].realRole, tsv.translate(class_name, idBased));
- }
- }
-}
-
-static void reTranslateTableItem(QTableWidgetItem *item, const QByteArray &class_name, bool idBased)
-{
- if (item)
- reTranslateWidgetItem(item, class_name, idBased);
-}
-
-#define RETRANSLATE_SUBWIDGET_PROP(mainWidget, setter, propName) \
- do { \
- QVariant v = mainWidget->widget(i)->property(propName); \
- if (v.isValid()) { \
- QUiTranslatableStringValue tsv = qvariant_cast<QUiTranslatableStringValue>(v); \
- mainWidget->setter(i, tsv.translate(m_className, m_idBased)); \
- } \
- } while (0)
-
-class TranslationWatcher: public QObject
-{
- Q_OBJECT
-
-public:
- explicit TranslationWatcher(QObject *parent, const QByteArray &className, bool idBased):
- QObject(parent),
- m_className(className),
- m_idBased(idBased)
- {
- }
-
- bool eventFilter(QObject *o, QEvent *event) override
- {
- if (event->type() == QEvent::LanguageChange) {
- const auto &dynamicPropertyNames = o->dynamicPropertyNames();
- for (const QByteArray &prop : dynamicPropertyNames) {
- if (prop.startsWith(PROP_GENERIC_PREFIX)) {
- const QByteArray propName = prop.mid(sizeof(PROP_GENERIC_PREFIX) - 1);
- const QUiTranslatableStringValue tsv =
- qvariant_cast<QUiTranslatableStringValue>(o->property(prop));
- o->setProperty(propName, tsv.translate(m_className, m_idBased));
- }
- }
- if (0) {
-#if QT_CONFIG(tabwidget)
- } else if (QTabWidget *tabw = qobject_cast<QTabWidget*>(o)) {
- const int cnt = tabw->count();
- for (int i = 0; i < cnt; ++i) {
- RETRANSLATE_SUBWIDGET_PROP(tabw, setTabText, PROP_TABPAGETEXT);
-#if QT_CONFIG(tooltip)
- RETRANSLATE_SUBWIDGET_PROP(tabw, setTabToolTip, PROP_TABPAGETOOLTIP);
-# endif
-#if QT_CONFIG(whatsthis)
- RETRANSLATE_SUBWIDGET_PROP(tabw, setTabWhatsThis, PROP_TABPAGEWHATSTHIS);
-# endif
- }
-#endif
-#if QT_CONFIG(listwidget)
- } else if (QListWidget *listw = qobject_cast<QListWidget*>(o)) {
- const int cnt = listw->count();
- for (int i = 0; i < cnt; ++i)
- reTranslateWidgetItem(listw->item(i), m_className, m_idBased);
-#endif
-#if QT_CONFIG(treewidget)
- } else if (QTreeWidget *treew = qobject_cast<QTreeWidget*>(o)) {
- if (QTreeWidgetItem *item = treew->headerItem())
- recursiveReTranslate(item, m_className, m_idBased);
- const int cnt = treew->topLevelItemCount();
- for (int i = 0; i < cnt; ++i) {
- QTreeWidgetItem *item = treew->topLevelItem(i);
- recursiveReTranslate(item, m_className, m_idBased);
- }
-#endif
-#if QT_CONFIG(tablewidget)
- } else if (QTableWidget *tablew = qobject_cast<QTableWidget*>(o)) {
- const int row_cnt = tablew->rowCount();
- const int col_cnt = tablew->columnCount();
- for (int j = 0; j < col_cnt; ++j)
- reTranslateTableItem(tablew->horizontalHeaderItem(j), m_className, m_idBased);
- for (int i = 0; i < row_cnt; ++i) {
- reTranslateTableItem(tablew->verticalHeaderItem(i), m_className, m_idBased);
- for (int j = 0; j < col_cnt; ++j)
- reTranslateTableItem(tablew->item(i, j), m_className, m_idBased);
- }
-#endif
-#if QT_CONFIG(combobox)
- } else if (QComboBox *combow = qobject_cast<QComboBox*>(o)) {
- if (!qobject_cast<QFontComboBox*>(o)) {
- const int cnt = combow->count();
- for (int i = 0; i < cnt; ++i) {
- const QVariant v = combow->itemData(i, Qt::DisplayPropertyRole);
- if (v.isValid()) {
- QUiTranslatableStringValue tsv = qvariant_cast<QUiTranslatableStringValue>(v);
- combow->setItemText(i, tsv.translate(m_className, m_idBased));
- }
- }
- }
-#endif
-#if QT_CONFIG(toolbox)
- } else if (QToolBox *toolw = qobject_cast<QToolBox*>(o)) {
- const int cnt = toolw->count();
- for (int i = 0; i < cnt; ++i) {
- RETRANSLATE_SUBWIDGET_PROP(toolw, setItemText, PROP_TOOLITEMTEXT);
-#if QT_CONFIG(tooltip)
- RETRANSLATE_SUBWIDGET_PROP(toolw, setItemToolTip, PROP_TOOLITEMTOOLTIP);
-# endif
- }
-#endif
- }
- }
- return false;
- }
-
-private:
- QByteArray m_className;
- bool m_idBased;
-};
-
-class FormBuilderPrivate: public QFormBuilder
-{
- friend class QT_PREPEND_NAMESPACE(QUiLoader);
- friend class QT_PREPEND_NAMESPACE(QUiLoaderPrivate);
- using ParentClass = QFormBuilder;
-
-public:
- QUiLoader *loader = nullptr;
-
- bool dynamicTr = false;
- bool trEnabled = true;
-
- FormBuilderPrivate() = default;
-
- QWidget *defaultCreateWidget(const QString &className, QWidget *parent, const QString &name)
- {
- return ParentClass::createWidget(className, parent, name);
- }
-
- QLayout *defaultCreateLayout(const QString &className, QObject *parent, const QString &name)
- {
- return ParentClass::createLayout(className, parent, name);
- }
-
- QAction *defaultCreateAction(QObject *parent, const QString &name)
- {
- return ParentClass::createAction(parent, name);
- }
-
- QActionGroup *defaultCreateActionGroup(QObject *parent, const QString &name)
- {
- return ParentClass::createActionGroup(parent, name);
- }
-
- QWidget *createWidget(const QString &className, QWidget *parent, const QString &name) override
- {
- if (QWidget *widget = loader->createWidget(className, parent, name)) {
- widget->setObjectName(name);
- return widget;
- }
-
- return nullptr;
- }
-
- QLayout *createLayout(const QString &className, QObject *parent, const QString &name) override
- {
- if (QLayout *layout = loader->createLayout(className, parent, name)) {
- layout->setObjectName(name);
- return layout;
- }
-
- return nullptr;
- }
-
- QActionGroup *createActionGroup(QObject *parent, const QString &name) override
- {
- if (QActionGroup *actionGroup = loader->createActionGroup(parent, name)) {
- actionGroup->setObjectName(name);
- return actionGroup;
- }
-
- return nullptr;
- }
-
- QAction *createAction(QObject *parent, const QString &name) override
- {
- if (QAction *action = loader->createAction(parent, name)) {
- action->setObjectName(name);
- return action;
- }
-
- return nullptr;
- }
-
- void applyProperties(QObject *o, const QList<DomProperty*> &properties) override;
- QWidget *create(DomUI *ui, QWidget *parentWidget) override;
- QWidget *create(DomWidget *ui_widget, QWidget *parentWidget) override;
- bool addItem(DomWidget *ui_widget, QWidget *widget, QWidget *parentWidget) override;
-
-private:
- QByteArray m_class;
- TranslationWatcher *m_trwatch = nullptr;
- bool m_idBased = false;
-};
-
-static QString convertTranslatable(const DomProperty *p, const QByteArray &className,
- bool idBased, QUiTranslatableStringValue *strVal)
-{
- if (p->kind() != DomProperty::String)
- return QString();
- const DomString *dom_str = p->elementString();
- if (!dom_str)
- return QString();
- if (dom_str->hasAttributeNotr()) {
- const QString notr = dom_str->attributeNotr();
- if (notr == QStringLiteral("yes") || notr == QStringLiteral("true"))
- return QString();
- }
- strVal->setValue(dom_str->text().toUtf8());
- strVal->setQualifier(idBased ? dom_str->attributeId().toUtf8() : dom_str->attributeComment().toUtf8());
- if (strVal->value().isEmpty() && strVal->qualifier().isEmpty())
- return QString();
- return strVal->translate(className, idBased);
-}
-
-void FormBuilderPrivate::applyProperties(QObject *o, const QList<DomProperty*> &properties)
-{
- QFormBuilder::applyProperties(o, properties);
-
- if (!m_trwatch)
- m_trwatch = new TranslationWatcher(o, m_class, m_idBased);
-
- if (properties.isEmpty())
- return;
-
- // Unlike string item roles, string properties are not loaded via the textBuilder
- // (as they are "shadowed" by the property sheets in designer). So do the initial
- // translation here.
- bool anyTrs = false;
- for (const DomProperty *p : properties) {
- QUiTranslatableStringValue strVal;
- const QString text = convertTranslatable(p, m_class, m_idBased, &strVal);
- if (text.isEmpty())
- continue;
- const QByteArray name = p->attributeName().toUtf8();
- if (dynamicTr) {
- const QByteArray dynname = QByteArray(PROP_GENERIC_PREFIX + name);
- o->setProperty(dynname, QVariant::fromValue(strVal));
- anyTrs = trEnabled;
- }
- o->setProperty(name, text);
- }
- if (anyTrs)
- o->installEventFilter(m_trwatch);
-}
-
-QWidget *FormBuilderPrivate::create(DomUI *ui, QWidget *parentWidget)
-{
- m_class = ui->elementClass().toUtf8();
- m_trwatch = nullptr;
- m_idBased = ui->attributeIdbasedtr();
- setTextBuilder(new TranslatingTextBuilder(m_idBased, trEnabled, m_class));
- return QFormBuilder::create(ui, parentWidget);
-}
-
-QWidget *FormBuilderPrivate::create(DomWidget *ui_widget, QWidget *parentWidget)
-{
- QWidget *w = QFormBuilder::create(ui_widget, parentWidget);
- if (w == nullptr)
- return nullptr;
-
- if (0) {
-#if QT_CONFIG(tabwidget)
- } else if (qobject_cast<QTabWidget*>(w)) {
-#endif
-#if QT_CONFIG(listwidget)
- } else if (qobject_cast<QListWidget*>(w)) {
-#endif
-#if QT_CONFIG(treewidget)
- } else if (qobject_cast<QTreeWidget*>(w)) {
-#endif
-#if QT_CONFIG(tablewidget)
- } else if (qobject_cast<QTableWidget*>(w)) {
-#endif
-#if QT_CONFIG(combobox)
- } else if (qobject_cast<QComboBox*>(w)) {
- if (qobject_cast<QFontComboBox*>(w))
- return w;
-#endif
-#if QT_CONFIG(toolbox)
- } else if (qobject_cast<QToolBox*>(w)) {
-#endif
- } else {
- return w;
- }
- if (dynamicTr && trEnabled)
- w->installEventFilter(m_trwatch);
- return w;
-}
-
-#define TRANSLATE_SUBWIDGET_PROP(mainWidget, attribute, setter, propName) \
- do { \
- if (const DomProperty *p##attribute = attributes.value(strings.attribute)) { \
- QUiTranslatableStringValue strVal; \
- const QString text = convertTranslatable(p##attribute, m_class, m_idBased, &strVal); \
- if (!text.isEmpty()) { \
- if (dynamicTr) \
- mainWidget->widget(i)->setProperty(propName, QVariant::fromValue(strVal)); \
- mainWidget->setter(i, text); \
- } \
- } \
- } while (0)
-
-bool FormBuilderPrivate::addItem(DomWidget *ui_widget, QWidget *widget, QWidget *parentWidget)
-{
- if (parentWidget == nullptr)
- return true;
-
- if (!ParentClass::addItem(ui_widget, widget, parentWidget))
- return false;
-
- // Check special cases. First: Custom container
- const QString className = QLatin1String(parentWidget->metaObject()->className());
- if (!d->customWidgetAddPageMethod(className).isEmpty())
- return true;
-
- const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
-
- if (0) {
-#if QT_CONFIG(tabwidget)
- } else if (QTabWidget *tabWidget = qobject_cast<QTabWidget*>(parentWidget)) {
- const DomPropertyHash attributes = propertyMap(ui_widget->elementAttribute());
- const int i = tabWidget->count() - 1;
- TRANSLATE_SUBWIDGET_PROP(tabWidget, titleAttribute, setTabText, PROP_TABPAGETEXT);
-#if QT_CONFIG(tooltip)
- TRANSLATE_SUBWIDGET_PROP(tabWidget, toolTipAttribute, setTabToolTip, PROP_TABPAGETOOLTIP);
-# endif
-#if QT_CONFIG(whatsthis)
- TRANSLATE_SUBWIDGET_PROP(tabWidget, whatsThisAttribute, setTabWhatsThis, PROP_TABPAGEWHATSTHIS);
-# endif
-#endif
-#if QT_CONFIG(toolbox)
- } else if (QToolBox *toolBox = qobject_cast<QToolBox*>(parentWidget)) {
- const DomPropertyHash attributes = propertyMap(ui_widget->elementAttribute());
- const int i = toolBox->count() - 1;
- TRANSLATE_SUBWIDGET_PROP(toolBox, labelAttribute, setItemText, PROP_TOOLITEMTEXT);
-#if QT_CONFIG(tooltip)
- TRANSLATE_SUBWIDGET_PROP(toolBox, toolTipAttribute, setItemToolTip, PROP_TOOLITEMTOOLTIP);
-# endif
-#endif
- }
-
- return true;
-}
-
-#ifdef QFORMINTERNAL_NAMESPACE
-}
-#endif
-
-class QUiLoaderPrivate
-{
-public:
-#ifdef QFORMINTERNAL_NAMESPACE
- QFormInternal::FormBuilderPrivate builder;
-#else
- FormBuilderPrivate builder;
-#endif
-
- void setupWidgetMap() const;
-};
-
-void QUiLoaderPrivate::setupWidgetMap() const
-{
- if (!g_widgets()->isEmpty())
- return;
-
-#define DECLARE_WIDGET(a, b) g_widgets()->insert(QLatin1String(#a), true);
-#define DECLARE_LAYOUT(a, b)
-
-#include "widgets.table"
-
-#undef DECLARE_WIDGET
-#undef DECLARE_WIDGET_1
-#undef DECLARE_LAYOUT
-}
-
-/*!
- \class QUiLoader
- \inmodule QtUiTools
-
- \brief The QUiLoader class enables standalone applications to
- dynamically create user interfaces at run-time using the
- information stored in UI files or specified in plugin paths.
-
- In addition, you can customize or create your own user interface by
- deriving your own loader class.
-
- If you have a custom component or an application that embeds \QD, you can
- also use the QFormBuilder class provided by the QtDesigner module to create
- user interfaces from UI files.
-
- The QUiLoader class provides a collection of functions allowing you to
- create widgets based on the information stored in UI files (created
- with \QD) or available in the specified plugin paths. The specified plugin
- paths can be retrieved using the pluginPaths() function. Similarly, the
- contents of a UI file can be retrieved using the load() function. For
- example:
-
- \snippet quiloader/mywidget.cpp 0
-
- \if !defined(qtforpython)
- By including the user interface in the form's resources (\c myform.qrc), we
- ensure that it will be present at run-time:
-
- \quotefile quiloader/mywidget.qrc
- \endif
-
- The availableWidgets() function returns a QStringList with the class names
- of the widgets available in the specified plugin paths. To create these
- widgets, simply use the createWidget() function. For example:
-
- \snippet quiloader/main.cpp 0
-
- To make a custom widget available to the loader, you can use the
- addPluginPath() function; to remove all available widgets, you can call
- the clearPluginPaths() function.
-
- The createAction(), createActionGroup(), createLayout(), and createWidget()
- functions are used internally by the QUiLoader class whenever it has to
- create an action, action group, layout, or widget respectively. For that
- reason, you can subclass the QUiLoader class and reimplement these
- functions to intervene the process of constructing a user interface. For
- example, you might want to have a list of the actions created when loading
- a form or creating a custom widget.
-
- For a complete example using the QUiLoader class, see the
- \l{Calculator Builder Example}.
-
- \sa {Qt UI Tools}, QFormBuilder
-*/
-
-/*!
- Creates a form loader with the given \a parent.
-*/
-QUiLoader::QUiLoader(QObject *parent)
- : QObject(parent), d_ptr(new QUiLoaderPrivate)
-{
- Q_D(QUiLoader);
-
-#ifndef QT_NO_DATASTREAM
- static int metaTypeId = 0;
- if (!metaTypeId) {
- metaTypeId = qRegisterMetaType<QUiTranslatableStringValue>("QUiTranslatableStringValue");
- }
-#endif // QT_NO_DATASTREAM
- d->builder.loader = this;
-
-#if QT_CONFIG(library)
- QStringList paths;
- const QStringList &libraryPaths = QApplication::libraryPaths();
- for (const QString &path : libraryPaths) {
- QString libPath = path;
- libPath += QDir::separator();
- libPath += QStringLiteral("designer");
- paths.append(libPath);
- }
-
- d->builder.setPluginPath(paths);
-#endif // QT_CONFIG(library)
-}
-
-/*!
- Destroys the loader.
-*/
-QUiLoader::~QUiLoader() = default;
-
-/*!
- Loads a form from the given \a device and creates a new widget with the
- given \a parentWidget to hold its contents.
-
- \sa createWidget(), errorString()
-*/
-QWidget *QUiLoader::load(QIODevice *device, QWidget *parentWidget)
-{
- Q_D(QUiLoader);
- // QXmlStreamReader will report errors on open failure.
- if (!device->isOpen())
- device->open(QIODevice::ReadOnly|QIODevice::Text);
- return d->builder.load(device, parentWidget);
-}
-
-/*!
- Returns a list naming the paths in which the loader will search when
- locating custom widget plugins.
-
- \sa addPluginPath(), clearPluginPaths()
-*/
-QStringList QUiLoader::pluginPaths() const
-{
- Q_D(const QUiLoader);
- return d->builder.pluginPaths();
-}
-
-/*!
- Clears the list of paths in which the loader will search when locating
- plugins.
-
- \sa addPluginPath(), pluginPaths()
-*/
-void QUiLoader::clearPluginPaths()
-{
- Q_D(QUiLoader);
- d->builder.clearPluginPaths();
-}
-
-/*!
- Adds the given \a path to the list of paths in which the loader will search
- when locating plugins.
-
- \sa pluginPaths(), clearPluginPaths()
-*/
-void QUiLoader::addPluginPath(const QString &path)
-{
- Q_D(QUiLoader);
- d->builder.addPluginPath(path);
-}
-
-/*!
- Creates a new widget with the given \a parent and \a name using the class
- specified by \a className. You can use this function to create any of the
- widgets returned by the availableWidgets() function.
-
- The function is also used internally by the QUiLoader class whenever it
- creates a widget. Hence, you can subclass QUiLoader and reimplement this
- function to intervene process of constructing a user interface or widget.
- However, in your implementation, ensure that you call QUiLoader's version
- first.
-
- \sa availableWidgets(), load()
-*/
-QWidget *QUiLoader::createWidget(const QString &className, QWidget *parent, const QString &name)
-{
- Q_D(QUiLoader);
- return d->builder.defaultCreateWidget(className, parent, name);
-}
-
-/*!
- Creates a new layout with the given \a parent and \a name using the class
- specified by \a className.
-
- The function is also used internally by the QUiLoader class whenever it
- creates a widget. Hence, you can subclass QUiLoader and reimplement this
- function to intervene process of constructing a user interface or widget.
- However, in your implementation, ensure that you call QUiLoader's version
- first.
-
- \sa createWidget(), load()
-*/
-QLayout *QUiLoader::createLayout(const QString &className, QObject *parent, const QString &name)
-{
- Q_D(QUiLoader);
- return d->builder.defaultCreateLayout(className, parent, name);
-}
-
-/*!
- Creates a new action group with the given \a parent and \a name.
-
- The function is also used internally by the QUiLoader class whenever it
- creates a widget. Hence, you can subclass QUiLoader and reimplement this
- function to intervene process of constructing a user interface or widget.
- However, in your implementation, ensure that you call QUiLoader's version
- first.
-
- \sa createAction(), createWidget(), load()
- */
-QActionGroup *QUiLoader::createActionGroup(QObject *parent, const QString &name)
-{
- Q_D(QUiLoader);
- return d->builder.defaultCreateActionGroup(parent, name);
-}
-
-/*!
- Creates a new action with the given \a parent and \a name.
-
- The function is also used internally by the QUiLoader class whenever it
- creates a widget. Hence, you can subclass QUiLoader and reimplement this
- function to intervene process of constructing a user interface or widget.
- However, in your implementation, ensure that you call QUiLoader's version
- first.
-
- \sa createActionGroup(), createWidget(), load()
-*/
-QAction *QUiLoader::createAction(QObject *parent, const QString &name)
-{
- Q_D(QUiLoader);
- return d->builder.defaultCreateAction(parent, name);
-}
-
-/*!
- Returns a list naming all available widgets that can be built using the
- createWidget() function, i.e all the widgets specified within the given
- plugin paths.
-
- \sa pluginPaths(), createWidget()
-
-*/
-QStringList QUiLoader::availableWidgets() const
-{
- Q_D(const QUiLoader);
-
- d->setupWidgetMap();
- widget_map available = *g_widgets();
-
- const auto &customWidgets = d->builder.customWidgets();
- for (QDesignerCustomWidgetInterface *plugin : customWidgets)
- available.insert(plugin->name(), true);
-
- return available.keys();
-}
-
-
-/*!
- \since 4.5
- Returns a list naming all available layouts that can be built using the
- createLayout() function
-
- \sa createLayout()
-*/
-
-QStringList QUiLoader::availableLayouts() const
-{
- QStringList rc;
-#define DECLARE_WIDGET(a, b)
-#define DECLARE_LAYOUT(a, b) rc.push_back(QLatin1String(#a));
-
-#include "widgets.table"
-
-#undef DECLARE_WIDGET
-#undef DECLARE_LAYOUT
- return rc;
-}
-
-/*!
- Sets the working directory of the loader to \a dir. The loader will look
- for other resources, such as icons and resource files, in paths relative to
- this directory.
-
- \sa workingDirectory()
-*/
-
-void QUiLoader::setWorkingDirectory(const QDir &dir)
-{
- Q_D(QUiLoader);
- d->builder.setWorkingDirectory(dir);
-}
-
-/*!
- Returns the working directory of the loader.
-
- \sa setWorkingDirectory()
-*/
-
-QDir QUiLoader::workingDirectory() const
-{
- Q_D(const QUiLoader);
- return d->builder.workingDirectory();
-}
-/*!
- \since 4.5
-
- If \a enabled is true, user interfaces loaded by this loader will
- automatically retranslate themselves upon receiving a language change
- event. Otherwise, the user interfaces will not be retranslated.
-
- \sa isLanguageChangeEnabled()
-*/
-
-void QUiLoader::setLanguageChangeEnabled(bool enabled)
-{
- Q_D(QUiLoader);
- d->builder.dynamicTr = enabled;
-}
-
-/*!
- \since 4.5
-
- Returns true if dynamic retranslation on language change is enabled;
- returns false otherwise.
-
- \sa setLanguageChangeEnabled()
-*/
-
-bool QUiLoader::isLanguageChangeEnabled() const
-{
- Q_D(const QUiLoader);
- return d->builder.dynamicTr;
-}
-
-/*!
- \internal
- \since 4.5
-
- If \a enabled is true, user interfaces loaded by this loader will be
- translated. Otherwise, the user interfaces will not be translated.
-
- \note This is orthogonal to languageChangeEnabled.
-
- \sa isLanguageChangeEnabled(), setLanguageChangeEnabled()
-*/
-
-void QUiLoader::setTranslationEnabled(bool enabled)
-{
- Q_D(QUiLoader);
- d->builder.trEnabled = enabled;
-}
-
-/*!
- \internal
- \since 4.5
-
- Returns true if translation is enabled; returns false otherwise.
-
- \sa setTranslationEnabled()
-*/
-
-bool QUiLoader::isTranslationEnabled() const
-{
- Q_D(const QUiLoader);
- return d->builder.trEnabled;
-}
-
-/*!
- Returns a human-readable description of the last error occurred in load().
-
- \since 5.0
- \sa load()
-*/
-
-QString QUiLoader::errorString() const
-{
- Q_D(const QUiLoader);
- return d->builder.errorString();
-}
-
-QT_END_NAMESPACE
-
-#include "quiloader.moc"
diff --git a/src/designer/src/uitools/quiloader.h b/src/designer/src/uitools/quiloader.h
deleted file mode 100644
index 7d632ab0b..000000000
--- a/src/designer/src/uitools/quiloader.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt UI Tools library of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QUILOADER_H
-#define QUILOADER_H
-
-#include <QtUiTools/qtuitoolsglobal.h>
-#include <QtCore/qobject.h>
-#include <QtCore/qscopedpointer.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWidget;
-class QLayout;
-class QAction;
-class QActionGroup;
-class QString;
-class QIODevice;
-class QDir;
-
-class QUiLoaderPrivate;
-class Q_UITOOLS_EXPORT QUiLoader : public QObject
-{
- Q_OBJECT
-public:
- explicit QUiLoader(QObject *parent = nullptr);
- ~QUiLoader() override;
-
- QStringList pluginPaths() const;
- void clearPluginPaths();
- void addPluginPath(const QString &path);
-
- QWidget *load(QIODevice *device, QWidget *parentWidget = nullptr);
- QStringList availableWidgets() const;
- QStringList availableLayouts() const;
-
- virtual QWidget *createWidget(const QString &className, QWidget *parent = nullptr, const QString &name = QString());
- virtual QLayout *createLayout(const QString &className, QObject *parent = nullptr, const QString &name = QString());
- virtual QActionGroup *createActionGroup(QObject *parent = nullptr, const QString &name = QString());
- virtual QAction *createAction(QObject *parent = nullptr, const QString &name = QString());
-
- void setWorkingDirectory(const QDir &dir);
- QDir workingDirectory() const;
-
- void setLanguageChangeEnabled(bool enabled);
- bool isLanguageChangeEnabled() const;
-
- void setTranslationEnabled(bool enabled);
- bool isTranslationEnabled() const;
-
- QString errorString() const;
-
-private:
- QScopedPointer<QUiLoaderPrivate> d_ptr;
- Q_DECLARE_PRIVATE(QUiLoader)
- Q_DISABLE_COPY_MOVE(QUiLoader)
-};
-
-QT_END_NAMESPACE
-
-#endif // QUILOADER_H
diff --git a/src/designer/src/uitools/quiloader_p.h b/src/designer/src/uitools/quiloader_p.h
deleted file mode 100644
index 0febc88c2..000000000
--- a/src/designer/src/uitools/quiloader_p.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt UI Tools library of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QUILOADER_P_H
-#define QUILOADER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtUiTools/qtuitoolsglobal.h>
-#include <QtCore/qbytearray.h>
-#include <QtCore/qmetatype.h>
-
-QT_FORWARD_DECLARE_CLASS(QDataStream)
-
-// This file is here for use by the form preview in Linguist. If you change anything
-// here or in the code which uses it, remember to adapt Linguist accordingly.
-
-#define PROP_GENERIC_PREFIX "_q_notr_"
-#define PROP_TOOLITEMTEXT "_q_toolItemText_notr"
-#define PROP_TOOLITEMTOOLTIP "_q_toolItemToolTip_notr"
-#define PROP_TABPAGETEXT "_q_tabPageText_notr"
-#define PROP_TABPAGETOOLTIP "_q_tabPageToolTip_notr"
-#define PROP_TABPAGEWHATSTHIS "_q_tabPageWhatsThis_notr"
-
-QT_BEGIN_NAMESPACE
-
-class Q_UITOOLS_EXPORT QUiTranslatableStringValue
-{
-public:
- QByteArray value() const { return m_value; }
- void setValue(const QByteArray &value) { m_value = value; }
- QByteArray qualifier() const { return m_qualifier; }
- void setQualifier(const QByteArray &qualifier) { m_qualifier = qualifier; }
-
- QString translate(const QByteArray &className, bool idBased) const;
-
-private:
- QByteArray m_value;
- QByteArray m_qualifier; // Comment or ID for id-based tr().
-};
-
-#ifndef QT_NO_DATASTREAM
-Q_UITOOLS_EXPORT QDataStream &operator<<(QDataStream &out, const QUiTranslatableStringValue &s);
-Q_UITOOLS_EXPORT QDataStream &operator>>(QDataStream &in, QUiTranslatableStringValue &s);
-#endif // QT_NO_DATASTREAM
-
-struct QUiItemRolePair {
- int realRole;
- int shadowRole;
-};
-
-#ifdef QFORMINTERNAL_NAMESPACE
-namespace QFormInternal
-{
-#endif
-
-extern const Q_UITOOLS_EXPORT QUiItemRolePair qUiItemRoles[];
-
-#ifdef QFORMINTERNAL_NAMESPACE
-}
-#endif
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QUiTranslatableStringValue)
-
-
-#endif // QUILOADER_P_H