summaryrefslogtreecommitdiffstats
path: root/src/designer/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/designer/src/components')
-rw-r--r--src/designer/src/components/CMakeLists.txt3
-rw-r--r--src/designer/src/components/buddyeditor/buddyeditor.cpp57
-rw-r--r--src/designer/src/components/buddyeditor/buddyeditor.h29
-rw-r--r--src/designer/src/components/buddyeditor/buddyeditor.pri17
-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/components.pro2
-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.cpp33
-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.pri67
-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.cpp395
-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.cpp160
-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.cpp59
-rw-r--r--src/designer/src/components/formeditor/previewactiongroup.h29
-rw-r--r--src/designer/src/components/formeditor/qdesigner_resource.cpp327
-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.cpp66
-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.txt1066
-rw-r--r--src/designer/src/components/lib/lib.pro42
-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.pri16
-rw-r--r--src/designer/src/components/objectinspector/objectinspector_global.h33
-rw-r--r--src/designer/src/components/objectinspector/objectinspectormodel.cpp80
-rw-r--r--src/designer/src/components/objectinspector/objectinspectormodel_p.h47
-rw-r--r--src/designer/src/components/propertyeditor/brushpropertymanager.cpp78
-rw-r--r--src/designer/src/components/propertyeditor/brushpropertymanager.h45
-rw-r--r--src/designer/src/components/propertyeditor/designerpropertymanager.cpp1069
-rw-r--r--src/designer/src/components/propertyeditor/designerpropertymanager.h165
-rw-r--r--src/designer/src/components/propertyeditor/fontmapping.xml33
-rw-r--r--src/designer/src/components/propertyeditor/fontpropertymanager.cpp228
-rw-r--r--src/designer/src/components/propertyeditor/fontpropertymanager.h52
-rw-r--r--src/designer/src/components/propertyeditor/newdynamicpropertydialog.cpp131
-rw-r--r--src/designer/src/components/propertyeditor/newdynamicpropertydialog.h33
-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.cpp242
-rw-r--r--src/designer/src/components/propertyeditor/propertyeditor.h37
-rw-r--r--src/designer/src/components/propertyeditor/propertyeditor.pri48
-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.pri22
-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.cpp50
-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.pri17
-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.cpp135
-rw-r--r--src/designer/src/components/taskmenu/itemlisteditor.h60
-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.cpp40
-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.cpp124
-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.pri49
-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.cpp132
-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.pri14
-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.cpp106
-rw-r--r--src/designer/src/components/widgetbox/widgetboxcategorylistview.h31
-rw-r--r--src/designer/src/components/widgetbox/widgetboxtreewidget.cpp168
-rw-r--r--src/designer/src/components/widgetbox/widgetboxtreewidget.h35
224 files changed, 3481 insertions, 8136 deletions
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 b31e2830b..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++) {
@@ -212,6 +189,8 @@ void BuddyEditor::setBackground(QWidget *background)
{
clear();
ConnectionEdit::setBackground(background);
+ if (background == nullptr)
+ return;
const auto label_list = background->findChildren<QLabel*>();
for (QLabel *label : label_list) {
@@ -232,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;
}
@@ -276,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)
@@ -286,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);
@@ -294,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);
@@ -318,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);
@@ -358,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.pri b/src/designer/src/components/buddyeditor/buddyeditor.pri
deleted file mode 100644
index b6e9614c1..000000000
--- a/src/designer/src/components/buddyeditor/buddyeditor.pri
+++ /dev/null
@@ -1,17 +0,0 @@
-
-QT += xml
-
-INCLUDEPATH += $$PWD
-
-HEADERS += \
- $$PWD/buddyeditor.h \
- $$PWD/buddyeditor_plugin.h \
- $$PWD/buddyeditor_tool.h \
- $$PWD/buddyeditor_global.h
-
-SOURCES += \
- $$PWD/buddyeditor.cpp \
- $$PWD/buddyeditor_tool.cpp \
- $$PWD/buddyeditor_plugin.cpp
-
-OTHER_FILES += $$PWD/buddyeditor.json
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/components.pro b/src/designer/src/components/components.pro
deleted file mode 100644
index dac34e57f..000000000
--- a/src/designer/src/components/components.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS = lib
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 739d70832..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"
@@ -145,7 +120,7 @@ void DPI_Chooser::setDPI(int dpiX, int dpiY)
int predefinedIndex = -1;
for (int i = 0; i < count; i++) {
const QVariant data = m_predefinedCombo->itemData(i);
- if (data.type() != QVariant::Invalid) {
+ if (data.metaType().id() != QMetaType::UnknownType) {
const struct DPI_Entry *entry = qvariant_cast<const struct DPI_Entry *>(data);
if (entry->dpiX == dpiX && entry->dpiY == dpiY) {
predefinedIndex = i;
@@ -178,7 +153,7 @@ void DPI_Chooser::syncSpinBoxes()
const QVariant data = m_predefinedCombo->itemData(predefIdx);
// Predefined mode in which spin boxes are disabled or user defined?
- const bool userSetting = data.type() == QVariant::Invalid;
+ const bool userSetting = data.metaType().id() == QMetaType::UnknownType;
m_dpiXSpinBox->setEnabled(userSetting);
m_dpiYSpinBox->setEnabled(userSetting);
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.pri b/src/designer/src/components/formeditor/formeditor.pri
deleted file mode 100644
index 7e4afd021..000000000
--- a/src/designer/src/components/formeditor/formeditor.pri
+++ /dev/null
@@ -1,67 +0,0 @@
-
-QT += xml
-
-INCLUDEPATH += $$PWD
-
-FORMS += $$PWD/deviceprofiledialog.ui \
- $$PWD/formwindowsettings.ui \
- $$PWD/templateoptionspage.ui
-
-HEADERS += $$PWD/qdesigner_resource.h \
- $$PWD/formwindow.h \
- $$PWD/formwindow_widgetstack.h \
- $$PWD/formwindow_dnditem.h \
- $$PWD/formwindowcursor.h \
- $$PWD/widgetselection.h \
- $$PWD/formwindowmanager.h \
- $$PWD/formeditor.h \
- $$PWD/formeditor_global.h \
- $$PWD/qlayoutwidget_propertysheet.h \
- $$PWD/layout_propertysheet.h \
- $$PWD/spacer_propertysheet.h \
- $$PWD/line_propertysheet.h \
- $$PWD/default_container.h \
- $$PWD/default_actionprovider.h \
- $$PWD/qmainwindow_container.h \
- $$PWD/qmdiarea_container.h \
- $$PWD/qwizard_container.h \
- $$PWD/default_layoutdecoration.h \
- $$PWD/tool_widgeteditor.h \
- $$PWD/formeditor_optionspage.h \
- $$PWD/embeddedoptionspage.h \
- $$PWD/formwindowsettings.h \
- $$PWD/deviceprofiledialog.h \
- $$PWD/dpi_chooser.h \
- $$PWD/previewactiongroup.h \
- $$PWD/itemview_propertysheet.h \
- $$PWD/templateoptionspage.h
-
-SOURCES += $$PWD/qdesigner_resource.cpp \
- $$PWD/formwindow.cpp \
- $$PWD/formwindow_widgetstack.cpp \
- $$PWD/formwindow_dnditem.cpp \
- $$PWD/formwindowcursor.cpp \
- $$PWD/widgetselection.cpp \
- $$PWD/formwindowmanager.cpp \
- $$PWD/formeditor.cpp \
- $$PWD/qlayoutwidget_propertysheet.cpp \
- $$PWD/layout_propertysheet.cpp \
- $$PWD/spacer_propertysheet.cpp \
- $$PWD/line_propertysheet.cpp \
- $$PWD/qmainwindow_container.cpp \
- $$PWD/qmdiarea_container.cpp \
- $$PWD/qwizard_container.cpp \
- $$PWD/default_container.cpp \
- $$PWD/default_layoutdecoration.cpp \
- $$PWD/default_actionprovider.cpp \
- $$PWD/tool_widgeteditor.cpp \
- $$PWD/formeditor_optionspage.cpp \
- $$PWD/embeddedoptionspage.cpp \
- $$PWD/formwindowsettings.cpp \
- $$PWD/deviceprofiledialog.cpp \
- $$PWD/dpi_chooser.cpp \
- $$PWD/previewactiongroup.cpp \
- $$PWD/itemview_propertysheet.cpp \
- $$PWD/templateoptionspage.cpp
-
-RESOURCES += $$PWD/formeditor.qrc
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 b27b7e18e..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);
@@ -1232,8 +1172,19 @@ void FormWindow::insertWidget(QWidget *w, const QRect &rect, QWidget *container,
m_undoStack.push(geom_cmd);
- InsertWidgetCommand *cmd = new InsertWidgetCommand(this);
- cmd->init(w, already_in_form);
+ QUndoCommand *cmd = nullptr;
+ if (auto dockWidget = qobject_cast<QDockWidget *>(w)) {
+ if (auto mainWindow = qobject_cast<QMainWindow *>(container)) {
+ auto addDockCmd = new AddDockWidgetCommand(this);
+ addDockCmd->init(mainWindow, dockWidget);
+ cmd = addDockCmd;
+ }
+ }
+ if (cmd == nullptr) {
+ auto insertCmd = new InsertWidgetCommand(this);
+ insertCmd->init(w, already_in_form);
+ cmd = insertCmd;
+ }
m_undoStack.push(cmd);
endCommand();
@@ -1276,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);
}
@@ -1299,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))
@@ -1476,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());
@@ -1499,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;
};
@@ -1516,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"));
}
@@ -1591,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;
}
@@ -1743,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;
@@ -1803,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
@@ -1817,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)
@@ -1996,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);
@@ -2031,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);
@@ -2048,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);
@@ -2188,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;
@@ -2267,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);
@@ -2368,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));
@@ -2428,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)
@@ -2444,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)
@@ -2478,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);
@@ -2540,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);
@@ -2700,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))
@@ -2818,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;
@@ -2864,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;
@@ -2879,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 0bb3ecb2f..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,27 +23,27 @@
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 *margin = "margin";
-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 {
LayoutPropertyNone,
- LayoutPropertyMargin, // Deprecated
LayoutPropertyLeftMargin,
LayoutPropertyTopMargin,
LayoutPropertyRightMargin,
@@ -94,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();
}
@@ -102,23 +77,21 @@ static bool isIntegerList(const QString &s)
// Quick lookup by name
static LayoutPropertyType layoutPropertyType(const QString &name)
{
- static QHash<QString, LayoutPropertyType> namePropertyMap;
- if (namePropertyMap.isEmpty()) {
- namePropertyMap.insert(QLatin1String(leftMargin), LayoutPropertyLeftMargin);
- namePropertyMap.insert(QLatin1String(topMargin), LayoutPropertyTopMargin);
- namePropertyMap.insert(QLatin1String(rightMargin), LayoutPropertyRightMargin);
- namePropertyMap.insert(QLatin1String(bottomMargin), LayoutPropertyBottomMargin);
- namePropertyMap.insert(QLatin1String(horizontalSpacing), LayoutPropertyHorizontalSpacing);
- namePropertyMap.insert(QLatin1String(verticalSpacing), LayoutPropertyVerticalSpacing);
- namePropertyMap.insert(QLatin1String(spacing), LayoutPropertySpacing);
- namePropertyMap.insert(QLatin1String(margin), LayoutPropertyMargin);
- namePropertyMap.insert(QLatin1String(sizeConstraint), LayoutPropertySizeConstraint);
- namePropertyMap.insert(QLatin1String(boxStretchPropertyC ), LayoutPropertyBoxStretch);
- namePropertyMap.insert(QLatin1String(gridRowStretchPropertyC), LayoutPropertyGridRowStretch);
- namePropertyMap.insert(QLatin1String(gridColumnStretchPropertyC), LayoutPropertyGridColumnStretch);
- namePropertyMap.insert(QLatin1String(gridRowMinimumHeightPropertyC), LayoutPropertyGridRowMinimumHeight);
- namePropertyMap.insert(QLatin1String(gridColumnMinimumWidthPropertyC), LayoutPropertyGridColumnMinimumWidth);
- }
+ static const QHash<QString, LayoutPropertyType> namePropertyMap = {
+ {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);
}
@@ -179,50 +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);
}
- setAttribute(indexOf(QLatin1String(margin)), 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);
}
@@ -232,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
}
@@ -256,14 +228,6 @@ void LayoutPropertySheet::setProperty(int index, const QVariant &value)
case LayoutPropertyBottomMargin:
lw->setLayoutBottomMargin(value.toInt());
return;
- case LayoutPropertyMargin: {
- const int v = value.toInt();
- lw->setLayoutLeftMargin(v);
- lw->setLayoutTopMargin(v);
- lw->setLayoutRightMargin(v);
- lw->setLayoutBottomMargin(v);
- }
- return;
default:
break;
}
@@ -451,16 +415,10 @@ 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;
- case LayoutPropertyMargin:
- setChanged(indexOf(QLatin1String(leftMargin)), changed);
- setChanged(indexOf(QLatin1String(topMargin)), changed);
- setChanged(indexOf(QLatin1String(rightMargin)), changed);
- setChanged(indexOf(QLatin1String(bottomMargin)), changed);
- break;
default:
break;
}
@@ -479,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());
@@ -517,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 a85fb22c0..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);
}
}
@@ -116,11 +83,11 @@ void PreviewActionGroup::slotTriggered(QAction *a)
{
// Device or style according to data.
const QVariant data = a->data();
- switch (data.type()) {
- case QVariant::String:
+ switch (data.metaType().id()) {
+ case QMetaType::QString:
emit preview(data.toString(), -1);
break;
- case QVariant::Int:
+ case QMetaType::Int:
emit preview(QString(), data.toInt());
break;
default:
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 bcec066ee..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);
- if (vprop.type() != QVariant::Invalid)
- designerFormData.insert((*it)->attributeName(), vprop);
+ for (auto *prop : domPropertyList) {
+ const QVariant vprop = domPropertyToVariant(this, mainWidget->metaObject(), prop);
+ if (vprop.metaType().id() != QMetaType::UnknownType)
+ 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);
@@ -940,6 +926,29 @@ static bool readDomEnumerationValue(const DomProperty *p,
return false;
}
+// ### fixme Qt 7 remove this: Exclude deprecated properties of Qt 5.
+static bool isDeprecatedQt5Property(const QObject *o, const DomProperty *p)
+{
+ const QString &propertyName = p->attributeName();
+ switch (p->kind()) {
+ case DomProperty::Set:
+ if (propertyName == u"features" && o->inherits("QDockWidget")
+ && p->elementSet() == u"QDockWidget::AllDockWidgetFeatures") {
+ return true;
+ }
+ break;
+ case DomProperty::Enum:
+ if (propertyName == u"sizeAdjustPolicy" && o->inherits("QComboBox")
+ && p->elementEnum() == u"QComboBox::AdjustToMinimumContentsLength") {
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+ return false;
+}
+
void QDesignerResource::applyProperties(QObject *o, const QList<DomProperty*> &properties)
{
if (properties.isEmpty())
@@ -952,11 +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))
@@ -992,25 +1002,25 @@ void QDesignerResource::applyProperties(QObject *o, const QList<DomProperty*> &p
sheet->setProperty(index, v);
sheet->setChanged(index, true);
} else if (dynamicPropertiesAllowed) {
- QVariant defaultValue = QVariant(v.type());
+ QVariant defaultValue = QVariant(v.metaType());
bool isDefault = (v == defaultValue);
if (v.canConvert<PropertySheetIconValue>()) {
- defaultValue = QVariant(QVariant::Icon);
+ defaultValue = QVariant(QMetaType(QMetaType::QIcon));
isDefault = (qvariant_cast<PropertySheetIconValue>(v) == PropertySheetIconValue());
} else if (v.canConvert<PropertySheetPixmapValue>()) {
- defaultValue = QVariant(QVariant::Pixmap);
+ defaultValue = QVariant(QMetaType(QMetaType::QPixmap));
isDefault = (qvariant_cast<PropertySheetPixmapValue>(v) == PropertySheetPixmapValue());
} else if (v.canConvert<PropertySheetStringValue>()) {
- defaultValue = QVariant(QVariant::String);
+ defaultValue = QVariant(QMetaType(QMetaType::QString));
isDefault = (qvariant_cast<PropertySheetStringValue>(v) == PropertySheetStringValue());
} else if (v.canConvert<PropertySheetStringListValue>()) {
- defaultValue = QVariant(QVariant::StringList);
+ defaultValue = QVariant(QMetaType(QMetaType::QStringList));
isDefault = (qvariant_cast<PropertySheetStringListValue>(v) == PropertySheetStringListValue());
} else if (v.canConvert<PropertySheetKeySequenceValue>()) {
- defaultValue = QVariant(QVariant::KeySequence);
+ defaultValue = QVariant(QMetaType(QMetaType::QKeySequence));
isDefault = (qvariant_cast<PropertySheetKeySequenceValue>(v) == PropertySheetKeySequenceValue());
}
- if (defaultValue.type() != QVariant::UserType) {
+ if (defaultValue.metaType().id() != QMetaType::User) {
const int idx = dynamicSheet->addDynamicProperty(p->attributeName(), defaultValue);
if (idx != -1) {
sheet->setProperty(idx, v);
@@ -1019,7 +1029,7 @@ void QDesignerResource::applyProperties(QObject *o, const QList<DomProperty*> &p
}
}
- if (propertyName == objectNameProperty)
+ if (propertyName == "objectName"_L1)
changeObjectName(o, o->objectName());
}
}
@@ -1136,25 +1146,21 @@ 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))
w->setAttributeClass(m_internal_to_qt.value(className));
- w->setAttributeName(widget->objectName());
-
if (isPromoted( core(), widget)) { // is promoted?
Q_ASSERT(widgetInfo != nullptr);
- w->setAttributeName(widget->objectName());
w->setAttributeClass(widgetInfo->name());
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());
@@ -1251,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;
@@ -1262,7 +1268,7 @@ DomTabStops *QDesignerResource::saveTabStops()
void QDesignerResource::applyTabStops(QWidget *widget, DomTabStops *tabStops)
{
- if (!tabStops)
+ if (tabStops == nullptr || widget == nullptr)
return;
QWidgetList tabOrder;
@@ -1344,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);
}
@@ -1364,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);
}
@@ -1390,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);
}
}
@@ -1459,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);
}
}
@@ -1503,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);
@@ -1538,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)
@@ -1611,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)) {
@@ -1638,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);
}
@@ -1690,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;
@@ -1712,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;
}
@@ -1731,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())
@@ -1783,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 {
@@ -1829,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();
@@ -1848,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());
@@ -1881,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;
}
@@ -1904,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);
@@ -1918,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 {
@@ -2125,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);
}
}
@@ -2216,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 180c38e79..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);
}
@@ -106,6 +80,10 @@ Qt::DockWidgetArea dockWidgetArea(QDockWidget *me)
}
}
+// In QMainWindowContainer::remove(), remember the dock area in a dynamic
+// property so that it can used in addWidget() if that is called by undo().
+static const char dockAreaPropertyName[] = "_q_dockArea";
+
void QMainWindowContainer::addWidget(QWidget *widget)
{
// remove all the occurrences of widget
@@ -138,7 +116,17 @@ void QMainWindowContainer::addWidget(QWidget *widget)
else if (QDockWidget *dockWidget = qobject_cast<QDockWidget*>(widget)) {
m_widgets.append(widget);
- m_mainWindow->addDockWidget(dockWidgetArea(dockWidget), dockWidget);
+
+ Qt::DockWidgetArea area = Qt::LeftDockWidgetArea;
+ const auto areaProperty = widget->property(dockAreaPropertyName);
+ if (areaProperty.canConvert<Qt::DockWidgetArea>()) {
+ area = areaProperty.value<Qt::DockWidgetArea>();
+ widget->setProperty(dockAreaPropertyName, {});
+ } else {
+ area = dockWidgetArea(dockWidget);
+ }
+
+ m_mainWindow->addDockWidget(area, dockWidget);
dockWidget->show();
if (FormWindow *fw = FormWindow::findFormWindow(m_mainWindow)) {
@@ -181,9 +169,13 @@ void QMainWindowContainer::remove(int index)
statusBar->setParent(nullptr);
m_mainWindow->setStatusBar(nullptr);
} else if (QDockWidget *dockWidget = qobject_cast<QDockWidget*>(widget)) {
+ const auto area = m_mainWindow->dockWidgetArea(dockWidget);
+ dockWidget->setProperty(dockAreaPropertyName, QVariant::fromValue(area));
m_mainWindow->removeDockWidget(dockWidget);
}
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 c094b756d..1d08b785f 100644
--- a/src/designer/src/components/lib/CMakeLists.txt
+++ b/src/designer/src/components/lib/CMakeLists.txt
@@ -1,12 +1,14 @@
-# Generated from lib.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
-## DesignerComponents Module:
+## DesignerComponentsPrivate Module:
#####################################################################
-qt_add_module(DesignerComponents
+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
@@ -14,7 +16,7 @@ qt_add_module(DesignerComponents
../formeditor/default_actionprovider.cpp ../formeditor/default_actionprovider.h
../formeditor/default_container.cpp ../formeditor/default_container.h
../formeditor/default_layoutdecoration.cpp ../formeditor/default_layoutdecoration.h
- ../formeditor/deviceprofiledialog.cpp ../formeditor/deviceprofiledialog.h ../formeditor/deviceprofiledialog.ui
+ ../formeditor/deviceprofiledialog.cpp ../formeditor/deviceprofiledialog.h
../formeditor/dpi_chooser.cpp ../formeditor/dpi_chooser.h
../formeditor/embeddedoptionspage.cpp ../formeditor/embeddedoptionspage.h
../formeditor/formeditor.cpp ../formeditor/formeditor.h
@@ -25,7 +27,7 @@ qt_add_module(DesignerComponents
../formeditor/formwindow_widgetstack.cpp ../formeditor/formwindow_widgetstack.h
../formeditor/formwindowcursor.cpp ../formeditor/formwindowcursor.h
../formeditor/formwindowmanager.cpp ../formeditor/formwindowmanager.h
- ../formeditor/formwindowsettings.cpp ../formeditor/formwindowsettings.h ../formeditor/formwindowsettings.ui
+ ../formeditor/formwindowsettings.cpp ../formeditor/formwindowsettings.h
../formeditor/itemview_propertysheet.cpp ../formeditor/itemview_propertysheet.h
../formeditor/layout_propertysheet.cpp ../formeditor/layout_propertysheet.h
../formeditor/line_propertysheet.cpp ../formeditor/line_propertysheet.h
@@ -36,7 +38,7 @@ qt_add_module(DesignerComponents
../formeditor/qmdiarea_container.cpp ../formeditor/qmdiarea_container.h
../formeditor/qwizard_container.cpp ../formeditor/qwizard_container.h
../formeditor/spacer_propertysheet.cpp ../formeditor/spacer_propertysheet.h
- ../formeditor/templateoptionspage.cpp ../formeditor/templateoptionspage.h ../formeditor/templateoptionspage.ui
+ ../formeditor/templateoptionspage.cpp ../formeditor/templateoptionspage.h
../formeditor/tool_widgeteditor.cpp ../formeditor/tool_widgeteditor.h
../formeditor/widgetselection.cpp ../formeditor/widgetselection.h
../objectinspector/objectinspector.cpp ../objectinspector/objectinspector.h
@@ -45,17 +47,18 @@ qt_add_module(DesignerComponents
../propertyeditor/brushpropertymanager.cpp ../propertyeditor/brushpropertymanager.h
../propertyeditor/designerpropertymanager.cpp ../propertyeditor/designerpropertymanager.h
../propertyeditor/fontpropertymanager.cpp ../propertyeditor/fontpropertymanager.h
- ../propertyeditor/newdynamicpropertydialog.cpp ../propertyeditor/newdynamicpropertydialog.h ../propertyeditor/newdynamicpropertydialog.ui
- ../propertyeditor/paletteeditor.cpp ../propertyeditor/paletteeditor.h ../propertyeditor/paletteeditor.ui
+ ../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/previewwidget.ui
+ ../propertyeditor/previewwidget.cpp ../propertyeditor/previewwidget.h
../propertyeditor/propertyeditor.cpp ../propertyeditor/propertyeditor.h
../propertyeditor/propertyeditor_global.h
../propertyeditor/qlonglongvalidator.cpp ../propertyeditor/qlonglongvalidator.h
- ../propertyeditor/stringlisteditor.cpp ../propertyeditor/stringlisteditor.h ../propertyeditor/stringlisteditor.ui
+ ../propertyeditor/stringlisteditor.cpp ../propertyeditor/stringlisteditor.h
../propertyeditor/stringlisteditorbutton.cpp ../propertyeditor/stringlisteditorbutton.h
- ../signalsloteditor/connectdialog.cpp ../signalsloteditor/connectdialog.ui ../signalsloteditor/connectdialog_p.h
+ ../signalsloteditor/connectdialog.cpp ../signalsloteditor/connectdialog_p.h
../signalsloteditor/signalslot_utils.cpp ../signalsloteditor/signalslot_utils_p.h
../signalsloteditor/signalsloteditor.cpp ../signalsloteditor/signalsloteditor.h ../signalsloteditor/signalsloteditor_p.h
../signalsloteditor/signalsloteditor_global.h
@@ -72,7 +75,7 @@ qt_add_module(DesignerComponents
../taskmenu/groupbox_taskmenu.cpp ../taskmenu/groupbox_taskmenu.h
../taskmenu/inplace_editor.cpp ../taskmenu/inplace_editor.h
../taskmenu/inplace_widget_helper.cpp ../taskmenu/inplace_widget_helper.h
- ../taskmenu/itemlisteditor.cpp ../taskmenu/itemlisteditor.h ../taskmenu/itemlisteditor.ui
+ ../taskmenu/itemlisteditor.cpp ../taskmenu/itemlisteditor.h
../taskmenu/label_taskmenu.cpp ../taskmenu/label_taskmenu.h
../taskmenu/layouttaskmenu.cpp ../taskmenu/layouttaskmenu.h
../taskmenu/lineedit_taskmenu.cpp ../taskmenu/lineedit_taskmenu.h
@@ -80,18 +83,21 @@ qt_add_module(DesignerComponents
../taskmenu/listwidgeteditor.cpp ../taskmenu/listwidgeteditor.h
../taskmenu/menutaskmenu.cpp ../taskmenu/menutaskmenu.h
../taskmenu/tablewidget_taskmenu.cpp ../taskmenu/tablewidget_taskmenu.h
- ../taskmenu/tablewidgeteditor.cpp ../taskmenu/tablewidgeteditor.h ../taskmenu/tablewidgeteditor.ui
+ ../taskmenu/tablewidgeteditor.cpp ../taskmenu/tablewidgeteditor.h
../taskmenu/taskmenu_component.cpp ../taskmenu/taskmenu_component.h
../taskmenu/textedit_taskmenu.cpp ../taskmenu/textedit_taskmenu.h
../taskmenu/toolbar_taskmenu.cpp ../taskmenu/toolbar_taskmenu.h
../taskmenu/treewidget_taskmenu.cpp ../taskmenu/treewidget_taskmenu.h
- ../taskmenu/treewidgeteditor.cpp ../taskmenu/treewidgeteditor.h ../taskmenu/treewidgeteditor.ui
+ ../taskmenu/treewidgeteditor.cpp ../taskmenu/treewidgeteditor.h
../widgetbox/widgetbox.cpp ../widgetbox/widgetbox.h
../widgetbox/widgetbox_dnditem.cpp ../widgetbox/widgetbox_dnditem.h
../widgetbox/widgetbox_global.h
../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,17 +129,37 @@ qt_add_module(DesignerComponents
uic
PRECOMPILED_HEADER
"lib_pch.h"
+ NO_GENERATE_CPP_EXPORTS
)
-# Resources:
-set_source_files_properties("../propertyeditor/fontmapping.xml"
- PROPERTIES QT_RESOURCE_ALIAS "fontmapping.xml"
+set(ui_sources
+ ../formeditor/deviceprofiledialog.ui
+ ../formeditor/formwindowsettings.ui
+ ../formeditor/templateoptionspage.ui
+ ../propertyeditor/newdynamicpropertydialog.ui
+ ../propertyeditor/paletteeditor.ui
+ ../propertyeditor/previewwidget.ui
+ ../propertyeditor/stringlisteditor.ui
+ ../signalsloteditor/connectdialog.ui
+ ../taskmenu/itemlisteditor.ui
+ ../taskmenu/tablewidgeteditor.ui
+ ../taskmenu/treewidgeteditor.ui
)
+
+# Work around QTBUG-95305
+if(CMAKE_GENERATOR STREQUAL "Ninja Multi-Config" AND CMAKE_CROSS_CONFIGS)
+ qt6_wrap_ui(ui_sources_processed ${ui_sources})
+else()
+ set(ui_sources_processed ${ui_sources})
+endif()
+target_sources(DesignerComponentsPrivate PRIVATE ${ui_sources_processed})
+
+# Resources:
set(propertyeditor_resource_files
- "fontmapping.xml"
+ "../propertyeditor/fontmapping.xml"
)
-qt_add_resource(DesignerComponents "propertyeditor"
+qt_internal_add_resource(DesignerComponentsPrivate "propertyeditor"
PREFIX
"/qt-project.org/propertyeditor"
BASE
@@ -141,698 +167,158 @@ qt_add_resource(DesignerComponents "propertyeditor"
FILES
${propertyeditor_resource_files}
)
-set_source_files_properties("../formeditor/images/cleartext.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cleartext.png"
-)
-set_source_files_properties("../formeditor/images/color.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/color.png"
-)
-set_source_files_properties("../formeditor/images/configure.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/configure.png"
-)
-set_source_files_properties("../formeditor/images/cursors/arrow.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursors/arrow.png"
-)
-set_source_files_properties("../formeditor/images/cursors/busy.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursors/busy.png"
-)
-set_source_files_properties("../formeditor/images/cursors/closedhand.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursors/closedhand.png"
-)
-set_source_files_properties("../formeditor/images/cursors/cross.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursors/cross.png"
-)
-set_source_files_properties("../formeditor/images/cursors/hand.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursors/hand.png"
-)
-set_source_files_properties("../formeditor/images/cursors/hsplit.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursors/hsplit.png"
-)
-set_source_files_properties("../formeditor/images/cursors/ibeam.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursors/ibeam.png"
-)
-set_source_files_properties("../formeditor/images/cursors/no.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursors/no.png"
-)
-set_source_files_properties("../formeditor/images/cursors/openhand.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursors/openhand.png"
-)
-set_source_files_properties("../formeditor/images/cursors/sizeall.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursors/sizeall.png"
-)
-set_source_files_properties("../formeditor/images/cursors/sizeb.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursors/sizeb.png"
-)
-set_source_files_properties("../formeditor/images/cursors/sizef.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursors/sizef.png"
-)
-set_source_files_properties("../formeditor/images/cursors/sizeh.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursors/sizeh.png"
-)
-set_source_files_properties("../formeditor/images/cursors/sizev.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursors/sizev.png"
-)
-set_source_files_properties("../formeditor/images/cursors/uparrow.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursors/uparrow.png"
-)
-set_source_files_properties("../formeditor/images/cursors/vsplit.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursors/vsplit.png"
-)
-set_source_files_properties("../formeditor/images/cursors/wait.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursors/wait.png"
-)
-set_source_files_properties("../formeditor/images/cursors/whatsthis.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursors/whatsthis.png"
-)
-set_source_files_properties("../formeditor/images/downplus.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/downplus.png"
-)
-set_source_files_properties("../formeditor/images/dropdownbutton.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/dropdownbutton.png"
-)
-set_source_files_properties("../formeditor/images/edit.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/edit.png"
-)
-set_source_files_properties("../formeditor/images/editdelete-16.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/editdelete-16.png"
-)
-set_source_files_properties("../formeditor/images/emptyicon.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/emptyicon.png"
-)
-set_source_files_properties("../formeditor/images/filenew-16.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/filenew-16.png"
-)
-set_source_files_properties("../formeditor/images/fileopen-16.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/fileopen-16.png"
-)
-set_source_files_properties("../formeditor/images/leveldown.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/leveldown.png"
-)
-set_source_files_properties("../formeditor/images/levelup.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/levelup.png"
-)
-set_source_files_properties("../formeditor/images/mac/adjustsize.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/adjustsize.png"
-)
-set_source_files_properties("../formeditor/images/mac/back.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/back.png"
-)
-set_source_files_properties("../formeditor/images/mac/buddytool.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/buddytool.png"
-)
-set_source_files_properties("../formeditor/images/mac/down.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/down.png"
-)
-set_source_files_properties("../formeditor/images/mac/editbreaklayout.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/editbreaklayout.png"
-)
-set_source_files_properties("../formeditor/images/mac/editcopy.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/editcopy.png"
-)
-set_source_files_properties("../formeditor/images/mac/editcut.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/editcut.png"
-)
-set_source_files_properties("../formeditor/images/mac/editdelete.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/editdelete.png"
-)
-set_source_files_properties("../formeditor/images/mac/editform.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/editform.png"
-)
-set_source_files_properties("../formeditor/images/mac/editgrid.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/editgrid.png"
-)
-set_source_files_properties("../formeditor/images/mac/edithlayout.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/edithlayout.png"
-)
-set_source_files_properties("../formeditor/images/mac/edithlayoutsplit.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/edithlayoutsplit.png"
-)
-set_source_files_properties("../formeditor/images/mac/editlower.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/editlower.png"
-)
-set_source_files_properties("../formeditor/images/mac/editpaste.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/editpaste.png"
-)
-set_source_files_properties("../formeditor/images/mac/editraise.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/editraise.png"
-)
-set_source_files_properties("../formeditor/images/mac/editvlayout.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/editvlayout.png"
-)
-set_source_files_properties("../formeditor/images/mac/editvlayoutsplit.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/editvlayoutsplit.png"
-)
-set_source_files_properties("../formeditor/images/mac/filenew.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/filenew.png"
-)
-set_source_files_properties("../formeditor/images/mac/fileopen.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/fileopen.png"
-)
-set_source_files_properties("../formeditor/images/mac/filesave.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/filesave.png"
-)
-set_source_files_properties("../formeditor/images/mac/forward.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/forward.png"
-)
-set_source_files_properties("../formeditor/images/mac/insertimage.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/insertimage.png"
-)
-set_source_files_properties("../formeditor/images/mac/minus.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/minus.png"
-)
-set_source_files_properties("../formeditor/images/mac/plus.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/plus.png"
-)
-set_source_files_properties("../formeditor/images/mac/redo.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/redo.png"
-)
-set_source_files_properties("../formeditor/images/mac/resourceeditortool.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/resourceeditortool.png"
-)
-set_source_files_properties("../formeditor/images/mac/signalslottool.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/signalslottool.png"
-)
-set_source_files_properties("../formeditor/images/mac/simplifyrichtext.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/simplifyrichtext.png"
-)
-set_source_files_properties("../formeditor/images/mac/tabordertool.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/tabordertool.png"
-)
-set_source_files_properties("../formeditor/images/mac/textanchor.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/textanchor.png"
-)
-set_source_files_properties("../formeditor/images/mac/textbold.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/textbold.png"
-)
-set_source_files_properties("../formeditor/images/mac/textcenter.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/textcenter.png"
-)
-set_source_files_properties("../formeditor/images/mac/textitalic.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/textitalic.png"
-)
-set_source_files_properties("../formeditor/images/mac/textjustify.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/textjustify.png"
-)
-set_source_files_properties("../formeditor/images/mac/textleft.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/textleft.png"
-)
-set_source_files_properties("../formeditor/images/mac/textright.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/textright.png"
-)
-set_source_files_properties("../formeditor/images/mac/textsubscript.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/textsubscript.png"
-)
-set_source_files_properties("../formeditor/images/mac/textsuperscript.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/textsuperscript.png"
-)
-set_source_files_properties("../formeditor/images/mac/textunder.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/textunder.png"
-)
-set_source_files_properties("../formeditor/images/mac/undo.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/undo.png"
-)
-set_source_files_properties("../formeditor/images/mac/up.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/up.png"
-)
-set_source_files_properties("../formeditor/images/mac/widgettool.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/widgettool.png"
-)
-set_source_files_properties("../formeditor/images/minus-16.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/minus-16.png"
-)
-set_source_files_properties("../formeditor/images/plus-16.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/plus-16.png"
-)
-set_source_files_properties("../formeditor/images/prefix-add.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/prefix-add.png"
-)
-set_source_files_properties("../formeditor/images/qt3logo.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/qt3logo.png"
-)
-set_source_files_properties("../formeditor/images/qtlogo16x16.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/qtlogo16x16.png"
-)
-set_source_files_properties("../formeditor/images/qtlogo24x24.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/qtlogo24x24.png"
-)
-set_source_files_properties("../formeditor/images/qtlogo32x32.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/qtlogo32x32.png"
-)
-set_source_files_properties("../formeditor/images/qtlogo64x64.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/qtlogo64x64.png"
-)
-set_source_files_properties("../formeditor/images/reload.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/reload.png"
-)
-set_source_files_properties("../formeditor/images/resetproperty.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/resetproperty.png"
-)
-set_source_files_properties("../formeditor/images/righttoleft.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/righttoleft.png"
-)
-set_source_files_properties("../formeditor/images/sort.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/sort.png"
-)
-set_source_files_properties("../formeditor/images/submenu.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/submenu.png"
-)
-set_source_files_properties("../formeditor/images/widgets/calendarwidget.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/calendarwidget.png"
-)
-set_source_files_properties("../formeditor/images/widgets/checkbox.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/checkbox.png"
-)
-set_source_files_properties("../formeditor/images/widgets/columnview.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/columnview.png"
-)
-set_source_files_properties("../formeditor/images/widgets/combobox.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/combobox.png"
-)
-set_source_files_properties("../formeditor/images/widgets/commandlinkbutton.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/commandlinkbutton.png"
-)
-set_source_files_properties("../formeditor/images/widgets/dateedit.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/dateedit.png"
-)
-set_source_files_properties("../formeditor/images/widgets/datetimeedit.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/datetimeedit.png"
-)
-set_source_files_properties("../formeditor/images/widgets/dial.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/dial.png"
-)
-set_source_files_properties("../formeditor/images/widgets/dialogbuttonbox.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/dialogbuttonbox.png"
-)
-set_source_files_properties("../formeditor/images/widgets/dockwidget.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/dockwidget.png"
-)
-set_source_files_properties("../formeditor/images/widgets/doublespinbox.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/doublespinbox.png"
-)
-set_source_files_properties("../formeditor/images/widgets/fontcombobox.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/fontcombobox.png"
-)
-set_source_files_properties("../formeditor/images/widgets/frame.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/frame.png"
-)
-set_source_files_properties("../formeditor/images/widgets/graphicsview.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/graphicsview.png"
-)
-set_source_files_properties("../formeditor/images/widgets/groupbox.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/groupbox.png"
-)
-set_source_files_properties("../formeditor/images/widgets/hscrollbar.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/hscrollbar.png"
-)
-set_source_files_properties("../formeditor/images/widgets/hslider.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/hslider.png"
-)
-set_source_files_properties("../formeditor/images/widgets/hsplit.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/hsplit.png"
-)
-set_source_files_properties("../formeditor/images/widgets/label.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/label.png"
-)
-set_source_files_properties("../formeditor/images/widgets/lcdnumber.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/lcdnumber.png"
-)
-set_source_files_properties("../formeditor/images/widgets/line.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/line.png"
-)
-set_source_files_properties("../formeditor/images/widgets/lineedit.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/lineedit.png"
-)
-set_source_files_properties("../formeditor/images/widgets/listbox.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/listbox.png"
-)
-set_source_files_properties("../formeditor/images/widgets/listview.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/listview.png"
-)
-set_source_files_properties("../formeditor/images/widgets/mdiarea.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/mdiarea.png"
-)
-set_source_files_properties("../formeditor/images/widgets/plaintextedit.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/plaintextedit.png"
-)
-set_source_files_properties("../formeditor/images/widgets/progress.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/progress.png"
-)
-set_source_files_properties("../formeditor/images/widgets/pushbutton.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/pushbutton.png"
-)
-set_source_files_properties("../formeditor/images/widgets/radiobutton.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/radiobutton.png"
-)
-set_source_files_properties("../formeditor/images/widgets/scrollarea.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/scrollarea.png"
-)
-set_source_files_properties("../formeditor/images/widgets/spacer.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/spacer.png"
-)
-set_source_files_properties("../formeditor/images/widgets/spinbox.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/spinbox.png"
-)
-set_source_files_properties("../formeditor/images/widgets/table.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/table.png"
-)
-set_source_files_properties("../formeditor/images/widgets/tabwidget.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/tabwidget.png"
-)
-set_source_files_properties("../formeditor/images/widgets/textedit.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/textedit.png"
-)
-set_source_files_properties("../formeditor/images/widgets/timeedit.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/timeedit.png"
-)
-set_source_files_properties("../formeditor/images/widgets/toolbox.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/toolbox.png"
-)
-set_source_files_properties("../formeditor/images/widgets/toolbutton.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/toolbutton.png"
-)
-set_source_files_properties("../formeditor/images/widgets/vline.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/vline.png"
-)
-set_source_files_properties("../formeditor/images/widgets/vscrollbar.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/vscrollbar.png"
-)
-set_source_files_properties("../formeditor/images/widgets/vslider.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/vslider.png"
-)
-set_source_files_properties("../formeditor/images/widgets/vspacer.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/vspacer.png"
-)
-set_source_files_properties("../formeditor/images/widgets/widget.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/widget.png"
-)
-set_source_files_properties("../formeditor/images/widgets/widgetstack.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/widgetstack.png"
-)
-set_source_files_properties("../formeditor/images/widgets/wizard.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/widgets/wizard.png"
-)
-set_source_files_properties("../formeditor/images/win/adjustsize.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/adjustsize.png"
-)
-set_source_files_properties("../formeditor/images/win/back.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/back.png"
-)
-set_source_files_properties("../formeditor/images/win/buddytool.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/buddytool.png"
-)
-set_source_files_properties("../formeditor/images/win/down.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/down.png"
-)
-set_source_files_properties("../formeditor/images/win/editbreaklayout.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/editbreaklayout.png"
-)
-set_source_files_properties("../formeditor/images/win/editcopy.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/editcopy.png"
-)
-set_source_files_properties("../formeditor/images/win/editcut.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/editcut.png"
-)
-set_source_files_properties("../formeditor/images/win/editdelete.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/editdelete.png"
-)
-set_source_files_properties("../formeditor/images/win/editform.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/editform.png"
-)
-set_source_files_properties("../formeditor/images/win/editgrid.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/editgrid.png"
-)
-set_source_files_properties("../formeditor/images/win/edithlayout.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/edithlayout.png"
-)
-set_source_files_properties("../formeditor/images/win/edithlayoutsplit.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/edithlayoutsplit.png"
-)
-set_source_files_properties("../formeditor/images/win/editlower.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/editlower.png"
-)
-set_source_files_properties("../formeditor/images/win/editpaste.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/editpaste.png"
-)
-set_source_files_properties("../formeditor/images/win/editraise.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/editraise.png"
-)
-set_source_files_properties("../formeditor/images/win/editvlayout.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/editvlayout.png"
-)
-set_source_files_properties("../formeditor/images/win/editvlayoutsplit.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/editvlayoutsplit.png"
-)
-set_source_files_properties("../formeditor/images/win/filenew.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/filenew.png"
-)
-set_source_files_properties("../formeditor/images/win/fileopen.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/fileopen.png"
-)
-set_source_files_properties("../formeditor/images/win/filesave.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/filesave.png"
-)
-set_source_files_properties("../formeditor/images/win/forward.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/forward.png"
-)
-set_source_files_properties("../formeditor/images/win/insertimage.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/insertimage.png"
-)
-set_source_files_properties("../formeditor/images/win/minus.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/minus.png"
-)
-set_source_files_properties("../formeditor/images/win/plus.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/plus.png"
-)
-set_source_files_properties("../formeditor/images/win/redo.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/redo.png"
-)
-set_source_files_properties("../formeditor/images/win/resourceeditortool.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/resourceeditortool.png"
-)
-set_source_files_properties("../formeditor/images/win/signalslottool.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/signalslottool.png"
-)
-set_source_files_properties("../formeditor/images/win/simplifyrichtext.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/simplifyrichtext.png"
-)
-set_source_files_properties("../formeditor/images/win/tabordertool.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/tabordertool.png"
-)
-set_source_files_properties("../formeditor/images/win/textanchor.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/textanchor.png"
-)
-set_source_files_properties("../formeditor/images/win/textbold.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/textbold.png"
-)
-set_source_files_properties("../formeditor/images/win/textcenter.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/textcenter.png"
-)
-set_source_files_properties("../formeditor/images/win/textitalic.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/textitalic.png"
-)
-set_source_files_properties("../formeditor/images/win/textjustify.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/textjustify.png"
-)
-set_source_files_properties("../formeditor/images/win/textleft.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/textleft.png"
-)
-set_source_files_properties("../formeditor/images/win/textright.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/textright.png"
-)
-set_source_files_properties("../formeditor/images/win/textsubscript.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/textsubscript.png"
-)
-set_source_files_properties("../formeditor/images/win/textsuperscript.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/textsuperscript.png"
-)
-set_source_files_properties("../formeditor/images/win/textunder.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/textunder.png"
-)
-set_source_files_properties("../formeditor/images/win/undo.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/undo.png"
-)
-set_source_files_properties("../formeditor/images/win/up.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/up.png"
-)
-set_source_files_properties("../formeditor/images/win/widgettool.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/widgettool.png"
-)
set(formeditor_resource_files
- "images/cleartext.png"
- "images/color.png"
- "images/configure.png"
- "images/cursors/arrow.png"
- "images/cursors/busy.png"
- "images/cursors/closedhand.png"
- "images/cursors/cross.png"
- "images/cursors/hand.png"
- "images/cursors/hsplit.png"
- "images/cursors/ibeam.png"
- "images/cursors/no.png"
- "images/cursors/openhand.png"
- "images/cursors/sizeall.png"
- "images/cursors/sizeb.png"
- "images/cursors/sizef.png"
- "images/cursors/sizeh.png"
- "images/cursors/sizev.png"
- "images/cursors/uparrow.png"
- "images/cursors/vsplit.png"
- "images/cursors/wait.png"
- "images/cursors/whatsthis.png"
- "images/downplus.png"
- "images/dropdownbutton.png"
- "images/edit.png"
- "images/editdelete-16.png"
- "images/emptyicon.png"
- "images/filenew-16.png"
- "images/fileopen-16.png"
- "images/leveldown.png"
- "images/levelup.png"
- "images/mac/adjustsize.png"
- "images/mac/back.png"
- "images/mac/buddytool.png"
- "images/mac/down.png"
- "images/mac/editbreaklayout.png"
- "images/mac/editcopy.png"
- "images/mac/editcut.png"
- "images/mac/editdelete.png"
- "images/mac/editform.png"
- "images/mac/editgrid.png"
- "images/mac/edithlayout.png"
- "images/mac/edithlayoutsplit.png"
- "images/mac/editlower.png"
- "images/mac/editpaste.png"
- "images/mac/editraise.png"
- "images/mac/editvlayout.png"
- "images/mac/editvlayoutsplit.png"
- "images/mac/filenew.png"
- "images/mac/fileopen.png"
- "images/mac/filesave.png"
- "images/mac/forward.png"
- "images/mac/insertimage.png"
- "images/mac/minus.png"
- "images/mac/plus.png"
- "images/mac/redo.png"
- "images/mac/resourceeditortool.png"
- "images/mac/signalslottool.png"
- "images/mac/simplifyrichtext.png"
- "images/mac/tabordertool.png"
- "images/mac/textanchor.png"
- "images/mac/textbold.png"
- "images/mac/textcenter.png"
- "images/mac/textitalic.png"
- "images/mac/textjustify.png"
- "images/mac/textleft.png"
- "images/mac/textright.png"
- "images/mac/textsubscript.png"
- "images/mac/textsuperscript.png"
- "images/mac/textunder.png"
- "images/mac/undo.png"
- "images/mac/up.png"
- "images/mac/widgettool.png"
- "images/minus-16.png"
- "images/plus-16.png"
- "images/prefix-add.png"
- "images/qt3logo.png"
- "images/qtlogo16x16.png"
- "images/qtlogo24x24.png"
- "images/qtlogo32x32.png"
- "images/qtlogo64x64.png"
- "images/reload.png"
- "images/resetproperty.png"
- "images/righttoleft.png"
- "images/sort.png"
- "images/submenu.png"
- "images/widgets/calendarwidget.png"
- "images/widgets/checkbox.png"
- "images/widgets/columnview.png"
- "images/widgets/combobox.png"
- "images/widgets/commandlinkbutton.png"
- "images/widgets/dateedit.png"
- "images/widgets/datetimeedit.png"
- "images/widgets/dial.png"
- "images/widgets/dialogbuttonbox.png"
- "images/widgets/dockwidget.png"
- "images/widgets/doublespinbox.png"
- "images/widgets/fontcombobox.png"
- "images/widgets/frame.png"
- "images/widgets/graphicsview.png"
- "images/widgets/groupbox.png"
- "images/widgets/hscrollbar.png"
- "images/widgets/hslider.png"
- "images/widgets/hsplit.png"
- "images/widgets/label.png"
- "images/widgets/lcdnumber.png"
- "images/widgets/line.png"
- "images/widgets/lineedit.png"
- "images/widgets/listbox.png"
- "images/widgets/listview.png"
- "images/widgets/mdiarea.png"
- "images/widgets/plaintextedit.png"
- "images/widgets/progress.png"
- "images/widgets/pushbutton.png"
- "images/widgets/radiobutton.png"
- "images/widgets/scrollarea.png"
- "images/widgets/spacer.png"
- "images/widgets/spinbox.png"
- "images/widgets/table.png"
- "images/widgets/tabwidget.png"
- "images/widgets/textedit.png"
- "images/widgets/timeedit.png"
- "images/widgets/toolbox.png"
- "images/widgets/toolbutton.png"
- "images/widgets/vline.png"
- "images/widgets/vscrollbar.png"
- "images/widgets/vslider.png"
- "images/widgets/vspacer.png"
- "images/widgets/widget.png"
- "images/widgets/widgetstack.png"
- "images/widgets/wizard.png"
- "images/win/adjustsize.png"
- "images/win/back.png"
- "images/win/buddytool.png"
- "images/win/down.png"
- "images/win/editbreaklayout.png"
- "images/win/editcopy.png"
- "images/win/editcut.png"
- "images/win/editdelete.png"
- "images/win/editform.png"
- "images/win/editgrid.png"
- "images/win/edithlayout.png"
- "images/win/edithlayoutsplit.png"
- "images/win/editlower.png"
- "images/win/editpaste.png"
- "images/win/editraise.png"
- "images/win/editvlayout.png"
- "images/win/editvlayoutsplit.png"
- "images/win/filenew.png"
- "images/win/fileopen.png"
- "images/win/filesave.png"
- "images/win/forward.png"
- "images/win/insertimage.png"
- "images/win/minus.png"
- "images/win/plus.png"
- "images/win/redo.png"
- "images/win/resourceeditortool.png"
- "images/win/signalslottool.png"
- "images/win/simplifyrichtext.png"
- "images/win/tabordertool.png"
- "images/win/textanchor.png"
- "images/win/textbold.png"
- "images/win/textcenter.png"
- "images/win/textitalic.png"
- "images/win/textjustify.png"
- "images/win/textleft.png"
- "images/win/textright.png"
- "images/win/textsubscript.png"
- "images/win/textsuperscript.png"
- "images/win/textunder.png"
- "images/win/undo.png"
- "images/win/up.png"
- "images/win/widgettool.png"
+ "../formeditor/images/color.png"
+ "../formeditor/images/configure.png"
+ "../formeditor/images/downplus.png"
+ "../formeditor/images/dropdownbutton.png"
+ "../formeditor/images/edit.png"
+ "../formeditor/images/editdelete-16.png"
+ "../formeditor/images/emptyicon.png"
+ "../formeditor/images/filenew-16.png"
+ "../formeditor/images/fileopen-16.png"
+ "../formeditor/images/leveldown.png"
+ "../formeditor/images/levelup.png"
+ "../formeditor/images/mac/adjustsize.png"
+ "../formeditor/images/mac/back.png"
+ "../formeditor/images/mac/buddytool.png"
+ "../formeditor/images/mac/down.png"
+ "../formeditor/images/mac/editbreaklayout.png"
+ "../formeditor/images/mac/editcopy.png"
+ "../formeditor/images/mac/editcut.png"
+ "../formeditor/images/mac/editdelete.png"
+ "../formeditor/images/mac/editform.png"
+ "../formeditor/images/mac/editgrid.png"
+ "../formeditor/images/mac/edithlayout.png"
+ "../formeditor/images/mac/edithlayoutsplit.png"
+ "../formeditor/images/mac/editlower.png"
+ "../formeditor/images/mac/editpaste.png"
+ "../formeditor/images/mac/editraise.png"
+ "../formeditor/images/mac/editvlayout.png"
+ "../formeditor/images/mac/editvlayoutsplit.png"
+ "../formeditor/images/mac/filenew.png"
+ "../formeditor/images/mac/fileopen.png"
+ "../formeditor/images/mac/filesave.png"
+ "../formeditor/images/mac/forward.png"
+ "../formeditor/images/mac/insertimage.png"
+ "../formeditor/images/mac/minus.png"
+ "../formeditor/images/mac/plus.png"
+ "../formeditor/images/mac/redo.png"
+ "../formeditor/images/mac/signalslottool.png"
+ "../formeditor/images/mac/simplifyrichtext.png"
+ "../formeditor/images/mac/tabordertool.png"
+ "../formeditor/images/mac/textanchor.png"
+ "../formeditor/images/mac/textbold.png"
+ "../formeditor/images/mac/textcenter.png"
+ "../formeditor/images/mac/textitalic.png"
+ "../formeditor/images/mac/textjustify.png"
+ "../formeditor/images/mac/textleft.png"
+ "../formeditor/images/mac/textright.png"
+ "../formeditor/images/mac/textsubscript.png"
+ "../formeditor/images/mac/textsuperscript.png"
+ "../formeditor/images/mac/textunder.png"
+ "../formeditor/images/mac/undo.png"
+ "../formeditor/images/mac/up.png"
+ "../formeditor/images/mac/widgettool.png"
+ "../formeditor/images/minus-16.png"
+ "../formeditor/images/prefix-add.png"
+ "../formeditor/images/qtlogo128x128.png"
+ "../formeditor/images/qtlogo16x16.png"
+ "../formeditor/images/qtlogo24x24.png"
+ "../formeditor/images/qtlogo32x32.png"
+ "../formeditor/images/qtlogo64x64.png"
+ "../formeditor/images/reload.png"
+ "../formeditor/images/resetproperty.png"
+ "../formeditor/images/righttoleft.png"
+ "../formeditor/images/sort.png"
+ "../formeditor/images/submenu.png"
+ "../formeditor/images/widgets/calendarwidget.png"
+ "../formeditor/images/widgets/checkbox.png"
+ "../formeditor/images/widgets/columnview.png"
+ "../formeditor/images/widgets/combobox.png"
+ "../formeditor/images/widgets/commandlinkbutton.png"
+ "../formeditor/images/widgets/dateedit.png"
+ "../formeditor/images/widgets/datetimeedit.png"
+ "../formeditor/images/widgets/dial.png"
+ "../formeditor/images/widgets/dialogbuttonbox.png"
+ "../formeditor/images/widgets/dockwidget.png"
+ "../formeditor/images/widgets/doublespinbox.png"
+ "../formeditor/images/widgets/fontcombobox.png"
+ "../formeditor/images/widgets/frame.png"
+ "../formeditor/images/widgets/graphicsview.png"
+ "../formeditor/images/widgets/groupbox.png"
+ "../formeditor/images/widgets/hscrollbar.png"
+ "../formeditor/images/widgets/hslider.png"
+ "../formeditor/images/widgets/label.png"
+ "../formeditor/images/widgets/lcdnumber.png"
+ "../formeditor/images/widgets/line.png"
+ "../formeditor/images/widgets/lineedit.png"
+ "../formeditor/images/widgets/listbox.png"
+ "../formeditor/images/widgets/listview.png"
+ "../formeditor/images/widgets/mdiarea.png"
+ "../formeditor/images/widgets/plaintextedit.png"
+ "../formeditor/images/widgets/progress.png"
+ "../formeditor/images/widgets/pushbutton.png"
+ "../formeditor/images/widgets/radiobutton.png"
+ "../formeditor/images/widgets/scrollarea.png"
+ "../formeditor/images/widgets/spacer.png"
+ "../formeditor/images/widgets/spinbox.png"
+ "../formeditor/images/widgets/table.png"
+ "../formeditor/images/widgets/tabwidget.png"
+ "../formeditor/images/widgets/textedit.png"
+ "../formeditor/images/widgets/timeedit.png"
+ "../formeditor/images/widgets/toolbox.png"
+ "../formeditor/images/widgets/toolbutton.png"
+ "../formeditor/images/widgets/vline.png"
+ "../formeditor/images/widgets/vscrollbar.png"
+ "../formeditor/images/widgets/vslider.png"
+ "../formeditor/images/widgets/vspacer.png"
+ "../formeditor/images/widgets/widget.png"
+ "../formeditor/images/widgets/widgetstack.png"
+ "../formeditor/images/win/adjustsize.png"
+ "../formeditor/images/win/back.png"
+ "../formeditor/images/win/buddytool.png"
+ "../formeditor/images/win/down.png"
+ "../formeditor/images/win/editbreaklayout.png"
+ "../formeditor/images/win/editcopy.png"
+ "../formeditor/images/win/editcut.png"
+ "../formeditor/images/win/editdelete.png"
+ "../formeditor/images/win/editform.png"
+ "../formeditor/images/win/editgrid.png"
+ "../formeditor/images/win/edithlayout.png"
+ "../formeditor/images/win/edithlayoutsplit.png"
+ "../formeditor/images/win/editlower.png"
+ "../formeditor/images/win/editpaste.png"
+ "../formeditor/images/win/editraise.png"
+ "../formeditor/images/win/editvlayout.png"
+ "../formeditor/images/win/editvlayoutsplit.png"
+ "../formeditor/images/win/filenew.png"
+ "../formeditor/images/win/fileopen.png"
+ "../formeditor/images/win/filesave.png"
+ "../formeditor/images/win/forward.png"
+ "../formeditor/images/win/insertimage.png"
+ "../formeditor/images/win/minus.png"
+ "../formeditor/images/win/plus.png"
+ "../formeditor/images/win/redo.png"
+ "../formeditor/images/win/signalslottool.png"
+ "../formeditor/images/win/simplifyrichtext.png"
+ "../formeditor/images/win/tabordertool.png"
+ "../formeditor/images/win/textanchor.png"
+ "../formeditor/images/win/textbold.png"
+ "../formeditor/images/win/textcenter.png"
+ "../formeditor/images/win/textitalic.png"
+ "../formeditor/images/win/textjustify.png"
+ "../formeditor/images/win/textleft.png"
+ "../formeditor/images/win/textright.png"
+ "../formeditor/images/win/textsubscript.png"
+ "../formeditor/images/win/textsuperscript.png"
+ "../formeditor/images/win/textunder.png"
+ "../formeditor/images/win/undo.png"
+ "../formeditor/images/win/up.png"
+ "../formeditor/images/win/widgettool.png"
)
-qt_add_resource(DesignerComponents "formeditor"
+qt_internal_add_resource(DesignerComponentsPrivate "formeditor"
PREFIX
"/qt-project.org/formeditor"
BASE
@@ -840,14 +326,11 @@ qt_add_resource(DesignerComponents "formeditor"
FILES
${formeditor_resource_files}
)
-set_source_files_properties("../formeditor/defaultbrushes.xml"
- PROPERTIES QT_RESOURCE_ALIAS "defaultbrushes.xml"
-)
set(formeditor1_resource_files
- "defaultbrushes.xml"
+ "../formeditor/defaultbrushes.xml"
)
-qt_add_resource(DesignerComponents "formeditor1"
+qt_internal_add_resource(DesignerComponentsPrivate "formeditor1"
PREFIX
"/qt-project.org/brushes"
BASE
@@ -855,14 +338,11 @@ qt_add_resource(DesignerComponents "formeditor1"
FILES
${formeditor1_resource_files}
)
-set_source_files_properties("../widgetbox/widgetbox.xml"
- PROPERTIES QT_RESOURCE_ALIAS "widgetbox.xml"
-)
set(widgetbox_resource_files
- "widgetbox.xml"
+ "../widgetbox/widgetbox.xml"
)
-qt_add_resource(DesignerComponents "widgetbox"
+qt_internal_add_resource(DesignerComponentsPrivate "widgetbox"
PREFIX
"/qt-project.org/widgetbox"
BASE
@@ -871,26 +351,19 @@ qt_add_resource(DesignerComponents "widgetbox"
${widgetbox_resource_files}
)
-
-#### Keys ignored in scope 1:.:.:lib.pro:<TRUE>:
-# MODULE = "designercomponents"
-
## Scopes:
#####################################################################
-qt_extend_target(DesignerComponents CONDITION static
+qt_internal_extend_target(DesignerComponentsPrivate CONDITION NOT QT_BUILD_SHARED_LIBS
DEFINES
QT_DESIGNER_STATIC
-)
-
-qt_extend_target(DesignerComponents CONDITION NOT QT_BUILD_SHARED_LIBS
INCLUDE_DIRECTORIES
../../../../shared/findwidget
../../../../shared/qtgradienteditor
../../../../shared/qtpropertybrowser
)
-qt_extend_target(DesignerComponents CONDITION QT_BUILD_SHARED_LIBS
+qt_internal_extend_target(DesignerComponentsPrivate CONDITION QT_BUILD_SHARED_LIBS
SOURCES
../../../../shared/findwidget/abstractfindwidget.cpp ../../../../shared/findwidget/abstractfindwidget.h
../../../../shared/findwidget/itemviewfindwidget.cpp ../../../../shared/findwidget/itemviewfindwidget.h
@@ -912,46 +385,19 @@ qt_extend_target(DesignerComponents CONDITION QT_BUILD_SHARED_LIBS
if(QT_BUILD_SHARED_LIBS)
# Resources:
- set_source_files_properties("../../../../shared/findwidget/images/mac/closetab.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/closetab.png"
- )
- set_source_files_properties("../../../../shared/findwidget/images/mac/next.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/next.png"
- )
- set_source_files_properties("../../../../shared/findwidget/images/mac/previous.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/previous.png"
- )
- set_source_files_properties("../../../../shared/findwidget/images/mac/searchfind.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/mac/searchfind.png"
- )
- set_source_files_properties("../../../../shared/findwidget/images/win/closetab.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/closetab.png"
- )
- set_source_files_properties("../../../../shared/findwidget/images/win/next.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/next.png"
- )
- set_source_files_properties("../../../../shared/findwidget/images/win/previous.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/previous.png"
- )
- set_source_files_properties("../../../../shared/findwidget/images/win/searchfind.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/win/searchfind.png"
- )
- set_source_files_properties("../../../../shared/findwidget/images/wrap.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/wrap.png"
- )
set(findwidget_resource_files
- "images/mac/closetab.png"
- "images/mac/next.png"
- "images/mac/previous.png"
- "images/mac/searchfind.png"
- "images/win/closetab.png"
- "images/win/next.png"
- "images/win/previous.png"
- "images/win/searchfind.png"
- "images/wrap.png"
+ "../../../../shared/findwidget/images/mac/closetab.png"
+ "../../../../shared/findwidget/images/mac/next.png"
+ "../../../../shared/findwidget/images/mac/previous.png"
+ "../../../../shared/findwidget/images/mac/searchfind.png"
+ "../../../../shared/findwidget/images/win/closetab.png"
+ "../../../../shared/findwidget/images/win/next.png"
+ "../../../../shared/findwidget/images/win/previous.png"
+ "../../../../shared/findwidget/images/win/searchfind.png"
+ "../../../../shared/findwidget/images/wrap.png"
)
- qt_add_resource(DesignerComponents "findwidget"
+ qt_internal_add_resource(DesignerComponentsPrivate "findwidget"
PREFIX
"/qt-project.org/shared"
BASE
@@ -959,82 +405,28 @@ if(QT_BUILD_SHARED_LIBS)
FILES
${findwidget_resource_files}
)
- set_source_files_properties("../../../../shared/qtpropertybrowser/images/cursor-arrow.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursor-arrow.png"
- )
- set_source_files_properties("../../../../shared/qtpropertybrowser/images/cursor-busy.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursor-busy.png"
- )
- set_source_files_properties("../../../../shared/qtpropertybrowser/images/cursor-closedhand.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursor-closedhand.png"
- )
- set_source_files_properties("../../../../shared/qtpropertybrowser/images/cursor-cross.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursor-cross.png"
- )
- set_source_files_properties("../../../../shared/qtpropertybrowser/images/cursor-forbidden.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursor-forbidden.png"
- )
- set_source_files_properties("../../../../shared/qtpropertybrowser/images/cursor-hand.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursor-hand.png"
- )
- set_source_files_properties("../../../../shared/qtpropertybrowser/images/cursor-hsplit.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursor-hsplit.png"
- )
- set_source_files_properties("../../../../shared/qtpropertybrowser/images/cursor-ibeam.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursor-ibeam.png"
- )
- set_source_files_properties("../../../../shared/qtpropertybrowser/images/cursor-openhand.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursor-openhand.png"
- )
- set_source_files_properties("../../../../shared/qtpropertybrowser/images/cursor-sizeall.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursor-sizeall.png"
- )
- set_source_files_properties("../../../../shared/qtpropertybrowser/images/cursor-sizeb.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursor-sizeb.png"
- )
- set_source_files_properties("../../../../shared/qtpropertybrowser/images/cursor-sizef.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursor-sizef.png"
- )
- set_source_files_properties("../../../../shared/qtpropertybrowser/images/cursor-sizeh.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursor-sizeh.png"
- )
- set_source_files_properties("../../../../shared/qtpropertybrowser/images/cursor-sizev.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursor-sizev.png"
- )
- set_source_files_properties("../../../../shared/qtpropertybrowser/images/cursor-uparrow.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursor-uparrow.png"
- )
- set_source_files_properties("../../../../shared/qtpropertybrowser/images/cursor-vsplit.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursor-vsplit.png"
- )
- set_source_files_properties("../../../../shared/qtpropertybrowser/images/cursor-wait.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursor-wait.png"
- )
- set_source_files_properties("../../../../shared/qtpropertybrowser/images/cursor-whatsthis.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/cursor-whatsthis.png"
- )
set(qtpropertybrowser_resource_files
- "images/cursor-arrow.png"
- "images/cursor-busy.png"
- "images/cursor-closedhand.png"
- "images/cursor-cross.png"
- "images/cursor-forbidden.png"
- "images/cursor-hand.png"
- "images/cursor-hsplit.png"
- "images/cursor-ibeam.png"
- "images/cursor-openhand.png"
- "images/cursor-sizeall.png"
- "images/cursor-sizeb.png"
- "images/cursor-sizef.png"
- "images/cursor-sizeh.png"
- "images/cursor-sizev.png"
- "images/cursor-uparrow.png"
- "images/cursor-vsplit.png"
- "images/cursor-wait.png"
- "images/cursor-whatsthis.png"
+ "../../../../shared/qtpropertybrowser/images/cursor-arrow.png"
+ "../../../../shared/qtpropertybrowser/images/cursor-busy.png"
+ "../../../../shared/qtpropertybrowser/images/cursor-closedhand.png"
+ "../../../../shared/qtpropertybrowser/images/cursor-cross.png"
+ "../../../../shared/qtpropertybrowser/images/cursor-forbidden.png"
+ "../../../../shared/qtpropertybrowser/images/cursor-hand.png"
+ "../../../../shared/qtpropertybrowser/images/cursor-hsplit.png"
+ "../../../../shared/qtpropertybrowser/images/cursor-ibeam.png"
+ "../../../../shared/qtpropertybrowser/images/cursor-openhand.png"
+ "../../../../shared/qtpropertybrowser/images/cursor-sizeall.png"
+ "../../../../shared/qtpropertybrowser/images/cursor-sizeb.png"
+ "../../../../shared/qtpropertybrowser/images/cursor-sizef.png"
+ "../../../../shared/qtpropertybrowser/images/cursor-sizeh.png"
+ "../../../../shared/qtpropertybrowser/images/cursor-sizev.png"
+ "../../../../shared/qtpropertybrowser/images/cursor-uparrow.png"
+ "../../../../shared/qtpropertybrowser/images/cursor-vsplit.png"
+ "../../../../shared/qtpropertybrowser/images/cursor-wait.png"
+ "../../../../shared/qtpropertybrowser/images/cursor-whatsthis.png"
)
- qt_add_resource(DesignerComponents "qtpropertybrowser"
+ qt_internal_add_resource(DesignerComponentsPrivate "qtpropertybrowser"
PREFIX
"/qt-project.org/qtpropertybrowser"
BASE
diff --git a/src/designer/src/components/lib/lib.pro b/src/designer/src/components/lib/lib.pro
deleted file mode 100644
index 3f6fae950..000000000
--- a/src/designer/src/components/lib/lib.pro
+++ /dev/null
@@ -1,42 +0,0 @@
-TARGET = QtDesignerComponents
-MODULE = designercomponents
-
-QT = core gui-private widgets-private designer-private
-QT_PRIVATE = xml
-CONFIG += internal_module create_cmake
-
-# QtDesignerComponents uses
-DEFINES += QT_STATICPLUGIN
-DEFINES += QDESIGNER_COMPONENTS_LIBRARY
-
-static:DEFINES += QT_DESIGNER_STATIC
-
-SOURCES += qdesigner_components.cpp
-
-INCLUDEPATH += . .. \
- $$PWD/../../lib/components \
- $$PWD/../../lib/sdk \
- $$PWD/../../lib/extension \
- $$PWD/../../lib/shared
-
-include(../propertyeditor/propertyeditor.pri)
-include(../objectinspector/objectinspector.pri)
-include(../signalsloteditor/signalsloteditor.pri)
-include(../formeditor/formeditor.pri)
-include(../widgetbox/widgetbox.pri)
-include(../buddyeditor/buddyeditor.pri)
-include(../taskmenu/taskmenu.pri)
-include(../tabordereditor/tabordereditor.pri)
-
-PRECOMPILED_HEADER= lib_pch.h
-
-# MinGW GCC cc1plus crashes when using precompiled header
-# Date Checked: 3rd September 2012
-#
-# Compilers known to be affected:
-# * MinGW-builds GCC 4.6.3 64-bit
-# * MinGW-builds GCC 4.7.1 64-bit
-# * MinGW-w64 GCC 4.7.1 64-bit (rubenvb)
-mingw:CONFIG -= precompile_header
-
-load(qt_module)
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.pri b/src/designer/src/components/objectinspector/objectinspector.pri
deleted file mode 100644
index ee666acb0..000000000
--- a/src/designer/src/components/objectinspector/objectinspector.pri
+++ /dev/null
@@ -1,16 +0,0 @@
-# --- The Find widget is also linked into the designer_shared library.
-# Avoid conflict when linking statically
-contains(CONFIG, static) {
- INCLUDEPATH *= ../../../../shared/findwidget
-} else {
- include(../../../../shared/findwidget/findwidget.pri)
-}
-
-INCLUDEPATH += $$PWD
-
-HEADERS += $$PWD/objectinspector.h \
- $$PWD/objectinspectormodel_p.h \
- $$PWD/objectinspector_global.h
-
-SOURCES += $$PWD/objectinspector.cpp \
- $$PWD/objectinspectormodel.cpp
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 c539f8f3d..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)) {
@@ -463,7 +435,7 @@ namespace qdesigner_internal {
const QVariant rc = QStandardItemModel::data(index, role);
// Return <noname> if the string is empty for the display role
// only (else, editing starts with <noname>).
- if (role == Qt::DisplayRole && rc.type() == QVariant::String) {
+ if (role == Qt::DisplayRole && rc.metaType().id() == QMetaType::QString) {
const QString s = rc.toString();
if (s.isEmpty()) {
static const QString noName = QCoreApplication::translate("ObjectInspectorModel", "<noname>");
@@ -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 41887cda2..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,12 +133,13 @@ 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
- QtVariantProperty *colorSubProperty = vm->addProperty(QVariant::Color, QCoreApplication::translate("BrushPropertyManager", "Color"));
+ QtVariantProperty *colorSubProperty =
+ vm->addProperty(QMetaType::QColor, QCoreApplication::translate("BrushPropertyManager", "Color"));
property->addSubProperty(colorSubProperty);
m_brushPropertyToColorSubProperty.insert(property, colorSubProperty);
m_brushColorSubPropertyToProperty.insert(colorSubProperty, property);
@@ -167,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;
@@ -192,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);
@@ -207,8 +187,8 @@ void BrushPropertyManager::slotPropertyDestroyed(QtProperty *property)
int BrushPropertyManager::valueChanged(QtVariantPropertyManager *vm, QtProperty *property, const QVariant &value)
{
- switch (value.type()) {
- case QVariant::Int: // Style subproperty?
+ switch (value.metaType().id()) {
+ case QMetaType::Int: // Style subproperty?
if (QtProperty *brushProperty = m_brushStyleSubPropertyToProperty.value(property, 0)) {
const QBrush oldValue = m_brushValues.value(brushProperty);
QBrush newBrush = oldValue;
@@ -220,7 +200,7 @@ int BrushPropertyManager::valueChanged(QtVariantPropertyManager *vm, QtProperty
return DesignerPropertyManager::Changed;
}
break;
- case QVariant::Color: // Color subproperty?
+ case QMetaType::QColor: // Color subproperty?
if (QtProperty *brushProperty = m_brushColorSubPropertyToProperty.value(property, 0)) {
const QBrush oldValue = m_brushValues.value(brushProperty);
QBrush newBrush = oldValue;
@@ -239,9 +219,9 @@ int BrushPropertyManager::valueChanged(QtVariantPropertyManager *vm, QtProperty
int BrushPropertyManager::setValue(QtVariantPropertyManager *vm, QtProperty *property, const QVariant &value)
{
- if (value.type() != QVariant::Brush)
+ 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;
@@ -259,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();
@@ -271,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());
@@ -280,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 48a59b458..868087e2f 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
{
@@ -104,28 +81,29 @@ void TranslatablePropertyManager<PropertySheetValue>::initialize(QtVariantProper
{
m_values.insert(property, value);
- QtVariantProperty *translatable = m->addProperty(QVariant::Bool, DesignerPropertyManager::tr("translatable"));
+ QtVariantProperty *translatable = m->addProperty(QMetaType::Bool, DesignerPropertyManager::tr("translatable"));
translatable->setValue(value.translatable());
m_valueToTranslatable.insert(property, translatable);
m_translatableToValue.insert(translatable, property);
property->addSubProperty(translatable);
if (!DesignerPropertyManager::useIdBasedTranslations()) {
- QtVariantProperty *disambiguation = m->addProperty(QVariant::String, DesignerPropertyManager::tr("disambiguation"));
+ QtVariantProperty *disambiguation =
+ m->addProperty(QMetaType::QString, DesignerPropertyManager::tr("disambiguation"));
disambiguation->setValue(value.disambiguation());
m_valueToDisambiguation.insert(property, disambiguation);
m_disambiguationToValue.insert(disambiguation, property);
property->addSubProperty(disambiguation);
}
- QtVariantProperty *comment = m->addProperty(QVariant::String, DesignerPropertyManager::tr("comment"));
+ QtVariantProperty *comment = m->addProperty(QMetaType::QString, DesignerPropertyManager::tr("comment"));
comment->setValue(value.comment());
m_valueToComment.insert(property, comment);
m_commentToValue.insert(comment, property);
property->addSubProperty(comment);
if (DesignerPropertyManager::useIdBasedTranslations()) {
- QtVariantProperty *id = m->addProperty(QVariant::String, DesignerPropertyManager::tr("id"));
+ QtVariantProperty *id = m->addProperty(QMetaType::QString, DesignerPropertyManager::tr("id"));
id->setValue(value.id());
m_valueToId.insert(property, id);
m_idToValue.insert(id, property);
@@ -270,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());
@@ -439,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();
@@ -456,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);
}
@@ -472,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)
@@ -482,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
{
@@ -825,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);
@@ -912,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++)
@@ -1014,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;
@@ -1029,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);
}
@@ -1054,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);
@@ -1062,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())
@@ -1070,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))
@@ -1101,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());
}
@@ -1123,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);
@@ -1139,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);
}
@@ -1152,6 +826,7 @@ void DesignerPropertyManager::slotPropertyDestroyed(QtProperty *property)
m_fontManager.slotPropertyDestroyed(property);
m_brushManager.slotPropertyDestroyed(property);
}
+ m_alignDefault.remove(property);
}
QStringList DesignerPropertyManager::attributes(int propertyType) const
@@ -1161,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));
- } else if (propertyType == designerStringTypeId() || propertyType == QVariant::String) {
- list.append(QLatin1String(validationModesAttributeC));
- list.append(QLatin1String(fontAttributeC));
- list.append(QLatin1String(themeAttributeC));
- } else if (propertyType == QVariant::Palette) {
- list.append(QLatin1String(superPaletteAttributeC));
- }
- list.append(QLatin1String(resettableAttributeC));
+ list.append(defaultResourceAttributeC);
+ } else if (propertyType == designerStringTypeId() || propertyType == QMetaType::QString) {
+ list.append(validationModesAttributeC);
+ list.append(fontAttributeC);
+ list.append(themeAttributeC);
+ } else if (propertyType == QMetaType::QPalette) {
+ list.append(superPaletteAttributeC);
+ } else if (propertyType == QMetaType::Int) {
+ list.append(themeEnumAttributeC);
+ }
+ list.append(resettableAttributeC);
return list;
}
@@ -1182,109 +859,119 @@ 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))
- return QVariant::Pixmap;
- if (propertyType == designerIconTypeId() && attribute == QLatin1String(defaultResourceAttributeC))
- return QVariant::Icon;
- if (attribute == QLatin1String(resettableAttributeC))
- return QVariant::Bool;
- if (propertyType == designerStringTypeId() || propertyType == QVariant::String) {
- if (attribute == QLatin1String(validationModesAttributeC))
- return QVariant::Int;
- if (attribute == QLatin1String(fontAttributeC))
- return QVariant::Font;
- if (attribute == QLatin1String(themeAttributeC))
- return QVariant::Bool;
- }
- if (propertyType == QVariant::Palette && attribute == QLatin1String(superPaletteAttributeC))
- return QVariant::Palette;
+ if (propertyType == designerPixmapTypeId() && attribute == defaultResourceAttributeC)
+ return QMetaType::QPixmap;
+ if (propertyType == designerIconTypeId() && attribute == defaultResourceAttributeC)
+ return QMetaType::QIcon;
+ if (attribute == resettableAttributeC)
+ return QMetaType::Bool;
+ if (propertyType == designerStringTypeId() || propertyType == QMetaType::QString) {
+ if (attribute == validationModesAttributeC)
+ return QMetaType::Int;
+ if (attribute == fontAttributeC)
+ return QMetaType::QFont;
+ if (attribute == themeAttributeC)
+ return QMetaType::Bool;
+ }
+ if (propertyType == QMetaType::QPalette && attribute == superPaletteAttributeC)
+ return QMetaType::QPalette;
return QtVariantPropertyManager::attributeType(propertyType, attribute);
}
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();
}
+ if (attribute == alignDefaultAttribute()) {
+ Qt::Alignment v = m_alignDefault.value(property,
+ Qt::Alignment(Qt::AlignLeading | Qt::AlignHCenter));
+ return QVariant(uint(v));
+ }
+
return QtVariantPropertyManager::attributeValue(property, attribute);
}
void DesignerPropertyManager::setAttribute(QtProperty *property,
const QString &attribute, const QVariant &value)
{
- if (attribute == QLatin1String(resettableAttributeC) && m_resetMap.contains(property)) {
- if (value.userType() != QVariant::Bool)
+ 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);
@@ -1294,9 +981,9 @@ 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(QVariant::Bool);
+ QtProperty *prop = addProperty(QMetaType::Bool);
prop->setPropertyName(flagName);
property->addSubProperty(prop);
m_propertyToFlags[property].append(prop);
@@ -1316,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)) {
- if (value.userType() != QVariant::Int)
+ } 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();
@@ -1331,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)) {
- if (value.userType() != QVariant::Font)
+ } 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);
@@ -1346,11 +1033,26 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
it.value() = newValue;
emit attributeChanged(property, attribute, newValue);
- } else if (attribute == QLatin1String(themeAttributeC) && m_stringThemeAttributes.contains(property)) {
- if (value.userType() != QVariant::Bool)
+ } else if (attribute == themeAttributeC && m_stringThemeAttributes.contains(property)) {
+ if (value.userType() != QMetaType::Bool)
+ return;
+
+ const auto it = m_stringThemeAttributes.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 == themeEnumAttributeC && m_intThemeEnumAttributes.contains(property)) {
+ if (value.userType() != QMetaType::Bool)
return;
- const PropertyBoolMap::iterator it = m_stringThemeAttributes.find(property);
+ const auto it = m_intThemeEnumAttributes.find(property);
const bool oldValue = it.value();
const bool newValue = value.toBool();
@@ -1361,20 +1063,20 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
it.value() = newValue;
emit attributeChanged(property, attribute, newValue);
- } else if (attribute == QLatin1String(superPaletteAttributeC) && m_paletteValues.contains(property)) {
- if (value.userType() != QVariant::Palette)
+ } 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);
@@ -1386,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)) {
- if (value.userType() != QVariant::Pixmap)
+ } 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;
@@ -1403,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)) {
- if (value.userType() != QVariant::Icon)
+ } 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;
@@ -1418,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));
}
}
@@ -1431,6 +1133,8 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
emit attributeChanged(property, attribute, v);
emit propertyChanged(property);
+ } else if (attribute == alignDefaultAttribute()) {
+ m_alignDefault[property] = Qt::Alignment(value.toUInt());
}
QtVariantPropertyManager::setAttribute(property, attribute, value);
}
@@ -1478,17 +1182,27 @@ int DesignerPropertyManager::designerKeySequenceTypeId()
return qMetaTypeId<PropertySheetKeySequenceValue>();
}
+QString DesignerPropertyManager::alignDefaultAttribute()
+{
+ return u"alignDefault"_s;
+}
+
+uint DesignerPropertyManager::alignDefault(const QtVariantProperty *prop)
+{
+ return prop->attributeValue(DesignerPropertyManager::alignDefaultAttribute()).toUInt();
+}
+
bool DesignerPropertyManager::isPropertyTypeSupported(int propertyType) const
{
switch (propertyType) {
- case QVariant::Palette:
- case QVariant::UInt:
- case QVariant::LongLong:
- case QVariant::ULongLong:
- case QVariant::Url:
- case QVariant::ByteArray:
- case QVariant::StringList:
- case QVariant::Brush:
+ case QMetaType::QPalette:
+ case QMetaType::UInt:
+ case QMetaType::LongLong:
+ case QMetaType::ULongLong:
+ case QMetaType::QUrl:
+ case QMetaType::QByteArray:
+ case QMetaType::QStringList:
+ case QMetaType::QBrush:
return true;
default:
break;
@@ -1512,82 +1226,75 @@ 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 == QVariant::String || vType == designerStringTypeId()) {
- const QString str = (QtVariantPropertyManager::valueType(property) == QVariant::String) ? value(property).toString() : qvariant_cast<PropertySheetStringValue>(value(property)).value();
- const int validationMode = attributeValue(property, QLatin1String(validationModesAttributeC)).toInt();
+ 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, validationModesAttributeC).toInt();
return TextPropertyEditor::stringToEditorString(str, static_cast<TextPropertyValidationMode>(validationMode));
}
- if (vType == QVariant::StringList || vType == designerStringListTypeId()) {
+ if (vType == QMetaType::QStringList || vType == designerStringListTypeId()) {
QVariant v = value(property);
- const QStringList list = v.type() == QVariant::StringList ? v.toStringList() : qvariant_cast<PropertySheetStringListValue>(v).value();
- return list.join(QLatin1String("; "));
+ const QStringList list = v.metaType().id() == QMetaType::QStringList
+ ? v.toStringList() : qvariant_cast<PropertySheetStringListValue>(v).value();
+ return list.join("; "_L1);
}
if (vType == designerKeySequenceTypeId()) {
return qvariant_cast<PropertySheetKeySequenceValue>(value(property)).value().toString(QKeySequence::NativeText);
}
- if (vType == QVariant::Bool) {
+ if (vType == QMetaType::Bool) {
return QString();
}
@@ -1601,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);
@@ -1615,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()));
}
@@ -1635,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;
@@ -1662,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);
}
@@ -1695,22 +1405,22 @@ QVariant DesignerPropertyManager::value(const QtProperty *property) const
int DesignerPropertyManager::valueType(int propertyType) const
{
switch (propertyType) {
- case QVariant::Palette:
- case QVariant::UInt:
- case QVariant::LongLong:
- case QVariant::ULongLong:
- case QVariant::Url:
- case QVariant::ByteArray:
- case QVariant::StringList:
- case QVariant::Brush:
+ case QMetaType::QPalette:
+ case QMetaType::UInt:
+ case QMetaType::LongLong:
+ case QMetaType::ULongLong:
+ case QMetaType::QUrl:
+ case QMetaType::QByteArray:
+ case QMetaType::QStringList:
+ case QMetaType::QBrush:
return propertyType;
default:
break;
}
if (propertyType == designerFlagTypeId())
- return QVariant::UInt;
+ return QMetaType::UInt;
if (propertyType == designerAlignmentTypeId())
- return QVariant::UInt;
+ return QMetaType::UInt;
if (propertyType == designerPixmapTypeId())
return propertyType;
if (propertyType == designerIconTypeId())
@@ -1739,10 +1449,10 @@ 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.type() != QVariant::UInt && !value.canConvert<uint>())
+ if (value.metaType().id() != QMetaType::UInt && !value.canConvert<uint>())
return;
const uint v = value.toUInt();
@@ -1755,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);
@@ -1774,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;
@@ -1794,7 +1504,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
return;
}
if (m_alignValues.contains(property)) {
- if (value.type() != QVariant::UInt && !value.canConvert<uint>())
+ if (value.metaType().id() != QMetaType::UInt && !value.canConvert<uint>())
return;
const uint v = value.toUInt();
@@ -1820,14 +1530,14 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
return;
}
if (m_paletteValues.contains(property)) {
- if (value.type() != QVariant::Palette && !value.canConvert<QPalette>())
+ if (value.metaType().id() != QMetaType::QPalette && !value.canConvert<QPalette>())
return;
QPalette p = qvariant_cast<QPalette>(value);
PaletteData data = m_paletteValues.value(property);
- const uint mask = p.resolveMask();
+ const auto mask = p.resolveMask();
p = p.resolve(data.superPalette);
p.setResolveMask(mask);
@@ -1864,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));
@@ -1880,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.
@@ -1914,8 +1629,25 @@ 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.type() != QVariant::UInt && !value.canConvert<uint>())
+ if (value.metaType().id() != QMetaType::UInt && !value.canConvert<uint>())
return;
const uint v = value.toUInt(nullptr);
@@ -1932,7 +1664,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
return;
}
if (m_longLongValues.contains(property)) {
- if (value.type() != QVariant::LongLong && !value.canConvert<qlonglong>())
+ if (value.metaType().id() != QMetaType::LongLong && !value.canConvert<qlonglong>())
return;
const qlonglong v = value.toLongLong(nullptr);
@@ -1949,7 +1681,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
return;
}
if (m_uLongLongValues.contains(property)) {
- if (value.type() != QVariant::ULongLong && !value.canConvert<qulonglong>())
+ if (value.metaType().id() != QMetaType::ULongLong && !value.canConvert<qulonglong>())
return;
qulonglong v = value.toULongLong(nullptr);
@@ -1966,7 +1698,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
return;
}
if (m_urlValues.contains(property)) {
- if (value.type() != QVariant::Url && !value.canConvert<QUrl>())
+ if (value.metaType().id() != QMetaType::QUrl && !value.canConvert<QUrl>())
return;
const QUrl v = value.toUrl();
@@ -1983,7 +1715,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
return;
}
if (m_byteArrayValues.contains(property)) {
- if (value.type() != QVariant::ByteArray && !value.canConvert<QByteArray>())
+ if (value.metaType().id() != QMetaType::QByteArray && !value.canConvert<QByteArray>())
return;
const QByteArray v = value.toByteArray();
@@ -2001,7 +1733,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
}
m_fontManager.setValue(this, property, value);
QtVariantPropertyManager::setValue(property, value);
- if (QtVariantPropertyManager::valueType(property) == QVariant::Bool)
+ if (QtVariantPropertyManager::valueType(property) == QMetaType::Bool)
property->setToolTip(QtVariantPropertyManager::valueText(property));
}
@@ -2012,30 +1744,34 @@ void DesignerPropertyManager::initializeProperty(QtProperty *property)
const int type = propertyType(property);
m_fontManager.preInitializeProperty(property, type, m_resetMap);
switch (type) {
- case QVariant::Palette:
+ case QMetaType::QPalette:
m_paletteValues[property] = PaletteData();
break;
- case QVariant::String:
+ case QMetaType::QString:
m_stringAttributes[property] = ValidationSingleLine;
m_stringFontAttributes[property] = QApplication::font();
m_stringThemeAttributes[property] = false;
break;
- case QVariant::UInt:
+ case QMetaType::Int:
+ m_intValues[property] = 0;
+ m_intThemeEnumAttributes[property] = false;
+ break;
+ case QMetaType::UInt:
m_uintValues[property] = 0;
break;
- case QVariant::LongLong:
+ case QMetaType::LongLong:
m_longLongValues[property] = 0;
break;
- case QVariant::ULongLong:
+ case QMetaType::ULongLong:
m_uLongLongValues[property] = 0;
break;
- case QVariant::Url:
+ case QMetaType::QUrl:
m_urlValues[property] = QUrl();
break;
- case QVariant::ByteArray:
+ case QMetaType::QByteArray:
m_byteArrayValues[property] = QByteArray();
break;
- case QVariant::Brush:
+ case QMetaType::QBrush:
m_brushManager.initializeProperty(this, property, enumTypeId());
break;
default:
@@ -2049,7 +1785,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;
@@ -2058,7 +1794,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;
@@ -2070,8 +1806,16 @@ void DesignerPropertyManager::initializeProperty(QtProperty *property)
m_iconValues[property] = PropertySheetIconValue();
m_defaultIcons[property] = QIcon();
- QtVariantProperty *themeProp = addProperty(QVariant::String, 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;
@@ -2099,13 +1843,13 @@ void DesignerPropertyManager::initializeProperty(QtProperty *property)
QtVariantPropertyManager::initializeProperty(property);
m_fontManager.postInitializeProperty(this, property, type, DesignerPropertyManager::enumTypeId());
- if (type == QVariant::Double)
- setAttribute(property, QStringLiteral("decimals"), 6);
+ if (type == QMetaType::Double)
+ 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;
@@ -2148,6 +1892,11 @@ void DesignerPropertyManager::uninitializeProperty(QtProperty *property)
m_iconSubPropertyToProperty.remove(iconTheme);
}
+ if (QtProperty *iconThemeEnum = m_propertyToThemeEnum.value(property)) {
+ m_iconSubPropertyToProperty.remove(iconThemeEnum);
+ delete iconThemeEnum;
+ }
+
m_propertyToAlignH.remove(property);
m_propertyToAlignV.remove(property);
@@ -2162,7 +1911,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;
@@ -2173,6 +1922,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);
@@ -2185,6 +1935,16 @@ void DesignerPropertyManager::uninitializeProperty(QtProperty *property)
QtVariantPropertyManager::uninitializeProperty(property);
}
+bool DesignerPropertyManager::resetTextAlignmentProperty(QtProperty *property)
+{
+ const auto it = m_alignDefault.constFind(property);
+ if (it == m_alignDefault.cend())
+ return false;
+ QtVariantProperty *alignProperty = variantProperty(property);
+ alignProperty->setValue(DesignerPropertyManager::alignDefault(alignProperty));
+ alignProperty->setModified(false);
+ return true;
+}
bool DesignerPropertyManager::resetFontSubProperty(QtProperty *property)
{
@@ -2202,11 +1962,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;
}
@@ -2284,23 +2050,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 == QVariant::String) {
- if (attribute == QLatin1String(validationModesAttributeC)) {
+ } else if (type == DesignerPropertyManager::designerStringTypeId() || type == QMetaType::QString) {
+ 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 == QVariant::Palette && 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);
}
@@ -2311,14 +2077,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);
}
}
@@ -2330,34 +2099,38 @@ void DesignerEditorFactory::slotValueChanged(QtProperty *property, const QVarian
QtVariantPropertyManager *manager = propertyManager(property);
const int type = manager->propertyType(property);
switch (type) {
- case QVariant::String:
+ case QMetaType::QString:
applyToEditors(m_stringPropertyToEditors.value(property), &TextEditor::setText, value.toString());
break;
- case QVariant::Palette:
+ case QMetaType::QPalette:
applyToEditors(m_palettePropertyToEditors.value(property), &PaletteEditorButton::setPalette, qvariant_cast<QPalette>(value));
break;
- case QVariant::UInt:
+ case QMetaType::Int:
+ applyToEditors(m_intPropertyToComboEditors.value(property), &QComboBox::setCurrentIndex, value.toInt());
+ break;
+ case QMetaType::UInt:
applyToEditors(m_uintPropertyToEditors.value(property), &QLineEdit::setText, QString::number(value.toUInt()));
break;
- case QVariant::LongLong:
+ case QMetaType::LongLong:
applyToEditors(m_longLongPropertyToEditors.value(property), &QLineEdit::setText, QString::number(value.toLongLong()));
break;
- case QVariant::ULongLong:
+ case QMetaType::ULongLong:
applyToEditors(m_uLongLongPropertyToEditors.value(property), &QLineEdit::setText, QString::number(value.toULongLong()));
break;
- case QVariant::Url:
+ case QMetaType::QUrl:
applyToEditors(m_urlPropertyToEditors.value(property), &TextEditor::setText, value.toUrl().toString());
break;
- case QVariant::ByteArray:
+ case QMetaType::QByteArray:
applyToEditors(m_byteArrayPropertyToEditors.value(property), &TextEditor::setText, QString::fromUtf8(value.toByteArray()));
break;
- case QVariant::StringList:
+ case QMetaType::QStringList:
applyToEditors(m_stringListPropertyToEditors.value(property), &StringListEditorButton::setStringList, value.toStringList());
break;
default:
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());
@@ -2388,20 +2161,21 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
QWidget *editor = nullptr;
const int type = manager->propertyType(property);
switch (type) {
- case QVariant::Bool: {
+ case QMetaType::Bool: {
editor = QtVariantEditorFactory::createEditor(manager, property, parent);
QtBoolEdit *boolEdit = qobject_cast<QtBoolEdit *>(editor);
if (boolEdit)
boolEdit->setTextVisible(false);
}
break;
- case QVariant::String: {
- const TextPropertyValidationMode tvm = static_cast<TextPropertyValidationMode>(manager->attributeValue(property, QLatin1String(validationModesAttributeC)).toInt());
+ case QMetaType::QString: {
+ 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));
- if (richTextDefaultFont.type() == QVariant::Font)
+ 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;
@@ -2410,9 +2184,9 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
editor = ed;
}
break;
- case QVariant::Palette: {
+ 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);
@@ -2420,7 +2194,19 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
editor = ed;
}
break;
- case QVariant::UInt: {
+ 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;
+ }
+ break;
+ case QMetaType::UInt: {
QLineEdit *ed = new QLineEdit(parent);
ed->setValidator(new QULongLongValidator(0, UINT_MAX, ed));
ed->setText(QString::number(manager->value(property).toUInt()));
@@ -2431,7 +2217,7 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
editor = ed;
}
break;
- case QVariant::LongLong: {
+ case QMetaType::LongLong: {
QLineEdit *ed = new QLineEdit(parent);
ed->setValidator(new QLongLongValidator(ed));
ed->setText(QString::number(manager->value(property).toLongLong()));
@@ -2442,7 +2228,7 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
editor = ed;
}
break;
- case QVariant::ULongLong: {
+ case QMetaType::ULongLong: {
QLineEdit *ed = new QLineEdit(parent);
ed->setValidator(new QULongLongValidator(ed));
ed->setText(QString::number(manager->value(property).toULongLong()));
@@ -2453,7 +2239,7 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
editor = ed;
}
break;
- case QVariant::Url: {
+ case QMetaType::QUrl: {
TextEditor *ed = createTextEditor(parent, ValidationURL, manager->value(property).toUrl().toString());
ed->setUpdateMode(TextPropertyEditor::UpdateOnFinished);
m_urlPropertyToEditors[property].append(ed);
@@ -2463,7 +2249,7 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
editor = ed;
}
break;
- case QVariant::ByteArray: {
+ case QMetaType::QByteArray: {
TextEditor *ed = createTextEditor(parent, ValidationMultiLine, QString::fromUtf8(manager->value(property).toByteArray()));
m_byteArrayPropertyToEditors[property].append(ed);
m_editorToByteArrayProperty[ed] = property;
@@ -2477,7 +2263,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;
@@ -2490,35 +2276,37 @@ 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));
- if (richTextDefaultFont.type() == QVariant::Font)
+ const QVariant richTextDefaultFont = manager->attributeValue(property, fontAttributeC);
+ if (richTextDefaultFont.metaType().id() == QMetaType::QFont)
ed->setRichTextDefaultFont(qvariant_cast<QFont>(richTextDefaultFont));
m_stringPropertyToEditors[property].append(ed);
m_editorToStringProperty[ed] = property;
connect(ed, &QObject::destroyed, this, &DesignerEditorFactory::slotEditorDestroyed);
connect(ed, &TextEditor::textChanged, this, &DesignerEditorFactory::slotStringTextChanged);
editor = ed;
- } else if (type == DesignerPropertyManager::designerStringListTypeId() || type == QVariant::StringList) {
+ } else if (type == DesignerPropertyManager::designerStringListTypeId() || type == QMetaType::QStringList) {
const QVariant variantValue = manager->value(property);
- const QStringList value = type == QVariant::StringList ? variantValue.toStringList() :
- qvariant_cast<PropertySheetStringListValue>(variantValue).value();
+ const QStringList value = type == QMetaType::QStringList
+ ? variantValue.toStringList() : qvariant_cast<PropertySheetStringListValue>(variantValue).value();
StringListEditorButton *ed = new StringListEditorButton(value, parent);
m_stringListPropertyToEditors[property].append(ed);
m_editorToStringListProperty.insert(ed, property);
@@ -2539,14 +2327,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;
@@ -2584,6 +2372,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))
@@ -2596,7 +2386,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;
@@ -2623,6 +2413,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());
@@ -2639,7 +2435,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)
@@ -2714,6 +2510,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())) {
@@ -2831,8 +2635,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 abc6e385c..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
@@ -135,6 +111,7 @@ public:
QString valueText(const QtProperty *property) const override;
QIcon valueIcon(const QtProperty *property) const override;
+ bool resetTextAlignmentProperty(QtProperty *property);
bool resetFontSubProperty(QtProperty *property);
bool resetIconSubProperty(QtProperty *subProperty);
@@ -156,6 +133,10 @@ public:
static bool useIdBasedTranslations()
{ return m_IdBasedTranslations; }
+ static QString alignDefaultAttribute();
+
+ static uint alignDefault(const QtVariantProperty *prop);
+
public Q_SLOTS:
void setAttribute(QtProperty *property, const QString &attribute, const QVariant &value) override;
void setValue(QtProperty *property, const QVariant &value) override;
@@ -172,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;
@@ -194,17 +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;
@@ -215,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;
@@ -274,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);
@@ -290,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 b624de147..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();
@@ -79,7 +69,7 @@ namespace qdesigner_internal {
resetMap[property] = true;
}
- if (type == QVariant::Font)
+ if (type == QMetaType::QFont)
m_createdFontProperty = property;
}
@@ -103,24 +93,33 @@ namespace qdesigner_internal {
int type,
int enumTypeId)
{
- if (type != QVariant::Font)
+ if (type != QMetaType::QFont)
return;
// This will cause a recursion
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 0a0046c9c..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,47 +10,77 @@
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);
-
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
-
- m_ui->m_comboBox->addItem(QStringLiteral("String"), QVariant(QVariant::String));
- m_ui->m_comboBox->addItem(QStringLiteral("StringList"), QVariant(QVariant::StringList));
- m_ui->m_comboBox->addItem(QStringLiteral("Char"), QVariant(QVariant::Char));
- m_ui->m_comboBox->addItem(QStringLiteral("ByteArray"), QVariant(QVariant::ByteArray));
- m_ui->m_comboBox->addItem(QStringLiteral("Url"), QVariant(QVariant::Url));
- m_ui->m_comboBox->addItem(QStringLiteral("Bool"), QVariant(QVariant::Bool));
- m_ui->m_comboBox->addItem(QStringLiteral("Int"), QVariant(QVariant::Int));
- m_ui->m_comboBox->addItem(QStringLiteral("UInt"), QVariant(QVariant::UInt));
- m_ui->m_comboBox->addItem(QStringLiteral("LongLong"), QVariant(QVariant::LongLong));
- m_ui->m_comboBox->addItem(QStringLiteral("ULongLong"), QVariant(QVariant::ULongLong));
- m_ui->m_comboBox->addItem(QStringLiteral("Double"), QVariant(QVariant::Double));
- m_ui->m_comboBox->addItem(QStringLiteral("Size"), QVariant(QVariant::Size));
- m_ui->m_comboBox->addItem(QStringLiteral("SizeF"), QVariant(QVariant::SizeF));
- m_ui->m_comboBox->addItem(QStringLiteral("Point"), QVariant(QVariant::Point));
- m_ui->m_comboBox->addItem(QStringLiteral("PointF"), QVariant(QVariant::PointF));
- m_ui->m_comboBox->addItem(QStringLiteral("Rect"), QVariant(QVariant::Rect));
- m_ui->m_comboBox->addItem(QStringLiteral("RectF"), QVariant(QVariant::RectF));
- m_ui->m_comboBox->addItem(QStringLiteral("Date"), QVariant(QVariant::Date));
- m_ui->m_comboBox->addItem(QStringLiteral("Time"), QVariant(QVariant::Time));
- m_ui->m_comboBox->addItem(QStringLiteral("DateTime"), QVariant(QVariant::DateTime));
- m_ui->m_comboBox->addItem(QStringLiteral("Font"), QVariant(QVariant::Font));
- m_ui->m_comboBox->addItem(QStringLiteral("Palette"), QVariant(QVariant::Palette));
- m_ui->m_comboBox->addItem(QStringLiteral("Color"), QVariant(QVariant::Color));
- m_ui->m_comboBox->addItem(QStringLiteral("Pixmap"), QVariant(QVariant::Pixmap));
- m_ui->m_comboBox->addItem(QStringLiteral("Icon"), QVariant(QVariant::Icon));
- m_ui->m_comboBox->addItem(QStringLiteral("Cursor"), QVariant(QVariant::Cursor));
- m_ui->m_comboBox->addItem(QStringLiteral("SizePolicy"), QVariant(QVariant::SizePolicy));
- m_ui->m_comboBox->addItem(QStringLiteral("KeySequence"), QVariant(QVariant::KeySequence));
+ connect(m_ui->m_buttonBox, &QDialogButtonBox::clicked,
+ this, &NewDynamicPropertyDialog::buttonBoxClicked);
+
+ m_ui->m_comboBox->addItem(u"String"_s,
+ QVariant(QMetaType(QMetaType::QString)));
+ m_ui->m_comboBox->addItem(u"StringList"_s,
+ QVariant(QMetaType(QMetaType::QStringList)));
+ m_ui->m_comboBox->addItem(u"Char"_s,
+ QVariant(QMetaType(QMetaType::QChar)));
+ m_ui->m_comboBox->addItem(u"ByteArray"_s,
+ QVariant(QMetaType(QMetaType::QByteArray)));
+ m_ui->m_comboBox->addItem(u"Url"_s,
+ QVariant(QMetaType(QMetaType::QUrl)));
+ m_ui->m_comboBox->addItem(u"Bool"_s,
+ QVariant(QMetaType(QMetaType::Bool)));
+ m_ui->m_comboBox->addItem(u"Int"_s,
+ QVariant(QMetaType(QMetaType::Int)));
+ m_ui->m_comboBox->addItem(u"UInt"_s,
+ QVariant(QMetaType(QMetaType::UInt)));
+ m_ui->m_comboBox->addItem(u"LongLong"_s,
+ QVariant(QMetaType(QMetaType::LongLong)));
+ m_ui->m_comboBox->addItem(u"ULongLong"_s,
+ QVariant(QMetaType(QMetaType::ULongLong)));
+ m_ui->m_comboBox->addItem(u"Double"_s,
+ QVariant(QMetaType(QMetaType::Double)));
+ m_ui->m_comboBox->addItem(u"Size"_s,
+ QVariant(QMetaType(QMetaType::QSize)));
+ m_ui->m_comboBox->addItem(u"SizeF"_s,
+ QVariant(QMetaType(QMetaType::QSizeF)));
+ m_ui->m_comboBox->addItem(u"Point"_s,
+ QVariant(QMetaType(QMetaType::QPoint)));
+ m_ui->m_comboBox->addItem(u"PointF"_s,
+ QVariant(QMetaType(QMetaType::QPointF)));
+ m_ui->m_comboBox->addItem(u"Rect"_s,
+ QVariant(QMetaType(QMetaType::QRect)));
+ m_ui->m_comboBox->addItem(u"RectF"_s,
+ QVariant(QMetaType(QMetaType::QRectF)));
+ m_ui->m_comboBox->addItem(u"Date"_s,
+ QVariant(QMetaType(QMetaType::QDate)));
+ m_ui->m_comboBox->addItem(u"Time"_s,
+ QVariant(QMetaType(QMetaType::QTime)));
+ m_ui->m_comboBox->addItem(u"DateTime"_s,
+ QVariant(QMetaType(QMetaType::QDateTime)));
+ m_ui->m_comboBox->addItem(u"Font"_s,
+ QVariant(QMetaType(QMetaType::QFont)));
+ m_ui->m_comboBox->addItem(u"Palette"_s,
+ QVariant(QMetaType(QMetaType::QPalette)));
+ m_ui->m_comboBox->addItem(u"Color"_s,
+ QVariant(QMetaType(QMetaType::QColor)));
+ m_ui->m_comboBox->addItem(u"Pixmap"_s,
+ QVariant(QMetaType(QMetaType::QPixmap)));
+ m_ui->m_comboBox->addItem(u"Icon"_s,
+ QVariant(QMetaType(QMetaType::QIcon)));
+ m_ui->m_comboBox->addItem(u"Cursor"_s,
+ QVariant(QMetaType(QMetaType::QCursor)));
+ m_ui->m_comboBox->addItem(u"SizePolicy"_s,
+ QVariant(QMetaType(QMetaType::QSizePolicy)));
+ m_ui->m_comboBox->addItem(u"KeySequence"_s,
+ QVariant(QMetaType(QMetaType::QKeySequence)));
m_ui->m_comboBox->setCurrentIndex(0); // String
setOkButtonEnabled(false);
@@ -96,9 +101,9 @@ void NewDynamicPropertyDialog::setReservedNames(const QStringList &names)
m_reservedNames = names;
}
-void NewDynamicPropertyDialog::setPropertyType(QVariant::Type t)
+void NewDynamicPropertyDialog::setPropertyType(int t)
{
- const int index = m_ui->m_comboBox->findData(QVariant(t));
+ const int index = m_ui->m_comboBox->findData(QVariant(QMetaType(t)));
if (index != -1)
m_ui->m_comboBox->setCurrentIndex(index);
}
@@ -132,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 17daee4c3..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
@@ -64,14 +39,14 @@ public:
~NewDynamicPropertyDialog();
void setReservedNames(const QStringList &names);
- void setPropertyType(QVariant::Type t);
+ void setPropertyType(int t);
QString propertyName() const;
QVariant propertyValue() const;
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 f42fba6b3..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);
@@ -256,21 +225,21 @@ PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *pare
m_addDynamicAction->setMenu(addDynamicActionMenu);
m_addDynamicAction->setEnabled(false);
QAction *addDynamicAction = addDynamicActionGroup->addAction(tr("String..."));
- addDynamicAction->setData(static_cast<int>(QVariant::String));
+ addDynamicAction->setData(static_cast<int>(QMetaType::QString));
addDynamicActionMenu->addAction(addDynamicAction);
addDynamicAction = addDynamicActionGroup->addAction(tr("Bool..."));
- addDynamicAction->setData(static_cast<int>(QVariant::Bool));
+ addDynamicAction->setData(static_cast<int>(QMetaType::Bool));
addDynamicActionMenu->addAction(addDynamicAction);
addDynamicActionMenu->addSeparator();
addDynamicAction = addDynamicActionGroup->addAction(tr("Other..."));
- addDynamicAction->setData(static_cast<int>(QVariant::Invalid));
+ addDynamicAction->setData(static_cast<int>(QMetaType::UnknownType));
addDynamicActionMenu->addAction(addDynamicAction);
// remove
m_removeDynamicAction->setEnabled(false);
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));
@@ -695,9 +656,9 @@ void PropertyEditor::slotAddDynamicProperty(QAction *action)
QString newName;
QVariant newValue;
{ // Make sure the dialog is closed before the signal is emitted.
- const QVariant::Type type = static_cast<QVariant::Type>(action->data().toInt());
+ const int type = action->data().toInt();
NewDynamicPropertyDialog dlg(core()->dialogGui(), m_currentBrowser);
- if (type != QVariant::Invalid)
+ if (type != QMetaType::UnknownType)
dlg.setPropertyType(type);
QStringList reservedNames;
@@ -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);
@@ -815,7 +776,7 @@ void PropertyEditor::updateBrowserValue(QtVariantProperty *property, const QVari
}
// Rich text string property with comment: Store/Update the font the rich text editor dialog starts out with
- if (type == QVariant::String && !property->subProperties().isEmpty()) {
+ if (type == QMetaType::QString && !property->subProperties().isEmpty()) {
const int fontIndex = m_propertySheet->indexOf(m_strings.m_fontProperty);
if (fontIndex != -1)
property->setAttribute(m_strings.m_fontAttribute, m_propertySheet->property(fontIndex));
@@ -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());
}
}
@@ -866,8 +827,8 @@ QString PropertyEditor::realClassName(QObject *object) const
static const char *typeName(int type)
{
if (type == qMetaTypeId<PropertySheetStringValue>())
- type = QVariant::String;
- if (type < int(QVariant::UserType))
+ type = QMetaType::QString;
+ if (type < int(QMetaType::User))
return QMetaType(type).name();
if (type == qMetaTypeId<PropertySheetIconValue>())
return "QIcon";
@@ -879,9 +840,9 @@ static const char *typeName(int type)
return "QFlags";
if (type == qMetaTypeId<PropertySheetEnumValue>())
return "enum";
- if (type == QVariant::Invalid)
+ if (type == QMetaType::UnknownType)
return "invalid";
- if (type == QVariant::UserType)
+ if (type == QMetaType::User)
return "user type";
return nullptr;
}
@@ -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,23 +995,23 @@ 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())
property->setDescriptionToolTip(descriptionToolTip);
switch (type) {
- case QVariant::Palette:
+ case QMetaType::QPalette:
setupPaletteProperty(property);
break;
- case QVariant::KeySequence:
+ case QMetaType::QKeySequence:
//addCommentProperty(property, propertyName);
break;
default:
break;
}
- if (type == QVariant::String || type == qMetaTypeId<PropertySheetStringValue>())
+ if (type == QMetaType::QString || type == qMetaTypeId<PropertySheetStringValue>())
setupStringProperty(property, isMainContainer);
property->setAttribute(m_strings.m_resettableAttribute, m_propertySheet->hasReset(i));
@@ -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 == QVariant::Rect) {
+ 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);
}
}
@@ -1188,6 +1149,9 @@ void PropertyEditor::slotResetProperty(QtProperty *property)
if (m_propertyManager->resetIconSubProperty(property))
return;
+ if (m_propertyManager->resetTextAlignmentProperty(property))
+ return;
+
if (!m_propertyToGroup.contains(property))
return;
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.pri b/src/designer/src/components/propertyeditor/propertyeditor.pri
deleted file mode 100644
index 6b095632b..000000000
--- a/src/designer/src/components/propertyeditor/propertyeditor.pri
+++ /dev/null
@@ -1,48 +0,0 @@
-INCLUDEPATH += $$PWD
-
-# --- Property browser is also linked into the designer_shared library.
-# Avoid conflict when linking statically
-contains(CONFIG, static) {
- INCLUDEPATH *= ../../../../shared/qtpropertybrowser
- INCLUDEPATH *= ../../../../shared/qtgradienteditor
-} else {
- include(../../../../shared/qtpropertybrowser/qtpropertybrowser.pri)
- include(../../../../shared/qtgradienteditor/qtcolorbutton.pri)
-}
-
-FORMS += $$PWD/paletteeditor.ui \
- $$PWD/stringlisteditor.ui \
- $$PWD/previewwidget.ui \
- $$PWD/newdynamicpropertydialog.ui
-
-HEADERS += $$PWD/propertyeditor.h \
- $$PWD/designerpropertymanager.h \
- $$PWD/paletteeditor.h \
- $$PWD/paletteeditorbutton.h \
- $$PWD/stringlisteditor.h \
- $$PWD/stringlisteditorbutton.h \
- $$PWD/previewwidget.h \
- $$PWD/previewframe.h \
- $$PWD/newdynamicpropertydialog.h \
- $$PWD/brushpropertymanager.h \
- $$PWD/fontpropertymanager.h
-
-SOURCES += $$PWD/propertyeditor.cpp \
- $$PWD/designerpropertymanager.cpp \
- $$PWD/paletteeditor.cpp \
- $$PWD/paletteeditorbutton.cpp \
- $$PWD/stringlisteditor.cpp \
- $$PWD/stringlisteditorbutton.cpp \
- $$PWD/previewwidget.cpp \
- $$PWD/previewframe.cpp \
- $$PWD/newdynamicpropertydialog.cpp \
- $$PWD/brushpropertymanager.cpp \
- $$PWD/fontpropertymanager.cpp
-
-HEADERS += \
- $$PWD/propertyeditor_global.h \
- $$PWD/qlonglongvalidator.h
-
-SOURCES += $$PWD/qlonglongvalidator.cpp
-
-RESOURCES += $$PWD/propertyeditor.qrc
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.pri b/src/designer/src/components/signalsloteditor/signalsloteditor.pri
deleted file mode 100644
index f8d9d359c..000000000
--- a/src/designer/src/components/signalsloteditor/signalsloteditor.pri
+++ /dev/null
@@ -1,22 +0,0 @@
-
-INCLUDEPATH += $$PWD
-
-HEADERS += $$PWD/signalslot_utils_p.h \
- $$PWD/connectdialog_p.h \
- $$PWD/signalsloteditor.h \
- $$PWD/signalsloteditor_tool.h \
- $$PWD/signalsloteditor_plugin.h \
- $$PWD/signalsloteditor_global.h \
- $$PWD/signalsloteditor_p.h \
- $$PWD/signalsloteditorwindow.h
-
-SOURCES += $$PWD/signalslot_utils.cpp \
- $$PWD/connectdialog.cpp \
- $$PWD/signalsloteditor.cpp \
- $$PWD/signalsloteditor_tool.cpp \
- $$PWD/signalsloteditor_plugin.cpp \
- $$PWD/signalsloteditorwindow.cpp
-
-FORMS += $$PWD/connectdialog.ui
-
-OTHER_FILES += $$PWD/signalsloteditor.json
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 fd6a90eb2..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)
@@ -308,7 +285,7 @@ bool ConnectionModel::setData(const QModelIndex &index, const QVariant &data, in
{
if (!index.isValid() || !m_editor)
return false;
- if (data.type() != QVariant::String)
+ if (data.metaType().id() != QMetaType::QString)
return false;
SignalSlotConnection *con = static_cast<SignalSlotConnection*>(m_editor->connection(index.row()));
@@ -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;
}
}
@@ -592,7 +566,7 @@ ConnectionDelegate::ConnectionDelegate(QWidget *parent)
factory = new QItemEditorFactory;
QItemEditorCreatorBase *creator
= new QItemEditorCreator<InlineEditor>("text");
- factory->registerEditor(QVariant::String, creator);
+ factory->registerEditor(QMetaType::QString, creator);
}
setItemEditorFactory(factory);
@@ -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);
@@ -743,7 +717,7 @@ void SignalSlotEditorWindow::setActiveFormWindow(QDesignerFormWindowInterface *f
}
}
- m_editor = form->findChild<SignalSlotEditor*>();
+ m_editor = form ? form->findChild<SignalSlotEditor*>() : nullptr;
m_model->setEditor(m_editor);
if (!m_editor.isNull()) {
ConnectionDelegate *delegate
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.pri b/src/designer/src/components/tabordereditor/tabordereditor.pri
deleted file mode 100644
index da1ecfbae..000000000
--- a/src/designer/src/components/tabordereditor/tabordereditor.pri
+++ /dev/null
@@ -1,17 +0,0 @@
-
-QT += xml
-
-INCLUDEPATH += $$PWD
-
-HEADERS += \
- $$PWD/tabordereditor.h \
- $$PWD/tabordereditor_plugin.h \
- $$PWD/tabordereditor_tool.h \
- $$PWD/tabordereditor_global.h
-
-SOURCES += \
- $$PWD/tabordereditor.cpp \
- $$PWD/tabordereditor_tool.cpp \
- $$PWD/tabordereditor_plugin.cpp
-
-OTHER_FILES += $$PWD/tabordereditor.json
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 ffa793c17..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);
@@ -116,24 +92,29 @@ static QStringList c2qStringList(const char * const in[])
return out;
}
-void AbstractItemEditor::setupProperties(PropertyDefinition *propList)
+void AbstractItemEditor::setupProperties(const PropertyDefinition *propList,
+ Qt::Alignment alignDefault)
{
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);
@@ -148,9 +129,11 @@ void AbstractItemEditor::setupObject(QWidget *object)
m_editorFactory->setFormWindowBase(fwb);
}
-void AbstractItemEditor::setupEditor(QWidget *object, PropertyDefinition *propList)
+void AbstractItemEditor::setupEditor(QWidget *object,
+ const PropertyDefinition *propList,
+ Qt::Alignment alignDefault)
{
- setupProperties(propList);
+ setupProperties(propList, alignDefault);
setupObject(object);
}
@@ -208,6 +191,9 @@ void AbstractItemEditor::resetProperty(QtProperty *property)
if (m_propertyManager->resetIconSubProperty(property))
return;
+ if (m_propertyManager->resetTextAlignmentProperty(property))
+ return;
+
BoolBlocker block(m_updatingBrowser);
QtVariantProperty *prop = m_propertyManager->variantProperty(property);
@@ -240,23 +226,26 @@ 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);
+
+ bool modified = false;
if (!val.isValid()) {
if (role == ItemFlagsShadowRole)
val = QVariant::fromValue(defaultItemFlags());
else
val = QVariant(QMetaType(prop->value().userType()), nullptr);
- prop->setModified(false);
} else {
- prop->setModified(true);
+ modified = role != Qt::TextAlignmentRole
+ || val.toUInt() != DesignerPropertyManager::alignDefault(prop);
}
+ prop->setModified(modified);
prop->setValue(val);
}
if (m_propertyBrowser->topLevelItems().isEmpty()) {
- for (QtVariantProperty *prop : qAsConst(m_rootProperties))
+ for (QtVariantProperty *prop : std::as_const(m_rootProperties))
m_propertyBrowser->addProperty(prop);
}
}
@@ -282,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);
@@ -296,9 +299,11 @@ ItemListEditor::ItemListEditor(QDesignerFormWindowInterface *form, QWidget *pare
connect(iconCache(), &DesignerIconCache::reloaded, this, &AbstractItemEditor::cacheReloaded);
}
-void ItemListEditor::setupEditor(QWidget *object, PropertyDefinition *propList)
+void ItemListEditor::setupEditor(QWidget *object,
+ const PropertyDefinition *propList,
+ Qt::Alignment alignDefault)
{
- AbstractItemEditor::setupEditor(object, propList);
+ AbstractItemEditor::setupEditor(object, propList, alignDefault);
if (ui.listWidget->count() > 0)
ui.listWidget->setCurrentRow(0);
@@ -313,12 +318,14 @@ void ItemListEditor::setCurrentIndex(int idx)
m_updating = false;
}
-void ItemListEditor::on_newListItemButton_clicked()
+void ItemListEditor::newListItemButtonClicked()
{
int row = ui.listWidget->currentRow() + 1;
QListWidgetItem *item = new QListWidgetItem(m_newItemText);
item->setData(Qt::DisplayPropertyRole, QVariant::fromValue(PropertySheetStringValue(m_newItemText)));
+ if (m_alignDefault != 0)
+ item->setTextAlignment(Qt::Alignment(m_alignDefault));
item->setFlags(item->flags() | Qt::ItemIsEditable);
if (row < ui.listWidget->count())
ui.listWidget->insertItem(row, item);
@@ -330,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();
@@ -347,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)
@@ -358,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)
@@ -369,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;
@@ -408,11 +415,13 @@ 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.type() == QVariant::Font) {
+ if (role == Qt::FontRole && newValue.metaType().id() == QMetaType::QFont) {
QFont oldFont = ui.listWidget->font();
QFont newFont = qvariant_cast<QFont>(newValue).resolve(oldFont);
newValue = QVariant::fromValue(newFont);
@@ -466,6 +475,16 @@ void ItemListEditor::updateEditor()
else
m_propertyBrowser->clear();
}
+
+uint ItemListEditor::alignDefault() const
+{
+ return m_alignDefault;
+}
+
+void ItemListEditor::setAlignDefault(uint newAlignDefault)
+{
+ m_alignDefault = newAlignDefault;
+}
} // namespace qdesigner_internal
QT_END_NAMESPACE
diff --git a/src/designer/src/components/taskmenu/itemlisteditor.h b/src/designer/src/components/taskmenu/itemlisteditor.h
index 97bcb19d9..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;
@@ -86,9 +63,11 @@ private slots:
protected:
virtual int defaultItemFlags() const = 0;
- void setupProperties(PropertyDefinition *propDefs);
+ void setupProperties(const PropertyDefinition *propList,
+ Qt::Alignment alignDefault = Qt::AlignLeading | Qt::AlignVCenter);
void setupObject(QWidget *object);
- void setupEditor(QWidget *object, PropertyDefinition *propDefs);
+ void setupEditor(QWidget *object, const PropertyDefinition *propDefs,
+ Qt::Alignment alignDefault = Qt::AlignLeading | Qt::AlignVCenter);
void injectPropertyBrowser(QWidget *parent, QWidget *widget);
void updateBrowser();
virtual void setItemData(int role, const QVariant &v) = 0;
@@ -112,12 +91,16 @@ class ItemListEditor: public AbstractItemEditor
public:
explicit ItemListEditor(QDesignerFormWindowInterface *form, QWidget *parent);
- void setupEditor(QWidget *object, PropertyDefinition *propDefs);
+ void setupEditor(QWidget *object, const PropertyDefinition *propDefs,
+ Qt::Alignment alignDefault = Qt::AlignLeading | Qt::AlignVCenter);
QListWidget *listWidget() const { return ui.listWidget; }
void setNewItemText(const QString &tpl) { m_newItemText = tpl; }
QString newItemText() const { return m_newItemText; }
void setCurrentIndex(int idx);
+ uint alignDefault() const;
+ void setAlignDefault(uint newAlignDefault);
+
signals:
void indexChanged(int idx);
void itemChanged(int idx, int role, const QVariant &v);
@@ -127,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();
@@ -145,6 +128,7 @@ private:
void setPropertyBrowserVisible(bool v);
void updateEditor();
Ui::ItemListEditor ui;
+ uint m_alignDefault = 0;
bool m_updating;
QString m_newItemText;
};
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 098dac2cd..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);
@@ -74,10 +48,10 @@ static AbstractItemEditor::PropertyDefinition listBoxPropList[] = {
{ Qt::ToolTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "toolTip" },
{ Qt::StatusTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "statusTip" },
{ Qt::WhatsThisPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "whatsThis" },
- { Qt::FontRole, QVariant::Font, nullptr, "font" },
+ { Qt::FontRole, QMetaType::QFont, nullptr, "font" },
{ Qt::TextAlignmentRole, 0, DesignerPropertyManager::designerAlignmentTypeId, "textAlignment" },
- { Qt::BackgroundRole, QVariant::Brush, nullptr, "background" },
- { Qt::ForegroundRole, QVariant::Brush, nullptr, "foreground" },
+ { Qt::BackgroundRole, QMetaType::QBrush, nullptr, "background" },
+ { Qt::ForegroundRole, QMetaType::QBrush, nullptr, "foreground" },
{ ItemFlagsShadowRole, 0, QtVariantPropertyManager::flagTypeId, "flags" },
{ Qt::CheckStateRole, 0, QtVariantPropertyManager::enumTypeId, "checkState" },
{ 0, 0, nullptr, nullptr }
@@ -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 b5f41626c..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,16 +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);
@@ -65,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[] = {
@@ -108,10 +85,10 @@ static AbstractItemEditor::PropertyDefinition tableHeaderPropList[] = {
{ Qt::ToolTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "toolTip" },
// { Qt::StatusTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "statusTip" },
{ Qt::WhatsThisPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "whatsThis" },
- { Qt::FontRole, QVariant::Font, nullptr, "font" },
+ { Qt::FontRole, QMetaType::QFont, nullptr, "font" },
{ Qt::TextAlignmentRole, 0, DesignerPropertyManager::designerAlignmentTypeId, "textAlignment" },
- { Qt::BackgroundRole, QVariant::Color, nullptr, "background" },
- { Qt::ForegroundRole, QVariant::Brush, nullptr, "foreground" },
+ { Qt::BackgroundRole, QMetaType::QColor, nullptr, "background" },
+ { Qt::ForegroundRole, QMetaType::QBrush, nullptr, "foreground" },
{ 0, 0, nullptr, nullptr }
};
@@ -121,10 +98,10 @@ static AbstractItemEditor::PropertyDefinition tableItemPropList[] = {
{ Qt::ToolTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "toolTip" },
// { Qt::StatusTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "statusTip" },
{ Qt::WhatsThisPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "whatsThis" },
- { Qt::FontRole, QVariant::Font, nullptr, "font" },
+ { Qt::FontRole, QMetaType::QFont, nullptr, "font" },
{ Qt::TextAlignmentRole, 0, DesignerPropertyManager::designerAlignmentTypeId, "textAlignment" },
- { Qt::BackgroundRole, QVariant::Brush, nullptr, "background" },
- { Qt::ForegroundRole, QVariant::Brush, nullptr, "foreground" },
+ { Qt::BackgroundRole, QMetaType::QBrush, nullptr, "background" },
+ { Qt::ForegroundRole, QMetaType::QBrush, nullptr, "foreground" },
{ ItemFlagsShadowRole, 0, QtVariantPropertyManager::flagTypeId, "flags" },
{ Qt::CheckStateRole, 0, QtVariantPropertyManager::enumTypeId, "checkState" },
{ 0, 0, nullptr, nullptr }
@@ -136,11 +113,19 @@ TableWidgetContents TableWidgetEditor::fillContentsFromTableWidget(QTableWidget
tblCont.fromTableWidget(tableWidget, false);
tblCont.applyToTableWidget(ui.tableWidget, iconCache(), true);
- tblCont.m_verticalHeader.applyToListWidget(m_rowEditor->listWidget(), iconCache(), true);
- m_rowEditor->setupEditor(tableWidget, tableHeaderPropList);
+ auto *header = tableWidget->verticalHeader();
+ auto headerAlignment = header != nullptr
+ ? header->defaultAlignment() : Qt::Alignment(Qt::AlignLeading | Qt::AlignVCenter);
+ tblCont.m_verticalHeader.applyToListWidget(m_rowEditor->listWidget(), iconCache(),
+ true, headerAlignment);
+ m_rowEditor->setupEditor(tableWidget, tableHeaderPropList, headerAlignment);
- tblCont.m_horizontalHeader.applyToListWidget(m_columnEditor->listWidget(), iconCache(), true);
- m_columnEditor->setupEditor(tableWidget, tableHeaderPropList);
+ header = tableWidget->horizontalHeader();
+ headerAlignment = header != nullptr
+ ? header->defaultAlignment() : Qt::Alignment(Qt::AlignCenter);
+ tblCont.m_horizontalHeader.applyToListWidget(m_columnEditor->listWidget(), iconCache(),
+ true, headerAlignment);
+ m_columnEditor->setupEditor(tableWidget, tableHeaderPropList, headerAlignment);
setupEditor(tableWidget, tableItemPropList);
if (ui.tableWidget->columnCount() > 0 && ui.tableWidget->rowCount() > 0)
@@ -167,7 +152,7 @@ void TableWidgetEditor::setItemData(int role, const QVariant &v)
ui.tableWidget->setItem(ui.tableWidget->currentRow(), ui.tableWidget->currentColumn(), item);
}
QVariant newValue = v;
- if (role == Qt::FontRole && newValue.type() == QVariant::Font) {
+ if (role == Qt::FontRole && newValue.metaType().id() == QMetaType::QFont) {
QFont oldFont = ui.tableWidget->font();
QFont newFont = qvariant_cast<QFont>(newValue).resolve(oldFont);
newValue = QVariant::fromValue(newFont);
@@ -190,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;
@@ -210,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);
}
@@ -333,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);
@@ -351,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();
@@ -361,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);
@@ -393,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();
@@ -403,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);
@@ -425,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.pri b/src/designer/src/components/taskmenu/taskmenu.pri
deleted file mode 100644
index 7f8ceca96..000000000
--- a/src/designer/src/components/taskmenu/taskmenu.pri
+++ /dev/null
@@ -1,49 +0,0 @@
-INCLUDEPATH += $$PWD \
- ../propertyeditor \
- ../../../../shared/tools/shared/qtpropertybrowser
-
-FORMS += $$PWD/itemlisteditor.ui \
- $$PWD/treewidgeteditor.ui \
- $$PWD/tablewidgeteditor.ui
-
-HEADERS += $$PWD/button_taskmenu.h \
- $$PWD/groupbox_taskmenu.h \
- $$PWD/label_taskmenu.h \
- $$PWD/lineedit_taskmenu.h \
- $$PWD/listwidget_taskmenu.h \
- $$PWD/treewidget_taskmenu.h \
- $$PWD/tablewidget_taskmenu.h \
- $$PWD/combobox_taskmenu.h \
- $$PWD/textedit_taskmenu.h \
- $$PWD/toolbar_taskmenu.h \
- $$PWD/containerwidget_taskmenu.h \
- $$PWD/inplace_editor.h \
- $$PWD/taskmenu_component.h \
- $$PWD/itemlisteditor.h \
- $$PWD/listwidgeteditor.h \
- $$PWD/treewidgeteditor.h \
- $$PWD/tablewidgeteditor.h \
- $$PWD/inplace_widget_helper.h \
- $$PWD/menutaskmenu.h \
- $$PWD/layouttaskmenu.h
-
-SOURCES += $$PWD/button_taskmenu.cpp \
- $$PWD/groupbox_taskmenu.cpp \
- $$PWD/label_taskmenu.cpp \
- $$PWD/lineedit_taskmenu.cpp \
- $$PWD/listwidget_taskmenu.cpp \
- $$PWD/treewidget_taskmenu.cpp \
- $$PWD/tablewidget_taskmenu.cpp \
- $$PWD/combobox_taskmenu.cpp \
- $$PWD/textedit_taskmenu.cpp \
- $$PWD/toolbar_taskmenu.cpp \
- $$PWD/containerwidget_taskmenu.cpp \
- $$PWD/inplace_editor.cpp \
- $$PWD/taskmenu_component.cpp \
- $$PWD/itemlisteditor.cpp \
- $$PWD/listwidgeteditor.cpp \
- $$PWD/treewidgeteditor.cpp \
- $$PWD/tablewidgeteditor.cpp \
- $$PWD/inplace_widget_helper.cpp \
- $$PWD/menutaskmenu.cpp \
- $$PWD/layouttaskmenu.cpp
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 5e77939e5..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);
}
@@ -108,10 +91,10 @@ static AbstractItemEditor::PropertyDefinition treeHeaderPropList[] = {
{ Qt::ToolTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "toolTip" },
{ Qt::StatusTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "statusTip" },
{ Qt::WhatsThisPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "whatsThis" },
- { Qt::FontRole, QVariant::Font, nullptr, "font" },
+ { Qt::FontRole, QMetaType::QFont, nullptr, "font" },
{ Qt::TextAlignmentRole, 0, DesignerPropertyManager::designerAlignmentTypeId, "textAlignment" },
- { Qt::BackgroundRole, QVariant::Color, nullptr, "background" },
- { Qt::ForegroundRole, QVariant::Brush, nullptr, "foreground" },
+ { Qt::BackgroundRole, QMetaType::QColor, nullptr, "background" },
+ { Qt::ForegroundRole, QMetaType::QBrush, nullptr, "foreground" },
{ 0, 0, nullptr, nullptr }
};
@@ -121,10 +104,10 @@ static AbstractItemEditor::PropertyDefinition treeItemColumnPropList[] = {
{ Qt::ToolTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "toolTip" },
{ Qt::StatusTipPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "statusTip" },
{ Qt::WhatsThisPropertyRole, 0, DesignerPropertyManager::designerStringTypeId, "whatsThis" },
- { Qt::FontRole, QVariant::Font, nullptr, "font" },
+ { Qt::FontRole, QMetaType::QFont, nullptr, "font" },
{ Qt::TextAlignmentRole, 0, DesignerPropertyManager::designerAlignmentTypeId, "textAlignment" },
- { Qt::BackgroundRole, QVariant::Brush, nullptr, "background" },
- { Qt::ForegroundRole, QVariant::Brush, nullptr, "foreground" },
+ { Qt::BackgroundRole, QMetaType::QBrush, nullptr, "background" },
+ { Qt::ForegroundRole, QMetaType::QBrush, nullptr, "foreground" },
{ Qt::CheckStateRole, 0, QtVariantPropertyManager::enumTypeId, "checkState" },
{ 0, 0, nullptr, nullptr }
};
@@ -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;
@@ -181,7 +164,7 @@ void TreeWidgetEditor::setItemData(int role, const QVariant &v)
const int col = (role == ItemFlagsShadowRole) ? 0 : ui.treeWidget->currentColumn();
QVariant newValue = v;
BoolBlocker block(m_updatingBrowser);
- if (role == Qt::FontRole && newValue.type() == QVariant::Font) {
+ if (role == Qt::FontRole && newValue.metaType().id() == QMetaType::QFont) {
QFont oldFont = ui.treeWidget->font();
QFont newFont = qvariant_cast<QFont>(newValue).resolve(oldFont);
newValue = QVariant::fromValue(newFont);
@@ -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.pri b/src/designer/src/components/widgetbox/widgetbox.pri
deleted file mode 100644
index dd8ad002e..000000000
--- a/src/designer/src/components/widgetbox/widgetbox.pri
+++ /dev/null
@@ -1,14 +0,0 @@
-
-INCLUDEPATH += $$PWD
-
-SOURCES += $$PWD/widgetboxcategorylistview.cpp \
- $$PWD/widgetboxtreewidget.cpp \
- $$PWD/widgetbox.cpp \
- $$PWD/widgetbox_dnditem.cpp
-HEADERS += $$PWD/widgetboxcategorylistview.h \
- $$PWD/widgetboxtreewidget.h \
- $$PWD/widgetbox.h \
- $$PWD/widgetbox_global.h \
- $$PWD/widgetbox_dnditem.h
-
-RESOURCES += $$PWD/widgetbox.qrc
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 9f44c5d00..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);
}
@@ -269,17 +240,19 @@ QVariant WidgetBoxCategoryModel::data(const QModelIndex &index, int role) const
bool WidgetBoxCategoryModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
const int row = index.row();
- if (role != Qt::EditRole || row < 0 || row >= m_items.size() || value.type() != QVariant::String)
+ if (role != Qt::EditRole || row < 0 || row >= m_items.size()
+ || value.metaType().id() != QMetaType::QString) {
return false;
+ }
// Set name and adapt Xml
WidgetBoxCategoryEntry &item = m_items[row];
const QString newName = value.toString();
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);
@@ -349,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));
}
@@ -407,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()
@@ -473,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 4fe5881b6..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"
@@ -46,6 +21,7 @@
#include <QtWidgets/qapplication.h>
#include <QtWidgets/qheaderview.h>
#include <QtWidgets/qmenu.h>
+#include <QtWidgets/qscrollbar.h>
#include <QtWidgets/qtreewidget.h>
#include <QtGui/qaction.h>
@@ -56,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)
{
@@ -112,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();
}
@@ -130,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
{
@@ -145,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();
}
@@ -155,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())
@@ -252,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,
@@ -304,7 +282,15 @@ bool WidgetBoxTreeWidget::load(QDesignerWidgetBox::LoadMode loadMode)
return false;
const QString contents = QString::fromUtf8(f.readAll());
- return loadContents(contents);
+ if (!loadContents(contents))
+ return false;
+ if (topLevelItemCount() > 0) {
+ // QTBUG-93099: Set the single step to the item height to have some
+ // size-related value.
+ const auto itemHeight = visualItemRect(topLevelItem(0)).height();
+ verticalScrollBar()->setSingleStep(itemHeight);
+ }
+ return true;
}
bool WidgetBoxTreeWidget::loadContents(const QString &contents)
@@ -316,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);
@@ -336,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)
@@ -368,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;
@@ -413,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;
@@ -474,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 {
@@ -487,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;
}
}
@@ -514,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>
@@ -552,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) {
@@ -611,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();
@@ -954,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;
};