summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2024-02-02 13:21:25 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2024-02-03 09:29:07 +0100
commit94a41d036d53b28e8638d13eae40875869af6123 (patch)
treebdca7510177bd20f956ef28484fab3d6ba107433
parent05e471a2cfce032240b5911ad9cecd9c5ffa3acc (diff)
Qt Designer: Port const char * constants to latin1 literals
Run a script with some manual refactorings. It saves a few lengthy QLatin1StringView(). Task-number: QTBUG-121823 Pick-to: 6.7 Change-Id: I2c9ee5436fdcfbd249ce8d908c993d57f07a4fac Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
-rw-r--r--src/designer/src/components/buddyeditor/buddyeditor.cpp10
-rw-r--r--src/designer/src/components/formeditor/default_container.cpp4
-rw-r--r--src/designer/src/components/formeditor/deviceprofiledialog.cpp6
-rw-r--r--src/designer/src/components/formeditor/itemview_propertysheet.cpp36
-rw-r--r--src/designer/src/components/formeditor/layout_propertysheet.cpp102
-rw-r--r--src/designer/src/components/formeditor/qdesigner_resource.cpp8
-rw-r--r--src/designer/src/components/formeditor/qmdiarea_container.cpp20
-rw-r--r--src/designer/src/components/propertyeditor/designerpropertymanager.cpp126
-rw-r--r--src/designer/src/components/propertyeditor/fontpropertymanager.cpp16
-rw-r--r--src/designer/src/components/propertyeditor/propertyeditor.cpp38
-rw-r--r--src/designer/src/components/taskmenu/label_taskmenu.cpp10
-rw-r--r--src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp23
-rw-r--r--src/designer/src/components/widgetbox/widgetboxtreewidget.cpp106
-rw-r--r--src/designer/src/designer/appfontdialog.cpp6
-rw-r--r--src/designer/src/designer/mainwindow.cpp4
-rw-r--r--src/designer/src/designer/qdesigner.cpp16
-rw-r--r--src/designer/src/designer/qdesigner_workbench.cpp6
-rw-r--r--src/designer/src/lib/shared/actioneditor.cpp56
-rw-r--r--src/designer/src/lib/shared/actionrepository.cpp8
-rw-r--r--src/designer/src/lib/shared/deviceprofile.cpp46
-rw-r--r--src/designer/src/lib/shared/formlayoutmenu.cpp12
-rw-r--r--src/designer/src/lib/shared/newformwidget.cpp4
-rw-r--r--src/designer/src/lib/shared/plaintexteditor.cpp15
-rw-r--r--src/designer/src/lib/shared/pluginmanager.cpp61
-rw-r--r--src/designer/src/lib/shared/previewconfigurationwidget.cpp12
-rw-r--r--src/designer/src/lib/shared/previewmanager.cpp18
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertysheet.cpp78
-rw-r--r--src/designer/src/lib/shared/qdesigner_stackedbox.cpp14
-rw-r--r--src/designer/src/lib/shared/qdesigner_tabwidget.cpp42
-rw-r--r--src/designer/src/lib/shared/qdesigner_toolbox.cpp40
-rw-r--r--src/designer/src/lib/shared/qlayout_widget.cpp68
-rw-r--r--src/designer/src/lib/shared/qtresourceeditordialog.cpp60
-rw-r--r--src/designer/src/lib/shared/qtresourceview.cpp54
-rw-r--r--src/designer/src/lib/shared/richtexteditor.cpp18
-rw-r--r--src/designer/src/lib/shared/shared_settings.cpp90
-rw-r--r--src/designer/src/lib/shared/signalslotdialog.cpp8
-rw-r--r--src/designer/src/lib/shared/stylesheeteditor.cpp20
-rw-r--r--src/designer/src/lib/shared/zoomwidget.cpp8
-rw-r--r--src/designer/src/lib/uilib/abstractformbuilder.cpp8
-rw-r--r--src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.cpp4
-rw-r--r--src/designer/src/plugins/qwebview/qwebview_plugin.cpp4
41 files changed, 639 insertions, 646 deletions
diff --git a/src/designer/src/components/buddyeditor/buddyeditor.cpp b/src/designer/src/components/buddyeditor/buddyeditor.cpp
index 58138940c..452d33771 100644
--- a/src/designer/src/components/buddyeditor/buddyeditor.cpp
+++ b/src/designer/src/components/buddyeditor/buddyeditor.cpp
@@ -30,7 +30,7 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
-static const char buddyPropertyC[] = "buddy";
+static constexpr auto buddyPropertyC = "buddy"_L1;
static bool canBeBuddy(QWidget *w, QDesignerFormWindowInterface *form)
{
@@ -57,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(QLatin1StringView(buddyPropertyC));
+ const int prop_idx = sheet->indexOf(buddyPropertyC);
if (prop_idx == -1)
return QString();
return sheet->property(prop_idx).toString();
@@ -211,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, QLatin1StringView(buddyPropertyC), buddy->objectName());
+ command->init(label, buddyPropertyC, buddy->objectName());
command->setText(BuddyEditor::tr("Add buddy"));
return command;
}
@@ -273,7 +273,7 @@ void BuddyEditor::widgetRemoved(QWidget *widget)
qDebug("BuddyConnection::widgetRemoved(): not a label");
} else {
ResetPropertyCommand *command = new ResetPropertyCommand(formWindow());
- command->init(source, QLatin1StringView(buddyPropertyC));
+ command->init(source, buddyPropertyC);
undoStack()->push(command);
}
delete takeConnection(con);
@@ -297,7 +297,7 @@ void BuddyEditor::deleteSelected()
qDebug("BuddyConnection::deleteSelected(): not a label");
} else {
ResetPropertyCommand *command = new ResetPropertyCommand(formWindow());
- command->init(source, QLatin1StringView(buddyPropertyC));
+ command->init(source, buddyPropertyC);
undoStack()->push(command);
}
delete takeConnection(con);
diff --git a/src/designer/src/components/formeditor/default_container.cpp b/src/designer/src/components/formeditor/default_container.cpp
index 920b77103..ea68b9b21 100644
--- a/src/designer/src/components/formeditor/default_container.cpp
+++ b/src/designer/src/components/formeditor/default_container.cpp
@@ -6,6 +6,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
template <class Container>
static inline void setCurrentContainerIndex(int index, Container *container)
{
@@ -21,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/deviceprofiledialog.cpp b/src/designer/src/components/formeditor/deviceprofiledialog.cpp
index fde972306..6deabbaa1 100644
--- a/src/designer/src/components/formeditor/deviceprofiledialog.cpp
+++ b/src/designer/src/components/formeditor/deviceprofiledialog.cpp
@@ -21,11 +21,11 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
-static const char profileExtensionC[] = "qdp";
+static constexpr auto profileExtensionC = "qdp"_L1;
static inline QString fileFilter()
{
- return qdesigner_internal::DeviceProfileDialog::tr("Device Profiles (*.%1)").arg(QLatin1StringView(profileExtensionC));
+ return qdesigner_internal::DeviceProfileDialog::tr("Device Profiles (*.%1)").arg(profileExtensionC);
}
// Populate a combo with a sequence of integers, also set them as data.
@@ -133,7 +133,7 @@ void DeviceProfileDialog::save()
if (fn.isEmpty())
return;
if (QFileInfo(fn).completeSuffix().isEmpty())
- fn += u'.' + QLatin1StringView(profileExtensionC);
+ fn += u'.' + profileExtensionC;
QFile file(fn);
if (!file.open(QIODevice::WriteOnly|QIODevice::Text)) {
diff --git a/src/designer/src/components/formeditor/itemview_propertysheet.cpp b/src/designer/src/components/formeditor/itemview_propertysheet.cpp
index 03c46ccad..312427341 100644
--- a/src/designer/src/components/formeditor/itemview_propertysheet.cpp
+++ b/src/designer/src/components/formeditor/itemview_propertysheet.cpp
@@ -43,16 +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";
+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 *********************/
@@ -73,14 +73,12 @@ ItemViewPropertySheetPrivate::ItemViewPropertySheetPrivate(QDesignerFormEditorIn
QStringList ItemViewPropertySheetPrivate::realPropertyNames()
{
if (m_realPropertyNames.isEmpty())
- m_realPropertyNames
- << QLatin1StringView(visibleProperty)
- << QLatin1StringView(cascadingSectionResizesProperty)
- << QLatin1StringView(defaultSectionSizeProperty)
- << QLatin1StringView(highlightSectionsProperty)
- << QLatin1StringView(minimumSectionSizeProperty)
- << QLatin1StringView(showSortIndicatorProperty)
- << QLatin1StringView(stretchLastSectionProperty);
+ m_realPropertyNames = {
+ visibleProperty, cascadingSectionResizesProperty,
+ defaultSectionSizeProperty, highlightSectionsProperty,
+ minimumSectionSizeProperty, showSortIndicatorProperty,
+ stretchLastSectionProperty
+ };
return m_realPropertyNames;
}
@@ -138,12 +136,12 @@ void ItemViewPropertySheet::initHeaderProperties(QHeaderView *hv, const QString
{
QDesignerPropertySheetExtension *headerSheet = d->m_propertySheet.value(hv);
Q_ASSERT(headerSheet);
- const QString headerGroupS = QLatin1StringView(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 == QLatin1StringView(visibleProperty) ?
+ const QVariant defaultValue = realPropertyName == visibleProperty ?
QVariant(true) : headerSheet->property(headerIndex);
const QString fakePropertyName = d->fakePropertyName(prefix, realPropertyName);
const int fakeIndex = createFakeProperty(fakePropertyName, defaultValue);
@@ -215,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) == QLatin1StringView(visibleProperty)) {
+ if (!resetRC && headerSheet->propertyName(headerIndex) == visibleProperty) {
headerSheet->setProperty(headerIndex, QVariant(true));
headerSheet->setChanged(headerIndex, false);
return true;
diff --git a/src/designer/src/components/formeditor/layout_propertysheet.cpp b/src/designer/src/components/formeditor/layout_propertysheet.cpp
index 49cf46770..8447f3fd5 100644
--- a/src/designer/src/components/formeditor/layout_propertysheet.cpp
+++ b/src/designer/src/components/formeditor/layout_propertysheet.cpp
@@ -27,19 +27,19 @@ using namespace Qt::StringLiterals;
#define USE_LAYOUT_SIZE_CONSTRAINT
-static const char leftMargin[] = "leftMargin";
-static const char topMargin[] = "topMargin";
-static const char rightMargin[] = "rightMargin";
-static const char bottomMargin[] = "bottomMargin";
-static const char horizontalSpacing[] = "horizontalSpacing";
-static const char verticalSpacing[] = "verticalSpacing";
-static const char spacing[] = "spacing";
-static const char sizeConstraint[] = "sizeConstraint";
-static const char boxStretchPropertyC[] = "stretch";
-static const char gridRowStretchPropertyC[] = "rowStretch";
-static const char gridColumnStretchPropertyC[] = "columnStretch";
-static const char gridRowMinimumHeightPropertyC[] = "rowMinimumHeight";
-static const char gridColumnMinimumWidthPropertyC[] = "columnMinimumWidth";
+static constexpr auto leftMargin = "leftMargin"_L1;
+static constexpr auto topMargin = "topMargin"_L1;
+static constexpr auto rightMargin = "rightMargin"_L1;
+static constexpr auto bottomMargin = "bottomMargin"_L1;
+static constexpr auto horizontalSpacing = "horizontalSpacing"_L1;
+static constexpr auto verticalSpacing = "verticalSpacing"_L1;
+static constexpr auto spacing = "spacing"_L1;
+static constexpr auto sizeConstraint = "sizeConstraint"_L1;
+static constexpr auto boxStretchPropertyC = "stretch"_L1;
+static constexpr auto gridRowStretchPropertyC = "rowStretch"_L1;
+static constexpr auto gridColumnStretchPropertyC = "columnStretch"_L1;
+static constexpr auto gridRowMinimumHeightPropertyC = "rowMinimumHeight"_L1;
+static constexpr auto gridColumnMinimumWidthPropertyC = "columnMinimumWidth"_L1;
namespace {
enum LayoutPropertyType {
@@ -78,19 +78,19 @@ static bool isIntegerList(const QString &s)
static LayoutPropertyType layoutPropertyType(const QString &name)
{
static const QHash<QString, LayoutPropertyType> namePropertyMap = {
- {QLatin1StringView(leftMargin), LayoutPropertyLeftMargin},
- {QLatin1StringView(topMargin), LayoutPropertyTopMargin},
- {QLatin1StringView(rightMargin), LayoutPropertyRightMargin},
- {QLatin1StringView(bottomMargin), LayoutPropertyBottomMargin},
- {QLatin1StringView(horizontalSpacing), LayoutPropertyHorizontalSpacing},
- {QLatin1StringView(verticalSpacing), LayoutPropertyVerticalSpacing},
- {QLatin1StringView(spacing), LayoutPropertySpacing},
- {QLatin1StringView(sizeConstraint), LayoutPropertySizeConstraint},
- {QLatin1StringView(boxStretchPropertyC), LayoutPropertyBoxStretch},
- {QLatin1StringView(gridRowStretchPropertyC), LayoutPropertyGridRowStretch},
- {QLatin1StringView(gridColumnStretchPropertyC), LayoutPropertyGridColumnStretch},
- {QLatin1StringView(gridRowMinimumHeightPropertyC), LayoutPropertyGridRowMinimumHeight},
- {QLatin1StringView(gridColumnMinimumWidthPropertyC), LayoutPropertyGridColumnMinimumWidth}
+ {leftMargin, LayoutPropertyLeftMargin},
+ {topMargin, LayoutPropertyTopMargin},
+ {rightMargin, LayoutPropertyRightMargin},
+ {bottomMargin, LayoutPropertyBottomMargin},
+ {horizontalSpacing, LayoutPropertyHorizontalSpacing},
+ {verticalSpacing, LayoutPropertyVerticalSpacing},
+ {spacing, LayoutPropertySpacing},
+ {sizeConstraint, LayoutPropertySizeConstraint},
+ {boxStretchPropertyC, LayoutPropertyBoxStretch},
+ {gridRowStretchPropertyC, LayoutPropertyGridRowStretch},
+ {gridColumnStretchPropertyC, LayoutPropertyGridColumnStretch},
+ {gridRowMinimumHeightPropertyC, LayoutPropertyGridRowMinimumHeight},
+ {gridColumnMinimumWidthPropertyC, LayoutPropertyGridColumnMinimumWidth}
};
return namePropertyMap.value(name, LayoutPropertyNone);
}
@@ -153,48 +153,48 @@ LayoutPropertySheet::LayoutPropertySheet(QLayout *l, QObject *parent)
: QDesignerPropertySheet(l, parent), m_layout(l)
{
const QString layoutGroup = u"Layout"_s;
- int pindex = createFakeProperty(QLatin1StringView(leftMargin), 0);
+ int pindex = createFakeProperty(leftMargin, 0);
setPropertyGroup(pindex, layoutGroup);
- pindex = createFakeProperty(QLatin1StringView(topMargin), 0);
+ pindex = createFakeProperty(topMargin, 0);
setPropertyGroup(pindex, layoutGroup);
- pindex = createFakeProperty(QLatin1StringView(rightMargin), 0);
+ pindex = createFakeProperty(rightMargin, 0);
setPropertyGroup(pindex, layoutGroup);
- pindex = createFakeProperty(QLatin1StringView(bottomMargin), 0);
+ pindex = createFakeProperty(bottomMargin, 0);
setPropertyGroup(pindex, layoutGroup);
const int visibleMask = LayoutProperties::visibleProperties(m_layout);
if (visibleMask & LayoutProperties::HorizSpacingProperty) {
- pindex = createFakeProperty(QLatin1StringView(horizontalSpacing), 0);
+ pindex = createFakeProperty(horizontalSpacing, 0);
setPropertyGroup(pindex, layoutGroup);
- pindex = createFakeProperty(QLatin1StringView(verticalSpacing), 0);
+ pindex = createFakeProperty(verticalSpacing, 0);
setPropertyGroup(pindex, layoutGroup);
- setAttribute(indexOf(QLatin1StringView(spacing)), true);
+ setAttribute(indexOf(spacing), true);
}
// Stretch
if (visibleMask & LayoutProperties::BoxStretchProperty) {
- pindex = createFakeProperty(QLatin1StringView(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(QLatin1StringView(gridRowStretchPropertyC), empty);
+ pindex = createFakeProperty(gridRowStretchPropertyC, empty);
setPropertyGroup(pindex, layoutGroup);
setAttribute(pindex, true);
- pindex = createFakeProperty(QLatin1StringView(gridColumnStretchPropertyC), empty);
+ pindex = createFakeProperty(gridColumnStretchPropertyC, empty);
setPropertyGroup(pindex, layoutGroup);
setAttribute(pindex, true);
- pindex = createFakeProperty(QLatin1StringView(gridRowMinimumHeightPropertyC), empty);
+ pindex = createFakeProperty(gridRowMinimumHeightPropertyC, empty);
setPropertyGroup(pindex, layoutGroup);
setAttribute(pindex, true);
- pindex = createFakeProperty(QLatin1StringView(gridColumnMinimumWidthPropertyC), empty);
+ pindex = createFakeProperty(gridColumnMinimumWidthPropertyC, empty);
setPropertyGroup(pindex, layoutGroup);
setAttribute(pindex, true);
}
@@ -204,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(QLatin1StringView(sizeConstraint));
+ pindex = createFakeProperty(sizeConstraint);
setPropertyGroup(pindex, layoutGroup);
#endif
}
@@ -415,8 +415,8 @@ void LayoutPropertySheet::setChanged(int index, bool changed)
switch (type) {
case LayoutPropertySpacing:
if (LayoutProperties::visibleProperties(m_layout) & LayoutProperties::HorizSpacingProperty) {
- setChanged(indexOf(QLatin1StringView(horizontalSpacing)), changed);
- setChanged(indexOf(QLatin1StringView(verticalSpacing)), changed);
+ setChanged(indexOf(horizontalSpacing), changed);
+ setChanged(indexOf(verticalSpacing), changed);
}
break;
default:
@@ -437,31 +437,31 @@ void LayoutPropertySheet::stretchAttributesToDom(QDesignerFormEditorInterface *c
// Stretch
if (visibleMask & LayoutProperties::BoxStretchProperty) {
- const int index = sheet->indexOf(QLatin1StringView(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(QLatin1StringView(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(QLatin1StringView(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(QLatin1StringView(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(QLatin1StringView(gridColumnMinimumWidthPropertyC));
+ const int index = sheet->indexOf(gridColumnMinimumWidthPropertyC);
Q_ASSERT(index != -1);
if (sheet->isChanged(index))
domLayout->setAttributeColumnMinimumWidth(sheet->property(index).toString());
@@ -475,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(QLatin1StringView(boxStretchPropertyC)), true);
+ sheet->setChanged(sheet->indexOf(boxStretchPropertyC), true);
if (!domLayout->attributeRowStretch().isEmpty())
- sheet->setChanged(sheet->indexOf(QLatin1StringView(gridRowStretchPropertyC)), true);
+ sheet->setChanged(sheet->indexOf(gridRowStretchPropertyC), true);
if (!domLayout->attributeColumnStretch().isEmpty())
- sheet->setChanged(sheet->indexOf(QLatin1StringView(gridColumnStretchPropertyC)), true);
+ sheet->setChanged(sheet->indexOf(gridColumnStretchPropertyC), true);
if (!domLayout->attributeColumnMinimumWidth().isEmpty())
- sheet->setChanged(sheet->indexOf(QLatin1StringView(gridColumnMinimumWidthPropertyC)), true);
+ sheet->setChanged(sheet->indexOf(gridColumnMinimumWidthPropertyC), true);
if (!domLayout->attributeRowMinimumHeight().isEmpty())
- sheet->setChanged(sheet->indexOf(QLatin1StringView(gridRowMinimumHeightPropertyC)), true);
+ sheet->setChanged(sheet->indexOf(gridRowMinimumHeightPropertyC), true);
}
}
diff --git a/src/designer/src/components/formeditor/qdesigner_resource.cpp b/src/designer/src/components/formeditor/qdesigner_resource.cpp
index 2b63d3bc1..4c2c6cace 100644
--- a/src/designer/src/components/formeditor/qdesigner_resource.cpp
+++ b/src/designer/src/components/formeditor/qdesigner_resource.cpp
@@ -91,8 +91,8 @@ 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.
@@ -1679,7 +1679,7 @@ DomUI *QDesignerResource::copy(const FormBuilderClipboard &selection)
m_copyWidget = true;
DomWidget *ui_widget = new DomWidget();
- ui_widget->setAttributeName(QLatin1StringView(clipboardObjectName));
+ ui_widget->setAttributeName(clipboardObjectName);
bool hasItems = false;
// Widgets
if (!selection.m_widgets.isEmpty()) {
@@ -1718,7 +1718,7 @@ DomUI *QDesignerResource::copy(const FormBuilderClipboard &selection)
}
// UI
DomUI *ui = new DomUI();
- ui->setAttributeVersion(QLatin1StringView(currentUiVersion));
+ ui->setAttributeVersion(currentUiVersion);
ui->setElementWidget(ui_widget);
ui->setElementResources(saveResources(m_resourceBuilder->usedQrcFiles()));
if (DomCustomWidgets *cws = saveCustomWidgets())
diff --git a/src/designer/src/components/formeditor/qmdiarea_container.cpp b/src/designer/src/components/formeditor/qmdiarea_container.cpp
index e35d1eecf..137bd9618 100644
--- a/src/designer/src/components/formeditor/qmdiarea_container.cpp
+++ b/src/designer/src/components/formeditor/qmdiarea_container.cpp
@@ -106,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(u"windowTitle"_s)
{
- createFakeProperty(QLatin1StringView(subWindowNameC), QString());
- createFakeProperty(QLatin1StringView(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(QLatin1StringView(subWindowNameC), MdiAreaSubWindowName);
- mdiAreaPropertyHash.insert(QLatin1StringView(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/propertyeditor/designerpropertymanager.cpp b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp
index 4344a434f..1b0304495 100644
--- a/src/designer/src/components/propertyeditor/designerpropertymanager.cpp
+++ b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp
@@ -48,13 +48,13 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
-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";
+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;
class DesignerFlagPropertyType
{
@@ -1140,19 +1140,19 @@ QStringList DesignerPropertyManager::attributes(int propertyType) const
QStringList list = QtVariantPropertyManager::attributes(propertyType);
if (propertyType == designerFlagTypeId()) {
- list.append(QLatin1StringView(flagsAttributeC));
+ list.append(flagsAttributeC);
} else if (propertyType == designerPixmapTypeId()) {
- list.append(QLatin1StringView(defaultResourceAttributeC));
+ list.append(defaultResourceAttributeC);
} else if (propertyType == designerIconTypeId()) {
- list.append(QLatin1StringView(defaultResourceAttributeC));
+ list.append(defaultResourceAttributeC);
} else if (propertyType == designerStringTypeId() || propertyType == QMetaType::QString) {
- list.append(QLatin1StringView(validationModesAttributeC));
- list.append(QLatin1StringView(fontAttributeC));
- list.append(QLatin1StringView(themeAttributeC));
+ list.append(validationModesAttributeC);
+ list.append(fontAttributeC);
+ list.append(themeAttributeC);
} else if (propertyType == QMetaType::QPalette) {
- list.append(QLatin1StringView(superPaletteAttributeC));
+ list.append(superPaletteAttributeC);
}
- list.append(QLatin1StringView(resettableAttributeC));
+ list.append(resettableAttributeC);
return list;
}
@@ -1161,23 +1161,23 @@ int DesignerPropertyManager::attributeType(int propertyType, const QString &attr
if (!isPropertyTypeSupported(propertyType))
return 0;
- if (propertyType == designerFlagTypeId() && attribute == QLatin1StringView(flagsAttributeC))
+ if (propertyType == designerFlagTypeId() && attribute == flagsAttributeC)
return designerFlagListTypeId();
- if (propertyType == designerPixmapTypeId() && attribute == QLatin1StringView(defaultResourceAttributeC))
+ if (propertyType == designerPixmapTypeId() && attribute == defaultResourceAttributeC)
return QMetaType::QPixmap;
- if (propertyType == designerIconTypeId() && attribute == QLatin1StringView(defaultResourceAttributeC))
+ if (propertyType == designerIconTypeId() && attribute == defaultResourceAttributeC)
return QMetaType::QIcon;
- if (attribute == QLatin1StringView(resettableAttributeC))
+ if (attribute == resettableAttributeC)
return QMetaType::Bool;
if (propertyType == designerStringTypeId() || propertyType == QMetaType::QString) {
- if (attribute == QLatin1StringView(validationModesAttributeC))
+ if (attribute == validationModesAttributeC)
return QMetaType::Int;
- if (attribute == QLatin1StringView(fontAttributeC))
+ if (attribute == fontAttributeC)
return QMetaType::QFont;
- if (attribute == QLatin1StringView(themeAttributeC))
+ if (attribute == themeAttributeC)
return QMetaType::Bool;
}
- if (propertyType == QMetaType::QPalette && attribute == QLatin1StringView(superPaletteAttributeC))
+ if (propertyType == QMetaType::QPalette && attribute == superPaletteAttributeC)
return QMetaType::QPalette;
return QtVariantPropertyManager::attributeType(propertyType, attribute);
@@ -1187,13 +1187,13 @@ QVariant DesignerPropertyManager::attributeValue(const QtProperty *property, con
{
QtProperty *prop = const_cast<QtProperty *>(property);
- if (attribute == QLatin1StringView(resettableAttributeC)) {
+ if (attribute == resettableAttributeC) {
const auto it = m_resetMap.constFind(prop);
if (it != m_resetMap.constEnd())
return it.value();
}
- if (attribute == QLatin1StringView(flagsAttributeC)) {
+ if (attribute == flagsAttributeC) {
const auto it = m_flagValues.constFind(prop);
if (it != m_flagValues.constEnd()) {
QVariant v;
@@ -1201,31 +1201,31 @@ QVariant DesignerPropertyManager::attributeValue(const QtProperty *property, con
return v;
}
}
- if (attribute == QLatin1StringView(validationModesAttributeC)) {
+ if (attribute == validationModesAttributeC) {
const auto it = m_stringAttributes.constFind(prop);
if (it != m_stringAttributes.constEnd())
return it.value();
}
- if (attribute == QLatin1StringView(fontAttributeC)) {
+ if (attribute == fontAttributeC) {
const auto it = m_stringFontAttributes.constFind(prop);
if (it != m_stringFontAttributes.constEnd())
return it.value();
}
- if (attribute == QLatin1StringView(themeAttributeC)) {
+ if (attribute == themeAttributeC) {
const auto it = m_stringThemeAttributes.constFind(prop);
if (it != m_stringThemeAttributes.constEnd())
return it.value();
}
- if (attribute == QLatin1StringView(superPaletteAttributeC)) {
+ if (attribute == superPaletteAttributeC) {
const auto it = m_paletteValues.constFind(prop);
if (it != m_paletteValues.cend())
return it.value().superPalette;
}
- if (attribute == QLatin1StringView(defaultResourceAttributeC)) {
+ if (attribute == defaultResourceAttributeC) {
const auto itPix = m_defaultPixmaps.constFind(prop);
if (itPix != m_defaultPixmaps.constEnd())
return itPix.value();
@@ -1247,7 +1247,7 @@ QVariant DesignerPropertyManager::attributeValue(const QtProperty *property, con
void DesignerPropertyManager::setAttribute(QtProperty *property,
const QString &attribute, const QVariant &value)
{
- if (attribute == QLatin1StringView(resettableAttributeC) && m_resetMap.contains(property)) {
+ if (attribute == resettableAttributeC && m_resetMap.contains(property)) {
if (value.userType() != QMetaType::Bool)
return;
const bool val = value.toBool();
@@ -1258,7 +1258,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
emit attributeChanged(variantProperty(property), attribute, value);
return;
}
- if (attribute == QLatin1StringView(flagsAttributeC) && m_flagValues.contains(property)) {
+ if (attribute == flagsAttributeC && m_flagValues.contains(property)) {
if (value.userType() != designerFlagListTypeId())
return;
@@ -1301,7 +1301,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
emit propertyChanged(property);
emit QtVariantPropertyManager::valueChanged(property, data.val);
- } else if (attribute == QLatin1StringView(validationModesAttributeC) && m_stringAttributes.contains(property)) {
+ } else if (attribute == validationModesAttributeC && m_stringAttributes.contains(property)) {
if (value.userType() != QMetaType::Int)
return;
@@ -1316,7 +1316,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
it.value() = newValue;
emit attributeChanged(property, attribute, newValue);
- } else if (attribute == QLatin1StringView(fontAttributeC) && m_stringFontAttributes.contains(property)) {
+ } else if (attribute == fontAttributeC && m_stringFontAttributes.contains(property)) {
if (value.userType() != QMetaType::QFont)
return;
@@ -1331,7 +1331,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
it.value() = newValue;
emit attributeChanged(property, attribute, newValue);
- } else if (attribute == QLatin1StringView(themeAttributeC) && m_stringThemeAttributes.contains(property)) {
+ } else if (attribute == themeAttributeC && m_stringThemeAttributes.contains(property)) {
if (value.userType() != QMetaType::Bool)
return;
@@ -1346,7 +1346,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
it.value() = newValue;
emit attributeChanged(property, attribute, newValue);
- } else if (attribute == QLatin1StringView(superPaletteAttributeC) && m_paletteValues.contains(property)) {
+ } else if (attribute == superPaletteAttributeC && m_paletteValues.contains(property)) {
if (value.userType() != QMetaType::QPalette)
return;
@@ -1371,7 +1371,7 @@ 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 == QLatin1StringView(defaultResourceAttributeC) && m_defaultPixmaps.contains(property)) {
+ } else if (attribute == defaultResourceAttributeC && m_defaultPixmaps.contains(property)) {
if (value.userType() != QMetaType::QPixmap)
return;
@@ -1388,7 +1388,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
emit attributeChanged(property, attribute, v);
emit propertyChanged(property);
- } else if (attribute == QLatin1StringView(defaultResourceAttributeC) && m_defaultIcons.contains(property)) {
+ } else if (attribute == defaultResourceAttributeC && m_defaultIcons.contains(property)) {
if (value.userType() != QMetaType::QIcon)
return;
@@ -1407,7 +1407,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
for (auto itSub = subIconProperties.cbegin(), end = subIconProperties.cend(); itSub != end; ++itSub) {
const auto pair = itSub.key();
QtProperty *subProp = itSub.value();
- setAttribute(subProp, QLatin1StringView(defaultResourceAttributeC),
+ setAttribute(subProp, defaultResourceAttributeC,
defaultIcon.pixmap(16, 16, pair.first, pair.second));
}
}
@@ -1573,7 +1573,7 @@ QString DesignerPropertyManager::valueText(const QtProperty *property) const
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, QLatin1StringView(validationModesAttributeC)).toInt();
+ const int validationMode = attributeValue(property, validationModesAttributeC).toInt();
return TextPropertyEditor::stringToEditorString(str, static_cast<TextPropertyValidationMode>(validationMode));
}
if (vType == QMetaType::QStringList || vType == designerStringListTypeId()) {
@@ -1617,7 +1617,7 @@ void DesignerPropertyManager::reloadResourceProperties()
for (auto itSub = subProperties.cbegin(), end = subProperties.cend(); itSub != end; ++itSub) {
const auto pair = itSub.key();
QtVariantProperty *subProperty = variantProperty(itSub.value());
- subProperty->setAttribute(QLatin1StringView(defaultResourceAttributeC),
+ subProperty->setAttribute(defaultResourceAttributeC,
defaultIcon.pixmap(16, 16, pair.first, pair.second));
}
@@ -1869,7 +1869,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
bool hasPath = iconPaths.contains(pair);
subProperty->setModified(hasPath);
subProperty->setValue(QVariant::fromValue(iconPaths.value(pair)));
- subProperty->setAttribute(QLatin1StringView(defaultResourceAttributeC),
+ subProperty->setAttribute(defaultResourceAttributeC,
defaultIcon.pixmap(16, 16, pair.first, pair.second));
}
QtVariantProperty *themeSubProperty = variantProperty(m_propertyToTheme.value(property));
@@ -2068,7 +2068,7 @@ void DesignerPropertyManager::initializeProperty(QtProperty *property)
m_defaultIcons[property] = QIcon();
QtVariantProperty *themeProp = addProperty(QMetaType::QString, tr("Theme"));
- themeProp->setAttribute(QLatin1StringView(themeAttributeC), true);
+ themeProp->setAttribute(themeAttributeC, true);
m_iconSubPropertyToProperty[themeProp] = property;
m_propertyToTheme[property] = themeProp;
m_resetMap[themeProp] = true;
@@ -2291,23 +2291,23 @@ void DesignerEditorFactory::slotAttributeChanged(QtProperty *property, const QSt
{
QtVariantPropertyManager *manager = propertyManager(property);
const int type = manager->propertyType(property);
- if (type == DesignerPropertyManager::designerPixmapTypeId() && attribute == QLatin1StringView(defaultResourceAttributeC)) {
+ if (type == DesignerPropertyManager::designerPixmapTypeId() && attribute == defaultResourceAttributeC) {
const QPixmap pixmap = qvariant_cast<QPixmap>(value);
applyToEditors(m_pixmapPropertyToEditors.value(property), &PixmapEditor::setDefaultPixmap, pixmap);
} else if (type == DesignerPropertyManager::designerStringTypeId() || type == QMetaType::QString) {
- if (attribute == QLatin1StringView(validationModesAttributeC)) {
+ if (attribute == validationModesAttributeC) {
const TextPropertyValidationMode validationMode = static_cast<TextPropertyValidationMode>(value.toInt());
applyToEditors(m_stringPropertyToEditors.value(property), &TextEditor::setTextPropertyValidationMode, validationMode);
}
- if (attribute == QLatin1StringView(fontAttributeC)) {
+ if (attribute == fontAttributeC) {
const QFont font = qvariant_cast<QFont>(value);
applyToEditors(m_stringPropertyToEditors.value(property), &TextEditor::setRichTextDefaultFont, font);
}
- if (attribute == QLatin1StringView(themeAttributeC)) {
+ if (attribute == themeAttributeC) {
const bool themeEnabled = value.toBool();
applyToEditors(m_stringPropertyToEditors.value(property), &TextEditor::setIconThemeModeEnabled, themeEnabled);
}
- } else if (type == QMetaType::QPalette && attribute == QLatin1StringView(superPaletteAttributeC)) {
+ } else if (type == QMetaType::QPalette && attribute == superPaletteAttributeC) {
const QPalette palette = qvariant_cast<QPalette>(value);
applyToEditors(m_palettePropertyToEditors.value(property), &PaletteEditorButton::setSuperPalette, palette);
}
@@ -2319,10 +2319,13 @@ void DesignerEditorFactory::slotPropertyChanged(QtProperty *property)
const int type = manager->propertyType(property);
if (type == DesignerPropertyManager::designerIconTypeId()) {
QPixmap defaultPixmap;
- if (!property->isModified())
- defaultPixmap = qvariant_cast<QIcon>(manager->attributeValue(property, QLatin1StringView(defaultResourceAttributeC))).pixmap(16, 16);
- else if (m_fwb)
- defaultPixmap = m_fwb->iconCache()->icon(qvariant_cast<PropertySheetIconValue>(manager->value(property))).pixmap(16, 16);
+ if (!property->isModified()) {
+ const auto attributeValue = manager->attributeValue(property, defaultResourceAttributeC);
+ defaultPixmap = attributeValue.value<QIcon>().pixmap(16, 16);
+ } else if (m_fwb) {
+ const auto value = manager->value(property);
+ defaultPixmap = m_fwb->iconCache()->icon(value.value<PropertySheetIconValue>()).pixmap(16, 16);
+ }
const auto editors = m_iconPropertyToEditors.value(property);
for (PixmapEditor *editor : editors)
editor->setDefaultPixmap(defaultPixmap);
@@ -2403,12 +2406,13 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
}
break;
case QMetaType::QString: {
- const TextPropertyValidationMode tvm = static_cast<TextPropertyValidationMode>(manager->attributeValue(property, QLatin1StringView(validationModesAttributeC)).toInt());
+ const int itvm = manager->attributeValue(property, validationModesAttributeC).toInt();
+ const auto tvm = static_cast<TextPropertyValidationMode>(itvm);
TextEditor *ed = createTextEditor(parent, tvm, manager->value(property).toString());
- const QVariant richTextDefaultFont = manager->attributeValue(property, QLatin1StringView(fontAttributeC));
+ const QVariant richTextDefaultFont = manager->attributeValue(property, fontAttributeC);
if (richTextDefaultFont.metaType().id() == QMetaType::QFont)
ed->setRichTextDefaultFont(qvariant_cast<QFont>(richTextDefaultFont));
- const bool themeEnabled = manager->attributeValue(property, QLatin1StringView(themeAttributeC)).toBool();
+ const bool themeEnabled = manager->attributeValue(property, themeAttributeC).toBool();
ed->setIconThemeModeEnabled(themeEnabled);
m_stringPropertyToEditors[property].append(ed);
m_editorToStringProperty[ed] = property;
@@ -2419,7 +2423,7 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
break;
case QMetaType::QPalette: {
PaletteEditorButton *ed = new PaletteEditorButton(m_core, qvariant_cast<QPalette>(manager->value(property)), parent);
- ed->setSuperPalette(qvariant_cast<QPalette>(manager->attributeValue(property, QLatin1StringView(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);
@@ -2484,7 +2488,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, QLatin1StringView(defaultResourceAttributeC))));
+ ed->setDefaultPixmap(qvariant_cast<QPixmap>(manager->attributeValue(property, defaultResourceAttributeC)));
ed->setSpacing(m_spacing);
m_pixmapPropertyToEditors[property].append(ed);
m_editorToPixmapProperty[ed] = property;
@@ -2500,7 +2504,7 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
ed->setPath(value.pixmap(QIcon::Normal, QIcon::Off).path());
QPixmap defaultPixmap;
if (!property->isModified())
- defaultPixmap = qvariant_cast<QIcon>(manager->attributeValue(property, QLatin1StringView(defaultResourceAttributeC))).pixmap(16, 16);
+ defaultPixmap = qvariant_cast<QIcon>(manager->attributeValue(property, defaultResourceAttributeC)).pixmap(16, 16);
else if (m_fwb)
defaultPixmap = m_fwb->iconCache()->icon(value).pixmap(16, 16);
ed->setDefaultPixmap(defaultPixmap);
@@ -2512,9 +2516,9 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
connect(ed, &PixmapEditor::themeChanged, this, &DesignerEditorFactory::slotIconThemeChanged);
editor = ed;
} else if (type == DesignerPropertyManager::designerStringTypeId()) {
- const TextPropertyValidationMode tvm = static_cast<TextPropertyValidationMode>(manager->attributeValue(property, QLatin1StringView(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, QLatin1StringView(fontAttributeC));
+ const QVariant richTextDefaultFont = manager->attributeValue(property, fontAttributeC);
if (richTextDefaultFont.metaType().id() == QMetaType::QFont)
ed->setRichTextDefaultFont(qvariant_cast<QFont>(richTextDefaultFont));
m_stringPropertyToEditors[property].append(ed);
@@ -2546,7 +2550,7 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
break;
}
return m_resetDecorator->editor(editor,
- manager->variantProperty(property)->attributeValue(QLatin1StringView(resettableAttributeC)).toBool(),
+ manager->variantProperty(property)->attributeValue(resettableAttributeC).toBool(),
manager, property, parent);
}
diff --git a/src/designer/src/components/propertyeditor/fontpropertymanager.cpp b/src/designer/src/components/propertyeditor/fontpropertymanager.cpp
index c616ba561..7d67f93a0 100644
--- a/src/designer/src/components/propertyeditor/fontpropertymanager.cpp
+++ b/src/designer/src/components/propertyeditor/fontpropertymanager.cpp
@@ -372,10 +372,10 @@ 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)
{
@@ -390,14 +390,14 @@ namespace qdesigner_internal {
{
switch (currentStage) {
case ParseBeginning:
- return startElement == QLatin1StringView(rootTagC) ? ParseWithinRoot : ParseError;
+ return startElement == rootTagC ? ParseWithinRoot : ParseError;
case ParseWithinRoot:
case ParseWithinDisplay: // Next mapping, was in <display>
- return startElement == QLatin1StringView(mappingTagC) ? ParseWithinMapping : ParseError;
+ return startElement == mappingTagC ? ParseWithinMapping : ParseError;
case ParseWithinMapping:
- return startElement == QLatin1StringView(familyTagC) ? ParseWithinFamily : ParseError;
+ return startElement == familyTagC ? ParseWithinFamily : ParseError;
case ParseWithinFamily:
- return startElement == QLatin1StringView(displayTagC) ? ParseWithinDisplay : ParseError;
+ return startElement == displayTagC ? ParseWithinDisplay : ParseError;
case ParseError:
break;
}
diff --git a/src/designer/src/components/propertyeditor/propertyeditor.cpp b/src/designer/src/components/propertyeditor/propertyeditor.cpp
index b06827f21..e8ecbfd76 100644
--- a/src/designer/src/components/propertyeditor/propertyeditor.cpp
+++ b/src/designer/src/components/propertyeditor/propertyeditor.cpp
@@ -45,19 +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 {
@@ -308,13 +308,13 @@ PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *pare
// retrieve initial settings
QDesignerSettingsInterface *settings = m_core->settingsManager();
- settings->beginGroup(QLatin1StringView(SettingsGroupC));
- const SettingsView view = settings->value(QLatin1StringView(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(QLatin1StringView(SortedKeyC), false).toBool();
- m_coloring = settings->value(QLatin1StringView(ColorKeyC), true).toBool();
- const QVariantMap expansionState = settings->value(QLatin1StringView(ExpansionKeyC), QVariantMap()).toMap();
- const int splitterPosition = settings->value(QLatin1StringView(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);
@@ -351,16 +351,16 @@ PropertyEditor::~PropertyEditor()
void PropertyEditor::saveSettings() const
{
QDesignerSettingsInterface *settings = m_core->settingsManager();
- settings->beginGroup(QLatin1StringView(SettingsGroupC));
- settings->setValue(QLatin1StringView(ViewKeyC), QVariant(m_treeAction->isChecked() ? TreeView : ButtonView));
- settings->setValue(QLatin1StringView(ColorKeyC), QVariant(m_coloring));
- settings->setValue(QLatin1StringView(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;
for (auto it = m_expansionState.cbegin(), cend = m_expansionState.cend(); it != cend; ++it)
expansionState.insert(it.key(), QVariant(it.value()));
- settings->setValue(QLatin1StringView(ExpansionKeyC), expansionState);
- settings->setValue(QLatin1StringView(SplitterPositionKeyC), m_treeBrowser->splitterPosition());
+ settings->setValue(ExpansionKeyC, expansionState);
+ settings->setValue(SplitterPositionKeyC, m_treeBrowser->splitterPosition());
settings->endGroup();
}
diff --git a/src/designer/src/components/taskmenu/label_taskmenu.cpp b/src/designer/src/components/taskmenu/label_taskmenu.cpp
index ffa72280f..14a58d8ce 100644
--- a/src/designer/src/components/taskmenu/label_taskmenu.cpp
+++ b/src/designer/src/components/taskmenu/label_taskmenu.cpp
@@ -12,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
@@ -29,7 +31,7 @@ protected:
};
LabelTaskMenuInlineEditor::LabelTaskMenuInlineEditor(QLabel *w, QObject *parent) :
- TaskMenuInlineEditor(w, ValidationRichText, QLatin1StringView(textPropertyC), parent)
+ TaskMenuInlineEditor(w, ValidationRichText, textPropertyC, parent)
{
}
@@ -73,7 +75,7 @@ QList<QAction*> LabelTaskMenu::taskActions() const
void LabelTaskMenu::editRichText()
{
- changeTextProperty(QLatin1StringView(textPropertyC), QString(), MultiSelectionMode, m_label->textFormat());
+ changeTextProperty(textPropertyC, QString(), MultiSelectionMode, m_label->textFormat());
}
}
diff --git a/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp b/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp
index 4b0fc63b9..1e90ef08e 100644
--- a/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp
+++ b/src/designer/src/components/widgetbox/widgetboxcategorylistview.cpp
@@ -21,15 +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)
@@ -250,9 +250,9 @@ bool WidgetBoxCategoryModel::setData(const QModelIndex &index, const QVariant &v
item.widget.setName(newName);
const QDomDocument doc = stringToDom(WidgetBoxCategoryListView::widgetDomXml(item.widget));
- QDomElement widget_elt = doc.firstChildElement(QLatin1StringView(widgetElementC));
+ QDomElement widget_elt = doc.firstChildElement(widgetElementC);
if (!widget_elt.isNull()) {
- widget_elt.setAttribute(QLatin1StringView(nameAttributeC), newName);
+ widget_elt.setAttribute(nameAttributeC, newName);
item.widget.setDomXml(domToString(widget_elt));
}
emit dataChanged(index, index);
@@ -446,13 +446,8 @@ QString WidgetBoxCategoryListView::widgetDomXml(const QDesignerWidgetBoxInterfac
{
QString domXml = widget.domXml();
- if (domXml.isEmpty()) {
- domXml = QLatin1StringView(uiOpeningTagC);
- domXml += QStringLiteral("<widget class=\"");
- domXml += widget.name();
- domXml += QStringLiteral("\"/>");
- domXml += QLatin1StringView(uiClosingTagC);
- }
+ if (domXml.isEmpty())
+ domXml = uiOpeningTagC + "<widget class=\""_L1 + widget.name() +"\"/>"_L1 + uiClosingTagC;
return domXml;
}
diff --git a/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp b/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp
index b102be9a1..4dca4a1d1 100644
--- a/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp
+++ b/src/designer/src/components/widgetbox/widgetboxtreewidget.cpp
@@ -32,26 +32,26 @@
#include <QtCore/qtimer.h>
#include <QtCore/qdebug.h>
-static const char widgetBoxRootElementC[] = "widgetbox";
-static const char wbWidgetElementC[] = "widget";
-static const char uiElementC[] = "ui";
-static const char categoryElementC[] = "category";
-static const char categoryEntryElementC[] = "categoryentry";
-static const char wbNameAttributeC[] = "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]";
-
-enum TopLevelRole { NORMAL_ITEM, SCRATCHPAD_ITEM, CUSTOM_ITEM };
-
QT_BEGIN_NAMESPACE
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;
+
+enum TopLevelRole { NORMAL_ITEM, SCRATCHPAD_ITEM, CUSTOM_ITEM };
+
static void setTopLevelRole(TopLevelRole tlr, QTreeWidgetItem *item)
{
item->setData(0, Qt::UserRole, QVariant(tlr));
@@ -90,7 +90,7 @@ QIcon WidgetBoxTreeWidget::iconForWidget(const QString &iconName) const
if (iconName.isEmpty())
return qdesigner_internal::qtLogoIcon();
- if (iconName.startsWith(QLatin1StringView(iconPrefixC))) {
+ if (iconName.startsWith(iconPrefixC)) {
const auto it = m_pluginIcons.constFind(iconName);
if (it != m_pluginIcons.constEnd())
return it.value();
@@ -108,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
{
@@ -123,9 +123,9 @@ void WidgetBoxTreeWidget::saveExpandedState() const
}
}
QDesignerSettingsInterface *settings = m_core->settingsManager();
- settings->beginGroup(QLatin1StringView(widgetBoxSettingsGroupC));
- settings->setValue(QLatin1StringView(widgetBoxExpandedKeyC), closedCategories);
- settings->setValue(QLatin1StringView(widgetBoxViewModeKeyC), m_iconMode);
+ settings->beginGroup(widgetBoxSettingsGroupC);
+ settings->setValue(widgetBoxExpandedKeyC, closedCategories);
+ settings->setValue(widgetBoxViewModeKeyC, m_iconMode);
settings->endGroup();
}
@@ -133,10 +133,10 @@ void WidgetBoxTreeWidget::restoreExpandedState()
{
using StringSet = QSet<QString>;
QDesignerSettingsInterface *settings = m_core->settingsManager();
- const QString groupKey = QLatin1StringView(widgetBoxSettingsGroupC) + u'/';
- m_iconMode = settings->value(groupKey + QLatin1StringView(widgetBoxViewModeKeyC)).toBool();
+ const QString groupKey = widgetBoxSettingsGroupC + u'/';
+ m_iconMode = settings->value(groupKey + widgetBoxViewModeKeyC).toBool();
updateViewMode();
- const auto &closedCategoryList = settings->value(groupKey + QLatin1StringView(widgetBoxExpandedKeyC), QStringList()).toStringList();
+ const auto &closedCategoryList = settings->value(groupKey + widgetBoxExpandedKeyC, QStringList()).toStringList();
const StringSet closedCategories(closedCategoryList.cbegin(), closedCategoryList.cend());
expandAll();
if (closedCategories.isEmpty())
@@ -353,33 +353,33 @@ bool WidgetBoxTreeWidget::readCategories(const QString &fileName, const QString
switch (reader.readNext()) {
case QXmlStreamReader::StartElement: {
const auto tag = reader.name();
- if (tag == QLatin1StringView(widgetBoxRootElementC)) {
+ if (tag == widgetBoxRootElementC) {
//<widgetbox version="4.5">
continue;
}
- if (tag == QLatin1StringView(categoryElementC)) {
+ if (tag == categoryElementC) {
// <category name="Layouts">
const QXmlStreamAttributes attributes = reader.attributes();
- const QString categoryName = attributes.value(QLatin1StringView(wbNameAttributeC)).toString();
- if (categoryName == QLatin1StringView(invisibleNameC)) {
+ const QString categoryName = attributes.value(wbNameAttributeC).toString();
+ if (categoryName == invisibleNameC) {
ignoreEntries = true;
} else {
Category category(categoryName);
- if (attributes.value(QLatin1StringView(typeAttributeC)) == QLatin1StringView(scratchPadValueC))
+ if (attributes.value(typeAttributeC) == scratchPadValueC)
category.setType(Category::Scratchpad);
cats->push_back(category);
}
continue;
}
- if (tag == QLatin1StringView(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(QLatin1StringView(wbNameAttributeC)).toString();
- const QString widgetIcon = attr.value(QLatin1StringView(iconAttributeC)).toString();
+ const QString widgetName = attr.value(wbNameAttributeC).toString();
+ const QString widgetIcon = attr.value(iconAttributeC).toString();
const WidgetBoxTreeWidget::Widget::Type widgetType =
- attr.value(QLatin1StringView(typeAttributeC)).toString()
- == QLatin1StringView(customValueC) ?
+ attr.value(typeAttributeC).toString()
+ == customValueC ?
WidgetBoxTreeWidget::Widget::Custom :
WidgetBoxTreeWidget::Widget::Default;
@@ -398,14 +398,14 @@ bool WidgetBoxTreeWidget::readCategories(const QString &fileName, const QString
}
case QXmlStreamReader::EndElement: {
const auto tag = reader.name();
- if (tag == QLatin1StringView(widgetBoxRootElementC)) {
+ if (tag == widgetBoxRootElementC) {
continue;
}
- if (tag == QLatin1StringView(categoryElementC)) {
+ if (tag == categoryElementC) {
ignoreEntries = false;
continue;
}
- if (tag == QLatin1StringView(categoryEntryElementC)) {
+ if (tag == categoryEntryElementC) {
continue;
}
break;
@@ -459,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 == QLatin1StringView(uiElementC)) {
+ if (name == uiElementC) {
startTagPosition = currentPosition;
} else {
- if (name == QLatin1StringView(wbWidgetElementC)) {
+ if (name == wbWidgetElementC) {
startTagPosition = currentPosition;
parsedWidgetTag = true;
} else {
@@ -472,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() == QLatin1StringView(wbWidgetElementC)) {
+ if (!parsedWidgetTag && r.name() == wbWidgetElementC) {
parsedWidgetTag = true;
}
}
@@ -507,14 +507,14 @@ bool WidgetBoxTreeWidget::readWidget(Widget *w, const QString &xml, QXmlStreamRe
void WidgetBoxTreeWidget::writeCategories(QXmlStreamWriter &writer, const CategoryList &cat_list) const
{
- const QString widgetbox = QLatin1StringView(widgetBoxRootElementC);
- const QString name = QLatin1StringView(wbNameAttributeC);
- const QString type = QLatin1StringView(typeAttributeC);
- const QString icon = QLatin1StringView(iconAttributeC);
- const QString defaultType = QLatin1StringView(defaultTypeValueC);
- const QString category = QLatin1StringView(categoryElementC);
- const QString categoryEntry = QLatin1StringView(categoryEntryElementC);
- const QString iconPrefix = QLatin1StringView(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>
@@ -536,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, QLatin1StringView(scratchPadValueC));
+ writer.writeAttribute(type, scratchPadValueC);
const int widgetCount = cat.widgetCount();
for (int i = 0; i < widgetCount; ++i) {
@@ -595,8 +595,8 @@ WidgetBoxTreeWidget::CategoryList WidgetBoxTreeWidget::loadCustomCategoryList()
static const QString customCatName = tr("Custom Widgets");
- const QString invisible = QLatin1StringView(invisibleNameC);
- const QString iconPrefix = QLatin1StringView(iconPrefixC);
+ const QString invisible = invisibleNameC;
+ const QString iconPrefix = iconPrefixC;
for (QDesignerCustomWidgetInterface *c : customWidgets) {
const QString dom_xml = c->domXml();
diff --git a/src/designer/src/designer/appfontdialog.cpp b/src/designer/src/designer/appfontdialog.cpp
index 0379a1d90..d6ccd3b9b 100644
--- a/src/designer/src/designer/appfontdialog.cpp
+++ b/src/designer/src/designer/appfontdialog.cpp
@@ -35,7 +35,7 @@ using namespace Qt::StringLiterals;
enum {FileNameRole = Qt::UserRole + 1, IdRole = Qt::UserRole + 2 };
enum { debugAppFontWidget = 0 };
-static const char fontFileKeyC[] = "fontFiles";
+static constexpr auto fontFileKeyC = "fontFiles"_L1;
// AppFontManager: Singleton that maintains the mapping of loaded application font
// ids to the file names (which are not stored in QFontDatabase)
@@ -83,7 +83,7 @@ void AppFontManager::save(QDesignerSettingsInterface *s, const QString &prefix)
fontFiles.push_back(fnp.first);
s->beginGroup(prefix);
- s->setValue(QLatin1StringView(fontFileKeyC), fontFiles);
+ s->setValue(fontFileKeyC, fontFiles);
s->endGroup();
if (debugAppFontWidget)
@@ -92,7 +92,7 @@ void AppFontManager::save(QDesignerSettingsInterface *s, const QString &prefix)
void AppFontManager::restore(const QDesignerSettingsInterface *s, const QString &prefix)
{
- const QString key = prefix + u'/' + QLatin1StringView(fontFileKeyC);
+ const QString key = prefix + u'/' + fontFileKeyC;
const QStringList fontFiles = s->value(key, QStringList()).toStringList();
if (debugAppFontWidget)
diff --git a/src/designer/src/designer/mainwindow.cpp b/src/designer/src/designer/mainwindow.cpp
index ee3313cc6..08898cafb 100644
--- a/src/designer/src/designer/mainwindow.cpp
+++ b/src/designer/src/designer/mainwindow.cpp
@@ -29,8 +29,6 @@
#include <algorithm>
-static const char uriListMimeFormatC[] = "text/uri-list";
-
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
@@ -134,7 +132,7 @@ QStringList DockedMdiArea::uiFiles(const QMimeData *d) const
{
// Extract dropped UI files from Mime data.
QStringList rc;
- if (!d->hasFormat(QLatin1StringView(uriListMimeFormatC)))
+ if (!d->hasFormat("text/uri-list"_L1))
return rc;
const auto urls = d->urls();
if (urls.isEmpty())
diff --git a/src/designer/src/designer/qdesigner.cpp b/src/designer/src/designer/qdesigner.cpp
index 5f7418cdf..2fbc25b87 100644
--- a/src/designer/src/designer/qdesigner.cpp
+++ b/src/designer/src/designer/qdesigner.cpp
@@ -34,16 +34,16 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
-static const char designerApplicationName[] = "Designer";
-static const char designerDisplayName[] = "Qt Designer";
-static const char designerWarningPrefix[] = "Designer: ";
+static constexpr auto designerApplicationName = "Designer"_L1;
+static constexpr auto designerDisplayName = "Qt Designer"_L1;
+static constexpr auto designerWarningPrefix = "Designer: "_L1;
static QtMessageHandler previousMessageHandler = nullptr;
static void designerMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
// Only Designer warnings are displayed as box
QDesigner *designerApp = qDesigner;
- if (type != QtWarningMsg || !designerApp || !msg.startsWith(QLatin1StringView(designerWarningPrefix))) {
+ if (type != QtWarningMsg || !designerApp || !msg.startsWith(designerWarningPrefix)) {
previousMessageHandler(type, context, msg);
return;
}
@@ -54,8 +54,8 @@ QDesigner::QDesigner(int &argc, char **argv)
: QApplication(argc, argv)
{
setOrganizationName(u"QtProject"_s);
- QGuiApplication::setApplicationDisplayName(QLatin1StringView(designerDisplayName));
- setApplicationName(QLatin1StringView(designerApplicationName));
+ QGuiApplication::setApplicationDisplayName(designerDisplayName);
+ setApplicationName(designerApplicationName);
QDesignerComponents::initializeResources();
#if !defined(Q_OS_MACOS) && !defined(Q_OS_WIN)
@@ -74,7 +74,7 @@ void QDesigner::showErrorMessage(const QString &message)
{
// strip the prefix
const QString qMessage =
- message.right(message.size() - int(qstrlen(designerWarningPrefix)));
+ message.right(message.size() - int(designerWarningPrefix.size()));
// If there is no main window yet, just store the message.
// The QErrorMessage would otherwise be hidden by the main window.
if (m_mainWindow) {
@@ -99,7 +99,7 @@ void QDesigner::showErrorMessageBox(const QString &msg)
if (!m_errorMessageDialog) {
m_lastErrorMessage.clear();
m_errorMessageDialog = new QErrorMessage(m_mainWindow);
- const QString title = QCoreApplication::translate("QDesigner", "%1 - warning").arg(QLatin1StringView(designerApplicationName));
+ const QString title = QCoreApplication::translate("QDesigner", "%1 - warning").arg(designerApplicationName);
m_errorMessageDialog->setWindowTitle(title);
m_errorMessageDialog->setMinimumSize(QSize(600, 250));
}
diff --git a/src/designer/src/designer/qdesigner_workbench.cpp b/src/designer/src/designer/qdesigner_workbench.cpp
index 8a6ae3c80..ff1b37030 100644
--- a/src/designer/src/designer/qdesigner_workbench.cpp
+++ b/src/designer/src/designer/qdesigner_workbench.cpp
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
-static const char appFontPrefixC[] = "AppFonts";
+static constexpr auto appFontPrefixC = "AppFonts"_L1;
using ActionList = QList<QAction *>;
@@ -220,7 +220,7 @@ QDesignerWorkbench::QDesignerWorkbench(const QStringList &pluginPaths) :
}
restoreUISettings();
- AppFontWidget::restore(m_core->settingsManager(), QLatin1StringView(appFontPrefixC));
+ AppFontWidget::restore(m_core->settingsManager(), appFontPrefixC);
m_state = StateUp;
}
@@ -627,7 +627,7 @@ void QDesignerWorkbench::saveSettings() const
QDesignerSettings settings(m_core);
settings.clearBackup();
saveGeometries(settings);
- AppFontWidget::save(m_core->settingsManager(), QLatin1StringView(appFontPrefixC));
+ AppFontWidget::save(m_core->settingsManager(), appFontPrefixC);
}
void QDesignerWorkbench::saveGeometries(QDesignerSettings &settings) const
diff --git a/src/designer/src/lib/shared/actioneditor.cpp b/src/designer/src/lib/shared/actioneditor.cpp
index 0895fcd7c..681b3f658 100644
--- a/src/designer/src/lib/shared/actioneditor.cpp
+++ b/src/designer/src/lib/shared/actioneditor.cpp
@@ -49,15 +49,15 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
-static const char actionEditorViewModeKey[] = "ActionEditorViewMode";
+static constexpr auto actionEditorViewModeKey = "ActionEditorViewMode"_L1;
-static const char iconPropertyC[] = "icon";
-static const char shortcutPropertyC[] = "shortcut";
-static const char menuRolePropertyC[] = "menuRole";
-static const char toolTipPropertyC[] = "toolTip";
-static const char checkablePropertyC[] = "checkable";
-static const char objectNamePropertyC[] = "objectName";
-static const char textPropertyC[] = "text";
+static constexpr auto iconPropertyC = "icon"_L1;
+static constexpr auto shortcutPropertyC = "shortcut"_L1;
+static constexpr auto menuRolePropertyC = "menuRole"_L1;
+static constexpr auto toolTipPropertyC = "toolTip"_L1;
+static constexpr auto checkablePropertyC = "checkable"_L1;
+static constexpr auto objectNamePropertyC = "objectName"_L1;
+static constexpr auto textPropertyC = "text"_L1;
namespace qdesigner_internal {
//-------- ActionGroupDelegate
@@ -388,7 +388,7 @@ void ActionEditor::setFilter(const QString &f)
// Set changed state of icon property, reset when icon is cleared
static void refreshIconPropertyChanged(const QAction *action, QDesignerPropertySheetExtension *sheet)
{
- sheet->setChanged(sheet->indexOf(QLatin1StringView(iconPropertyC)), !action->icon().isNull());
+ sheet->setChanged(sheet->indexOf(iconPropertyC), !action->icon().isNull());
}
void ActionEditor::manageAction(QAction *action)
@@ -400,8 +400,8 @@ void ActionEditor::manageAction(QAction *action)
return;
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), action);
- sheet->setChanged(sheet->indexOf(QLatin1StringView(objectNamePropertyC)), true);
- sheet->setChanged(sheet->indexOf(QLatin1StringView(textPropertyC)), true);
+ sheet->setChanged(sheet->indexOf(objectNamePropertyC), true);
+ sheet->setChanged(sheet->indexOf(textPropertyC), true);
refreshIconPropertyChanged(action, sheet);
m_actionView->setCurrentIndex(m_actionView->model()->addAction(action));
@@ -444,17 +444,17 @@ void ActionEditor::slotNewAction()
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), action);
if (!actionData.toolTip.isEmpty())
- setInitialProperty(sheet, QLatin1StringView(toolTipPropertyC), actionData.toolTip);
+ setInitialProperty(sheet, toolTipPropertyC, actionData.toolTip);
if (actionData.checkable)
- setInitialProperty(sheet, QLatin1StringView(checkablePropertyC), QVariant(true));
+ setInitialProperty(sheet, checkablePropertyC, QVariant(true));
if (!actionData.keysequence.value().isEmpty())
- setInitialProperty(sheet, QLatin1StringView(shortcutPropertyC), QVariant::fromValue(actionData.keysequence));
+ setInitialProperty(sheet, shortcutPropertyC, QVariant::fromValue(actionData.keysequence));
- sheet->setProperty(sheet->indexOf(QLatin1StringView(iconPropertyC)), QVariant::fromValue(actionData.icon));
+ sheet->setProperty(sheet->indexOf(iconPropertyC), QVariant::fromValue(actionData.icon));
- setInitialProperty(sheet, QLatin1StringView(menuRolePropertyC), QVariant::fromValue(actionData.menuRole));
+ setInitialProperty(sheet, menuRolePropertyC, QVariant::fromValue(actionData.menuRole));
AddActionCommand *cmd = new AddActionCommand(formWindow());
cmd->init(action);
@@ -467,7 +467,7 @@ void ActionEditor::slotNewAction()
static QDesignerFormWindowCommand *setIconPropertyCommand(const PropertySheetIconValue &newIcon, QAction *action, QDesignerFormWindowInterface *fw)
{
- const QString iconProperty = QLatin1StringView(iconPropertyC);
+ const QString iconProperty = iconPropertyC;
if (newIcon.isEmpty()) {
ResetPropertyCommand *cmd = new ResetPropertyCommand(fw);
cmd->init(action, iconProperty);
@@ -483,7 +483,7 @@ static QDesignerFormWindowCommand *setIconPropertyCommand(const PropertySheetIco
static QDesignerFormWindowCommand *setKeySequencePropertyCommand(const PropertySheetKeySequenceValue &ks, QAction *action, QDesignerFormWindowInterface *fw)
{
- const QString shortcutProperty = QLatin1StringView(shortcutPropertyC);
+ const QString shortcutProperty = shortcutPropertyC;
if (ks.value().isEmpty()) {
ResetPropertyCommand *cmd = new ResetPropertyCommand(fw);
cmd->init(action, shortcutProperty);
@@ -532,8 +532,8 @@ void ActionEditor::editAction(QAction *action, int column)
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), action);
oldActionData.name = action->objectName();
oldActionData.text = action->text();
- oldActionData.toolTip = textPropertyValue(sheet, QLatin1StringView(toolTipPropertyC));
- oldActionData.icon = qvariant_cast<PropertySheetIconValue>(sheet->property(sheet->indexOf(QLatin1StringView(iconPropertyC))));
+ oldActionData.toolTip = textPropertyValue(sheet, toolTipPropertyC);
+ oldActionData.icon = qvariant_cast<PropertySheetIconValue>(sheet->property(sheet->indexOf(iconPropertyC)));
oldActionData.keysequence = ActionModel::actionShortCut(sheet);
oldActionData.checkable = action->isCheckable();
oldActionData.menuRole.value = action->menuRole();
@@ -580,25 +580,25 @@ void ActionEditor::editAction(QAction *action, int column)
fw->beginCommand(u"Edit action"_s);
if (changeMask & ActionData::NameChanged)
- undoStack->push(createTextPropertyCommand(QLatin1StringView(objectNamePropertyC), newActionData.name, action, fw));
+ undoStack->push(createTextPropertyCommand(objectNamePropertyC, newActionData.name, action, fw));
if (changeMask & ActionData::TextChanged)
- undoStack->push(createTextPropertyCommand(QLatin1StringView(textPropertyC), newActionData.text, action, fw));
+ undoStack->push(createTextPropertyCommand(textPropertyC, newActionData.text, action, fw));
if (changeMask & ActionData::ToolTipChanged)
- undoStack->push(createTextPropertyCommand(QLatin1StringView(toolTipPropertyC), newActionData.toolTip, action, fw));
+ undoStack->push(createTextPropertyCommand(toolTipPropertyC, newActionData.toolTip, action, fw));
if (changeMask & ActionData::IconChanged)
undoStack->push(setIconPropertyCommand(newActionData.icon, action, fw));
if (changeMask & ActionData::CheckableChanged)
- undoStack->push(setPropertyCommand(QLatin1StringView(checkablePropertyC), newActionData.checkable, false, action, fw));
+ undoStack->push(setPropertyCommand(checkablePropertyC, newActionData.checkable, false, action, fw));
if (changeMask & ActionData::KeysequenceChanged)
undoStack->push(setKeySequencePropertyCommand(newActionData.keysequence, action, fw));
if (changeMask & ActionData::MenuRoleChanged)
- undoStack->push(setPropertyCommand(QLatin1StringView(menuRolePropertyC), static_cast<QAction::MenuRole>(newActionData.menuRole.value), QAction::NoRole, action, fw));
+ undoStack->push(setPropertyCommand(menuRolePropertyC, static_cast<QAction::MenuRole>(newActionData.menuRole.value), QAction::NoRole, action, fw));
if (severalChanges)
fw->endCommand();
@@ -733,7 +733,7 @@ void ActionEditor::resourceImageDropped(const QString &path, QAction *action)
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), action);
const PropertySheetIconValue oldIcon =
- qvariant_cast<PropertySheetIconValue>(sheet->property(sheet->indexOf(QLatin1StringView(iconPropertyC))));
+ qvariant_cast<PropertySheetIconValue>(sheet->property(sheet->indexOf(iconPropertyC)));
PropertySheetIconValue newIcon;
newIcon.setPixmap(QIcon::Normal, QIcon::Off, PropertySheetPixmapValue(path));
if (newIcon.paths().isEmpty() || newIcon.paths() == oldIcon.paths())
@@ -790,14 +790,14 @@ void ActionEditor::slotSelectAssociatedWidget(QWidget *w)
void ActionEditor::restoreSettings()
{
QDesignerSettingsInterface *settings = m_core->settingsManager();
- m_actionView->setViewMode(settings->value(QLatin1StringView(actionEditorViewModeKey), 0).toInt());
+ m_actionView->setViewMode(settings->value(actionEditorViewModeKey, 0).toInt());
updateViewModeActions();
}
void ActionEditor::saveSettings()
{
QDesignerSettingsInterface *settings = m_core->settingsManager();
- settings->setValue(QLatin1StringView(actionEditorViewModeKey), m_actionView->viewMode());
+ settings->setValue(actionEditorViewModeKey, m_actionView->viewMode());
}
void ActionEditor::updateViewModeActions()
diff --git a/src/designer/src/lib/shared/actionrepository.cpp b/src/designer/src/lib/shared/actionrepository.cpp
index 5ad3d75ca..59d8fc6b7 100644
--- a/src/designer/src/lib/shared/actionrepository.cpp
+++ b/src/designer/src/lib/shared/actionrepository.cpp
@@ -33,8 +33,8 @@ namespace {
enum { listModeIconSize = 16, iconModeIconSize = 24 };
}
-static const char actionMimeType[] = "action-repository/actions";
-static const char plainTextMimeType[] = "text/plain";
+static constexpr auto actionMimeType = "action-repository/actions"_L1;
+static constexpr auto plainTextMimeType = "text/plain"_L1;
static inline QAction *actionOfItem(const QStandardItem* item)
{
@@ -221,7 +221,7 @@ QMimeData *ActionModel::mimeData(const QModelIndexList &indexes ) const
// Resource images are plain text. The drag needs to be restricted, however.
QStringList ActionModel::mimeTypes() const
{
- return QStringList(QLatin1StringView(plainTextMimeType));
+ return QStringList(plainTextMimeType);
}
QString ActionModel::actionName(int row) const
@@ -613,7 +613,7 @@ ActionRepositoryMimeData::ActionRepositoryMimeData(const ActionList &al, Qt::Dro
QStringList ActionRepositoryMimeData::formats() const
{
- return QStringList(QLatin1StringView(actionMimeType));
+ return QStringList(actionMimeType);
}
QPixmap ActionRepositoryMimeData::actionDragPixmap(const QAction *action)
diff --git a/src/designer/src/lib/shared/deviceprofile.cpp b/src/designer/src/lib/shared/deviceprofile.cpp
index e5fdc8570..25148b526 100644
--- a/src/designer/src/lib/shared/deviceprofile.cpp
+++ b/src/designer/src/lib/shared/deviceprofile.cpp
@@ -24,15 +24,21 @@
static const char dpiXPropertyC[] = "_q_customDpiX";
static const char dpiYPropertyC[] = "_q_customDpiY";
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+namespace qdesigner_internal {
+
// XML serialization
static const char *xmlVersionC="1.0";
static const char *rootElementC="deviceprofile";
-static const char nameElementC[] = "name";
-static const char fontFamilyElementC[] = "fontfamily";
-static const char fontPointSizeElementC[] = "fontpointsize";
-static const char dPIXElementC[] = "dpix";
-static const char dPIYElementC[] = "dpiy";
-static const char styleElementC[] = "style";
+static constexpr auto nameElementC = "name"_L1;
+static constexpr auto fontFamilyElementC = "fontfamily"_L1;
+static constexpr auto fontPointSizeElementC = "fontpointsize"_L1;
+static constexpr auto dPIXElementC = "dpix"_L1;
+static constexpr auto dPIYElementC = "dpiy"_L1;
+static constexpr auto styleElementC = "style"_L1;
/* DeviceProfile:
* For preview purposes (preview, widget box, new form dialog), the
@@ -44,10 +50,6 @@ static const char styleElementC[] = "style";
* In addition, the widgetfactory maintains the system settings style
* and applies it when creating widgets. */
-QT_BEGIN_NAMESPACE
-
-namespace qdesigner_internal {
-
// ---------------- DeviceProfileData
class DeviceProfileData : public QSharedData {
public:
@@ -284,18 +286,18 @@ QString DeviceProfile::toXml() const
QXmlStreamWriter writer(&rc);
writer.writeStartDocument(QLatin1StringView(xmlVersionC));
writer.writeStartElement(QLatin1StringView(rootElementC));
- writeElement(writer, QLatin1StringView(nameElementC), d.m_name);
+ writeElement(writer, nameElementC, d.m_name);
if (!d.m_fontFamily.isEmpty())
- writeElement(writer, QLatin1StringView(fontFamilyElementC), d.m_fontFamily);
+ writeElement(writer, fontFamilyElementC, d.m_fontFamily);
if (d.m_fontPointSize >= 0)
- writeElement(writer, QLatin1StringView(fontPointSizeElementC), QString::number(d.m_fontPointSize));
+ writeElement(writer, fontPointSizeElementC, QString::number(d.m_fontPointSize));
if (d.m_dpiX > 0)
- writeElement(writer, QLatin1StringView(dPIXElementC), QString::number(d.m_dpiX));
+ writeElement(writer, dPIXElementC, QString::number(d.m_dpiX));
if (d.m_dpiY > 0)
- writeElement(writer, QLatin1StringView(dPIYElementC), QString::number(d.m_dpiY));
+ writeElement(writer, dPIYElementC, QString::number(d.m_dpiY));
if (!d.m_style.isEmpty())
- writeElement(writer, QLatin1StringView(styleElementC), d.m_style);
+ writeElement(writer, styleElementC, d.m_style);
writer.writeEndElement();
writer.writeEndDocument();
@@ -321,17 +323,17 @@ static ParseStage nextStage(ParseStage currentStage, QStringView startElement)
case ParseDPIX:
case ParseDPIY:
case ParseStyle:
- if (startElement == QLatin1StringView(nameElementC))
+ if (startElement == nameElementC)
return ParseName;
- if (startElement == QLatin1StringView(fontFamilyElementC))
+ if (startElement == fontFamilyElementC)
return ParseFontFamily;
- if (startElement == QLatin1StringView(fontPointSizeElementC))
+ if (startElement == fontPointSizeElementC)
return ParseFontPointSize;
- if (startElement == QLatin1StringView(dPIXElementC))
+ if (startElement == dPIXElementC)
return ParseDPIX;
- if (startElement == QLatin1StringView(dPIYElementC))
+ if (startElement == dPIYElementC)
return ParseDPIY;
- if (startElement == QLatin1StringView(styleElementC))
+ if (startElement == styleElementC)
return ParseStyle;
break;
case ParseError:
diff --git a/src/designer/src/lib/shared/formlayoutmenu.cpp b/src/designer/src/lib/shared/formlayoutmenu.cpp
index 17255aa56..0c7313770 100644
--- a/src/designer/src/lib/shared/formlayoutmenu.cpp
+++ b/src/designer/src/lib/shared/formlayoutmenu.cpp
@@ -31,16 +31,16 @@
#include <QtCore/qhash.h>
#include <QtCore/qdebug.h>
-static const char buddyPropertyC[] = "buddy";
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+static constexpr auto buddyPropertyC = "buddy"_L1;
static const char *fieldWidgetBaseClasses[] = {
"QLineEdit", "QComboBox", "QSpinBox", "QDoubleSpinBox", "QCheckBox",
"QDateEdit", "QTimeEdit", "QDateTimeEdit", "QDial", "QWidget"
};
-QT_BEGIN_NAMESPACE
-
-using namespace Qt::StringLiterals;
-
namespace qdesigner_internal {
// Struct that describes a row of controls (descriptive label and control) to
@@ -426,7 +426,7 @@ static void addFormLayoutRow(const FormLayoutRow &formLayoutRow, int row, QWidge
undoStack->push(controlCmd);
if (formLayoutRow.buddy) {
SetPropertyCommand *buddyCommand = new SetPropertyCommand(formWindow);
- buddyCommand->init(widgetPair.first, QLatin1StringView(buddyPropertyC), widgetPair.second->objectName());
+ buddyCommand->init(widgetPair.first, buddyPropertyC, widgetPair.second->objectName());
undoStack->push(buddyCommand);
}
undoStack->endMacro();
diff --git a/src/designer/src/lib/shared/newformwidget.cpp b/src/designer/src/lib/shared/newformwidget.cpp
index 2101403a0..1cf1c8bfb 100644
--- a/src/designer/src/lib/shared/newformwidget.cpp
+++ b/src/designer/src/lib/shared/newformwidget.cpp
@@ -44,14 +44,14 @@ enum NewForm_CustomRole {
ClassNameRole = Qt::UserRole + 101
};
-static const char newFormObjectNameC[] = "Form";
+static constexpr auto newFormObjectNameC = "Form"_L1;
// Create a form name for an arbitrary class. If it is Qt, qtify it,
// else return "Form".
static QString formName(const QString &className)
{
if (!className.startsWith(u'Q'))
- return QLatin1StringView(newFormObjectNameC);
+ return newFormObjectNameC;
QString rc = className;
rc.remove(0, 1);
return rc;
diff --git a/src/designer/src/lib/shared/plaintexteditor.cpp b/src/designer/src/lib/shared/plaintexteditor.cpp
index 32e0c50a9..ad6708c9f 100644
--- a/src/designer/src/lib/shared/plaintexteditor.cpp
+++ b/src/designer/src/lib/shared/plaintexteditor.cpp
@@ -13,9 +13,10 @@
QT_BEGIN_NAMESPACE
-static const char PlainTextDialogC[] = "PlainTextDialog";
-static const char PlainTextEditorGeometryC[] = "Geometry";
+using namespace Qt::StringLiterals;
+static constexpr auto PlainTextDialogC = "PlainTextDialog"_L1;
+static constexpr auto PlainTextEditorGeometryC = "Geometry"_L1;
namespace qdesigner_internal {
@@ -37,10 +38,10 @@ PlainTextEditorDialog::PlainTextEditorDialog(QDesignerFormEditorInterface *core,
vlayout->addWidget(buttonBox);
QDesignerSettingsInterface *settings = core->settingsManager();
- settings->beginGroup(QLatin1StringView(PlainTextDialogC));
+ settings->beginGroup(PlainTextDialogC);
- if (settings->contains(QLatin1StringView(PlainTextEditorGeometryC)))
- restoreGeometry(settings->value(QLatin1StringView(PlainTextEditorGeometryC)).toByteArray());
+ if (settings->contains(PlainTextEditorGeometryC))
+ restoreGeometry(settings->value(PlainTextEditorGeometryC).toByteArray());
settings->endGroup();
}
@@ -48,9 +49,9 @@ PlainTextEditorDialog::PlainTextEditorDialog(QDesignerFormEditorInterface *core,
PlainTextEditorDialog::~PlainTextEditorDialog()
{
QDesignerSettingsInterface *settings = m_core->settingsManager();
- settings->beginGroup(QLatin1StringView(PlainTextDialogC));
+ settings->beginGroup(PlainTextDialogC);
- settings->setValue(QLatin1StringView(PlainTextEditorGeometryC), saveGeometry());
+ settings->setValue(PlainTextEditorGeometryC, saveGeometry());
settings->endGroup();
}
diff --git a/src/designer/src/lib/shared/pluginmanager.cpp b/src/designer/src/lib/shared/pluginmanager.cpp
index e40c02e11..83c587809 100644
--- a/src/designer/src/lib/shared/pluginmanager.cpp
+++ b/src/designer/src/lib/shared/pluginmanager.cpp
@@ -27,21 +27,21 @@
using namespace Qt::StringLiterals;
-static const char uiElementC[] = "ui";
-static const char languageAttributeC[] = "language";
-static const char widgetElementC[] = "widget";
-static const char displayNameAttributeC[] = "displayname";
-static const char classAttributeC[] = "class";
-static const char customwidgetElementC[] = "customwidget";
-static const char extendsElementC[] = "extends";
-static const char addPageMethodC[] = "addpagemethod";
-static const char propertySpecsC[] = "propertyspecifications";
-static const char stringPropertySpecC[] = "stringpropertyspecification";
-static const char propertyToolTipC[] = "tooltip";
-static const char stringPropertyNameAttrC[] = "name";
-static const char stringPropertyTypeAttrC[] = "type";
-static const char stringPropertyNoTrAttrC[] = "notr";
-static const char jambiLanguageC[] = "jambi";
+static constexpr auto uiElementC = "ui"_L1;
+static constexpr auto languageAttributeC = "language"_L1;
+static constexpr auto widgetElementC = "widget"_L1;
+static constexpr auto displayNameAttributeC = "displayname"_L1;
+static constexpr auto classAttributeC = "class"_L1;
+static constexpr auto customwidgetElementC = "customwidget"_L1;
+static constexpr auto extendsElementC = "extends"_L1;
+static constexpr auto addPageMethodC = "addpagemethod"_L1;
+static constexpr auto propertySpecsC = "propertyspecifications"_L1;
+static constexpr auto stringPropertySpecC = "stringpropertyspecification"_L1;
+static constexpr auto propertyToolTipC = "tooltip"_L1;
+static constexpr auto stringPropertyNameAttrC = "name"_L1;
+static constexpr auto stringPropertyTypeAttrC = "type"_L1;
+static constexpr auto stringPropertyNoTrAttrC = "notr"_L1;
+static constexpr auto jambiLanguageC = "jambi"_L1;
enum { debugPluginManager = 0 };
@@ -89,7 +89,7 @@ static inline QString getDesignerLanguage(QDesignerFormEditorInterface *core)
{
if (QDesignerLanguageExtension *lang = qt_extension<QDesignerLanguageExtension *>(core->extensionManager(), core)) {
if (lang->uiExtension() == "jui"_L1)
- return QLatin1StringView(jambiLanguageC);
+ return jambiLanguageC;
return u"unknown"_s;
}
return u"c++"_s;
@@ -259,12 +259,12 @@ static bool parsePropertySpecs(QXmlStreamReader &sr,
QDesignerCustomWidgetSharedData *data,
QString *errorMessage)
{
- const QString propertySpecs = QLatin1StringView(propertySpecsC);
- const QString stringPropertySpec = QLatin1StringView(stringPropertySpecC);
- const QString propertyToolTip = QLatin1StringView(propertyToolTipC);
- const QString stringPropertyTypeAttr = QLatin1StringView(stringPropertyTypeAttrC);
- const QString stringPropertyNoTrAttr = QLatin1StringView(stringPropertyNoTrAttrC);
- const QString stringPropertyNameAttr = QLatin1StringView(stringPropertyNameAttrC);
+ const QString propertySpecs = propertySpecsC;
+ const QString stringPropertySpec = stringPropertySpecC;
+ const QString propertyToolTip = propertyToolTipC;
+ const QString stringPropertyTypeAttr = stringPropertyTypeAttrC;
+ const QString stringPropertyNoTrAttr = stringPropertyNoTrAttrC;
+ const QString stringPropertyNameAttr = stringPropertyNameAttrC;
while (!sr.atEnd()) {
switch(sr.readNext()) {
@@ -330,8 +330,8 @@ QDesignerCustomWidgetData::ParseResult
ParseResult rc = ParseOk;
// Parse for the (optional) <ui> or the first <widget> element
QStringList elements;
- elements.push_back(QLatin1StringView(uiElementC));
- elements.push_back(QLatin1StringView(widgetElementC));
+ elements.push_back(uiElementC);
+ elements.push_back(widgetElementC);
for (int i = 0; i < 2 && !foundWidget; i++) {
switch (findElement(elements, sr)) {
case FindError:
@@ -342,13 +342,13 @@ QDesignerCustomWidgetData::ParseResult
return ParseError;
case 0: { // <ui>
const QXmlStreamAttributes attributes = sr.attributes();
- data.xmlLanguage = attributes.value(QLatin1StringView(languageAttributeC)).toString();
- data.xmlDisplayName = attributes.value(QLatin1StringView(displayNameAttributeC)).toString();
+ data.xmlLanguage = attributes.value(languageAttributeC).toString();
+ data.xmlDisplayName = attributes.value(displayNameAttributeC).toString();
foundUI = true;
}
break;
case 1: // <widget>: Do some sanity checks
- data.xmlClassName = sr.attributes().value(QLatin1StringView(classAttributeC)).toString();
+ data.xmlClassName = sr.attributes().value(classAttributeC).toString();
if (data.xmlClassName.isEmpty()) {
*errorMessage = QDesignerPluginManager::tr("The class attribute for the class %1 is missing.").arg(name);
rc = ParseWarning;
@@ -366,7 +366,7 @@ QDesignerCustomWidgetData::ParseResult
if (!foundUI)
return rc;
elements.clear();
- elements.push_back(QLatin1StringView(customwidgetElementC));
+ elements.push_back(customwidgetElementC);
switch (findElement(elements, sr)) {
case FindError:
*errorMessage = msgXmlError(name, sr.errorString());
@@ -377,10 +377,7 @@ QDesignerCustomWidgetData::ParseResult
break;
}
// Find <extends>, <addPageMethod>, <stringproperties>
- elements.clear();
- elements.push_back(QLatin1StringView(extendsElementC));
- elements.push_back(QLatin1StringView(addPageMethodC));
- elements.push_back(QLatin1StringView(propertySpecsC));
+ elements = {extendsElementC, addPageMethodC, propertySpecsC};
while (true) {
switch (findElement(elements, sr)) {
case FindError:
diff --git a/src/designer/src/lib/shared/previewconfigurationwidget.cpp b/src/designer/src/lib/shared/previewconfigurationwidget.cpp
index e89d6a4aa..f338b1f2e 100644
--- a/src/designer/src/lib/shared/previewconfigurationwidget.cpp
+++ b/src/designer/src/lib/shared/previewconfigurationwidget.cpp
@@ -23,14 +23,12 @@
#include <QtCore/qfileinfo.h>
#include <QtCore/qshareddata.h>
-
-static const char skinResourcePathC[] = ":/skins/";
-
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
-static const char skinExtensionC[] = "skin";
+static constexpr auto skinResourcePathC = ":/skins/"_L1;
+static constexpr auto skinExtensionC = "skin"_L1;
// Pair of skin name, path
using SkinNamePath = std::pair<QString, QString>;
@@ -41,9 +39,7 @@ enum { SkinComboNoneIndex = 0 };
static const Skins &defaultSkins() {
static Skins rc;
if (rc.isEmpty()) {
- const QString skinPath = QLatin1StringView(skinResourcePathC);
- const QString pattern = "*."_L1 + QLatin1StringView(skinExtensionC);
- const QDir dir(skinPath, pattern);
+ const QDir dir(skinResourcePathC, "*."_L1 + skinExtensionC);
const QFileInfoList list = dir.entryInfoList(QDir::Dirs|QDir::NoDotAndDotDot, QDir::Name);
if (list.isEmpty())
return rc;
@@ -241,7 +237,7 @@ int PreviewConfigurationWidget::PreviewConfigurationWidgetPrivate::browseSkin()
dlg.setOption(QFileDialog::ShowDirsOnly);
const QString title = tr("Load Custom Device Skin");
dlg.setWindowTitle(title);
- dlg.setNameFilter(tr("All QVFB Skins (*.%1)").arg(QLatin1StringView(skinExtensionC)));
+ dlg.setNameFilter(tr("All QVFB Skins (*.%1)").arg(skinExtensionC));
int rc = m_lastSkinIndex;
do {
diff --git a/src/designer/src/lib/shared/previewmanager.cpp b/src/designer/src/lib/shared/previewmanager.cpp
index d0170e6ff..ce9a58e72 100644
--- a/src/designer/src/lib/shared/previewmanager.cpp
+++ b/src/designer/src/lib/shared/previewmanager.cpp
@@ -408,9 +408,9 @@ void ZoomablePreviewDeviceSkin::fitWidget(const QSize &size)
// ------------- PreviewConfiguration
-static const char styleKey[] = "Style";
-static const char appStyleSheetKey[] = "AppStyleSheet";
-static const char skinKey[] = "Skin";
+static constexpr auto styleKey = "Style"_L1;
+static constexpr auto appStyleSheetKey = "AppStyleSheet"_L1;
+static constexpr auto skinKey = "Skin"_L1;
PreviewConfiguration::PreviewConfiguration() :
m_d(new PreviewConfigurationData)
@@ -478,9 +478,9 @@ void PreviewConfiguration::toSettings(const QString &prefix, QDesignerSettingsIn
{
const PreviewConfigurationData &d = *m_d;
settings->beginGroup(prefix);
- settings->setValue(QLatin1StringView(styleKey), d.m_style);
- settings->setValue(QLatin1StringView(appStyleSheetKey), d.m_applicationStyleSheet);
- settings->setValue(QLatin1StringView(skinKey), d.m_deviceSkin);
+ settings->setValue(styleKey, d.m_style);
+ settings->setValue(appStyleSheetKey, d.m_applicationStyleSheet);
+ settings->setValue(skinKey, d.m_deviceSkin);
settings->endGroup();
}
@@ -494,13 +494,13 @@ void PreviewConfiguration::fromSettings(const QString &prefix, const QDesignerSe
const QVariant emptyString = QVariant(QString());
- key += QLatin1StringView(styleKey);
+ key += styleKey;
d.m_style = settings->value(key, emptyString).toString();
- key.replace(prefixSize, key.size() - prefixSize, QLatin1StringView(appStyleSheetKey));
+ key.replace(prefixSize, key.size() - prefixSize, appStyleSheetKey);
d.m_applicationStyleSheet = settings->value(key, emptyString).toString();
- key.replace(prefixSize, key.size() - prefixSize, QLatin1StringView(skinKey));
+ key.replace(prefixSize, key.size() - prefixSize, skinKey);
d.m_deviceSkin = settings->value(key, emptyString).toString();
}
diff --git a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp
index 38bea7dbe..954c1c35f 100644
--- a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp
+++ b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp
@@ -59,26 +59,26 @@ static const QDesignerMetaObjectInterface *propertyIntroducedBy(const QDesignerM
// old forms, QLayoutWidget will show up as ''; however, the uic code will
// still use 'verticalLayout' (in case someone accesses it). New Layouts get autogenerated names,
// legacy forms will keep their empty names (unless someone types in a new name).
-static const char layoutObjectNameC[] = "layoutName";
-static const char layoutLeftMarginC[] = "layoutLeftMargin";
-static const char layoutTopMarginC[] = "layoutTopMargin";
-static const char layoutRightMarginC[] = "layoutRightMargin";
-static const char layoutBottomMarginC[] = "layoutBottomMargin";
-static const char layoutSpacingC[] = "layoutSpacing";
-static const char layoutHorizontalSpacingC[] = "layoutHorizontalSpacing";
-static const char layoutVerticalSpacingC[] = "layoutVerticalSpacing";
-static const char layoutSizeConstraintC[] = "layoutSizeConstraint";
+static constexpr auto layoutObjectNameC = "layoutName"_L1;
+static constexpr auto layoutLeftMarginC = "layoutLeftMargin"_L1;
+static constexpr auto layoutTopMarginC = "layoutTopMargin"_L1;
+static constexpr auto layoutRightMarginC = "layoutRightMargin"_L1;
+static constexpr auto layoutBottomMarginC = "layoutBottomMargin"_L1;
+static constexpr auto layoutSpacingC = "layoutSpacing"_L1;
+static constexpr auto layoutHorizontalSpacingC = "layoutHorizontalSpacing"_L1;
+static constexpr auto layoutVerticalSpacingC = "layoutVerticalSpacing"_L1;
+static constexpr auto layoutSizeConstraintC = "layoutSizeConstraint"_L1;
// form layout
-static const char layoutFieldGrowthPolicyC[] = "layoutFieldGrowthPolicy";
-static const char layoutRowWrapPolicyC[] = "layoutRowWrapPolicy";
-static const char layoutLabelAlignmentC[] = "layoutLabelAlignment";
-static const char layoutFormAlignmentC[] = "layoutFormAlignment";
+static constexpr auto layoutFieldGrowthPolicyC = "layoutFieldGrowthPolicy"_L1;
+static constexpr auto layoutRowWrapPolicyC = "layoutRowWrapPolicy"_L1;
+static constexpr auto layoutLabelAlignmentC = "layoutLabelAlignment"_L1;
+static constexpr auto layoutFormAlignmentC = "layoutFormAlignment"_L1;
// stretches
-static const char layoutboxStretchPropertyC[] = "layoutStretch";
-static const char layoutGridRowStretchPropertyC[] = "layoutRowStretch";
-static const char layoutGridColumnStretchPropertyC[] = "layoutColumnStretch";
-static const char layoutGridRowMinimumHeightC[] = "layoutRowMinimumHeight";
-static const char layoutGridColumnMinimumWidthC[] = "layoutColumnMinimumWidth";
+static constexpr auto layoutboxStretchPropertyC = "layoutStretch"_L1;
+static constexpr auto layoutGridRowStretchPropertyC = "layoutRowStretch"_L1;
+static constexpr auto layoutGridColumnStretchPropertyC = "layoutColumnStretch"_L1;
+static constexpr auto layoutGridRowMinimumHeightC = "layoutRowMinimumHeight"_L1;
+static constexpr auto layoutGridColumnMinimumWidthC = "layoutColumnMinimumWidth"_L1;
static bool hasLayoutAttributes(QDesignerFormEditorInterface *core, QObject *object)
{
@@ -497,24 +497,24 @@ QDesignerPropertySheet::ObjectFlags QDesignerPropertySheet::objectFlagsFromObjec
QDesignerPropertySheet::PropertyType QDesignerPropertySheet::propertyTypeFromName(const QString &name)
{
static const QHash<QString, PropertyType> propertyTypeHash = {
- {QLatin1StringView(layoutObjectNameC), PropertyLayoutObjectName},
- {QLatin1StringView(layoutLeftMarginC), PropertyLayoutLeftMargin},
- {QLatin1StringView(layoutTopMarginC), PropertyLayoutTopMargin},
- {QLatin1StringView(layoutRightMarginC), PropertyLayoutRightMargin},
- {QLatin1StringView(layoutBottomMarginC), PropertyLayoutBottomMargin},
- {QLatin1StringView(layoutSpacingC), PropertyLayoutSpacing},
- {QLatin1StringView(layoutHorizontalSpacingC), PropertyLayoutHorizontalSpacing},
- {QLatin1StringView(layoutVerticalSpacingC), PropertyLayoutVerticalSpacing},
- {QLatin1StringView(layoutSizeConstraintC), PropertyLayoutSizeConstraint},
- {QLatin1StringView(layoutFieldGrowthPolicyC), PropertyLayoutFieldGrowthPolicy},
- {QLatin1StringView(layoutRowWrapPolicyC), PropertyLayoutRowWrapPolicy},
- {QLatin1StringView(layoutLabelAlignmentC), PropertyLayoutLabelAlignment},
- {QLatin1StringView(layoutFormAlignmentC), PropertyLayoutFormAlignment},
- {QLatin1StringView(layoutboxStretchPropertyC), PropertyLayoutBoxStretch},
- {QLatin1StringView(layoutGridRowStretchPropertyC), PropertyLayoutGridRowStretch},
- {QLatin1StringView(layoutGridColumnStretchPropertyC), PropertyLayoutGridColumnStretch},
- {QLatin1StringView(layoutGridRowMinimumHeightC), PropertyLayoutGridRowMinimumHeight},
- {QLatin1StringView(layoutGridColumnMinimumWidthC), PropertyLayoutGridColumnMinimumWidth},
+ {layoutObjectNameC, PropertyLayoutObjectName},
+ {layoutLeftMarginC, PropertyLayoutLeftMargin},
+ {layoutTopMarginC, PropertyLayoutTopMargin},
+ {layoutRightMarginC, PropertyLayoutRightMargin},
+ {layoutBottomMarginC, PropertyLayoutBottomMargin},
+ {layoutSpacingC, PropertyLayoutSpacing},
+ {layoutHorizontalSpacingC, PropertyLayoutHorizontalSpacing},
+ {layoutVerticalSpacingC, PropertyLayoutVerticalSpacing},
+ {layoutSizeConstraintC, PropertyLayoutSizeConstraint},
+ {layoutFieldGrowthPolicyC, PropertyLayoutFieldGrowthPolicy},
+ {layoutRowWrapPolicyC, PropertyLayoutRowWrapPolicy},
+ {layoutLabelAlignmentC, PropertyLayoutLabelAlignment},
+ {layoutFormAlignmentC, PropertyLayoutFormAlignment},
+ {layoutboxStretchPropertyC, PropertyLayoutBoxStretch},
+ {layoutGridRowStretchPropertyC, PropertyLayoutGridRowStretch},
+ {layoutGridColumnStretchPropertyC, PropertyLayoutGridColumnStretch},
+ {layoutGridRowMinimumHeightC, PropertyLayoutGridRowMinimumHeight},
+ {layoutGridColumnMinimumWidthC, PropertyLayoutGridColumnMinimumWidth},
{u"buddy"_s, PropertyBuddy},
{u"geometry"_s, PropertyGeometry},
{u"checked"_s, PropertyChecked},
@@ -619,7 +619,7 @@ QDesignerPropertySheet::QDesignerPropertySheet(QObject *object, QObject *parent)
}
if (d->m_canHaveLayoutAttributes) {
const QString layoutGroup = u"Layout"_s;
- const char* fakeLayoutProperties[] = {
+ static constexpr QLatin1StringView fakeLayoutProperties[] = {
layoutObjectNameC, layoutLeftMarginC, layoutTopMarginC, layoutRightMarginC, layoutBottomMarginC, layoutSpacingC, layoutHorizontalSpacingC, layoutVerticalSpacingC,
layoutFieldGrowthPolicyC, layoutRowWrapPolicyC, layoutLabelAlignmentC, layoutFormAlignmentC,
layoutboxStretchPropertyC, layoutGridRowStretchPropertyC, layoutGridColumnStretchPropertyC,
@@ -628,10 +628,10 @@ QDesignerPropertySheet::QDesignerPropertySheet(QObject *object, QObject *parent)
, layoutSizeConstraintC
#endif
};
- const int fakeLayoutPropertyCount = sizeof(fakeLayoutProperties)/sizeof(const char*);
+ static constexpr int fakeLayoutPropertyCount = sizeof(fakeLayoutProperties)/sizeof(fakeLayoutProperties[0]);
const int size = count();
for (int i = 0; i < fakeLayoutPropertyCount; i++) {
- createFakeProperty(QLatin1StringView(fakeLayoutProperties[i]), 0);
+ createFakeProperty(fakeLayoutProperties[i], 0);
setAttribute(size + i, true);
setPropertyGroup(size + i, layoutGroup);
}
diff --git a/src/designer/src/lib/shared/qdesigner_stackedbox.cpp b/src/designer/src/lib/shared/qdesigner_stackedbox.cpp
index b35a50a7e..993dd6089 100644
--- a/src/designer/src/lib/shared/qdesigner_stackedbox.cpp
+++ b/src/designer/src/lib/shared/qdesigner_stackedbox.cpp
@@ -313,25 +313,25 @@ QMenu *QStackedWidgetEventFilter::addContextMenuActions(QMenu *popup)
// -------- QStackedWidgetPropertySheet
-static const char pagePropertyName[] = "currentPageName";
+static constexpr auto pagePropertyName = "currentPageName"_L1;
QStackedWidgetPropertySheet::QStackedWidgetPropertySheet(QStackedWidget *object, QObject *parent) :
QDesignerPropertySheet(object, parent),
m_stackedWidget(object)
{
- createFakeProperty(QLatin1StringView(pagePropertyName), QString());
+ createFakeProperty(pagePropertyName, QString());
}
bool QStackedWidgetPropertySheet::isEnabled(int index) const
{
- if (propertyName(index) != QLatin1StringView(pagePropertyName))
+ if (propertyName(index) != pagePropertyName)
return QDesignerPropertySheet::isEnabled(index);
return m_stackedWidget->currentWidget() != nullptr;
}
void QStackedWidgetPropertySheet::setProperty(int index, const QVariant &value)
{
- if (propertyName(index) == QLatin1StringView(pagePropertyName)) {
+ if (propertyName(index) == pagePropertyName) {
if (QWidget *w = m_stackedWidget->currentWidget())
w->setObjectName(value.toString());
} else {
@@ -341,7 +341,7 @@ void QStackedWidgetPropertySheet::setProperty(int index, const QVariant &value)
QVariant QStackedWidgetPropertySheet::property(int index) const
{
- if (propertyName(index) == QLatin1StringView(pagePropertyName)) {
+ if (propertyName(index) == pagePropertyName) {
if (const QWidget *w = m_stackedWidget->currentWidget())
return w->objectName();
return QString();
@@ -351,7 +351,7 @@ QVariant QStackedWidgetPropertySheet::property(int index) const
bool QStackedWidgetPropertySheet::reset(int index)
{
- if (propertyName(index) == QLatin1StringView(pagePropertyName)) {
+ if (propertyName(index) == pagePropertyName) {
setProperty(index, QString());
return true;
}
@@ -360,7 +360,7 @@ bool QStackedWidgetPropertySheet::reset(int index)
bool QStackedWidgetPropertySheet::checkProperty(const QString &propertyName)
{
- return propertyName != QLatin1StringView(pagePropertyName);
+ return propertyName != pagePropertyName;
}
QT_END_NAMESPACE
diff --git a/src/designer/src/lib/shared/qdesigner_tabwidget.cpp b/src/designer/src/lib/shared/qdesigner_tabwidget.cpp
index bd8649939..36d0c3798 100644
--- a/src/designer/src/lib/shared/qdesigner_tabwidget.cpp
+++ b/src/designer/src/lib/shared/qdesigner_tabwidget.cpp
@@ -358,39 +358,37 @@ QMenu *QTabWidgetEventFilter::addContextMenuActions(QMenu *popup)
// ----------- QTabWidgetPropertySheet
-static const char currentTabTextKey[] = "currentTabText";
-static const char currentTabNameKey[] = "currentTabName";
-static const char currentTabIconKey[] = "currentTabIcon";
-static const char currentTabToolTipKey[] = "currentTabToolTip";
-static const char currentTabWhatsThisKey[] = "currentTabWhatsThis";
-static const char tabMovableKey[] = "movable";
+static constexpr auto currentTabTextKey = "currentTabText"_L1;
+static constexpr auto currentTabNameKey = "currentTabName"_L1;
+static constexpr auto currentTabIconKey = "currentTabIcon"_L1;
+static constexpr auto currentTabToolTipKey = "currentTabToolTip"_L1;
+static constexpr auto currentTabWhatsThisKey = "currentTabWhatsThis"_L1;
+static constexpr auto tabMovableKey = "movable"_L1;
QTabWidgetPropertySheet::QTabWidgetPropertySheet(QTabWidget *object, QObject *parent) :
QDesignerPropertySheet(object, parent),
m_tabWidget(object)
{
- createFakeProperty(QLatin1StringView(currentTabTextKey), QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
- createFakeProperty(QLatin1StringView(currentTabNameKey), QString());
- createFakeProperty(QLatin1StringView(currentTabIconKey), QVariant::fromValue(qdesigner_internal::PropertySheetIconValue()));
+ createFakeProperty(currentTabTextKey, QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
+ createFakeProperty(currentTabNameKey, QString());
+ createFakeProperty(currentTabIconKey, QVariant::fromValue(qdesigner_internal::PropertySheetIconValue()));
if (formWindowBase())
- formWindowBase()->addReloadableProperty(this, indexOf(QLatin1StringView(currentTabIconKey)));
- createFakeProperty(QLatin1StringView(currentTabToolTipKey), QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
- createFakeProperty(QLatin1StringView(currentTabWhatsThisKey), QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
+ formWindowBase()->addReloadableProperty(this, indexOf(currentTabIconKey));
+ createFakeProperty(currentTabToolTipKey, QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
+ createFakeProperty(currentTabWhatsThisKey, QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
// Prevent the tab widget's drag and drop handling from interfering with Designer's
- createFakeProperty(QLatin1StringView(tabMovableKey), QVariant(false));
+ createFakeProperty(tabMovableKey, QVariant(false));
}
QTabWidgetPropertySheet::TabWidgetProperty QTabWidgetPropertySheet::tabWidgetPropertyFromName(const QString &name)
{
- using TabWidgetPropertyHash = QHash<QString, TabWidgetProperty>;
- static TabWidgetPropertyHash tabWidgetPropertyHash;
- if (tabWidgetPropertyHash.isEmpty()) {
- tabWidgetPropertyHash.insert(QLatin1StringView(currentTabTextKey), PropertyCurrentTabText);
- tabWidgetPropertyHash.insert(QLatin1StringView(currentTabNameKey), PropertyCurrentTabName);
- tabWidgetPropertyHash.insert(QLatin1StringView(currentTabIconKey), PropertyCurrentTabIcon);
- tabWidgetPropertyHash.insert(QLatin1StringView(currentTabToolTipKey), PropertyCurrentTabToolTip);
- tabWidgetPropertyHash.insert(QLatin1StringView(currentTabWhatsThisKey), PropertyCurrentTabWhatsThis);
- }
+ static const QHash<QString, TabWidgetProperty> tabWidgetPropertyHash = {
+ {currentTabTextKey, PropertyCurrentTabText},
+ {currentTabNameKey, PropertyCurrentTabName},
+ {currentTabIconKey, PropertyCurrentTabIcon},
+ {currentTabToolTipKey, PropertyCurrentTabToolTip},
+ {currentTabWhatsThisKey, PropertyCurrentTabWhatsThis}
+ };
return tabWidgetPropertyHash.value(name, PropertyTabWidgetNone);
}
diff --git a/src/designer/src/lib/shared/qdesigner_toolbox.cpp b/src/designer/src/lib/shared/qdesigner_toolbox.cpp
index 907c12b16..0295e4d07 100644
--- a/src/designer/src/lib/shared/qdesigner_toolbox.cpp
+++ b/src/designer/src/lib/shared/qdesigner_toolbox.cpp
@@ -21,6 +21,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
QToolBoxHelper::QToolBoxHelper(QToolBox *toolbox) :
QObject(toolbox),
m_toolbox(toolbox),
@@ -208,11 +210,11 @@ QMenu *QToolBoxHelper::addContextMenuActions(QMenu *popup) const
// -------- QToolBoxWidgetPropertySheet
-static const char currentItemTextKey[] = "currentItemText";
-static const char currentItemNameKey[] = "currentItemName";
-static const char currentItemIconKey[] = "currentItemIcon";
-static const char currentItemToolTipKey[] = "currentItemToolTip";
-static const char tabSpacingKey[] = "tabSpacing";
+static constexpr auto currentItemTextKey = "currentItemText"_L1;
+static constexpr auto currentItemNameKey = "currentItemName"_L1;
+static constexpr auto currentItemIconKey = "currentItemIcon"_L1;
+static constexpr auto currentItemToolTipKey = "currentItemToolTip"_L1;
+static constexpr auto tabSpacingKey = "tabSpacing"_L1;
enum { tabSpacingDefault = -1 };
@@ -220,26 +222,24 @@ QToolBoxWidgetPropertySheet::QToolBoxWidgetPropertySheet(QToolBox *object, QObje
QDesignerPropertySheet(object, parent),
m_toolBox(object)
{
- createFakeProperty(QLatin1StringView(currentItemTextKey), QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
- createFakeProperty(QLatin1StringView(currentItemNameKey), QString());
- createFakeProperty(QLatin1StringView(currentItemIconKey), QVariant::fromValue(qdesigner_internal::PropertySheetIconValue()));
+ createFakeProperty(currentItemTextKey, QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
+ createFakeProperty(currentItemNameKey, QString());
+ createFakeProperty(currentItemIconKey, QVariant::fromValue(qdesigner_internal::PropertySheetIconValue()));
if (formWindowBase())
- formWindowBase()->addReloadableProperty(this, indexOf(QLatin1StringView(currentItemIconKey)));
- createFakeProperty(QLatin1StringView(currentItemToolTipKey), QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
- createFakeProperty(QLatin1StringView(tabSpacingKey), QVariant(tabSpacingDefault));
+ formWindowBase()->addReloadableProperty(this, indexOf(currentItemIconKey));
+ createFakeProperty(currentItemToolTipKey, QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
+ createFakeProperty(tabSpacingKey, QVariant(tabSpacingDefault));
}
QToolBoxWidgetPropertySheet::ToolBoxProperty QToolBoxWidgetPropertySheet::toolBoxPropertyFromName(const QString &name)
{
- using ToolBoxPropertyHash = QHash<QString, ToolBoxProperty>;
- static ToolBoxPropertyHash toolBoxPropertyHash;
- if (toolBoxPropertyHash.isEmpty()) {
- toolBoxPropertyHash.insert(QLatin1StringView(currentItemTextKey), PropertyCurrentItemText);
- toolBoxPropertyHash.insert(QLatin1StringView(currentItemNameKey), PropertyCurrentItemName);
- toolBoxPropertyHash.insert(QLatin1StringView(currentItemIconKey), PropertyCurrentItemIcon);
- toolBoxPropertyHash.insert(QLatin1StringView(currentItemToolTipKey), PropertyCurrentItemToolTip);
- toolBoxPropertyHash.insert(QLatin1StringView(tabSpacingKey), PropertyTabSpacing);
- }
+ static const QHash<QString, ToolBoxProperty> toolBoxPropertyHash = {
+ {currentItemTextKey, PropertyCurrentItemText},
+ {currentItemNameKey, PropertyCurrentItemName},
+ {currentItemIconKey, PropertyCurrentItemIcon},
+ {currentItemToolTipKey, PropertyCurrentItemToolTip},
+ {tabSpacingKey, PropertyTabSpacing}
+ };
return toolBoxPropertyHash.value(name, PropertyToolBoxNone);
}
diff --git a/src/designer/src/lib/shared/qlayout_widget.cpp b/src/designer/src/lib/shared/qlayout_widget.cpp
index f0ee5f51d..28b25ce84 100644
--- a/src/designer/src/lib/shared/qlayout_widget.cpp
+++ b/src/designer/src/lib/shared/qlayout_widget.cpp
@@ -78,8 +78,10 @@ inline void getGridItemPosition(QFormLayout *formLayout, int index, int *row, in
QT_BEGIN_NAMESPACE
-static const char objectNameC[] = "objectName";
-static const char sizeConstraintC[] = "sizeConstraint";
+using namespace Qt::StringLiterals;
+
+static constexpr auto objectNameC = "objectName"_L1;
+static constexpr auto sizeConstraintC = "sizeConstraint"_L1;
/* A padding spacer element that is used to represent an empty form layout cell. It should grow with its cell.
* Should not be used on a grid as it causes resizing inconsistencies */
@@ -252,15 +254,15 @@ int LayoutProperties::visibleProperties(const QLayout *layout)
static const char *marginPropertyNamesC[] = {"leftMargin", "topMargin", "rightMargin", "bottomMargin"};
static const char *spacingPropertyNamesC[] = {"spacing", "horizontalSpacing", "verticalSpacing" };
-static const char fieldGrowthPolicyPropertyC[] = "fieldGrowthPolicy";
-static const char rowWrapPolicyPropertyC[] = "rowWrapPolicy";
-static const char labelAlignmentPropertyC[] = "labelAlignment";
-static const char formAlignmentPropertyC[] = "formAlignment";
-static const char boxStretchPropertyC[] = "stretch";
-static const char gridRowStretchPropertyC[] = "rowStretch";
-static const char gridColumnStretchPropertyC[] = "columnStretch";
-static const char gridRowMinimumHeightPropertyC[] = "rowMinimumHeight";
-static const char gridColumnMinimumWidthPropertyC[] = "columnMinimumWidth";
+static constexpr auto fieldGrowthPolicyPropertyC = "fieldGrowthPolicy"_L1;
+static constexpr auto rowWrapPolicyPropertyC = "rowWrapPolicy"_L1;
+static constexpr auto labelAlignmentPropertyC = "labelAlignment"_L1;
+static constexpr auto formAlignmentPropertyC = "formAlignment"_L1;
+static constexpr auto boxStretchPropertyC = "stretch"_L1;
+static constexpr auto gridRowStretchPropertyC = "rowStretch"_L1;
+static constexpr auto gridColumnStretchPropertyC = "columnStretch"_L1;
+static constexpr auto gridRowMinimumHeightPropertyC = "rowMinimumHeight"_L1;
+static constexpr auto gridColumnMinimumWidthPropertyC = "columnMinimumWidth"_L1;
static bool intValueFromSheet(const QDesignerPropertySheetExtension *sheet, const QString &name, int *value, bool *changed)
{
@@ -292,7 +294,7 @@ int LayoutProperties::fromPropertySheet(const QDesignerFormEditorInterface *core
Q_ASSERT(sheet);
// name
if (mask & ObjectNameProperty) {
- const int nameIndex = sheet->indexOf(QLatin1StringView(objectNameC));
+ const int nameIndex = sheet->indexOf(objectNameC);
Q_ASSERT(nameIndex != -1);
m_objectName = sheet->property(nameIndex);
m_objectNameChanged = sheet->isChanged(nameIndex);
@@ -311,16 +313,16 @@ int LayoutProperties::fromPropertySheet(const QDesignerFormEditorInterface *core
if (intValueFromSheet(sheet, QLatin1StringView(spacingPropertyNamesC[i]), m_spacings + i, m_spacingsChanged + i))
rc |= spacingFlags[i];
// sizeConstraint, flags
- variantPropertyFromSheet(mask, SizeConstraintProperty, sheet, QLatin1StringView(sizeConstraintC), &m_sizeConstraint, &m_sizeConstraintChanged, &rc);
- variantPropertyFromSheet(mask, FieldGrowthPolicyProperty, sheet, QLatin1StringView(fieldGrowthPolicyPropertyC), &m_fieldGrowthPolicy, &m_fieldGrowthPolicyChanged, &rc);
- variantPropertyFromSheet(mask, RowWrapPolicyProperty, sheet, QLatin1StringView(rowWrapPolicyPropertyC), &m_rowWrapPolicy, &m_rowWrapPolicyChanged, &rc);
- variantPropertyFromSheet(mask, LabelAlignmentProperty, sheet, QLatin1StringView(labelAlignmentPropertyC), &m_labelAlignment, &m_labelAlignmentChanged, &rc);
- variantPropertyFromSheet(mask, FormAlignmentProperty, sheet, QLatin1StringView(formAlignmentPropertyC), &m_formAlignment, &m_formAlignmentChanged, &rc);
- variantPropertyFromSheet(mask, BoxStretchProperty, sheet, QLatin1StringView(boxStretchPropertyC), &m_boxStretch, & m_boxStretchChanged, &rc);
- variantPropertyFromSheet(mask, GridRowStretchProperty, sheet, QLatin1StringView(gridRowStretchPropertyC), &m_gridRowStretch, &m_gridRowStretchChanged, &rc);
- variantPropertyFromSheet(mask, GridColumnStretchProperty, sheet, QLatin1StringView(gridColumnStretchPropertyC), &m_gridColumnStretch, &m_gridColumnStretchChanged, &rc);
- variantPropertyFromSheet(mask, GridRowMinimumHeightProperty, sheet, QLatin1StringView(gridRowMinimumHeightPropertyC), &m_gridRowMinimumHeight, &m_gridRowMinimumHeightChanged, &rc);
- variantPropertyFromSheet(mask, GridColumnMinimumWidthProperty, sheet, QLatin1StringView(gridColumnMinimumWidthPropertyC), &m_gridColumnMinimumWidth, &m_gridColumnMinimumWidthChanged, &rc);
+ variantPropertyFromSheet(mask, SizeConstraintProperty, sheet, sizeConstraintC, &m_sizeConstraint, &m_sizeConstraintChanged, &rc);
+ variantPropertyFromSheet(mask, FieldGrowthPolicyProperty, sheet, fieldGrowthPolicyPropertyC, &m_fieldGrowthPolicy, &m_fieldGrowthPolicyChanged, &rc);
+ variantPropertyFromSheet(mask, RowWrapPolicyProperty, sheet, rowWrapPolicyPropertyC, &m_rowWrapPolicy, &m_rowWrapPolicyChanged, &rc);
+ variantPropertyFromSheet(mask, LabelAlignmentProperty, sheet, labelAlignmentPropertyC, &m_labelAlignment, &m_labelAlignmentChanged, &rc);
+ variantPropertyFromSheet(mask, FormAlignmentProperty, sheet, formAlignmentPropertyC, &m_formAlignment, &m_formAlignmentChanged, &rc);
+ variantPropertyFromSheet(mask, BoxStretchProperty, sheet, boxStretchPropertyC, &m_boxStretch, & m_boxStretchChanged, &rc);
+ variantPropertyFromSheet(mask, GridRowStretchProperty, sheet, gridRowStretchPropertyC, &m_gridRowStretch, &m_gridRowStretchChanged, &rc);
+ variantPropertyFromSheet(mask, GridColumnStretchProperty, sheet, gridColumnStretchPropertyC, &m_gridColumnStretch, &m_gridColumnStretchChanged, &rc);
+ variantPropertyFromSheet(mask, GridRowMinimumHeightProperty, sheet, gridRowMinimumHeightPropertyC, &m_gridRowMinimumHeight, &m_gridRowMinimumHeightChanged, &rc);
+ variantPropertyFromSheet(mask, GridColumnMinimumWidthProperty, sheet, gridColumnMinimumWidthPropertyC, &m_gridColumnMinimumWidth, &m_gridColumnMinimumWidthChanged, &rc);
return rc;
}
@@ -360,7 +362,7 @@ int LayoutProperties::toPropertySheet(const QDesignerFormEditorInterface *core,
Q_ASSERT(sheet);
// name
if (mask & ObjectNameProperty) {
- const int nameIndex = sheet->indexOf(QLatin1StringView(objectNameC));
+ const int nameIndex = sheet->indexOf(objectNameC);
Q_ASSERT(nameIndex != -1);
sheet->setProperty(nameIndex, m_objectName);
if (applyChanged)
@@ -380,16 +382,16 @@ int LayoutProperties::toPropertySheet(const QDesignerFormEditorInterface *core,
if (intValueToSheet(sheet, QLatin1StringView(spacingPropertyNamesC[i]), m_spacings[i], m_spacingsChanged[i], applyChanged))
rc |= spacingFlags[i];
// sizeConstraint
- variantPropertyToSheet(mask, SizeConstraintProperty, applyChanged, sheet, QLatin1StringView(sizeConstraintC), m_sizeConstraint, m_sizeConstraintChanged, &rc);
- variantPropertyToSheet(mask, FieldGrowthPolicyProperty, applyChanged, sheet, QLatin1StringView(fieldGrowthPolicyPropertyC), m_fieldGrowthPolicy, m_fieldGrowthPolicyChanged, &rc);
- variantPropertyToSheet(mask, RowWrapPolicyProperty, applyChanged, sheet, QLatin1StringView(rowWrapPolicyPropertyC), m_rowWrapPolicy, m_rowWrapPolicyChanged, &rc);
- variantPropertyToSheet(mask, LabelAlignmentProperty, applyChanged, sheet, QLatin1StringView(labelAlignmentPropertyC), m_labelAlignment, m_labelAlignmentChanged, &rc);
- variantPropertyToSheet(mask, FormAlignmentProperty, applyChanged, sheet, QLatin1StringView(formAlignmentPropertyC), m_formAlignment, m_formAlignmentChanged, &rc);
- variantPropertyToSheet(mask, BoxStretchProperty, applyChanged, sheet, QLatin1StringView(boxStretchPropertyC), m_boxStretch, m_boxStretchChanged, &rc);
- variantPropertyToSheet(mask, GridRowStretchProperty, applyChanged, sheet, QLatin1StringView(gridRowStretchPropertyC), m_gridRowStretch, m_gridRowStretchChanged, &rc);
- variantPropertyToSheet(mask, GridColumnStretchProperty, applyChanged, sheet, QLatin1StringView(gridColumnStretchPropertyC), m_gridColumnStretch, m_gridColumnStretchChanged, &rc);
- variantPropertyToSheet(mask, GridRowMinimumHeightProperty, applyChanged, sheet, QLatin1StringView(gridRowMinimumHeightPropertyC), m_gridRowMinimumHeight, m_gridRowMinimumHeightChanged, &rc);
- variantPropertyToSheet(mask, GridColumnMinimumWidthProperty, applyChanged, sheet, QLatin1StringView(gridColumnMinimumWidthPropertyC), m_gridColumnMinimumWidth, m_gridColumnMinimumWidthChanged, &rc);
+ variantPropertyToSheet(mask, SizeConstraintProperty, applyChanged, sheet, sizeConstraintC, m_sizeConstraint, m_sizeConstraintChanged, &rc);
+ variantPropertyToSheet(mask, FieldGrowthPolicyProperty, applyChanged, sheet, fieldGrowthPolicyPropertyC, m_fieldGrowthPolicy, m_fieldGrowthPolicyChanged, &rc);
+ variantPropertyToSheet(mask, RowWrapPolicyProperty, applyChanged, sheet, rowWrapPolicyPropertyC, m_rowWrapPolicy, m_rowWrapPolicyChanged, &rc);
+ variantPropertyToSheet(mask, LabelAlignmentProperty, applyChanged, sheet, labelAlignmentPropertyC, m_labelAlignment, m_labelAlignmentChanged, &rc);
+ variantPropertyToSheet(mask, FormAlignmentProperty, applyChanged, sheet, formAlignmentPropertyC, m_formAlignment, m_formAlignmentChanged, &rc);
+ variantPropertyToSheet(mask, BoxStretchProperty, applyChanged, sheet, boxStretchPropertyC, m_boxStretch, m_boxStretchChanged, &rc);
+ variantPropertyToSheet(mask, GridRowStretchProperty, applyChanged, sheet, gridRowStretchPropertyC, m_gridRowStretch, m_gridRowStretchChanged, &rc);
+ variantPropertyToSheet(mask, GridColumnStretchProperty, applyChanged, sheet, gridColumnStretchPropertyC, m_gridColumnStretch, m_gridColumnStretchChanged, &rc);
+ variantPropertyToSheet(mask, GridRowMinimumHeightProperty, applyChanged, sheet, gridRowMinimumHeightPropertyC, m_gridRowMinimumHeight, m_gridRowMinimumHeightChanged, &rc);
+ variantPropertyToSheet(mask, GridColumnMinimumWidthProperty, applyChanged, sheet, gridColumnMinimumWidthPropertyC, m_gridColumnMinimumWidth, m_gridColumnMinimumWidthChanged, &rc);
return rc;
}
diff --git a/src/designer/src/lib/shared/qtresourceeditordialog.cpp b/src/designer/src/lib/shared/qtresourceeditordialog.cpp
index d0ac616f4..b595a1ffb 100644
--- a/src/designer/src/lib/shared/qtresourceeditordialog.cpp
+++ b/src/designer/src/lib/shared/qtresourceeditordialog.cpp
@@ -27,15 +27,15 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
-static const char rccRootTag[] = "RCC";
-static const char rccTag[] = "qresource";
-static const char rccFileTag[] = "file";
-static const char rccAliasAttribute[] = "alias";
-static const char rccPrefixAttribute[] = "prefix";
-static const char rccLangAttribute[] = "lang";
-static const char SplitterPosition[] = "SplitterPosition";
-static const char ResourceEditorGeometry[] = "Geometry";
-static const char QrcDialogC[] = "QrcDialog";
+static constexpr auto rccRootTag = "RCC"_L1;
+static constexpr auto rccTag = "qresource"_L1;
+static constexpr auto rccFileTag = "file"_L1;
+static constexpr auto rccAliasAttribute = "alias"_L1;
+static constexpr auto rccPrefixAttribute = "prefix"_L1;
+static constexpr auto rccLangAttribute = "lang"_L1;
+static constexpr auto SplitterPosition = "SplitterPosition"_L1;
+static constexpr auto ResourceEditorGeometry = "Geometry"_L1;
+static constexpr auto QrcDialogC = "QrcDialog"_L1;
static QString msgOverwrite(const QString &fname)
{
@@ -103,15 +103,15 @@ static bool loadResourceFileData(const QDomElement &fileElem, QtResourceFileData
if (!fileData)
return false;
- if (fileElem.tagName() != QLatin1StringView(rccFileTag)) {
- *errorMessage = msgTagMismatch(fileElem.tagName(), QLatin1StringView(rccFileTag));
+ if (fileElem.tagName() != rccFileTag) {
+ *errorMessage = msgTagMismatch(fileElem.tagName(), rccFileTag);
return false;
}
QtResourceFileData &data = *fileData;
data.path = fileElem.text();
- data.alias = fileElem.attribute(QLatin1StringView(rccAliasAttribute));
+ data.alias = fileElem.attribute(rccAliasAttribute);
return true;
}
@@ -121,15 +121,15 @@ static bool loadResourcePrefixData(const QDomElement &prefixElem, QtResourcePref
if (!prefixData)
return false;
- if (prefixElem.tagName() != QLatin1StringView(rccTag)) {
- *errorMessage = msgTagMismatch(prefixElem.tagName(), QLatin1StringView(rccTag));
+ if (prefixElem.tagName() != rccTag) {
+ *errorMessage = msgTagMismatch(prefixElem.tagName(), rccTag);
return false;
}
QtResourcePrefixData &data = *prefixData;
- data.prefix = prefixElem.attribute(QLatin1StringView(rccPrefixAttribute));
- data.language = prefixElem.attribute(QLatin1StringView(rccLangAttribute));
+ data.prefix = prefixElem.attribute(rccPrefixAttribute);
+ data.language = prefixElem.attribute(rccLangAttribute);
QDomElement fileElem = prefixElem.firstChildElement();
while (!fileElem.isNull()) {
QtResourceFileData fileData;
@@ -149,8 +149,8 @@ static bool loadQrcFileData(const QDomDocument &doc, const QString &path, QtQrcF
QtQrcFileData &data = *qrcFileData;
QDomElement docElem = doc.documentElement();
- if (docElem.tagName() != QLatin1StringView(rccRootTag)) {
- *errorMessage = msgTagMismatch(docElem.tagName(), QLatin1StringView(rccRootTag));
+ if (docElem.tagName() != rccRootTag) {
+ *errorMessage = msgTagMismatch(docElem.tagName(), rccRootTag);
return false;
}
@@ -170,9 +170,9 @@ static bool loadQrcFileData(const QDomDocument &doc, const QString &path, QtQrcF
static QDomElement saveResourceFileData(QDomDocument &doc, const QtResourceFileData &fileData)
{
- QDomElement fileElem = doc.createElement(QLatin1StringView(rccFileTag));
+ QDomElement fileElem = doc.createElement(rccFileTag);
if (!fileData.alias.isEmpty())
- fileElem.setAttribute(QLatin1StringView(rccAliasAttribute), fileData.alias);
+ fileElem.setAttribute(rccAliasAttribute, fileData.alias);
QDomText textElem = doc.createTextNode(fileData.path);
fileElem.appendChild(textElem);
@@ -182,11 +182,11 @@ static QDomElement saveResourceFileData(QDomDocument &doc, const QtResourceFileD
static QDomElement saveResourcePrefixData(QDomDocument &doc, const QtResourcePrefixData &prefixData)
{
- QDomElement prefixElem = doc.createElement(QLatin1StringView(rccTag));
+ QDomElement prefixElem = doc.createElement(rccTag);
if (!prefixData.prefix.isEmpty())
- prefixElem.setAttribute(QLatin1StringView(rccPrefixAttribute), prefixData.prefix);
+ prefixElem.setAttribute(rccPrefixAttribute, prefixData.prefix);
if (!prefixData.language.isEmpty())
- prefixElem.setAttribute(QLatin1StringView(rccLangAttribute), prefixData.language);
+ prefixElem.setAttribute(rccLangAttribute, prefixData.language);
for (const QtResourceFileData &rfd : prefixData.resourceFileList) {
QDomElement fileElem = saveResourceFileData(doc, rfd);
@@ -199,7 +199,7 @@ static QDomElement saveResourcePrefixData(QDomDocument &doc, const QtResourcePre
static QDomDocument saveQrcFileData(const QtQrcFileData &qrcFileData)
{
QDomDocument doc;
- QDomElement docElem = doc.createElement(QLatin1StringView(rccRootTag));
+ QDomElement docElem = doc.createElement(rccRootTag);
for (const QtResourcePrefixData &prefixData : qrcFileData.resourceList) {
QDomElement prefixElem = saveResourcePrefixData(doc, prefixData);
@@ -2009,10 +2009,10 @@ QtResourceEditorDialog::QtResourceEditorDialog(QDesignerFormEditorInterface *cor
d_ptr->m_moveDownQrcFileAction->setEnabled(false);
QDesignerSettingsInterface *settings = core->settingsManager();
- settings->beginGroup(QLatin1StringView(QrcDialogC));
+ settings->beginGroup(QrcDialogC);
- d_ptr->m_ui.splitter->restoreState(settings->value(QLatin1StringView(SplitterPosition)).toByteArray());
- const QVariant geometry = settings->value(QLatin1StringView(ResourceEditorGeometry));
+ d_ptr->m_ui.splitter->restoreState(settings->value(SplitterPosition).toByteArray());
+ const QVariant geometry = settings->value(ResourceEditorGeometry);
if (geometry.metaType().id() == QMetaType::QByteArray) // Used to be a QRect up until 5.4.0, QTBUG-43374
restoreGeometry(geometry.toByteArray());
@@ -2022,10 +2022,10 @@ QtResourceEditorDialog::QtResourceEditorDialog(QDesignerFormEditorInterface *cor
QtResourceEditorDialog::~QtResourceEditorDialog()
{
QDesignerSettingsInterface *settings = d_ptr->m_core->settingsManager();
- settings->beginGroup(QLatin1StringView(QrcDialogC));
+ settings->beginGroup(QrcDialogC);
- settings->setValue(QLatin1StringView(SplitterPosition), d_ptr->m_ui.splitter->saveState());
- settings->setValue(QLatin1StringView(ResourceEditorGeometry), saveGeometry());
+ settings->setValue(SplitterPosition, d_ptr->m_ui.splitter->saveState());
+ settings->setValue(ResourceEditorGeometry, saveGeometry());
settings->endGroup();
disconnect(d_ptr->m_qrcManager, nullptr, this, nullptr);
diff --git a/src/designer/src/lib/shared/qtresourceview.cpp b/src/designer/src/lib/shared/qtresourceview.cpp
index e9e3bbb54..9673982ce 100644
--- a/src/designer/src/lib/shared/qtresourceview.cpp
+++ b/src/designer/src/lib/shared/qtresourceview.cpp
@@ -43,15 +43,15 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
-static const char elementResourceData[] = "resource";
-static const char typeAttribute[] = "type";
-static const char typeImage[] = "image";
-static const char typeStyleSheet[] = "stylesheet";
-static const char typeOther[] = "other";
-static const char fileAttribute[] = "file";
-static const char qrvSplitterPosition[] = "SplitterPosition";
-static const char qrvGeometry[] = "Geometry";
-static const char ResourceViewDialogC[] = "ResourceDialog";
+static constexpr auto elementResourceData = "resource"_L1;
+static constexpr auto typeAttribute = "type"_L1;
+static constexpr auto typeImage = "image"_L1;
+static constexpr auto typeStyleSheet = "stylesheet"_L1;
+static constexpr auto typeOther = "other"_L1;
+static constexpr auto fileAttribute = "file"_L1;
+static constexpr auto qrvSplitterPosition = "SplitterPosition"_L1;
+static constexpr auto qrvGeometry = "Geometry"_L1;
+static constexpr auto ResourceViewDialogC = "ResourceDialog"_L1;
// ---------------- ResourceListWidget: A list widget that has drag enabled
class ResourceListWidget : public QListWidget {
@@ -174,7 +174,7 @@ void QtResourceViewPrivate::restoreSettings()
QDesignerSettingsInterface *settings = m_core->settingsManager();
settings->beginGroup(m_settingsKey);
- m_splitter->restoreState(settings->value(QLatin1StringView(qrvSplitterPosition)).toByteArray());
+ m_splitter->restoreState(settings->value(qrvSplitterPosition).toByteArray());
settings->endGroup();
}
@@ -186,7 +186,7 @@ void QtResourceViewPrivate::saveSettings()
QDesignerSettingsInterface *settings = m_core->settingsManager();
settings->beginGroup(m_settingsKey);
- settings->setValue(QLatin1StringView(qrvSplitterPosition), m_splitter->saveState());
+ settings->setValue(qrvSplitterPosition, m_splitter->saveState());
settings->endGroup();
}
@@ -718,19 +718,19 @@ bool QtResourceView::dragEnabled() const
QString QtResourceView::encodeMimeData(ResourceType resourceType, const QString &path)
{
QDomDocument doc;
- QDomElement elem = doc.createElement(QLatin1StringView(elementResourceData));
+ QDomElement elem = doc.createElement(elementResourceData);
switch (resourceType) {
case ResourceImage:
- elem.setAttribute(QLatin1StringView(typeAttribute), QLatin1StringView(typeImage));
+ elem.setAttribute(typeAttribute, typeImage);
break;
case ResourceStyleSheet:
- elem.setAttribute(QLatin1StringView(typeAttribute), QLatin1StringView(typeStyleSheet));
+ elem.setAttribute(typeAttribute, typeStyleSheet);
break;
case ResourceOther:
- elem.setAttribute(QLatin1StringView(typeAttribute), QLatin1StringView(typeOther));
+ elem.setAttribute(typeAttribute, typeOther);
break;
}
- elem.setAttribute(QLatin1StringView(fileAttribute), path);
+ elem.setAttribute(fileAttribute, path);
doc.appendChild(elem);
return doc.toString();
}
@@ -743,7 +743,7 @@ bool QtResourceView::decodeMimeData(const QMimeData *md, ResourceType *t, QStrin
bool QtResourceView::decodeMimeData(const QString &text, ResourceType *t, QString *file)
{
- static auto docElementName = QLatin1StringView(elementResourceData);
+ static auto docElementName = elementResourceData;
static const QString docElementString = u'<' + docElementName;
if (text.isEmpty() || text.indexOf(docElementString) == -1)
@@ -758,18 +758,18 @@ bool QtResourceView::decodeMimeData(const QString &text, ResourceType *t, QStrin
return false;
if (t) {
- const QString typeAttr = QLatin1StringView(typeAttribute);
+ const QString typeAttr = typeAttribute;
if (domElement.hasAttribute (typeAttr)) {
- const QString typeValue = domElement.attribute(typeAttr, QLatin1StringView(typeOther));
- if (typeValue == QLatin1StringView(typeImage)) {
+ const QString typeValue = domElement.attribute(typeAttr, typeOther);
+ if (typeValue == typeImage) {
*t = ResourceImage;
} else {
- *t = typeValue == QLatin1StringView(typeStyleSheet) ? ResourceStyleSheet : ResourceOther;
+ *t = typeValue == typeStyleSheet ? ResourceStyleSheet : ResourceOther;
}
}
}
if (file) {
- const QString fileAttr = QLatin1StringView(fileAttribute);
+ const QString fileAttr = fileAttribute;
if (domElement.hasAttribute(fileAttr)) {
*file = domElement.attribute(fileAttr, QString());
} else {
@@ -802,7 +802,7 @@ QtResourceViewDialogPrivate::QtResourceViewDialogPrivate(QDesignerFormEditorInte
m_view(new QtResourceView(core)),
m_box(new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel))
{
- m_view->setSettingsKey(QLatin1StringView(ResourceViewDialogC));
+ m_view->setSettingsKey(ResourceViewDialogC);
}
// ------------ QtResourceViewDialog
@@ -824,9 +824,9 @@ QtResourceViewDialog::QtResourceViewDialog(QDesignerFormEditorInterface *core, Q
d_ptr->m_view->setResourceModel(core->resourceModel());
QDesignerSettingsInterface *settings = core->settingsManager();
- settings->beginGroup(QLatin1StringView(ResourceViewDialogC));
+ settings->beginGroup(ResourceViewDialogC);
- const QVariant geometry = settings->value(QLatin1StringView(qrvGeometry));
+ const QVariant geometry = settings->value(qrvGeometry);
if (geometry.metaType().id() == QMetaType::QByteArray) // Used to be a QRect up until 5.4.0, QTBUG-43374.
restoreGeometry(geometry.toByteArray());
@@ -836,9 +836,9 @@ QtResourceViewDialog::QtResourceViewDialog(QDesignerFormEditorInterface *core, Q
QtResourceViewDialog::~QtResourceViewDialog()
{
QDesignerSettingsInterface *settings = d_ptr->m_core->settingsManager();
- settings->beginGroup(QLatin1StringView(ResourceViewDialogC));
+ settings->beginGroup(ResourceViewDialogC);
- settings->setValue(QLatin1StringView(qrvGeometry), saveGeometry());
+ settings->setValue(qrvGeometry, saveGeometry());
settings->endGroup();
}
diff --git a/src/designer/src/lib/shared/richtexteditor.cpp b/src/designer/src/lib/shared/richtexteditor.cpp
index d4d361442..f4bdc48a5 100644
--- a/src/designer/src/lib/shared/richtexteditor.cpp
+++ b/src/designer/src/lib/shared/richtexteditor.cpp
@@ -42,9 +42,9 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
-static const char RichTextDialogGroupC[] = "RichTextDialog";
-static const char GeometryKeyC[] = "Geometry";
-static const char TabKeyC[] = "Tab";
+static constexpr auto RichTextDialogGroupC = "RichTextDialog"_L1;
+static constexpr auto GeometryKeyC = "Geometry"_L1;
+static constexpr auto TabKeyC = "Tab"_L1;
const bool simplifyRichTextDefault = true;
@@ -729,9 +729,9 @@ RichTextEditorDialog::RichTextEditorDialog(QDesignerFormEditorInterface *core, Q
// Read settings
const QDesignerSettingsInterface *settings = core->settingsManager();
- const QString rootKey = QLatin1StringView(RichTextDialogGroupC) + u'/';
- const QByteArray lastGeometry = settings->value(rootKey + QLatin1StringView(GeometryKeyC)).toByteArray();
- const int initialTab = settings->value(rootKey + QLatin1StringView(TabKeyC), QVariant(m_initialTab)).toInt();
+ const QString rootKey = RichTextDialogGroupC + u'/';
+ const QByteArray lastGeometry = settings->value(rootKey + GeometryKeyC).toByteArray();
+ const int initialTab = settings->value(rootKey + TabKeyC, QVariant(m_initialTab)).toInt();
if (initialTab == RichTextIndex || initialTab == SourceIndex)
m_initialTab = initialTab;
@@ -781,10 +781,10 @@ RichTextEditorDialog::RichTextEditorDialog(QDesignerFormEditorInterface *core, Q
RichTextEditorDialog::~RichTextEditorDialog()
{
QDesignerSettingsInterface *settings = m_core->settingsManager();
- settings->beginGroup(QLatin1StringView(RichTextDialogGroupC));
+ settings->beginGroup(RichTextDialogGroupC);
- settings->setValue(QLatin1StringView(GeometryKeyC), saveGeometry());
- settings->setValue(QLatin1StringView(TabKeyC), m_tab_widget->currentIndex());
+ settings->setValue(GeometryKeyC, saveGeometry());
+ settings->setValue(TabKeyC, m_tab_widget->currentIndex());
settings->endGroup();
}
diff --git a/src/designer/src/lib/shared/shared_settings.cpp b/src/designer/src/lib/shared/shared_settings.cpp
index 2a1a437f3..aec4e59ca 100644
--- a/src/designer/src/lib/shared/shared_settings.cpp
+++ b/src/designer/src/lib/shared/shared_settings.cpp
@@ -21,20 +21,20 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
-static const char defaultGridKey[] = "defaultGrid";
-static const char previewKey[] = "Preview";
-static const char enabledKey[] = "Enabled";
-static const char *userDeviceSkinsKey= "UserDeviceSkins";
-static const char zoomKey[] = "zoom";
-static const char zoomEnabledKey[] = "zoomEnabled";
-static const char deviceProfileIndexKey[] = "DeviceProfileIndex";
-static const char deviceProfilesKey[] = "DeviceProfiles";
-static const char formTemplatePathsKey[] = "FormTemplatePaths";
-static const char formTemplateKey[] = "FormTemplate";
-static const char newFormSizeKey[] = "NewFormSize";
-static inline QString namingModeKey() { return u"naming"_s; }
-static inline QString underScoreNamingMode() { return u"underscore"_s; }
-static inline QString camelCaseNamingMode() { return u"camelcase"_s; }
+static constexpr auto defaultGridKey = "defaultGrid"_L1;
+static constexpr auto previewKey = "Preview"_L1;
+static constexpr auto enabledKey = "Enabled"_L1;
+static constexpr auto userDeviceSkinsKey= "UserDeviceSkins"_L1;
+static constexpr auto zoomKey = "zoom"_L1;
+static constexpr auto zoomEnabledKey = "zoomEnabled"_L1;
+static constexpr auto deviceProfileIndexKey = "DeviceProfileIndex"_L1;
+static constexpr auto deviceProfilesKey = "DeviceProfiles"_L1;
+static constexpr auto formTemplatePathsKey = "FormTemplatePaths"_L1;
+static constexpr auto formTemplateKey = "FormTemplate"_L1;
+static constexpr auto newFormSizeKey = "NewFormSize"_L1;
+static constexpr auto namingModeKey = "naming"_L1;
+static constexpr auto underScoreNamingMode = "underscore"_L1;
+static constexpr auto camelCaseNamingMode = "camelcase"_L1;
static bool checkTemplatePath(const QString &path, bool create)
{
@@ -63,7 +63,7 @@ Grid QDesignerSharedSettings::defaultGrid() const
{
Grid grid;
const QVariantMap defaultGridMap
- = m_settings->value(QLatin1StringView(defaultGridKey), QVariantMap()).toMap();
+ = m_settings->value(defaultGridKey, QVariantMap()).toMap();
if (!defaultGridMap.isEmpty())
grid.fromVariantMap(defaultGridMap);
return grid;
@@ -71,7 +71,7 @@ Grid QDesignerSharedSettings::defaultGrid() const
void QDesignerSharedSettings::setDefaultGrid(const Grid &grid)
{
- m_settings->setValue(QLatin1StringView(defaultGridKey), grid.toVariantMap());
+ m_settings->setValue(defaultGridKey, grid.toVariantMap());
}
const QStringList &QDesignerSharedSettings::defaultFormTemplatePaths()
@@ -116,23 +116,23 @@ void QDesignerSharedSettings::migrateTemplates()
QStringList QDesignerSharedSettings::formTemplatePaths() const
{
- return m_settings->value(QLatin1StringView(formTemplatePathsKey),
+ return m_settings->value(formTemplatePathsKey,
defaultFormTemplatePaths()).toStringList();
}
void QDesignerSharedSettings::setFormTemplatePaths(const QStringList &paths)
{
- m_settings->setValue(QLatin1StringView(formTemplatePathsKey), paths);
+ m_settings->setValue(formTemplatePathsKey, paths);
}
QString QDesignerSharedSettings::formTemplate() const
{
- return m_settings->value(QLatin1StringView(formTemplateKey)).toString();
+ return m_settings->value(formTemplateKey).toString();
}
void QDesignerSharedSettings::setFormTemplate(const QString &t)
{
- m_settings->setValue(QLatin1StringView(formTemplateKey), t);
+ m_settings->setValue(formTemplateKey, t);
}
void QDesignerSharedSettings::setAdditionalFormTemplatePaths(const QStringList &additionalPaths)
@@ -157,15 +157,15 @@ QStringList QDesignerSharedSettings::additionalFormTemplatePaths() const
QSize QDesignerSharedSettings::newFormSize() const
{
- return m_settings->value(QLatin1StringView(newFormSizeKey), QSize(0, 0)).toSize();
+ return m_settings->value(newFormSizeKey, QSize(0, 0)).toSize();
}
void QDesignerSharedSettings::setNewFormSize(const QSize &s)
{
if (s.isNull()) {
- m_settings->remove(QLatin1StringView(newFormSizeKey));
+ m_settings->remove(newFormSizeKey);
} else {
- m_settings->setValue(QLatin1StringView(newFormSizeKey), s);
+ m_settings->setValue(newFormSizeKey, s);
}
}
@@ -173,78 +173,78 @@ void QDesignerSharedSettings::setNewFormSize(const QSize &s)
PreviewConfiguration QDesignerSharedSettings::customPreviewConfiguration() const
{
PreviewConfiguration configuration;
- configuration.fromSettings(QLatin1StringView(previewKey), m_settings);
+ configuration.fromSettings(previewKey, m_settings);
return configuration;
}
void QDesignerSharedSettings::setCustomPreviewConfiguration(const PreviewConfiguration &configuration)
{
- configuration.toSettings(QLatin1StringView(previewKey), m_settings);
+ configuration.toSettings(previewKey, m_settings);
}
bool QDesignerSharedSettings::isCustomPreviewConfigurationEnabled() const
{
- m_settings->beginGroup(QLatin1StringView(previewKey));
- bool isEnabled = m_settings->value(QLatin1StringView(enabledKey), false).toBool();
+ m_settings->beginGroup(previewKey);
+ bool isEnabled = m_settings->value(enabledKey, false).toBool();
m_settings->endGroup();
return isEnabled;
}
void QDesignerSharedSettings::setCustomPreviewConfigurationEnabled(bool enabled)
{
- m_settings->beginGroup(QLatin1StringView(previewKey));
- m_settings->setValue(QLatin1StringView(enabledKey), enabled);
+ m_settings->beginGroup(previewKey);
+ m_settings->setValue(enabledKey, enabled);
m_settings->endGroup();
}
QStringList QDesignerSharedSettings::userDeviceSkins() const
{
- m_settings->beginGroup(QLatin1StringView(previewKey));
+ m_settings->beginGroup(previewKey);
QStringList userDeviceSkins
- = m_settings->value(QLatin1StringView(userDeviceSkinsKey), QStringList()).toStringList();
+ = m_settings->value(userDeviceSkinsKey, QStringList()).toStringList();
m_settings->endGroup();
return userDeviceSkins;
}
void QDesignerSharedSettings::setUserDeviceSkins(const QStringList &userDeviceSkins)
{
- m_settings->beginGroup(QLatin1StringView(previewKey));
- m_settings->setValue(QLatin1StringView(userDeviceSkinsKey), userDeviceSkins);
+ m_settings->beginGroup(previewKey);
+ m_settings->setValue(userDeviceSkinsKey, userDeviceSkins);
m_settings->endGroup();
}
int QDesignerSharedSettings::zoom() const
{
- return m_settings->value(QLatin1StringView(zoomKey), 100).toInt();
+ return m_settings->value(zoomKey, 100).toInt();
}
void QDesignerSharedSettings::setZoom(int z)
{
- m_settings->setValue(QLatin1StringView(zoomKey), QVariant(z));
+ m_settings->setValue(zoomKey, QVariant(z));
}
ObjectNamingMode QDesignerSharedSettings::objectNamingMode() const
{
- const QString value = m_settings->value(namingModeKey()).toString();
- return value == camelCaseNamingMode()
+ const QString value = m_settings->value(namingModeKey).toString();
+ return value == camelCaseNamingMode
? qdesigner_internal::CamelCase : qdesigner_internal::Underscore;
}
void QDesignerSharedSettings::setObjectNamingMode(ObjectNamingMode n)
{
const QString value = n == qdesigner_internal::CamelCase
- ? camelCaseNamingMode() : underScoreNamingMode();
- m_settings->setValue(namingModeKey(), QVariant(value));
+ ? camelCaseNamingMode : underScoreNamingMode;
+ m_settings->setValue(namingModeKey, QVariant(value));
}
bool QDesignerSharedSettings::zoomEnabled() const
{
- return m_settings->value(QLatin1StringView(zoomEnabledKey), false).toBool();
+ return m_settings->value(zoomEnabledKey, false).toBool();
}
void QDesignerSharedSettings::setZoomEnabled(bool v)
{
- m_settings->setValue(QLatin1StringView(zoomEnabledKey), v);
+ m_settings->setValue(zoomEnabledKey, v);
}
DeviceProfile QDesignerSharedSettings::currentDeviceProfile() const
@@ -254,12 +254,12 @@ DeviceProfile QDesignerSharedSettings::currentDeviceProfile() const
void QDesignerSharedSettings::setCurrentDeviceProfileIndex(int i)
{
- m_settings->setValue(QLatin1StringView(deviceProfileIndexKey), i);
+ m_settings->setValue(deviceProfileIndexKey, i);
}
int QDesignerSharedSettings::currentDeviceProfileIndex() const
{
- return m_settings->value(QLatin1StringView(deviceProfileIndexKey), -1).toInt();
+ return m_settings->value(deviceProfileIndexKey, -1).toInt();
}
static inline QString msgWarnDeviceProfileXml(const QString &msg)
@@ -285,7 +285,7 @@ DeviceProfile QDesignerSharedSettings::deviceProfileAt(int idx) const
QStringList QDesignerSharedSettings::deviceProfileXml() const
{
- return m_settings->value(QLatin1StringView(deviceProfilesKey), QStringList()).toStringList();
+ return m_settings->value(deviceProfilesKey, QStringList()).toStringList();
}
QDesignerSharedSettings::DeviceProfileList QDesignerSharedSettings::deviceProfiles() const
@@ -312,7 +312,7 @@ void QDesignerSharedSettings::setDeviceProfiles(const DeviceProfileList &dpl)
QStringList l;
for (const auto &dp : dpl)
l.push_back(dp.toXml());
- m_settings->setValue(QLatin1StringView(deviceProfilesKey), l);
+ m_settings->setValue(deviceProfilesKey, l);
}
}
diff --git a/src/designer/src/lib/shared/signalslotdialog.cpp b/src/designer/src/lib/shared/signalslotdialog.cpp
index 1d3cd22bb..3cf60e050 100644
--- a/src/designer/src/lib/shared/signalslotdialog.cpp
+++ b/src/designer/src/lib/shared/signalslotdialog.cpp
@@ -32,8 +32,8 @@ using namespace Qt::StringLiterals;
// Regexp to match a function signature, arguments potentially
// with namespace colons.
-static const char signatureRegExp[] = "^[\\w+_]+\\(([\\w+:]\\*?,?)*\\)$";
-static const char methodNameRegExp[] = "^[\\w+_]+$";
+static constexpr auto signatureRegExp = "^[\\w+_]+\\(([\\w+:]\\*?,?)*\\)$"_L1;
+static constexpr auto methodNameRegExp = "^[\\w+_]+$"_L1;
static QStandardItem *createEditableItem(const QString &text)
{
@@ -66,8 +66,8 @@ namespace {
SignatureDelegate::SignatureDelegate(QObject * parent) :
QItemDelegate(parent),
- m_signatureRegexp(QLatin1StringView(signatureRegExp)),
- m_methodNameRegexp(QLatin1StringView(methodNameRegExp))
+ m_signatureRegexp(signatureRegExp),
+ m_methodNameRegexp(methodNameRegExp)
{
Q_ASSERT(m_signatureRegexp.isValid());
Q_ASSERT(m_methodNameRegexp.isValid());
diff --git a/src/designer/src/lib/shared/stylesheeteditor.cpp b/src/designer/src/lib/shared/stylesheeteditor.cpp
index 568037a0f..da15f6bf1 100644
--- a/src/designer/src/lib/shared/stylesheeteditor.cpp
+++ b/src/designer/src/lib/shared/stylesheeteditor.cpp
@@ -37,9 +37,9 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
-static const char styleSheetProperty[] = "styleSheet";
-static const char StyleSheetDialogC[] = "StyleSheetDialog";
-static const char seGeometry[] = "Geometry";
+static constexpr auto styleSheetProperty = "styleSheet"_L1;
+static constexpr auto StyleSheetDialogC = "StyleSheetDialog"_L1;
+static constexpr auto seGeometry = "Geometry"_L1;
namespace qdesigner_internal {
@@ -170,10 +170,10 @@ StyleSheetEditorDialog::StyleSheetEditorDialog(QDesignerFormEditorInterface *cor
m_editor->setFocus();
QDesignerSettingsInterface *settings = core->settingsManager();
- settings->beginGroup(QLatin1StringView(StyleSheetDialogC));
+ settings->beginGroup(StyleSheetDialogC);
- if (settings->contains(QLatin1StringView(seGeometry)))
- restoreGeometry(settings->value(QLatin1StringView(seGeometry)).toByteArray());
+ if (settings->contains(seGeometry))
+ restoreGeometry(settings->value(seGeometry).toByteArray());
settings->endGroup();
}
@@ -181,9 +181,9 @@ StyleSheetEditorDialog::StyleSheetEditorDialog(QDesignerFormEditorInterface *cor
StyleSheetEditorDialog::~StyleSheetEditorDialog()
{
QDesignerSettingsInterface *settings = m_core->settingsManager();
- settings->beginGroup(QLatin1StringView(StyleSheetDialogC));
+ settings->beginGroup(StyleSheetDialogC);
- settings->setValue(QLatin1StringView(seGeometry), saveGeometry());
+ settings->setValue(seGeometry, saveGeometry());
settings->endGroup();
}
@@ -390,7 +390,7 @@ StyleSheetPropertyEditorDialog::StyleSheetPropertyEditorDialog(QWidget *parent,
QDesignerPropertySheetExtension *sheet =
qt_extension<QDesignerPropertySheetExtension*>(m_fw->core()->extensionManager(), m_widget);
Q_ASSERT(sheet != nullptr);
- const int index = sheet->indexOf(QLatin1StringView(styleSheetProperty));
+ const int index = sheet->indexOf(styleSheetProperty);
const PropertySheetStringValue value = qvariant_cast<PropertySheetStringValue>(sheet->property(index));
setText(value.value());
}
@@ -398,7 +398,7 @@ StyleSheetPropertyEditorDialog::StyleSheetPropertyEditorDialog(QWidget *parent,
void StyleSheetPropertyEditorDialog::applyStyleSheet()
{
const PropertySheetStringValue value(text(), false);
- m_fw->cursor()->setWidgetProperty(m_widget, QLatin1StringView(styleSheetProperty), QVariant::fromValue(value));
+ m_fw->cursor()->setWidgetProperty(m_widget, styleSheetProperty, QVariant::fromValue(value));
}
} // namespace qdesigner_internal
diff --git a/src/designer/src/lib/shared/zoomwidget.cpp b/src/designer/src/lib/shared/zoomwidget.cpp
index 0b465d38b..57968920c 100644
--- a/src/designer/src/lib/shared/zoomwidget.cpp
+++ b/src/designer/src/lib/shared/zoomwidget.cpp
@@ -19,6 +19,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
enum { debugZoomWidget = 0 };
static const int menuZoomList[] = { 100, 25, 50, 75, 125, 150 , 175, 200 };
@@ -224,7 +226,7 @@ QVariant ZoomProxyWidget::itemChange(GraphicsItemChange change, const QVariant &
* It redirects the events to another handler of ZoomWidget as its
* base class QScrollArea also implements eventFilter() for its viewport. */
-static const char zoomedEventFilterRedirectorNameC[] = "__qt_ZoomedEventFilterRedirector";
+static constexpr auto zoomedEventFilterRedirectorNameC = "__qt_ZoomedEventFilterRedirector"_L1;
class ZoomedEventFilterRedirector : public QObject {
Q_DISABLE_COPY_MOVE(ZoomedEventFilterRedirector)
@@ -241,7 +243,7 @@ ZoomedEventFilterRedirector::ZoomedEventFilterRedirector(ZoomWidget *zw, QObject
QObject(parent),
m_zw(zw)
{
- setObjectName(QLatin1StringView(zoomedEventFilterRedirectorNameC));
+ setObjectName(zoomedEventFilterRedirectorNameC);
}
bool ZoomedEventFilterRedirector::eventFilter(QObject *watched, QEvent *event)
@@ -268,7 +270,7 @@ void ZoomWidget::setWidget(QWidget *w, Qt::WindowFlags wFlags)
scene().removeItem(m_proxy);
if (QWidget *w = m_proxy->widget()) {
// remove the event filter
- if (QObject *evf = w->findChild<QObject*>(QLatin1StringView(zoomedEventFilterRedirectorNameC)))
+ if (QObject *evf = w->findChild<QObject*>(zoomedEventFilterRedirectorNameC))
w->removeEventFilter(evf);
}
m_proxy->deleteLater();
diff --git a/src/designer/src/lib/uilib/abstractformbuilder.cpp b/src/designer/src/lib/uilib/abstractformbuilder.cpp
index 1f0e89253..6e59928b7 100644
--- a/src/designer/src/lib/uilib/abstractformbuilder.cpp
+++ b/src/designer/src/lib/uilib/abstractformbuilder.cpp
@@ -56,12 +56,12 @@
Q_DECLARE_METATYPE(QWidgetList)
-static const char buttonGroupPropertyC[] = "buttonGroup";
-
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
+static constexpr auto buttonGroupPropertyC = "buttonGroup"_L1;
+
#ifdef QFORMINTERNAL_NAMESPACE
using namespace QFormInternal;
#endif
@@ -1852,7 +1852,7 @@ void QAbstractFormBuilder::saveButtonExtraInfo(const QAbstractButton *widget, Do
domString->setText(buttonGroup->objectName());
domString->setAttributeNotr(u"true"_s);
DomProperty *domProperty = new DomProperty();
- domProperty->setAttributeName(QLatin1StringView(buttonGroupPropertyC));
+ domProperty->setAttributeName(buttonGroupPropertyC);
domProperty->setElementString(domString);
attributes += domProperty;
ui_widget->setElementAttribute(attributes);
@@ -2193,7 +2193,7 @@ static QString buttonGroupName(const DomWidget *ui_widget)
const auto &attributes = ui_widget->elementAttribute();
if (attributes.isEmpty())
return QString();
- const QString buttonGroupProperty = QLatin1StringView(buttonGroupPropertyC);
+ const QString buttonGroupProperty = buttonGroupPropertyC;
for (const DomProperty *p : attributes) {
if (p->attributeName() == buttonGroupProperty)
return p->elementString()->text();
diff --git a/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.cpp b/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.cpp
index 637369604..fab99717c 100644
--- a/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.cpp
+++ b/src/designer/src/plugins/activeqt/qaxwidgetpropertysheet.cpp
@@ -14,8 +14,6 @@
#include <QtCore/qdebug.h>
#include <QtCore/qtimer.h>
-static const char *geometryPropertyC = "geometry";
-
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
@@ -143,7 +141,7 @@ void QAxWidgetPropertySheet::reloadPropertySheet(const struct SavedProperties &p
properties.widget);
bool foundGeometry = false;
- const QString geometryProperty = QLatin1String(geometryPropertyC);
+ const QString geometryProperty = "geometry"_L1;
for (auto i = properties.changedProperties.cbegin(), cend = properties.changedProperties.cend();
i != cend; ++i) {
const QString name = i.key();
diff --git a/src/designer/src/plugins/qwebview/qwebview_plugin.cpp b/src/designer/src/plugins/qwebview/qwebview_plugin.cpp
index e5208b67f..5f591b65e 100644
--- a/src/designer/src/plugins/qwebview/qwebview_plugin.cpp
+++ b/src/designer/src/plugins/qwebview/qwebview_plugin.cpp
@@ -6,12 +6,12 @@
#include <QtCore/qplugin.h>
#include <QWebView>
-static const char *toolTipC = "A widget for displaying a web page, from the Qt WebKit Widgets module.";
-
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
+static constexpr auto toolTipC = "A widget for displaying a web page, from the Qt WebKit Widgets module."_L1;
+
QWebViewPlugin::QWebViewPlugin(QObject *parent) :
QObject(parent),
m_initialized(false)