summaryrefslogtreecommitdiff
path: root/src/designer/src/lib/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/designer/src/lib/shared')
-rw-r--r--src/designer/src/lib/shared/actioneditor.cpp28
-rw-r--r--src/designer/src/lib/shared/actionrepository.cpp6
-rw-r--r--src/designer/src/lib/shared/codedialog.cpp10
-rw-r--r--src/designer/src/lib/shared/formlayoutmenu.cpp18
-rw-r--r--src/designer/src/lib/shared/formwindowbase.cpp12
-rw-r--r--src/designer/src/lib/shared/iconloader.cpp8
-rw-r--r--src/designer/src/lib/shared/iconselector.cpp13
-rw-r--r--src/designer/src/lib/shared/layout.cpp18
-rw-r--r--src/designer/src/lib/shared/layoutinfo.cpp15
-rw-r--r--src/designer/src/lib/shared/morphmenu.cpp38
-rw-r--r--src/designer/src/lib/shared/newactiondialog.cpp4
-rw-r--r--src/designer/src/lib/shared/newformwidget.cpp10
-rw-r--r--src/designer/src/lib/shared/plugindialog.cpp2
-rw-r--r--src/designer/src/lib/shared/pluginmanager.cpp32
-rw-r--r--src/designer/src/lib/shared/previewconfigurationwidget.cpp5
-rw-r--r--src/designer/src/lib/shared/propertylineedit.cpp4
-rw-r--r--src/designer/src/lib/shared/qdesigner_command.cpp41
-rw-r--r--src/designer/src/lib/shared/qdesigner_formbuilder.cpp12
-rw-r--r--src/designer/src/lib/shared/qdesigner_formwindowcommand.cpp4
-rw-r--r--src/designer/src/lib/shared/qdesigner_introspection.cpp5
-rw-r--r--src/designer/src/lib/shared/qdesigner_membersheet.cpp5
-rw-r--r--src/designer/src/lib/shared/qdesigner_menu.cpp10
-rw-r--r--src/designer/src/lib/shared/qdesigner_menubar.cpp10
-rw-r--r--src/designer/src/lib/shared/qdesigner_promotion.cpp29
-rw-r--r--src/designer/src/lib/shared/qdesigner_promotiondialog.cpp8
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertycommand.cpp66
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertyeditor.cpp46
-rw-r--r--src/designer/src/lib/shared/qdesigner_propertysheet.cpp157
-rw-r--r--src/designer/src/lib/shared/qdesigner_stackedbox.cpp13
-rw-r--r--src/designer/src/lib/shared/qdesigner_tabwidget.cpp4
-rw-r--r--src/designer/src/lib/shared/qdesigner_taskmenu.cpp17
-rw-r--r--src/designer/src/lib/shared/qdesigner_toolbar.cpp4
-rw-r--r--src/designer/src/lib/shared/qdesigner_utils.cpp6
-rw-r--r--src/designer/src/lib/shared/qdesigner_widgetbox.cpp11
-rw-r--r--src/designer/src/lib/shared/qsimpleresource.cpp6
-rw-r--r--src/designer/src/lib/shared/qtresourceeditordialog.cpp12
-rw-r--r--src/designer/src/lib/shared/qtresourceview.cpp17
-rw-r--r--src/designer/src/lib/shared/richtexteditor.cpp19
-rw-r--r--src/designer/src/lib/shared/shared_settings.cpp8
-rw-r--r--src/designer/src/lib/shared/signalslotdialog.cpp10
-rw-r--r--src/designer/src/lib/shared/spacer_widget.cpp4
-rw-r--r--src/designer/src/lib/shared/stylesheeteditor.cpp46
-rw-r--r--src/designer/src/lib/shared/textpropertyeditor.cpp43
-rw-r--r--src/designer/src/lib/shared/widgetdatabase.cpp85
-rw-r--r--src/designer/src/lib/shared/widgetfactory.cpp78
45 files changed, 530 insertions, 469 deletions
diff --git a/src/designer/src/lib/shared/actioneditor.cpp b/src/designer/src/lib/shared/actioneditor.cpp
index 4c8893540..057616217 100644
--- a/src/designer/src/lib/shared/actioneditor.cpp
+++ b/src/designer/src/lib/shared/actioneditor.cpp
@@ -47,6 +47,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
static const char *actionEditorViewModeKey = "ActionEditorViewMode";
static const char *iconPropertyC = "icon";
@@ -112,7 +114,8 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent,
toolbar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
l->addWidget(toolbar);
// edit actions
- QIcon documentNewIcon = QIcon::fromTheme(QStringLiteral("document-new"), createIconSet(QStringLiteral("filenew.png")));
+ QIcon documentNewIcon = QIcon::fromTheme(u"document-new"_s,
+ createIconSet(u"filenew.png"_s));
m_actionNew->setIcon(documentNewIcon);
m_actionNew->setEnabled(false);
connect(m_actionNew, &QAction::triggered, this, &ActionEditor::slotNewAction);
@@ -123,17 +126,20 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent,
#if QT_CONFIG(clipboard)
m_actionCut->setEnabled(false);
connect(m_actionCut, &QAction::triggered, this, &ActionEditor::slotCut);
- QIcon editCutIcon = QIcon::fromTheme(QStringLiteral("edit-cut"), createIconSet(QStringLiteral("editcut.png")));
+ QIcon editCutIcon = QIcon::fromTheme(u"edit-cut"_s,
+ createIconSet(u"editcut.png"_s));
m_actionCut->setIcon(editCutIcon);
m_actionCopy->setEnabled(false);
connect(m_actionCopy, &QAction::triggered, this, &ActionEditor::slotCopy);
- QIcon editCopyIcon = QIcon::fromTheme(QStringLiteral("edit-copy"), createIconSet(QStringLiteral("editcopy.png")));
+ QIcon editCopyIcon = QIcon::fromTheme(u"edit-copy"_s,
+ createIconSet(u"editcopy.png"_s));
m_actionCopy->setIcon(editCopyIcon);
toolbar->addAction(m_actionCopy);
connect(m_actionPaste, &QAction::triggered, this, &ActionEditor::slotPaste);
- QIcon editPasteIcon = QIcon::fromTheme(QStringLiteral("edit-paste"), createIconSet(QStringLiteral("editpaste.png")));
+ QIcon editPasteIcon = QIcon::fromTheme(u"edit-paste"_s,
+ createIconSet(u"editpaste.png"_s));
m_actionPaste->setIcon(editPasteIcon);
toolbar->addAction(m_actionPaste);
#endif
@@ -143,7 +149,8 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent,
connect(m_actionNavigateToSlot, &QAction::triggered, this, &ActionEditor::navigateToSlotCurrentAction);
- QIcon editDeleteIcon = QIcon::fromTheme(QStringLiteral("edit-delete"), createIconSet(QStringLiteral("editdelete.png")));
+ QIcon editDeleteIcon = QIcon::fromTheme(u"edit-delete"_s,
+ createIconSet(u"editdelete.png"_s));
m_actionDelete->setIcon(editDeleteIcon);
m_actionDelete->setEnabled(false);
connect(m_actionDelete, &QAction::triggered, this, &ActionEditor::slotDelete);
@@ -222,7 +229,8 @@ QToolButton *ActionEditor::createConfigureMenuButton(const QString &t, QMenu **p
{
QToolButton *configureButton = new QToolButton;
QAction *configureAction = new QAction(t, configureButton);
- QIcon configureIcon = QIcon::fromTheme(QStringLiteral("document-properties"), createIconSet(QStringLiteral("configure.png")));
+ QIcon configureIcon = QIcon::fromTheme(u"document-properties"_s,
+ createIconSet(u"configure.png"_s));
configureAction->setIcon(configureIcon);
QMenu *configureMenu = new QMenu(configureButton);
configureAction->setMenu(configureMenu);
@@ -569,7 +577,7 @@ void ActionEditor::editAction(QAction *action, int column)
QDesignerFormWindowInterface *fw = formWindow();
QUndoStack *undoStack = fw->commandHistory();
if (severalChanges)
- fw->beginCommand(QStringLiteral("Edit action"));
+ fw->beginCommand(u"Edit action"_s);
if (changeMask & ActionData::NameChanged)
undoStack->push(createTextPropertyCommand(QLatin1String(objectNamePropertyC), newActionData.name, action, fw));
@@ -605,7 +613,7 @@ void ActionEditor::editCurrentAction()
void ActionEditor::navigateToSlotCurrentAction()
{
if (QAction *a = m_actionView->currentAction())
- QDesignerTaskMenu::navigateToSlot(m_core, a, QStringLiteral("triggered()"));
+ QDesignerTaskMenu::navigateToSlot(m_core, a, u"triggered()"_s);
}
void ActionEditor::deleteActions(QDesignerFormWindowInterface *fw, const ActionList &actions)
@@ -665,10 +673,10 @@ void ActionEditor::slotDelete()
static QString underscore(QString text)
{
const QString underscore = QString(QLatin1Char('_'));
- static const QRegularExpression nonAsciiPattern(QStringLiteral("[^a-zA-Z_0-9]"));
+ static const QRegularExpression nonAsciiPattern(u"[^a-zA-Z_0-9]"_s);
Q_ASSERT(nonAsciiPattern.isValid());
text.replace(nonAsciiPattern, underscore);
- static const QRegularExpression multipleSpacePattern(QStringLiteral("__*"));
+ static const QRegularExpression multipleSpacePattern(u"__*"_s);
Q_ASSERT(multipleSpacePattern.isValid());
text.replace(multipleSpacePattern, underscore);
if (text.endsWith(underscore.at(0)))
diff --git a/src/designer/src/lib/shared/actionrepository.cpp b/src/designer/src/lib/shared/actionrepository.cpp
index b6a452bb0..8f49a6dc7 100644
--- a/src/designer/src/lib/shared/actionrepository.cpp
+++ b/src/designer/src/lib/shared/actionrepository.cpp
@@ -27,6 +27,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace {
enum { listModeIconSize = 16, iconModeIconSize = 24 };
}
@@ -137,7 +139,7 @@ PropertySheetKeySequenceValue ActionModel::actionShortCut(QDesignerFormEditorInt
PropertySheetKeySequenceValue ActionModel::actionShortCut(const QDesignerPropertySheetExtension *sheet)
{
- const int index = sheet->indexOf(QStringLiteral("shortcut"));
+ const int index = sheet->indexOf(u"shortcut"_s);
if (index == -1)
return PropertySheetKeySequenceValue();
return qvariant_cast<PropertySheetKeySequenceValue>(sheet->property(index));
@@ -173,7 +175,7 @@ void ActionModel::setItems(QDesignerFormEditorInterface *core, QAction *action,
item->setCheckState(used ? Qt::Checked : Qt::Unchecked);
if (used) {
QString usedToolTip;
- const QString separator = QStringLiteral(", ");
+ const auto separator = ", "_L1;
const int count = associatedDesignerWidgets.size();
for (int i = 0; i < count; i++) {
if (i)
diff --git a/src/designer/src/lib/shared/codedialog.cpp b/src/designer/src/lib/shared/codedialog.cpp
index 4d918462e..ae91ea6dc 100644
--- a/src/designer/src/lib/shared/codedialog.cpp
+++ b/src/designer/src/lib/shared/codedialog.cpp
@@ -30,6 +30,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
// ----------------- CodeDialogPrivate
struct CodeDialog::CodeDialogPrivate {
@@ -57,12 +59,12 @@ CodeDialog::CodeDialog(QWidget *parent) :
// Edit tool bar
QToolBar *toolBar = new QToolBar;
- const QIcon saveIcon = createIconSet(QStringLiteral("filesave.png"));
+ const QIcon saveIcon = createIconSet(u"filesave.png"_s);
QAction *saveAction = toolBar->addAction(saveIcon, tr("Save..."));
connect(saveAction, &QAction::triggered, this, &CodeDialog::slotSaveAs);
#if QT_CONFIG(clipboard)
- const QIcon copyIcon = createIconSet(QStringLiteral("editcopy.png"));
+ const QIcon copyIcon = createIconSet(u"editcopy.png"_s);
QAction *copyAction = toolBar->addAction(copyIcon, tr("Copy All"));
connect(copyAction, &QAction::triggered, this, &CodeDialog::copyAll);
#endif
@@ -136,11 +138,11 @@ bool CodeDialog::generateCode(const QDesignerFormWindowInterface *fw,
tempPattern += QDir::separator();
const QString fileName = fw->fileName();
if (fileName.isEmpty()) {
- tempPattern += QStringLiteral("designer");
+ tempPattern += "designer"_L1;
} else {
tempPattern += QFileInfo(fileName).baseName();
}
- tempPattern += QStringLiteral("XXXXXX.ui");
+ tempPattern += "XXXXXX.ui"_L1;
// Write to temp file
QTemporaryFile tempFormFile(tempPattern);
diff --git a/src/designer/src/lib/shared/formlayoutmenu.cpp b/src/designer/src/lib/shared/formlayoutmenu.cpp
index 116afe885..ba0dc6baa 100644
--- a/src/designer/src/lib/shared/formlayoutmenu.cpp
+++ b/src/designer/src/lib/shared/formlayoutmenu.cpp
@@ -39,6 +39,8 @@ static const char *fieldWidgetBaseClasses[] = {
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
// Struct that describes a row of controls (descriptive label and control) to
@@ -102,7 +104,7 @@ private:
FormLayoutRowDialog::FormLayoutRowDialog(QDesignerFormEditorInterface *core,
QWidget *parent) :
QDialog(parent),
- m_buddyMarkerRegexp(QStringLiteral("\\&[^&]")),
+ m_buddyMarkerRegexp(u"\\&[^&]"_s),
m_labelNameEdited(false),
m_fieldNameEdited(false),
m_buddyClicked(false)
@@ -113,7 +115,7 @@ FormLayoutRowDialog::FormLayoutRowDialog(QDesignerFormEditorInterface *core,
m_ui.setupUi(this);
connect(m_ui.labelTextLineEdit, &QLineEdit::textEdited, this, &FormLayoutRowDialog::labelTextEdited);
- QRegularExpressionValidator *nameValidator = new QRegularExpressionValidator(QRegularExpression(QStringLiteral("^[a-zA-Z0-9_]+$")), this);
+ auto *nameValidator = new QRegularExpressionValidator(QRegularExpression(u"^[a-zA-Z0-9_]+$"_s), this);
Q_ASSERT(nameValidator->regularExpression().isValid());
m_ui.labelNameLineEdit->setValidator(nameValidator);
@@ -214,7 +216,7 @@ void FormLayoutRowDialog::labelTextEdited(const QString &text)
// "namespace::QLineEdit"->"LineEdit"
static inline QString postFixFromClassName(QString className)
{
- const int index = className.lastIndexOf(QStringLiteral("::"));
+ const int index = className.lastIndexOf("::"_L1);
if (index != -1)
className.remove(0, index + 2);
if (className.size() > 2)
@@ -295,7 +297,7 @@ void FormLayoutRowDialog::updateObjectNames(bool updateLabel, bool updateField)
const QString prefix = prefixFromLabel(labelText());
// Set names
if (doUpdateLabel)
- m_ui.labelNameLineEdit->setText(prefix + QStringLiteral("Label"));
+ m_ui.labelNameLineEdit->setText(prefix + "Label"_L1);
if (doUpdateField)
m_ui.fieldNameLineEdit->setText(prefix + postFixFromClassName(fieldClass()));
}
@@ -384,16 +386,16 @@ static QPair<QWidget *,QWidget *>
QDesignerFormEditorInterface *core = formWindow->core();
QDesignerWidgetFactoryInterface *wf = core->widgetFactory();
- QPair<QWidget *,QWidget *> rc = QPair<QWidget *,QWidget *>(wf->createWidget(QStringLiteral("QLabel"), parent),
- wf->createWidget(row.fieldClassName, parent));
+ QPair<QWidget *,QWidget *> rc{wf->createWidget(u"QLabel"_s, parent),
+ wf->createWidget(row.fieldClassName, parent)};
// Set up properties of the label
- const QString objectNameProperty = QStringLiteral("objectName");
+ const QString objectNameProperty = u"objectName"_s;
QDesignerPropertySheetExtension *labelSheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), rc.first);
int nameIndex = labelSheet->indexOf(objectNameProperty);
labelSheet->setProperty(nameIndex, QVariant::fromValue(PropertySheetStringValue(row.labelName)));
labelSheet->setChanged(nameIndex, true);
formWindow->ensureUniqueObjectName(rc.first);
- const int textIndex = labelSheet->indexOf(QStringLiteral("text"));
+ const int textIndex = labelSheet->indexOf(u"text"_s);
labelSheet->setProperty(textIndex, QVariant::fromValue(PropertySheetStringValue(row.labelText)));
labelSheet->setChanged(textIndex, true);
// Set up properties of the control
diff --git a/src/designer/src/lib/shared/formwindowbase.cpp b/src/designer/src/lib/shared/formwindowbase.cpp
index 4ef3a2b9f..7d93f7098 100644
--- a/src/designer/src/lib/shared/formwindowbase.cpp
+++ b/src/designer/src/lib/shared/formwindowbase.cpp
@@ -41,6 +41,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
class FormWindowBasePrivate {
@@ -207,11 +209,11 @@ void FormWindowBase::reloadProperties()
for (auto jt = it.value().begin(), end = it.value().end(); jt != end; ++jt) {
const int index = jt.key();
const QVariant newValue = sheet->property(index);
- if (qobject_cast<QLabel *>(sheet->object()) && sheet->propertyName(index) == QStringLiteral("text")) {
+ if (qobject_cast<QLabel *>(sheet->object()) && sheet->propertyName(index) == "text"_L1) {
const PropertySheetStringValue newString = qvariant_cast<PropertySheetStringValue>(newValue);
// optimize a bit, reset only if the text value might contain a reference to qt resources
// (however reloading of icons other than taken from resources might not work here)
- if (newString.value().contains(QStringLiteral(":/"))) {
+ if (newString.value().contains(":/"_L1)) {
const QVariant resetValue = QVariant::fromValue(PropertySheetStringValue());
sheet->setProperty(index, resetValue);
}
@@ -221,7 +223,7 @@ void FormWindowBase::reloadProperties()
if (QTabWidget *tabWidget = qobject_cast<QTabWidget *>(sheet->object())) {
const int count = tabWidget->count();
const int current = tabWidget->currentIndex();
- const QString currentTabIcon = QStringLiteral("currentTabIcon");
+ const QString currentTabIcon = u"currentTabIcon"_s;
for (int i = 0; i < count; i++) {
tabWidget->setCurrentIndex(i);
const int index = sheet->indexOf(currentTabIcon);
@@ -231,7 +233,7 @@ void FormWindowBase::reloadProperties()
} else if (QToolBox *toolBox = qobject_cast<QToolBox *>(sheet->object())) {
const int count = toolBox->count();
const int current = toolBox->currentIndex();
- const QString currentItemIcon = QStringLiteral("currentItemIcon");
+ const QString currentItemIcon = u"currentItemIcon"_s;
for (int i = 0; i < count; i++) {
toolBox->setCurrentIndex(i);
const int index = sheet->indexOf(currentItemIcon);
@@ -441,7 +443,7 @@ QMenu *FormWindowBase::createExtensionTaskMenu(QDesignerFormWindowInterface *fw,
QExtensionManager *em = fw->core()->extensionManager();
if (const QDesignerTaskMenuExtension *extTaskMenu = qt_extension<QDesignerTaskMenuExtension*>(em, o))
actions += extTaskMenu->taskActions();
- if (const QDesignerTaskMenuExtension *intTaskMenu = qobject_cast<QDesignerTaskMenuExtension *>(em->extension(o, QStringLiteral("QDesignerInternalTaskMenuExtension")))) {
+ if (const auto *intTaskMenu = qobject_cast<QDesignerTaskMenuExtension *>(em->extension(o, u"QDesignerInternalTaskMenuExtension"_s))) {
if (!actions.isEmpty()) {
QAction *a = new QAction(fw);
a->setSeparator(true);
diff --git a/src/designer/src/lib/shared/iconloader.cpp b/src/designer/src/lib/shared/iconloader.cpp
index 739f57a19..e67e06cca 100644
--- a/src/designer/src/lib/shared/iconloader.cpp
+++ b/src/designer/src/lib/shared/iconloader.cpp
@@ -9,6 +9,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
QDESIGNER_SHARED_EXPORT QIcon createIconSet(const QString &name)
@@ -32,7 +34,7 @@ QDESIGNER_SHARED_EXPORT QIcon createIconSet(const QString &name)
QDESIGNER_SHARED_EXPORT QIcon emptyIcon()
{
- return QIcon(QStringLiteral(":/qt-project.org/formeditor/images/emptyicon.png"));
+ return QIcon(u":/qt-project.org/formeditor/images/emptyicon.png"_s);
}
static QIcon buildIcon(const QString &prefix, const int *sizes, size_t sizeCount)
@@ -40,7 +42,7 @@ static QIcon buildIcon(const QString &prefix, const int *sizes, size_t sizeCount
QIcon result;
for (size_t i = 0; i < sizeCount; ++i) {
const QString size = QString::number(sizes[i]);
- const QPixmap pixmap(prefix + size + QLatin1Char('x') + size + QStringLiteral(".png"));
+ const QPixmap pixmap(prefix + size + 'x'_L1 + size + ".png"_L1);
Q_ASSERT(!pixmap.size().isEmpty());
result.addPixmap(pixmap);
}
@@ -51,7 +53,7 @@ QDESIGNER_SHARED_EXPORT QIcon qtLogoIcon()
{
static const int sizes[] = {16, 24, 32, 64, 128};
static const QIcon result =
- buildIcon(QStringLiteral(":/qt-project.org/formeditor/images/qtlogo"),
+ buildIcon(u":/qt-project.org/formeditor/images/qtlogo"_s,
sizes, sizeof(sizes) / sizeof(sizes[0]));
return result;
}
diff --git a/src/designer/src/lib/shared/iconselector.cpp b/src/designer/src/lib/shared/iconselector.cpp
index 4cf73eb5b..677f155eb 100644
--- a/src/designer/src/lib/shared/iconselector.cpp
+++ b/src/designer/src/lib/shared/iconselector.cpp
@@ -36,6 +36,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
// Validator for theme line edit, accepts empty or non-blank strings.
@@ -316,17 +318,16 @@ static QString imageFilter()
{
QString filter = QApplication::translate("IconSelector", "All Pixmaps (");
const auto supportedImageFormats = QImageReader::supportedImageFormats();
- const QString jpeg = QStringLiteral("JPEG");
const qsizetype count = supportedImageFormats.size();
for (qsizetype i = 0; i < count; ++i) {
if (i)
filter += QLatin1Char(' ');
- filter += QStringLiteral("*.");
+ filter += "*."_L1;
const QString outputFormat = QString::fromUtf8(supportedImageFormats.at(i));
- if (outputFormat != jpeg)
+ if (outputFormat != "JPEG"_L1)
filter += outputFormat.toLower();
else
- filter += QStringLiteral("jpg *.jpeg");
+ filter += "jpg *.jpeg"_L1;
}
filter += QLatin1Char(')');
return filter;
@@ -503,7 +504,7 @@ static const QMap<QString, QIcon> &themeIcons()
{
static QMap<QString, QIcon> result;
if (result.isEmpty()) {
- QFile file(QStringLiteral(":/qt-project.org/designer/icon-naming-spec.txt"));
+ QFile file(u":/qt-project.org/designer/icon-naming-spec.txt"_s);
if (file.open(QIODevice::ReadOnly)) {
while (!file.atEnd()) {
const auto line = file.readLine().trimmed();
@@ -546,7 +547,7 @@ IconThemeEditor::IconThemeEditor(QWidget *parent, bool wantResetButton) :
if (wantResetButton) {
QToolButton *themeResetButton = new QToolButton;
- themeResetButton->setIcon(createIconSet(QStringLiteral("resetproperty.png")));
+ themeResetButton->setIcon(createIconSet(u"resetproperty.png"_s));
connect(themeResetButton, &QAbstractButton::clicked, this, &IconThemeEditor::reset);
mainHLayout->addWidget(themeResetButton);
}
diff --git a/src/designer/src/lib/shared/layout.cpp b/src/designer/src/lib/shared/layout.cpp
index da2a4cb3a..7ec7775e2 100644
--- a/src/designer/src/lib/shared/layout.cpp
+++ b/src/designer/src/lib/shared/layout.cpp
@@ -38,6 +38,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
enum { FormLayoutColumns = 2 };
namespace qdesigner_internal {
@@ -198,7 +200,7 @@ bool Layout::prepareLayout(bool &needMove, bool &needReparent)
const QString baseWidgetClassName = useSplitter ? QLatin1String("QSplitter") : QLatin1String("QLayoutWidget");
m_layoutBase = widgetFactory->createWidget(baseWidgetClassName, widgetFactory->containerOfWidget(m_parentWidget));
if (useSplitter) {
- m_layoutBase->setObjectName(QStringLiteral("splitter"));
+ m_layoutBase->setObjectName(u"splitter"_s);
m_formWindow->ensureUniqueObjectName(m_layoutBase);
}
} else {
@@ -402,11 +404,11 @@ static QString suggestLayoutName(const char *className)
{
// Legacy
if (!qstrcmp(className, "QHBoxLayout"))
- return QStringLiteral("horizontalLayout");
+ return u"horizontalLayout"_s;
if (!qstrcmp(className, "QVBoxLayout"))
- return QStringLiteral("verticalLayout");
+ return u"verticalLayout"_s;
if (!qstrcmp(className, "QGridLayout"))
- return QStringLiteral("gridLayout");
+ return u"gridLayout"_s;
return qtify(QString::fromUtf8(className));
}
@@ -420,10 +422,10 @@ QLayout *Layout::createLayout(int type)
// QLayoutWidget
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(m_formWindow->core()->extensionManager(), layout);
if (sheet && qobject_cast<QLayoutWidget*>(m_layoutBase)) {
- sheet->setProperty(sheet->indexOf(QStringLiteral("leftMargin")), 0);
- sheet->setProperty(sheet->indexOf(QStringLiteral("topMargin")), 0);
- sheet->setProperty(sheet->indexOf(QStringLiteral("rightMargin")), 0);
- sheet->setProperty(sheet->indexOf(QStringLiteral("bottomMargin")), 0);
+ sheet->setProperty(sheet->indexOf(u"leftMargin"_s), 0);
+ sheet->setProperty(sheet->indexOf(u"topMargin"_s), 0);
+ sheet->setProperty(sheet->indexOf(u"rightMargin"_s), 0);
+ sheet->setProperty(sheet->indexOf(u"bottomMargin"_s), 0);
}
return layout;
}
diff --git a/src/designer/src/lib/shared/layoutinfo.cpp b/src/designer/src/lib/shared/layoutinfo.cpp
index ec6e0917c..182e42f37 100644
--- a/src/designer/src/lib/shared/layoutinfo.cpp
+++ b/src/designer/src/lib/shared/layoutinfo.cpp
@@ -17,6 +17,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
/*!
\overload
@@ -39,13 +41,12 @@ LayoutInfo::Type LayoutInfo::layoutType(const QDesignerFormEditorInterface *core
static const QHash<QString, LayoutInfo::Type> &layoutNameTypeMap()
{
- static QHash<QString, LayoutInfo::Type> nameTypeMap;
- if (nameTypeMap.isEmpty()) {
- nameTypeMap.insert(QStringLiteral("QVBoxLayout"), LayoutInfo::VBox);
- nameTypeMap.insert(QStringLiteral("QHBoxLayout"), LayoutInfo::HBox);
- nameTypeMap.insert(QStringLiteral("QGridLayout"), LayoutInfo::Grid);
- nameTypeMap.insert(QStringLiteral("QFormLayout"), LayoutInfo::Form);
- }
+ static const QHash<QString, LayoutInfo::Type> nameTypeMap = {
+ {u"QVBoxLayout"_s, LayoutInfo::VBox},
+ {u"QHBoxLayout"_s, LayoutInfo::HBox},
+ {u"QGridLayout"_s, LayoutInfo::Grid},
+ {u"QFormLayout"_s, LayoutInfo::Form}
+ };
return nameTypeMap;
}
diff --git a/src/designer/src/lib/shared/morphmenu.cpp b/src/designer/src/lib/shared/morphmenu.cpp
index 0b3e87d6d..1ad8a4f3a 100644
--- a/src/designer/src/lib/shared/morphmenu.cpp
+++ b/src/designer/src/lib/shared/morphmenu.cpp
@@ -48,6 +48,8 @@ Q_DECLARE_METATYPE(QWidgetList)
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
// Helpers for the dynamic properties that store Z/Widget order
static const char *widgetOrderPropertyC = "_q_widgetOrder";
static const char *zOrderPropertyC = "_q_zOrder";
@@ -134,29 +136,29 @@ static QStringList classesOfCategory(MorphCategory cat)
case MorphSimpleContainer:
// Do not generally allow to morph into a layout.
// This can be risky in case of container pages,etc.
- l << QStringLiteral("QWidget") << QStringLiteral("QFrame") << QStringLiteral("QGroupBox");
+ l << u"QWidget"_s << u"QFrame"_s << u"QGroupBox"_s;
break;
case MorphPageContainer:
- l << QStringLiteral("QTabWidget") << QStringLiteral("QStackedWidget") << QStringLiteral("QToolBox");
+ l << u"QTabWidget"_s << u"QStackedWidget"_s << u"QToolBox"_s;
break;
case MorphItemView:
- l << QStringLiteral("QListView") << QStringLiteral("QListWidget")
- << QStringLiteral("QTreeView") << QStringLiteral("QTreeWidget")
- << QStringLiteral("QTableView") << QStringLiteral("QTableWidget")
- << QStringLiteral("QColumnView");
+ l << u"QListView"_s << u"QListWidget"_s
+ << u"QTreeView"_s << u"QTreeWidget"_s
+ << u"QTableView"_s << u"QTableWidget"_s
+ << u"QColumnView"_s;
break;
case MorphButton:
- l << QStringLiteral("QCheckBox") << QStringLiteral("QRadioButton")
- << QStringLiteral("QPushButton") << QStringLiteral("QToolButton")
- << QStringLiteral("QCommandLinkButton");
+ l << u"QCheckBox"_s << u"QRadioButton"_s
+ << u"QPushButton"_s << u"QToolButton"_s
+ << u"QCommandLinkButton"_s;
break;
case MorphSpinBox:
- l << QStringLiteral("QDateTimeEdit") << QStringLiteral("QDateEdit")
- << QStringLiteral("QTimeEdit")
- << QStringLiteral("QSpinBox") << QStringLiteral("QDoubleSpinBox");
+ l << u"QDateTimeEdit"_s << u"QDateEdit"_s
+ << u"QTimeEdit"_s
+ << u"QSpinBox"_s << u"QDoubleSpinBox"_s;
break;
case MorphTextEdit:
- l << QStringLiteral("QTextEdit") << QStringLiteral("QPlainTextEdit") << QStringLiteral("QTextBrowser");
+ l << u"QTextEdit"_s << u"QPlainTextEdit"_s << u"QTextBrowser"_s;
break;
}
}
@@ -276,7 +278,7 @@ bool MorphWidgetCommand::addMorphMacro(QDesignerFormWindowInterface *fw, QWidget
// restore buddy using the QByteArray name.
if (buddyLabel) {
SetPropertyCommand *buddyCmd = new SetPropertyCommand(fw);
- buddyCmd->init(buddyLabel, QStringLiteral("buddy"), QVariant(newWidgetName.toUtf8()));
+ buddyCmd->init(buddyLabel, u"buddy"_s, QVariant(newWidgetName.toUtf8()));
us->push(buddyCmd);
}
us->endMacro();
@@ -317,13 +319,12 @@ bool MorphWidgetCommand::init(QWidget *widget, const QString &newClassName)
// up the children of the before widget
if (QDesignerContainerExtension* c = qt_extension<QDesignerContainerExtension*>(core->extensionManager(), m_afterWidget)) {
if (const auto pageCount = childContainers(core, m_beforeWidget).size()) {
- const QString qWidget = QStringLiteral("QWidget");
const QString containerName = m_afterWidget->objectName();
for (qsizetype i = 0; i < pageCount; ++i) {
QString name = containerName;
- name += QStringLiteral("Page");
+ name += "Page"_L1;
name += QString::number(i + 1);
- QWidget *page = core->widgetFactory()->createWidget(qWidget);
+ QWidget *page = core->widgetFactory()->createWidget(u"QWidget"_s);
page->setObjectName(name);
fw->ensureUniqueObjectName(page);
c->addWidget(page);
@@ -335,12 +336,11 @@ bool MorphWidgetCommand::init(QWidget *widget, const QString &newClassName)
// Copy over applicable properties
const QDesignerPropertySheetExtension *beforeSheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), widget);
QDesignerPropertySheetExtension *afterSheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), m_afterWidget);
- const QString objectNameProperty = QStringLiteral("objectName");
const int count = beforeSheet->count();
for (int i = 0; i < count; i++)
if (beforeSheet->isVisible(i) && beforeSheet->isChanged(i)) {
const QString name = beforeSheet->propertyName(i);
- if (name != objectNameProperty) {
+ if (name != "objectName"_L1) {
const int afterIndex = afterSheet->indexOf(name);
if (afterIndex != -1 && afterSheet->isVisible(afterIndex) && afterSheet->propertyGroup(afterIndex) == beforeSheet->propertyGroup(i)) {
afterSheet->setProperty(i, beforeSheet->property(i));
diff --git a/src/designer/src/lib/shared/newactiondialog.cpp b/src/designer/src/lib/shared/newactiondialog.cpp
index 381a4edfb..3ff08f6c6 100644
--- a/src/designer/src/lib/shared/newactiondialog.cpp
+++ b/src/designer/src/lib/shared/newactiondialog.cpp
@@ -17,6 +17,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
// Returns a combination of ChangeMask flags
unsigned ActionData::compare(const ActionData &rhs) const
@@ -51,7 +53,7 @@ NewActionDialog::NewActionDialog(ActionEditor *parent) :
m_ui->tooltipEditor->setTextPropertyValidationMode(ValidationRichText);
connect(m_ui->toolTipToolButton, &QAbstractButton::clicked, this, &NewActionDialog::slotEditToolTip);
- m_ui->keysequenceResetToolButton->setIcon(createIconSet(QStringLiteral("resetproperty.png")));
+ m_ui->keysequenceResetToolButton->setIcon(createIconSet(u"resetproperty.png"_s));
connect(m_ui->keysequenceResetToolButton, &QAbstractButton::clicked,
this, &NewActionDialog::slotResetKeySequence);
diff --git a/src/designer/src/lib/shared/newformwidget.cpp b/src/designer/src/lib/shared/newformwidget.cpp
index dbe1c0219..8ee2c4955 100644
--- a/src/designer/src/lib/shared/newformwidget.cpp
+++ b/src/designer/src/lib/shared/newformwidget.cpp
@@ -32,6 +32,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
enum { profileComboIndexOffset = 1 };
enum { debugNewFormWidget = 0 };
@@ -116,12 +118,12 @@ NewFormWidget::NewFormWidget(QDesignerFormEditorInterface *core, QWidget *parent
m_ui->lblPreview->setBackgroundRole(QPalette::Base);
QDesignerSharedSettings settings(m_core);
- QString uiExtension = QStringLiteral("ui");
- QString templatePath = QStringLiteral(":/qt-project.org/designer/templates/forms");
+ QString uiExtension = u"ui"_s;
+ QString templatePath = u":/qt-project.org/designer/templates/forms"_s;
QDesignerLanguageExtension *lang = qt_extension<QDesignerLanguageExtension *>(core->extensionManager(), core);
if (lang) {
- templatePath = QStringLiteral(":/templates/forms");
+ templatePath = u":/templates/forms"_s;
uiExtension = lang->uiExtension();
}
@@ -378,7 +380,7 @@ void NewFormWidget::loadFrom(const QString &path, bool resourceFile, const QStri
return;
// Iterate through the directory and add the templates
- const QFileInfoList list = dir.entryInfoList(QStringList(QStringLiteral("*.") + uiExtension),
+ const QFileInfoList list = dir.entryInfoList(QStringList{"*."_L1 + uiExtension},
QDir::Files);
if (list.isEmpty())
diff --git a/src/designer/src/lib/shared/plugindialog.cpp b/src/designer/src/lib/shared/plugindialog.cpp
index dda523b7c..9b954802f 100644
--- a/src/designer/src/lib/shared/plugindialog.cpp
+++ b/src/designer/src/lib/shared/plugindialog.cpp
@@ -28,6 +28,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
enum { ErrorItemRole = Qt::UserRole + 1 };
namespace qdesigner_internal {
diff --git a/src/designer/src/lib/shared/pluginmanager.cpp b/src/designer/src/lib/shared/pluginmanager.cpp
index 4c6e822ad..7ab9d17aa 100644
--- a/src/designer/src/lib/shared/pluginmanager.cpp
+++ b/src/designer/src/lib/shared/pluginmanager.cpp
@@ -76,9 +76,9 @@ QStringList QDesignerPluginManager::defaultPluginPaths()
const QStringList path_list = QCoreApplication::libraryPaths();
for (const QString &path : path_list)
- result.append(path + u"/designer"_s);
+ result.append(path + "/designer"_L1);
- result.append(qdesigner_internal::dataDirectory() + u"/plugins"_s);
+ result.append(qdesigner_internal::dataDirectory() + "/plugins"_L1);
return result;
}
@@ -88,11 +88,11 @@ QStringList QDesignerPluginManager::defaultPluginPaths()
static inline QString getDesignerLanguage(QDesignerFormEditorInterface *core)
{
if (QDesignerLanguageExtension *lang = qt_extension<QDesignerLanguageExtension *>(core->extensionManager(), core)) {
- if (lang->uiExtension() == QStringLiteral("jui"))
+ if (lang->uiExtension() == "jui"_L1)
return QLatin1String(jambiLanguageC);
- return QStringLiteral("unknown");
+ return u"unknown"_s;
}
- return QStringLiteral("c++");
+ return u"c++"_s;
}
// ---------------- QDesignerCustomWidgetSharedData
@@ -239,19 +239,19 @@ static inline QString msgAttributeMissing(const QString &name)
static qdesigner_internal::TextPropertyValidationMode typeStringToType(const QString &v, bool *ok)
{
*ok = true;
- if (v == QStringLiteral("multiline"))
+ if (v == "multiline"_L1)
return qdesigner_internal::ValidationMultiLine;
- if (v == QStringLiteral("richtext"))
+ if (v == "richtext"_L1)
return qdesigner_internal::ValidationRichText;
- if (v == QStringLiteral("stylesheet"))
+ if (v == "stylesheet"_L1)
return qdesigner_internal::ValidationStyleSheet;
- if (v == QStringLiteral("singleline"))
+ if (v == "singleline"_L1)
return qdesigner_internal::ValidationSingleLine;
- if (v == QStringLiteral("objectname"))
+ if (v == "objectname"_L1)
return qdesigner_internal::ValidationObjectName;
- if (v == QStringLiteral("objectnamescope"))
+ if (v == "objectnamescope"_L1)
return qdesigner_internal::ValidationObjectNameScope;
- if (v == QStringLiteral("url"))
+ if (v == "url"_L1)
return qdesigner_internal::ValidationURL;
*ok = false;
return qdesigner_internal::ValidationRichText;
@@ -286,7 +286,7 @@ static bool parsePropertySpecs(QXmlStreamReader &sr,
return false;
}
bool typeOk;
- const bool noTr = notrS == QStringLiteral("true") || notrS == QStringLiteral("1");
+ const bool noTr = notrS == "true"_L1 || notrS == "1"_L1;
QDesignerCustomWidgetSharedData::StringPropertyType v(typeStringToType(type, &typeOk), !noTr);
if (!typeOk) {
*errorMessage = QDesignerPluginManager::tr("'%1' is not a valid string property specification.").arg(type);
@@ -526,7 +526,7 @@ QDesignerPluginManager::QDesignerPluginManager(QDesignerFormEditorInterface *cor
{
m_d->m_pluginPaths = defaultPluginPaths();
const QSettings settings(qApp->organizationName(), QDesignerQSettings::settingsApplicationName());
- m_d->m_disabledPlugins = unique(settings.value(QStringLiteral("PluginManager/DisabledPlugins")).toStringList());
+ m_d->m_disabledPlugins = unique(settings.value("PluginManager/DisabledPlugins").toStringList());
// Register plugins
updateRegisteredPlugins();
@@ -684,8 +684,8 @@ void QDesignerPluginManager::registerPlugin(const QString &plugin)
bool QDesignerPluginManager::syncSettings()
{
QSettings settings(qApp->organizationName(), QDesignerQSettings::settingsApplicationName());
- settings.beginGroup(QStringLiteral("PluginManager"));
- settings.setValue(QStringLiteral("DisabledPlugins"), m_d->m_disabledPlugins);
+ settings.beginGroup("PluginManager");
+ settings.setValue("DisabledPlugins", m_d->m_disabledPlugins);
settings.endGroup();
return settings.status() == QSettings::NoError;
}
diff --git a/src/designer/src/lib/shared/previewconfigurationwidget.cpp b/src/designer/src/lib/shared/previewconfigurationwidget.cpp
index d8c8a81ce..ba9f11e26 100644
--- a/src/designer/src/lib/shared/previewconfigurationwidget.cpp
+++ b/src/designer/src/lib/shared/previewconfigurationwidget.cpp
@@ -28,6 +28,8 @@ static const char *skinResourcePathC = ":/skins/";
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
static const char *skinExtensionC = "skin";
// Pair of skin name, path
@@ -40,8 +42,7 @@ static const Skins &defaultSkins() {
static Skins rc;
if (rc.isEmpty()) {
const QString skinPath = QLatin1String(skinResourcePathC);
- QString pattern = QStringLiteral("*.");
- pattern += QLatin1String(skinExtensionC);
+ const QString pattern = "*."_L1 + QLatin1StringView(skinExtensionC);
const QDir dir(skinPath, pattern);
const QFileInfoList list = dir.entryInfoList(QDir::Dirs|QDir::NoDotAndDotDot, QDir::Name);
if (list.isEmpty())
diff --git a/src/designer/src/lib/shared/propertylineedit.cpp b/src/designer/src/lib/shared/propertylineedit.cpp
index 2f3f6b311..bea91010a 100644
--- a/src/designer/src/lib/shared/propertylineedit.cpp
+++ b/src/designer/src/lib/shared/propertylineedit.cpp
@@ -8,6 +8,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
PropertyLineEdit::PropertyLineEdit(QWidget *parent) :
QLineEdit(parent), m_wantNewLine(false)
@@ -30,7 +32,7 @@ namespace qdesigner_internal {
}
void PropertyLineEdit::insertNewLine() {
- insertText(QStringLiteral("\\n"));
+ insertText(u"\\n"_s);
}
void PropertyLineEdit::insertText(const QString &text) {
diff --git a/src/designer/src/lib/shared/qdesigner_command.cpp b/src/designer/src/lib/shared/qdesigner_command.cpp
index 6f3aa74b3..91b5bf443 100644
--- a/src/designer/src/lib/shared/qdesigner_command.cpp
+++ b/src/designer/src/lib/shared/qdesigner_command.cpp
@@ -50,10 +50,12 @@ Q_DECLARE_METATYPE(QWidgetList)
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
static inline void setPropertySheetWindowTitle(const QDesignerFormEditorInterface *core, QObject *o, const QString &t)
{
if (QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), o)) {
- const int idx = sheet->indexOf(QStringLiteral("windowTitle"));
+ const int idx = sheet->indexOf(u"windowTitle"_s);
if (idx != -1) {
sheet->setProperty(idx, t);
sheet->setChanged(idx, true);
@@ -209,7 +211,7 @@ void InsertWidgetCommand::refreshBuddyLabels()
if (label_list.isEmpty())
return;
- const QString buddyProperty = QStringLiteral("buddy");
+ const QString buddyProperty = u"buddy"_s;
const QByteArray objectNameU8 = m_widget->objectName().toUtf8();
// Re-set the buddy (The sheet locates the object by name and sets it)
for (QLabel *label : label_list) {
@@ -957,7 +959,7 @@ void ToolBoxCommand::addPage()
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(formWindow()->core()->extensionManager(), m_toolBox);
if (sheet) {
qdesigner_internal::PropertySheetStringValue itemText(m_itemText);
- sheet->setProperty(sheet->indexOf(QStringLiteral("currentItemText")), QVariant::fromValue(itemText));
+ sheet->setProperty(sheet->indexOf(u"currentItemText"_s), QVariant::fromValue(itemText));
}
m_widget->show();
@@ -1048,7 +1050,7 @@ void AddToolBoxPageCommand::init(QToolBox *toolBox, InsertionMode mode)
m_widget = new QDesignerWidget(formWindow(), m_toolBox);
m_itemText = QApplication::translate("Command", "Page");
m_itemIcon = QIcon();
- m_widget->setObjectName(QStringLiteral("page"));
+ m_widget->setObjectName(u"page"_s);
formWindow()->ensureUniqueObjectName(m_widget);
setText(QApplication::translate("Command", "Insert Page"));
@@ -1109,7 +1111,8 @@ void TabWidgetCommand::addPage()
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(formWindow()->core()->extensionManager(), m_tabWidget);
if (sheet) {
qdesigner_internal::PropertySheetStringValue itemText(m_itemText);
- sheet->setProperty(sheet->indexOf(QStringLiteral("currentTabText")), QVariant::fromValue(itemText));
+ sheet->setProperty(sheet->indexOf(u"currentTabText"_s),
+ QVariant::fromValue(itemText));
}
formWindow()->clearSelection();
@@ -1165,7 +1168,7 @@ void AddTabPageCommand::init(QTabWidget *tabWidget, InsertionMode mode)
m_widget = new QDesignerWidget(formWindow(), m_tabWidget);
m_itemText = QApplication::translate("Command", "Page");
m_itemIcon = QIcon();
- m_widget->setObjectName(QStringLiteral("tab"));
+ m_widget->setObjectName(u"tab"_s);
formWindow()->ensureUniqueObjectName(m_widget);
setText(QApplication::translate("Command", "Insert Page"));
@@ -1341,7 +1344,7 @@ void AddStackedWidgetPageCommand::init(QStackedWidget *stackedWidget, InsertionM
if (mode == InsertAfter)
m_index++;
m_widget = new QDesignerWidget(formWindow(), m_stackedWidget);
- m_widget->setObjectName(QStringLiteral("page"));
+ m_widget->setObjectName(u"page"_s);
formWindow()->ensureUniqueObjectName(m_widget);
setText(QApplication::translate("Command", "Insert Page"));
@@ -1400,7 +1403,7 @@ void CreateMenuBarCommand::init(QMainWindow *mainWindow)
{
m_mainWindow = mainWindow;
QDesignerFormEditorInterface *core = formWindow()->core();
- m_menuBar = qobject_cast<QMenuBar*>(core->widgetFactory()->createWidget(QStringLiteral("QMenuBar"), m_mainWindow));
+ m_menuBar = qobject_cast<QMenuBar*>(core->widgetFactory()->createWidget(u"QMenuBar"_s, m_mainWindow));
core->widgetFactory()->initialize(m_menuBar);
}
@@ -1411,7 +1414,7 @@ void CreateMenuBarCommand::redo()
c = qt_extension<QDesignerContainerExtension*>(core->extensionManager(), m_mainWindow);
c->addWidget(m_menuBar);
- m_menuBar->setObjectName(QStringLiteral("menuBar"));
+ m_menuBar->setObjectName(u"menuBar"_s);
formWindow()->ensureUniqueObjectName(m_menuBar);
core->metaDataBase()->add(m_menuBar);
formWindow()->emitSelectionChanged();
@@ -1491,7 +1494,7 @@ void CreateStatusBarCommand::init(QMainWindow *mainWindow)
{
m_mainWindow = mainWindow;
QDesignerFormEditorInterface *core = formWindow()->core();
- m_statusBar = qobject_cast<QStatusBar*>(core->widgetFactory()->createWidget(QStringLiteral("QStatusBar"), m_mainWindow));
+ m_statusBar = qobject_cast<QStatusBar*>(core->widgetFactory()->createWidget(u"QStatusBar"_s, m_mainWindow));
core->widgetFactory()->initialize(m_statusBar);
}
@@ -1502,7 +1505,7 @@ void CreateStatusBarCommand::redo()
c = qt_extension<QDesignerContainerExtension*>(core->extensionManager(), m_mainWindow);
c->addWidget(m_statusBar);
- m_statusBar->setObjectName(QStringLiteral("statusBar"));
+ m_statusBar->setObjectName(u"statusBar"_s);
formWindow()->ensureUniqueObjectName(m_statusBar);
core->metaDataBase()->add(m_statusBar);
formWindow()->emitSelectionChanged();
@@ -1579,7 +1582,7 @@ void AddToolBarCommand::init(QMainWindow *mainWindow, Qt::ToolBarArea area)
m_mainWindow = mainWindow;
QDesignerWidgetFactoryInterface * wf = formWindow()->core()->widgetFactory();
// Pass on 0 parent first to avoid reparenting flicker.
- m_toolBar = qobject_cast<QToolBar*>(wf->createWidget(QStringLiteral("QToolBar"), nullptr));
+ m_toolBar = qobject_cast<QToolBar*>(wf->createWidget(u"QToolBar"_s, nullptr));
m_toolBar->setProperty("_q_desiredArea", QVariant(area));
wf->initialize(m_toolBar);
m_toolBar->hide();
@@ -1593,7 +1596,7 @@ void AddToolBarCommand::redo()
QDesignerContainerExtension *c = qt_extension<QDesignerContainerExtension*>(core->extensionManager(), m_mainWindow);
c->addWidget(m_toolBar);
- m_toolBar->setObjectName(QStringLiteral("toolBar"));
+ m_toolBar->setObjectName(u"toolBar"_s);
formWindow()->ensureUniqueObjectName(m_toolBar);
setPropertySheetWindowTitle(core, m_toolBar, m_toolBar->objectName());
formWindow()->emitSelectionChanged();
@@ -1642,7 +1645,7 @@ void AddDockWidgetCommand::init(QMainWindow *mainWindow)
{
m_mainWindow = mainWindow;
QDesignerFormEditorInterface *core = formWindow()->core();
- m_dockWidget = qobject_cast<QDockWidget*>(core->widgetFactory()->createWidget(QStringLiteral("QDockWidget"), m_mainWindow));
+ m_dockWidget = qobject_cast<QDockWidget*>(core->widgetFactory()->createWidget(u"QDockWidget"_s, m_mainWindow));
}
void AddDockWidgetCommand::redo()
@@ -1651,7 +1654,7 @@ void AddDockWidgetCommand::redo()
QDesignerContainerExtension *c = qt_extension<QDesignerContainerExtension*>(core->extensionManager(), m_mainWindow);
c->addWidget(m_dockWidget);
- m_dockWidget->setObjectName(QStringLiteral("dockWidget"));
+ m_dockWidget->setObjectName(u"dockWidget"_s);
formWindow()->ensureUniqueObjectName(m_dockWidget);
formWindow()->manageWidget(m_dockWidget);
formWindow()->emitSelectionChanged();
@@ -1732,7 +1735,7 @@ void AdjustWidgetSizeCommand::updatePropertyEditor() const
{
if (QDesignerPropertyEditorInterface *propertyEditor = formWindow()->core()->propertyEditor()) {
if (propertyEditor->object() == m_widget)
- propertyEditor->setPropertyValue(QStringLiteral("geometry"), m_widget->geometry(), true);
+ propertyEditor->setPropertyValue(u"geometry"_s, m_widget->geometry(), true);
}
}
// ------------ ChangeFormLayoutItemRoleCommand
@@ -2006,16 +2009,16 @@ void AddContainerWidgetPageCommand::init(QWidget *containerWidget, ContainerType
case PageContainer:
setText(QApplication::translate("Command", "Insert Page"));
m_widget = new QDesignerWidget(formWindow(), m_containerWidget);
- m_widget->setObjectName(QStringLiteral("page"));
+ m_widget->setObjectName(u"page"_s);
break;
case MdiContainer:
setText(QApplication::translate("Command", "Insert Subwindow"));
m_widget = new QDesignerWidget(formWindow(), m_containerWidget);
- m_widget->setObjectName(QStringLiteral("subwindow"));
+ m_widget->setObjectName(u"subwindow"_s);
setPropertySheetWindowTitle(core, m_widget, QApplication::translate("Command", "Subwindow"));
break;
case WizardContainer: // Apply style, don't manage
- m_widget = core->widgetFactory()->createWidget(QStringLiteral("QWizardPage"), nullptr);
+ m_widget = core->widgetFactory()->createWidget(u"QWizardPage"_s, nullptr);
break;
}
formWindow()->ensureUniqueObjectName(m_widget);
diff --git a/src/designer/src/lib/shared/qdesigner_formbuilder.cpp b/src/designer/src/lib/shared/qdesigner_formbuilder.cpp
index 02af81672..27b92c4e5 100644
--- a/src/designer/src/lib/shared/qdesigner_formbuilder.cpp
+++ b/src/designer/src/lib/shared/qdesigner_formbuilder.cpp
@@ -44,6 +44,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
QDesignerFormBuilder::QDesignerFormBuilder(QDesignerFormEditorInterface *core,
@@ -98,11 +100,11 @@ QWidget *QDesignerFormBuilder::createWidget(const QString &widgetName, QWidget *
{
QWidget *widget = nullptr;
- if (widgetName == QStringLiteral("QToolBar")) {
+ if (widgetName == "QToolBar"_L1) {
widget = new QToolBar(parentWidget);
- } else if (widgetName == QStringLiteral("QMenu")) {
+ } else if (widgetName == "QMenu"_L1) {
widget = new QMenu(parentWidget);
- } else if (widgetName == QStringLiteral("QMenuBar")) {
+ } else if (widgetName == "QMenuBar"_L1) {
widget = new QMenuBar(parentWidget);
} else {
widget = core()->widgetFactory()->createWidget(widgetName, parentWidget);
@@ -206,7 +208,7 @@ void QDesignerFormBuilder::applyProperties(QObject *o, const QList<DomProperty*>
const QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), o);
const QDesignerDynamicPropertySheetExtension *dynamicSheet = qt_extension<QDesignerDynamicPropertySheetExtension*>(core()->extensionManager(), o);
- const bool changingMetaObject = WidgetFactory::classNameOf(core(), o) == QStringLiteral("QAxWidget");
+ const bool changingMetaObject = WidgetFactory::classNameOf(core(), o) == "QAxWidget"_L1;
const QDesignerMetaObjectInterface *meta = core()->introspection()->metaObject(o);
const bool dynamicPropertiesAllowed = dynamicSheet && dynamicSheet->dynamicPropertiesAllowed();
@@ -242,7 +244,7 @@ void QDesignerFormBuilder::applyProperties(QObject *o, const QList<DomProperty*>
QObject *obj = o;
QAbstractScrollArea *scroll = qobject_cast<QAbstractScrollArea *>(o);
- if (scroll && attributeName == QStringLiteral("cursor") && scroll->viewport())
+ if (scroll && attributeName == "cursor"_L1 && scroll->viewport())
obj = scroll->viewport();
// a real property
diff --git a/src/designer/src/lib/shared/qdesigner_formwindowcommand.cpp b/src/designer/src/lib/shared/qdesigner_formwindowcommand.cpp
index f6e3370c2..48687277e 100644
--- a/src/designer/src/lib/shared/qdesigner_formwindowcommand.cpp
+++ b/src/designer/src/lib/shared/qdesigner_formwindowcommand.cpp
@@ -21,6 +21,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
// ---- QDesignerFormWindowCommand ----
@@ -79,7 +81,7 @@ void QDesignerFormWindowCommand::updateBuddies(QDesignerFormWindowInterface *for
if (label_list.isEmpty())
return;
- const QString buddyProperty = QStringLiteral("buddy");
+ const QString buddyProperty = u"buddy"_s;
const QByteArray oldNameU8 = old_name.toUtf8();
const QByteArray newNameU8 = new_name.toUtf8();
diff --git a/src/designer/src/lib/shared/qdesigner_introspection.cpp b/src/designer/src/lib/shared/qdesigner_introspection.cpp
index d918abbb9..8c2dd3736 100644
--- a/src/designer/src/lib/shared/qdesigner_introspection.cpp
+++ b/src/designer/src/lib/shared/qdesigner_introspection.cpp
@@ -10,6 +10,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
// Qt Implementation
static QStringList byteArrayListToStringList(const QByteArrayList &l)
{
@@ -60,8 +62,7 @@ namespace {
QString QDesignerMetaEnum::separator() const
{
- static const QString rc = QStringLiteral("::");
- return rc;
+ return u"::"_s;
}
// ------- QDesignerMetaProperty
diff --git a/src/designer/src/lib/shared/qdesigner_membersheet.cpp b/src/designer/src/lib/shared/qdesigner_membersheet.cpp
index 31f92bb1d..29aec04dd 100644
--- a/src/designer/src/lib/shared/qdesigner_membersheet.cpp
+++ b/src/designer/src/lib/shared/qdesigner_membersheet.cpp
@@ -8,8 +8,11 @@
#include <abstractintrospection_p.h>
#include <QtWidgets/qwidget.h>
+
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
static QByteArrayList stringListToByteArray(const QStringList &l)
{
QByteArrayList rc;
@@ -142,7 +145,7 @@ bool QDesignerMemberSheet::isSlot(int index) const
bool QDesignerMemberSheet::inheritedFromWidget(int index) const
{
- return declaredInClass(index) == QStringLiteral("QWidget") || declaredInClass(index) == QStringLiteral("QObject");
+ return declaredInClass(index) == "QWidget"_L1 || declaredInClass(index) == "QObject"_L1;
}
diff --git a/src/designer/src/lib/shared/qdesigner_menu.cpp b/src/designer/src/lib/shared/qdesigner_menu.cpp
index 9b558189b..c19f98dec 100644
--- a/src/designer/src/lib/shared/qdesigner_menu.cpp
+++ b/src/designer/src/lib/shared/qdesigner_menu.cpp
@@ -33,6 +33,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
// give the user a little more space to click on the sub menu rectangle
static inline void extendClickableArea(QRect *subMenuRect, Qt::LayoutDirection dir)
{
@@ -49,7 +51,7 @@ static inline void extendClickableArea(QRect *subMenuRect, Qt::LayoutDirection d
QDesignerMenu::QDesignerMenu(QWidget *parent) :
QMenu(parent),
- m_subMenuPixmap(QPixmap(QStringLiteral(":/qt-project.org/formeditor/images/submenu.png"))),
+ m_subMenuPixmap(QPixmap(u":/qt-project.org/formeditor/images/submenu.png"_s)),
m_currentIndex(0),
m_addItem(new qdesigner_internal::SpecialMenuAction(this)),
m_addSeparator(new qdesigner_internal::SpecialMenuAction(this)),
@@ -75,7 +77,7 @@ QDesignerMenu::QDesignerMenu(QWidget *parent) :
connect(m_deactivateWindowTimer, &QTimer::timeout, this, &QDesignerMenu::slotDeactivateNow);
- m_editor->setObjectName(QStringLiteral("__qt__passive_editor"));
+ m_editor->setObjectName(u"__qt__passive_editor"_s);
m_editor->hide();
m_editor->installEventFilter(this);
@@ -979,7 +981,7 @@ void QDesignerMenu::createRealMenuAction(QAction *action)
core->widgetFactory()->initialize(menu);
- const QString niceObjectName = ActionEditor::actionTextToName(menu->title(), QStringLiteral("menu"));
+ const QString niceObjectName = ActionEditor::actionTextToName(menu->title(), u"menu"_s);
menu->setObjectName(niceObjectName);
core->metaDataBase()->add(menu);
@@ -1173,7 +1175,7 @@ void QDesignerMenu::leaveEditMode(LeaveEditMode mode)
}
auto *cmd = new qdesigner_internal::SetPropertyCommand(fw);
- cmd->init(action, QStringLiteral("text"), m_editor->text());
+ cmd->init(action, u"text"_s, m_editor->text());
fw->commandHistory()->push(cmd);
if (parentMenu()) {
diff --git a/src/designer/src/lib/shared/qdesigner_menubar.cpp b/src/designer/src/lib/shared/qdesigner_menubar.cpp
index 016f1cbfa..7b442ed31 100644
--- a/src/designer/src/lib/shared/qdesigner_menubar.cpp
+++ b/src/designer/src/lib/shared/qdesigner_menubar.cpp
@@ -29,6 +29,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
using ActionList = QList<QAction *>;
namespace qdesigner_internal
@@ -65,7 +67,7 @@ QDesignerMenuBar::QDesignerMenuBar(QWidget *parent) :
italic.setItalic(true);
m_addMenu->setFont(italic);
- m_editor->setObjectName(QStringLiteral("__qt__passive_editor"));
+ m_editor->setObjectName(u"__qt__passive_editor"_s);
m_editor->hide();
m_editor->installEventFilter(this);
installEventFilter(this);
@@ -438,8 +440,8 @@ void QDesignerMenuBar::leaveEditMode(LeaveEditMode mode)
fw->beginCommand(QApplication::translate("Command", "Change Title"));
} else {
fw->beginCommand(QApplication::translate("Command", "Insert Menu"));
- const QString niceObjectName = ActionEditor::actionTextToName(m_editor->text(), QStringLiteral("menu"));
- QMenu *menu = qobject_cast<QMenu*>(fw->core()->widgetFactory()->createWidget(QStringLiteral("QMenu"), this));
+ const QString niceObjectName = ActionEditor::actionTextToName(m_editor->text(), u"menu"_s);
+ QMenu *menu = qobject_cast<QMenu*>(fw->core()->widgetFactory()->createWidget(u"QMenu"_s, this));
fw->core()->widgetFactory()->initialize(menu);
menu->setObjectName(niceObjectName);
menu->setTitle(tr("Menu"));
@@ -451,7 +453,7 @@ void QDesignerMenuBar::leaveEditMode(LeaveEditMode mode)
}
auto *cmd = new qdesigner_internal::SetPropertyCommand(fw);
- cmd->init(action, QStringLiteral("text"), m_editor->text());
+ cmd->init(action, u"text"_s, m_editor->text());
fw->commandHistory()->push(cmd);
fw->endCommand();
}
diff --git a/src/designer/src/lib/shared/qdesigner_promotion.cpp b/src/designer/src/lib/shared/qdesigner_promotion.cpp
index d02336f27..3f12808bd 100644
--- a/src/designer/src/lib/shared/qdesigner_promotion.cpp
+++ b/src/designer/src/lib/shared/qdesigner_promotion.cpp
@@ -19,19 +19,20 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace {
// Return a set of on-promotable classes
const QSet<QString> &nonPromotableClasses() {
- static QSet<QString> rc;
- if (rc.isEmpty()) {
- rc.insert(QStringLiteral("Line"));
- rc.insert(QStringLiteral("QAction"));
- rc.insert(QStringLiteral("Spacer"));
- rc.insert(QStringLiteral("QMainWindow"));
- rc.insert(QStringLiteral("QDialog"));
- rc.insert(QStringLiteral("QMdiArea"));
- rc.insert(QStringLiteral("QMdiSubWindow"));
- }
+ static const QSet<QString> rc = {
+ u"Line"_s,
+ u"QAction"_s,
+ u"Spacer"_s,
+ u"QMainWindow"_s,
+ u"QDialog"_s,
+ u"QMdiArea"_s,
+ u"QMdiSubWindow"_s
+ };
return rc;
}
@@ -59,8 +60,9 @@ namespace {
}
// extract class name from xml "<widget class="QWidget" ...>". Quite a hack.
- QString classNameFromXml(QString xml) {
- static const QString tag = QStringLiteral("class=\"");
+ QString classNameFromXml(QString xml)
+ {
+ constexpr auto tag = "class=\""_L1;
const int pos = xml.indexOf(tag);
if (pos == -1)
return QString();
@@ -168,8 +170,7 @@ namespace qdesigner_internal {
if (nonPromotableClasses().contains(name))
return false;
- if (name.startsWith(QStringLiteral("QDesigner")) ||
- name.startsWith(QStringLiteral("QLayout")))
+ if (name.startsWith("QDesigner"_L1) || name.startsWith("QLayout"_L1))
return false;
return true;
diff --git a/src/designer/src/lib/shared/qdesigner_promotiondialog.cpp b/src/designer/src/lib/shared/qdesigner_promotiondialog.cpp
index 84e200721..5dc4e7d9c 100644
--- a/src/designer/src/lib/shared/qdesigner_promotiondialog.cpp
+++ b/src/designer/src/lib/shared/qdesigner_promotiondialog.cpp
@@ -35,6 +35,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
// PromotionParameters
struct PromotionParameters {
@@ -58,7 +60,7 @@ namespace qdesigner_internal {
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
QHBoxLayout *hboxLayout = new QHBoxLayout(this);
- m_classNameEdit->setValidator(new QRegularExpressionValidator(QRegularExpression(QStringLiteral("^[_a-zA-Z:][:_a-zA-Z0-9]*$")), m_classNameEdit));
+ m_classNameEdit->setValidator(new QRegularExpressionValidator(QRegularExpression(u"^[_a-zA-Z:][:_a-zA-Z0-9]*$"_s), m_classNameEdit));
connect(m_classNameEdit, &QLineEdit::textChanged,
this, &NewPromotedClassPanel::slotNameChanged);
connect(m_includeFileEdit, &QLineEdit::textChanged,
@@ -132,7 +134,7 @@ namespace qdesigner_internal {
const QChar dot(QLatin1Char('.'));
QString suggestedHeader = m_promotedHeaderLowerCase ?
className.toLower() : className;
- suggestedHeader.replace(QStringLiteral("::"), QString(QLatin1Char('_')));
+ suggestedHeader.replace("::"_L1, "_"_L1);
if (!m_promotedHeaderSuffix.startsWith(dot))
suggestedHeader += dot;
suggestedHeader += m_promotedHeaderSuffix;
@@ -226,7 +228,7 @@ namespace qdesigner_internal {
preselectedBaseClass = baseClassNameList.indexOf(m_promotableWidgetClassName);
}
if (preselectedBaseClass == -1)
- preselectedBaseClass = baseClassNameList.indexOf(QStringLiteral("QFrame"));
+ preselectedBaseClass = baseClassNameList.indexOf("QFrame"_L1);
NewPromotedClassPanel *newPromotedClassPanel = new NewPromotedClassPanel(baseClassNameList, preselectedBaseClass);
newPromotedClassPanel->setPromotedHeaderSuffix(core->integration()->headerSuffix());
diff --git a/src/designer/src/lib/shared/qdesigner_propertycommand.cpp b/src/designer/src/lib/shared/qdesigner_propertycommand.cpp
index 814c439d3..355b2a331 100644
--- a/src/designer/src/lib/shared/qdesigner_propertycommand.cpp
+++ b/src/designer/src/lib/shared/qdesigner_propertycommand.cpp
@@ -34,6 +34,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace {
enum { debugPropertyCommands = 0 };
@@ -44,21 +46,21 @@ QString fontMask(unsigned m)
{
QString rc;
if (m & QFontFamiliesResolved)
- rc += QStringLiteral("Family");
+ rc += "Family"_L1;
if (m & QFont::SizeResolved)
- rc += QStringLiteral("Size ");
+ rc += "Size "_L1;
if (m & QFont::WeightResolved)
- rc += QStringLiteral("Bold ");
+ rc += "Bold "_L1;
if (m & QFont::StyleResolved)
- rc += QStringLiteral("Style ");
+ rc += "Style "_L1;
if (m & QFont::UnderlineResolved)
- rc += QStringLiteral("Underline ");
+ rc += "Underline "_L1;
if (m & QFont::StrikeOutResolved)
- rc += QStringLiteral("StrikeOut ");
+ rc += "StrikeOut "_L1;
if (m & QFont::KerningResolved)
- rc += QStringLiteral("Kerning ");
+ rc += "Kerning "_L1;
if (m & QFont::StyleStrategyResolved)
- rc += QStringLiteral("StyleStrategy");
+ rc += "StyleStrategy"_L1;
return rc;
}
@@ -66,22 +68,20 @@ QString fontMask(unsigned m)
QString fontString(const QFont &f)
{
QString rc; {
- const QChar comma = QLatin1Char(',');
QTextStream str(&rc);
- str << QStringLiteral("QFont(\"") << f.family() << comma <<
- f.pointSize();
+ str << "QFont(\"" << f.family() << ',' << f.pointSize();
if (f.bold())
- str << comma << QStringLiteral("bold");
+ str << ',' << "bold";
if (f.italic())
- str << comma << QStringLiteral("italic");
+ str << ',' << "italic";
if (f.underline())
- str << comma << QStringLiteral("underline");
+ str << ',' << "underline";
if (f.strikeOut())
- str << comma << QStringLiteral("strikeOut");
+ str << ',' << "strikeOut";
if (f.kerning())
- str << comma << QStringLiteral("kerning");
- str << comma << f.styleStrategy() << QStringLiteral(" resolve: ")
- << fontMask(f.resolveMask()) << QLatin1Char(')');
+ str << ',' << "kerning";
+ str << ',' << f.styleStrategy() << " resolve: "
+ << fontMask(f.resolveMask()) << ')';
}
return rc;
}
@@ -575,35 +575,35 @@ PropertyHelper::Value applySubProperty(const QVariant &oldValue, const QVariant
// figure out special property
enum SpecialProperty getSpecialProperty(const QString& propertyName)
{
- if (propertyName == QStringLiteral("objectName"))
+ if (propertyName == "objectName"_L1)
return SP_ObjectName;
- if (propertyName == QStringLiteral("layoutName"))
+ if (propertyName == "layoutName"_L1)
return SP_LayoutName;
- if (propertyName == QStringLiteral("spacerName"))
+ if (propertyName == "spacerName"_L1)
return SP_SpacerName;
- if (propertyName == QStringLiteral("icon"))
+ if (propertyName == "icon"_L1)
return SP_Icon;
- if (propertyName == QStringLiteral("currentTabName"))
+ if (propertyName == "currentTabName"_L1)
return SP_CurrentTabName;
- if (propertyName == QStringLiteral("currentItemName"))
+ if (propertyName == "currentItemName"_L1)
return SP_CurrentItemName;
- if (propertyName == QStringLiteral("currentPageName"))
+ if (propertyName == "currentPageName"_L1)
return SP_CurrentPageName;
- if (propertyName == QStringLiteral("geometry"))
+ if (propertyName == "geometry"_L1)
return SP_Geometry;
- if (propertyName == QStringLiteral("windowTitle"))
+ if (propertyName == "windowTitle"_L1)
return SP_WindowTitle;
- if (propertyName == QStringLiteral("minimumSize"))
+ if (propertyName == "minimumSize"_L1)
return SP_MinimumSize;
- if (propertyName == QStringLiteral("maximumSize"))
+ if (propertyName == "maximumSize"_L1)
return SP_MaximumSize;
- if (propertyName == QStringLiteral("alignment"))
+ if (propertyName == "alignment"_L1)
return SP_Alignment;
- if (propertyName == QStringLiteral("autoDefault"))
+ if (propertyName == "autoDefault"_L1)
return SP_AutoDefault;
- if (propertyName == QStringLiteral("shortcut"))
+ if (propertyName == "shortcut"_L1)
return SP_Shortcut;
- if (propertyName == QStringLiteral("orientation"))
+ if (propertyName == "orientation"_L1)
return SP_Orientation;
return SP_None;
}
diff --git a/src/designer/src/lib/shared/qdesigner_propertyeditor.cpp b/src/designer/src/lib/shared/qdesigner_propertyeditor.cpp
index 3c2785a90..866dbe95a 100644
--- a/src/designer/src/lib/shared/qdesigner_propertyeditor.cpp
+++ b/src/designer/src/lib/shared/qdesigner_propertyeditor.cpp
@@ -17,6 +17,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
using StringPropertyParameters = QDesignerPropertyEditor::StringPropertyParameters;
// A map of property name to type
@@ -29,31 +31,31 @@ static const PropertyNameTypeMap &stringPropertyTypes()
if (propertyNameTypeMap.isEmpty()) {
const StringPropertyParameters richtext(ValidationRichText, true);
// Accessibility. Both are texts the narrator reads
- propertyNameTypeMap.insert(QStringLiteral("accessibleDescription"), richtext);
- propertyNameTypeMap.insert(QStringLiteral("accessibleName"), richtext);
+ propertyNameTypeMap.insert(u"accessibleDescription"_s, richtext);
+ propertyNameTypeMap.insert(u"accessibleName"_s, richtext);
// object names
const StringPropertyParameters objectName(ValidationObjectName, false);
- propertyNameTypeMap.insert(QStringLiteral("buddy"), objectName);
- propertyNameTypeMap.insert(QStringLiteral("currentItemName"), objectName);
- propertyNameTypeMap.insert(QStringLiteral("currentPageName"), objectName);
- propertyNameTypeMap.insert(QStringLiteral("currentTabName"), objectName);
- propertyNameTypeMap.insert(QStringLiteral("layoutName"), objectName);
- propertyNameTypeMap.insert(QStringLiteral("spacerName"), objectName);
+ propertyNameTypeMap.insert(u"buddy"_s, objectName);
+ propertyNameTypeMap.insert(u"currentItemName"_s, objectName);
+ propertyNameTypeMap.insert(u"currentPageName"_s, objectName);
+ propertyNameTypeMap.insert(u"currentTabName"_s, objectName);
+ propertyNameTypeMap.insert(u"layoutName"_s, objectName);
+ propertyNameTypeMap.insert(u"spacerName"_s, objectName);
// Style sheet
- propertyNameTypeMap.insert(QStringLiteral("styleSheet"), StringPropertyParameters(ValidationStyleSheet, false));
+ propertyNameTypeMap.insert(u"styleSheet"_s, StringPropertyParameters(ValidationStyleSheet, false));
// Buttons/ QCommandLinkButton
const StringPropertyParameters multiline(ValidationMultiLine, true);
- propertyNameTypeMap.insert(QStringLiteral("description"), multiline);
- propertyNameTypeMap.insert(QStringLiteral("iconText"), multiline);
+ propertyNameTypeMap.insert(u"description"_s, multiline);
+ propertyNameTypeMap.insert(u"iconText"_s, multiline);
// Tooltips, etc.
- propertyNameTypeMap.insert(QStringLiteral("toolTip"), richtext);
- propertyNameTypeMap.insert(QStringLiteral("whatsThis"), richtext);
- propertyNameTypeMap.insert(QStringLiteral("windowIconText"), richtext);
- propertyNameTypeMap.insert(QStringLiteral("html"), richtext);
+ propertyNameTypeMap.insert(u"toolTip"_s, richtext);
+ propertyNameTypeMap.insert(u"whatsThis"_s, richtext);
+ propertyNameTypeMap.insert(u"windowIconText"_s, richtext);
+ propertyNameTypeMap.insert(u"html"_s, richtext);
// A QWizard page id
- propertyNameTypeMap.insert(QStringLiteral("pageId"), StringPropertyParameters(ValidationSingleLine, false));
+ propertyNameTypeMap.insert(u"pageId"_s, StringPropertyParameters(ValidationSingleLine, false));
// QPlainTextEdit
- propertyNameTypeMap.insert(QStringLiteral("plainText"), StringPropertyParameters(ValidationMultiLine, true));
+ propertyNameTypeMap.insert(u"plainText"_s, StringPropertyParameters(ValidationMultiLine, true));
}
return propertyNameTypeMap;
}
@@ -85,7 +87,7 @@ QDesignerPropertyEditor::StringPropertyParameters QDesignerPropertyEditor::textP
const QString &propertyName, bool isMainContainer)
{
// object name - no comment
- if (propertyName == QStringLiteral("objectName")) {
+ if (propertyName == "objectName"_L1) {
const TextPropertyValidationMode vm = isMainContainer ? ValidationObjectNameScope : ValidationObjectName;
return StringPropertyParameters(vm, false);
}
@@ -108,7 +110,7 @@ QDesignerPropertyEditor::StringPropertyParameters QDesignerPropertyEditor::textP
return hit.value();
// text: Check according to widget type.
- if (propertyName == QStringLiteral("text")) {
+ if (propertyName == "text"_L1) {
if (qobject_cast<const QAction *>(object) || qobject_cast<const QLineEdit *>(object))
return StringPropertyParameters(ValidationSingleLine, true);
if (qobject_cast<const QAbstractButton *>(object))
@@ -117,14 +119,14 @@ QDesignerPropertyEditor::StringPropertyParameters QDesignerPropertyEditor::textP
}
// Fuzzy matching
- if (propertyName.endsWith(QStringLiteral("Name")))
+ if (propertyName.endsWith("Name"_L1))
return StringPropertyParameters(ValidationSingleLine, true);
- if (propertyName.endsWith(QStringLiteral("ToolTip")))
+ if (propertyName.endsWith("ToolTip"_L1))
return StringPropertyParameters(ValidationRichText, true);
#ifdef Q_OS_WIN // No translation for the active X "control" property
- if (propertyName == QStringLiteral("control") && className == QStringLiteral("QAxWidget"))
+ if (propertyName == "control"_L1 && className == "QAxWidget"_L1)
return StringPropertyParameters(ValidationSingleLine, false);
#endif
diff --git a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp
index 31369ae40..abdf5f749 100644
--- a/src/designer/src/lib/shared/qdesigner_propertysheet.cpp
+++ b/src/designer/src/lib/shared/qdesigner_propertysheet.cpp
@@ -34,6 +34,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
#define USE_LAYOUT_SIZE_CONSTRAINT
static const QDesignerMetaObjectInterface *propertyIntroducedBy(const QDesignerMetaObjectInterface *meta, int index)
@@ -438,27 +440,26 @@ QDesignerPropertySheet::PropertyType QDesignerPropertySheetPrivate::propertyType
QString QDesignerPropertySheetPrivate::transformLayoutPropertyName(int index) const
{
using TypeNameMap = QMap<QDesignerPropertySheet::PropertyType, QString>;
- static TypeNameMap typeNameMap;
- if (typeNameMap.isEmpty()) {
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutObjectName, QStringLiteral("objectName"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutLeftMargin, QStringLiteral("leftMargin"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutTopMargin, QStringLiteral("topMargin"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutRightMargin, QStringLiteral("rightMargin"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutBottomMargin, QStringLiteral("bottomMargin"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutSpacing, QStringLiteral("spacing"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutHorizontalSpacing, QStringLiteral("horizontalSpacing"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutVerticalSpacing, QStringLiteral("verticalSpacing"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutSizeConstraint, QStringLiteral("sizeConstraint"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutFieldGrowthPolicy, QStringLiteral("fieldGrowthPolicy"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutRowWrapPolicy, QStringLiteral("rowWrapPolicy"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutLabelAlignment, QStringLiteral("labelAlignment"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutFormAlignment, QStringLiteral("formAlignment"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutBoxStretch, QStringLiteral("stretch"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutGridRowStretch, QStringLiteral("rowStretch"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutGridColumnStretch, QStringLiteral("columnStretch"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutGridRowMinimumHeight, QStringLiteral("rowMinimumHeight"));
- typeNameMap.insert(QDesignerPropertySheet::PropertyLayoutGridColumnMinimumWidth, QStringLiteral("columnMinimumWidth"));
- }
+ static const TypeNameMap typeNameMap = {
+ {QDesignerPropertySheet::PropertyLayoutObjectName, u"objectName"_s},
+ {QDesignerPropertySheet::PropertyLayoutLeftMargin, u"leftMargin"_s},
+ {QDesignerPropertySheet::PropertyLayoutTopMargin, u"topMargin"_s},
+ {QDesignerPropertySheet::PropertyLayoutRightMargin, u"rightMargin"_s},
+ {QDesignerPropertySheet::PropertyLayoutBottomMargin, u"bottomMargin"_s},
+ {QDesignerPropertySheet::PropertyLayoutSpacing, u"spacing"_s},
+ {QDesignerPropertySheet::PropertyLayoutHorizontalSpacing, u"horizontalSpacing"_s},
+ {QDesignerPropertySheet::PropertyLayoutVerticalSpacing, u"verticalSpacing"_s},
+ {QDesignerPropertySheet::PropertyLayoutSizeConstraint, u"sizeConstraint"_s},
+ {QDesignerPropertySheet::PropertyLayoutFieldGrowthPolicy, u"fieldGrowthPolicy"_s},
+ {QDesignerPropertySheet::PropertyLayoutRowWrapPolicy, u"rowWrapPolicy"_s},
+ {QDesignerPropertySheet::PropertyLayoutLabelAlignment, u"labelAlignment"_s},
+ {QDesignerPropertySheet::PropertyLayoutFormAlignment, u"formAlignment"_s},
+ {QDesignerPropertySheet::PropertyLayoutBoxStretch, u"stretch"_s},
+ {QDesignerPropertySheet::PropertyLayoutGridRowStretch, u"rowStretch"_s},
+ {QDesignerPropertySheet::PropertyLayoutGridColumnStretch, u"columnStretch"_s},
+ {QDesignerPropertySheet::PropertyLayoutGridRowMinimumHeight, u"rowMinimumHeight"_s},
+ {QDesignerPropertySheet::PropertyLayoutGridColumnMinimumWidth, u"columnMinimumWidth"_s}
+ };
const TypeNameMap::const_iterator it = typeNameMap.constFind(propertyType(index));
if (it != typeNameMap.constEnd())
return it.value();
@@ -498,43 +499,42 @@ QDesignerPropertySheet::ObjectFlags QDesignerPropertySheet::objectFlagsFromObjec
QDesignerPropertySheet::PropertyType QDesignerPropertySheet::propertyTypeFromName(const QString &name)
{
typedef QHash<QString, PropertyType> PropertyTypeHash;
- static PropertyTypeHash propertyTypeHash;
- if (propertyTypeHash.isEmpty()) {
- propertyTypeHash.insert(QLatin1String(layoutObjectNameC), PropertyLayoutObjectName);
- propertyTypeHash.insert(QLatin1String(layoutLeftMarginC), PropertyLayoutLeftMargin);
- propertyTypeHash.insert(QLatin1String(layoutTopMarginC), PropertyLayoutTopMargin);
- propertyTypeHash.insert(QLatin1String(layoutRightMarginC), PropertyLayoutRightMargin);
- propertyTypeHash.insert(QLatin1String(layoutBottomMarginC), PropertyLayoutBottomMargin);
- propertyTypeHash.insert(QLatin1String(layoutSpacingC), PropertyLayoutSpacing);
- propertyTypeHash.insert(QLatin1String(layoutHorizontalSpacingC), PropertyLayoutHorizontalSpacing);
- propertyTypeHash.insert(QLatin1String(layoutVerticalSpacingC), PropertyLayoutVerticalSpacing);
- propertyTypeHash.insert(QLatin1String(layoutSizeConstraintC), PropertyLayoutSizeConstraint);
- propertyTypeHash.insert(QLatin1String(layoutFieldGrowthPolicyC), PropertyLayoutFieldGrowthPolicy);
- propertyTypeHash.insert(QLatin1String(layoutRowWrapPolicyC), PropertyLayoutRowWrapPolicy);
- propertyTypeHash.insert(QLatin1String(layoutLabelAlignmentC), PropertyLayoutLabelAlignment);
- propertyTypeHash.insert(QLatin1String(layoutFormAlignmentC), PropertyLayoutFormAlignment);
- propertyTypeHash.insert(QLatin1String(layoutboxStretchPropertyC), PropertyLayoutBoxStretch);
- propertyTypeHash.insert(QLatin1String(layoutGridRowStretchPropertyC), PropertyLayoutGridRowStretch);
- propertyTypeHash.insert(QLatin1String(layoutGridColumnStretchPropertyC), PropertyLayoutGridColumnStretch);
- propertyTypeHash.insert(QLatin1String(layoutGridRowMinimumHeightC), PropertyLayoutGridRowMinimumHeight);
- propertyTypeHash.insert(QLatin1String(layoutGridColumnMinimumWidthC), PropertyLayoutGridColumnMinimumWidth);
- propertyTypeHash.insert(QStringLiteral("buddy"), PropertyBuddy);
- propertyTypeHash.insert(QStringLiteral("geometry"), PropertyGeometry);
- propertyTypeHash.insert(QStringLiteral("checked"), PropertyChecked);
- propertyTypeHash.insert(QStringLiteral("checkable"), PropertyCheckable);
- propertyTypeHash.insert(QStringLiteral("accessibleName"), PropertyAccessibility);
- propertyTypeHash.insert(QStringLiteral("accessibleDescription"), PropertyAccessibility);
- propertyTypeHash.insert(QStringLiteral("visible"), PropertyVisible);
- propertyTypeHash.insert(QStringLiteral("windowTitle"), PropertyWindowTitle);
- propertyTypeHash.insert(QStringLiteral("windowIcon"), PropertyWindowIcon);
- propertyTypeHash.insert(QStringLiteral("windowFilePath"), PropertyWindowFilePath);
- propertyTypeHash.insert(QStringLiteral("windowOpacity"), PropertyWindowOpacity);
- propertyTypeHash.insert(QStringLiteral("windowIconText"), PropertyWindowIconText);
- propertyTypeHash.insert(QStringLiteral("windowModality"), PropertyWindowModality);
- propertyTypeHash.insert(QStringLiteral("windowModified"), PropertyWindowModified);
- propertyTypeHash.insert(QStringLiteral("styleSheet"), PropertyStyleSheet);
- propertyTypeHash.insert(QStringLiteral("text"), PropertyText);
- }
+ static const PropertyTypeHash 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},
+ {u"buddy"_s, PropertyBuddy},
+ {u"geometry"_s, PropertyGeometry},
+ {u"checked"_s, PropertyChecked},
+ {u"checkable"_s, PropertyCheckable},
+ {u"accessibleName"_s, PropertyAccessibility},
+ {u"accessibleDescription"_s, PropertyAccessibility},
+ {u"visible"_s, PropertyVisible},
+ {u"windowTitle"_s, PropertyWindowTitle},
+ {u"windowIcon"_s, PropertyWindowIcon},
+ {u"windowFilePath"_s, PropertyWindowFilePath},
+ {u"windowOpacity"_s, PropertyWindowOpacity},
+ {u"windowIconText"_s, PropertyWindowIconText},
+ {u"windowModality"_s, PropertyWindowModality},
+ {u"windowModified"_s, PropertyWindowModified},
+ {u"styleSheet"_s, PropertyStyleSheet},
+ {u"text"_s, PropertyText}
+ };
return propertyTypeHash.value(name, PropertyNone);
}
@@ -545,7 +545,7 @@ QDesignerPropertySheet::QDesignerPropertySheet(QObject *object, QObject *parent)
using Info = QDesignerPropertySheetPrivate::Info;
const QDesignerMetaObjectInterface *baseMeta = d->m_meta;
- while (baseMeta &&baseMeta->className().startsWith(QStringLiteral("QDesigner"))) {
+ while (baseMeta &&baseMeta->className().startsWith("QDesigner"_L1)) {
baseMeta = baseMeta->superClass();
}
Q_ASSERT(baseMeta != nullptr);
@@ -601,27 +601,27 @@ QDesignerPropertySheet::QDesignerPropertySheet(QObject *object, QObject *parent)
}
if (object->isWidgetType()) {
- createFakeProperty(QStringLiteral("focusPolicy"));
- createFakeProperty(QStringLiteral("cursor"));
- createFakeProperty(QStringLiteral("toolTip"));
- createFakeProperty(QStringLiteral("whatsThis"));
- createFakeProperty(QStringLiteral("acceptDrops"));
- createFakeProperty(QStringLiteral("dragEnabled"));
+ createFakeProperty(u"focusPolicy"_s);
+ createFakeProperty(u"cursor"_s);
+ createFakeProperty(u"toolTip"_s);
+ createFakeProperty(u"whatsThis"_s);
+ createFakeProperty(u"acceptDrops"_s);
+ createFakeProperty(u"dragEnabled"_s);
// windowModality/Opacity is visible only for the main container, in which case the form windows enables it on loading
- setVisible(createFakeProperty(QStringLiteral("windowModality")), false);
- setVisible(createFakeProperty(QStringLiteral("windowOpacity"), double(1.0)), false);
+ setVisible(createFakeProperty(u"windowModality"_s), false);
+ setVisible(createFakeProperty(u"windowOpacity"_s, double(1.0)), false);
if (qobject_cast<const QToolBar *>(d->m_object)) { // prevent toolbars from being dragged off
- createFakeProperty(QStringLiteral("floatable"), QVariant(true));
+ createFakeProperty(u"floatable"_s, QVariant(true));
} else {
if (qobject_cast<const QMenuBar *>(d->m_object)) {
// Keep the menu bar editable in the form even if a native menu bar is used.
const bool nativeMenuBarDefault =
!QCoreApplication::testAttribute(Qt::AA_DontUseNativeMenuBar);
- createFakeProperty(QStringLiteral("nativeMenuBar"), QVariant(nativeMenuBarDefault));
+ createFakeProperty(u"nativeMenuBar"_s, QVariant(nativeMenuBarDefault));
}
}
if (d->m_canHaveLayoutAttributes) {
- static const QString layoutGroup = QStringLiteral("Layout");
+ const QString layoutGroup = u"Layout"_s;
const char* fakeLayoutProperties[] = {
layoutObjectNameC, layoutLeftMarginC, layoutTopMarginC, layoutRightMarginC, layoutBottomMarginC, layoutSpacingC, layoutHorizontalSpacingC, layoutVerticalSpacingC,
layoutFieldGrowthPolicyC, layoutRowWrapPolicyC, layoutLabelAlignmentC, layoutFormAlignmentC,
@@ -641,19 +641,19 @@ QDesignerPropertySheet::QDesignerPropertySheet(QObject *object, QObject *parent)
}
if (d->m_objectType == ObjectLabel)
- createFakeProperty(QStringLiteral("buddy"), QVariant(QByteArray()));
+ createFakeProperty(u"buddy"_s, QVariant(QByteArray()));
/* We need to create a fake property since the property does not work
* for non-toplevel windows or on other systems than Mac and only if
* it is above a certain Mac OS version. */
if (qobject_cast<const QMainWindow *>(d->m_object))
- createFakeProperty(QStringLiteral("unifiedTitleAndToolBarOnMac"), false);
+ createFakeProperty(u"unifiedTitleAndToolBarOnMac"_s, false);
}
if (qobject_cast<const QDialog*>(object)) {
- createFakeProperty(QStringLiteral("modal"));
+ createFakeProperty(u"modal"_s);
}
if (qobject_cast<const QDockWidget*>(object)) {
- createFakeProperty(QStringLiteral("floating"));
+ createFakeProperty(u"floating"_s);
}
const QByteArrayList names = object->dynamicPropertyNames();
@@ -683,8 +683,7 @@ bool QDesignerPropertySheet::dynamicPropertiesAllowed() const
bool QDesignerPropertySheet::canAddDynamicProperty(const QString &propName) const
{
// used internally
- if (propName == QStringLiteral("database") ||
- propName == QStringLiteral("buttonGroupId"))
+ if (propName == "database"_L1 || propName == "buttonGroupId"_L1)
return false;
const int index = d->m_meta->indexOfProperty(propName);
if (index != -1)
@@ -694,7 +693,7 @@ bool QDesignerPropertySheet::canAddDynamicProperty(const QString &propName) cons
return !isVisible(idx); // dynamic property already exists
}
return QDesignerPropertySheet::internalDynamicPropertiesEnabled()
- || !propName.startsWith(QStringLiteral("_q_"));
+ || !propName.startsWith("_q_"_L1);
}
int QDesignerPropertySheet::addDynamicProperty(const QString &propName, const QVariant &value)
@@ -1211,7 +1210,7 @@ void QDesignerPropertySheet::setProperty(int index, const QVariant &value)
const QDesignerMetaPropertyInterface *p = d->m_meta->property(index);
p->write(d->m_object, resolvePropertyValue(index, value));
if (qobject_cast<QGroupBox *>(d->m_object) && propertyType(index) == PropertyCheckable) {
- const int idx = indexOf(QStringLiteral("focusPolicy"));
+ const int idx = indexOf(u"focusPolicy"_s);
if (!isChanged(idx)) {
qdesigner_internal::PropertySheetEnumValue e = qvariant_cast<qdesigner_internal::PropertySheetEnumValue>(property(idx));
if (value.toBool()) {
@@ -1248,7 +1247,7 @@ bool QDesignerPropertySheet::reset(int index)
if (d->isStringProperty(index)) {
qdesigner_internal::PropertySheetStringValue value;
// Main container: Reset to stored class name as not to change the file names generated by uic.
- if (propertyName(index) == QStringLiteral("objectName")) {
+ if (propertyName(index) == "objectName"_L1) {
const QVariant classNameDefaultV = d->m_object->property("_q_classname");
if (classNameDefaultV.isValid())
value.setValue(classNameDefaultV.toString());
diff --git a/src/designer/src/lib/shared/qdesigner_stackedbox.cpp b/src/designer/src/lib/shared/qdesigner_stackedbox.cpp
index 40255398a..d24847d08 100644
--- a/src/designer/src/lib/shared/qdesigner_stackedbox.cpp
+++ b/src/designer/src/lib/shared/qdesigner_stackedbox.cpp
@@ -21,7 +21,10 @@
QT_BEGIN_NAMESPACE
-static QToolButton *createToolButton(QWidget *parent, Qt::ArrowType at, const QString &name) {
+using namespace Qt::StringLiterals;
+
+static QToolButton *createToolButton(QWidget *parent, Qt::ArrowType at, const QString &name)
+{
QToolButton *rc = new QToolButton();
rc->setAttribute(Qt::WA_NoChildEventsForParent, true);
rc->setParent(parent);
@@ -38,8 +41,8 @@ QStackedWidgetPreviewEventFilter::QStackedWidgetPreviewEventFilter(QStackedWidge
QObject(parent),
m_buttonToolTipEnabled(false), // Not on preview
m_stackedWidget(parent),
- m_prev(createToolButton(m_stackedWidget, Qt::LeftArrow, QStringLiteral("__qt__passive_prev"))),
- m_next(createToolButton(m_stackedWidget, Qt::RightArrow, QStringLiteral("__qt__passive_next")))
+ m_prev(createToolButton(m_stackedWidget, Qt::LeftArrow, u"__qt__passive_prev"_s)),
+ m_next(createToolButton(m_stackedWidget, Qt::RightArrow, u"__qt__passive_next"_s))
{
connect(m_prev, &QAbstractButton::clicked, this, &QStackedWidgetPreviewEventFilter::prevPage);
connect(m_next, &QAbstractButton::clicked, this, &QStackedWidgetPreviewEventFilter::nextPage);
@@ -133,7 +136,7 @@ static inline QString stackedClassName(QStackedWidget *w)
{
if (const QDesignerFormWindowInterface *fw = QDesignerFormWindowInterface::findFormWindow(w))
return qdesigner_internal::WidgetFactory::classNameOf(fw->core(), w);
- return QStringLiteral("Stacked widget");
+ return u"Stacked widget"_s;
}
void QStackedWidgetPreviewEventFilter::updateButtonToolTip(QObject *o)
@@ -265,7 +268,7 @@ void QStackedWidgetEventFilter::gotoPage(int page) {
// Are we on a form or in a preview?
if (QDesignerFormWindowInterface *fw = QDesignerFormWindowInterface::findFormWindow(stackedWidget())) {
qdesigner_internal::SetPropertyCommand *cmd = new qdesigner_internal::SetPropertyCommand(fw);
- cmd->init(stackedWidget(), QStringLiteral("currentIndex"), page);
+ cmd->init(stackedWidget(), u"currentIndex"_s, page);
fw->commandHistory()->push(cmd);
fw->emitSelectionChanged(); // Magically prevent an endless loop triggered by auto-repeat.
updateButtons();
diff --git a/src/designer/src/lib/shared/qdesigner_tabwidget.cpp b/src/designer/src/lib/shared/qdesigner_tabwidget.cpp
index 6b2c5db22..060bc5f99 100644
--- a/src/designer/src/lib/shared/qdesigner_tabwidget.cpp
+++ b/src/designer/src/lib/shared/qdesigner_tabwidget.cpp
@@ -24,6 +24,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
// Store tab widget as drag source
class MyMimeData : public QMimeData
@@ -154,7 +156,7 @@ bool QTabWidgetEventFilter::eventFilter(QObject *o, QEvent *e)
if (tabbar->tabRect(i).contains(m_pressPoint)) {
if (i != tabbar->currentIndex()) {
qdesigner_internal::SetPropertyCommand *cmd = new qdesigner_internal::SetPropertyCommand(fw);
- cmd->init(m_tabWidget, QStringLiteral("currentIndex"), i);
+ cmd->init(m_tabWidget, u"currentIndex"_s, i);
fw->commandHistory()->push(cmd);
}
break;
diff --git a/src/designer/src/lib/shared/qdesigner_taskmenu.cpp b/src/designer/src/lib/shared/qdesigner_taskmenu.cpp
index 10538a7ba..9b34135e5 100644
--- a/src/designer/src/lib/shared/qdesigner_taskmenu.cpp
+++ b/src/designer/src/lib/shared/qdesigner_taskmenu.cpp
@@ -52,6 +52,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
static inline QAction *createSeparatorHelper(QObject *parent) {
QAction *rc = new QAction(parent);
rc->setSeparator(true);
@@ -63,8 +65,7 @@ static QString objName(const QDesignerFormEditorInterface *core, QObject *object
= qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), object);
Q_ASSERT(sheet != nullptr);
- const QString objectNameProperty = QStringLiteral("objectName");
- const int index = sheet->indexOf(objectNameProperty);
+ const int index = sheet->indexOf(u"objectName"_s);
const QVariant v = sheet->property(index);
if (v.canConvert<qdesigner_internal::PropertySheetStringValue>())
return v.value<qdesigner_internal::PropertySheetStringValue>().value();
@@ -504,10 +505,10 @@ void QDesignerTaskMenu::changeObjectName()
if (dialog.exec() == QDialog::Accepted) {
const QString newObjectName = dialog.newObjectName();
if (!newObjectName.isEmpty() && newObjectName != oldObjectName ) {
- const QString objectNameProperty = QStringLiteral("objectName");
PropertySheetStringValue objectNameValue;
objectNameValue.setValue(newObjectName);
- setProperty(fw, CurrentWidgetMode, objectNameProperty, QVariant::fromValue(objectNameValue));
+ setProperty(fw, CurrentWidgetMode, u"objectName"_s,
+ QVariant::fromValue(objectNameValue));
}
}
}
@@ -563,12 +564,12 @@ void QDesignerTaskMenu::changeTextProperty(const QString &propertyName, const QS
void QDesignerTaskMenu::changeToolTip()
{
- changeTextProperty(QStringLiteral("toolTip"), tr("Edit ToolTip"), MultiSelectionMode, Qt::AutoText);
+ changeTextProperty(u"toolTip"_s, tr("Edit ToolTip"), MultiSelectionMode, Qt::AutoText);
}
void QDesignerTaskMenu::changeWhatsThis()
{
- changeTextProperty(QStringLiteral("whatsThis"), tr("Edit WhatsThis"), MultiSelectionMode, Qt::AutoText);
+ changeTextProperty(u"whatsThis"_s, tr("Edit WhatsThis"), MultiSelectionMode, Qt::AutoText);
}
void QDesignerTaskMenu::changeStyleSheet()
@@ -628,7 +629,7 @@ static void createSizeCommand(QDesignerFormWindowInterface *fw, QWidget *w, int
if (flags & ApplyMinimumHeight)
minimumSize.setHeight(size.height());
SetPropertyCommand* cmd = new SetPropertyCommand(fw);
- cmd->init(w, QStringLiteral("minimumSize"), minimumSize);
+ cmd->init(w, u"minimumSize"_s, minimumSize);
fw->commandHistory()->push(cmd);
}
if (flags & (ApplyMaximumWidth|ApplyMaximumHeight)) {
@@ -638,7 +639,7 @@ static void createSizeCommand(QDesignerFormWindowInterface *fw, QWidget *w, int
if (flags & ApplyMaximumHeight)
maximumSize.setHeight(size.height());
SetPropertyCommand* cmd = new SetPropertyCommand(fw);
- cmd->init(w, QStringLiteral("maximumSize"), maximumSize);
+ cmd->init(w, u"maximumSize"_s, maximumSize);
fw->commandHistory()->push(cmd);
}
}
diff --git a/src/designer/src/lib/shared/qdesigner_toolbar.cpp b/src/designer/src/lib/shared/qdesigner_toolbar.cpp
index c3a729d67..f04ba9113 100644
--- a/src/designer/src/lib/shared/qdesigner_toolbar.cpp
+++ b/src/designer/src/lib/shared/qdesigner_toolbar.cpp
@@ -29,6 +29,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
using ActionList = QList<QAction *>;
namespace qdesigner_internal {
@@ -190,7 +192,7 @@ void ToolBarEventFilter::slotInsertSeparator()
QAction *theSender = qobject_cast<QAction*>(sender());
QAction *previous = qvariant_cast<QAction *>(theSender->data());
fw->beginCommand(tr("Insert Separator"));
- QAction *action = createAction(fw, QStringLiteral("separator"), true);
+ QAction *action = createAction(fw, u"separator"_s, true);
InsertActionIntoCommand *cmd = new InsertActionIntoCommand(fw);
cmd->init(m_toolBar, action, previous);
fw->commandHistory()->push(cmd);
diff --git a/src/designer/src/lib/shared/qdesigner_utils.cpp b/src/designer/src/lib/shared/qdesigner_utils.cpp
index f8ab045f3..f2e2372ff 100644
--- a/src/designer/src/lib/shared/qdesigner_utils.cpp
+++ b/src/designer/src/lib/shared/qdesigner_utils.cpp
@@ -696,8 +696,8 @@ namespace qdesigner_internal
}
}
if (!action) {
- if (const QDesignerTaskMenuExtension *taskMenu = qobject_cast<QDesignerTaskMenuExtension *>(
- core->extensionManager()->extension(managedWidget, QStringLiteral("QDesignerInternalTaskMenuExtension")))) {
+ if (const auto *taskMenu = qobject_cast<QDesignerTaskMenuExtension *>(
+ core->extensionManager()->extension(managedWidget, u"QDesignerInternalTaskMenuExtension"_s))) {
action = taskMenu->preferredEditAction();
if (!action) {
const auto actions = taskMenu->taskActions();
@@ -714,7 +714,7 @@ namespace qdesigner_internal
{
QProcess uic;
QStringList arguments;
- QString binary = QLibraryInfo::path(QLibraryInfo::LibraryExecutablesPath) + QStringLiteral("/uic");
+ QString binary = QLibraryInfo::path(QLibraryInfo::LibraryExecutablesPath) + "/uic"_L1;
switch (language) {
case UicLanguage::Cpp:
break;
diff --git a/src/designer/src/lib/shared/qdesigner_widgetbox.cpp b/src/designer/src/lib/shared/qdesigner_widgetbox.cpp
index d2ac9ea68..260f68a9c 100644
--- a/src/designer/src/lib/shared/qdesigner_widgetbox.cpp
+++ b/src/designer/src/lib/shared/qdesigner_widgetbox.cpp
@@ -13,6 +13,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
class QDesignerWidgetBoxWidgetData : public QSharedData
{
public:
@@ -129,7 +131,6 @@ bool QDesignerWidgetBox::findWidget(const QDesignerWidgetBoxInterface *wbox,
// Note that entry names do not necessarily match the class name
// (at least, not for the standard widgets), so,
// look in the XML for the class name of the first widget to appear
- const QString widgetTag = QStringLiteral("<widget");
QString pattern = QStringLiteral("^<widget\\s+class\\s*=\\s*\"");
pattern += className;
pattern += QStringLiteral("\".*$");
@@ -143,7 +144,7 @@ bool QDesignerWidgetBox::findWidget(const QDesignerWidgetBoxInterface *wbox,
for (int w = 0; w < widgetCount; w++) {
const Widget widget = cat.widget(w);
QString xml = widget.domXml(); // Erase the <ui> tag that can be present starting from 4.4
- const int widgetTagIndex = xml.indexOf(widgetTag);
+ const auto widgetTagIndex = xml.indexOf("<widget"_L1);
if (widgetTagIndex != -1) {
xml.remove(0, widgetTagIndex);
if (regexp.match(xml).hasMatch()) {
@@ -175,12 +176,12 @@ DomUI *QDesignerWidgetBox::xmlToUi(const QString &name, const QString &xml, bool
continue;
}
- if (name.compare(QStringLiteral("widget"), Qt::CaseInsensitive) == 0) { // 4.3 legacy, wrap into DomUI
+ if (name.compare("widget"_L1, Qt::CaseInsensitive) == 0) { // 4.3 legacy, wrap into DomUI
ui = new DomUI;
DomWidget *widget = new DomWidget;
widget->read(reader);
ui->setElementWidget(widget);
- } else if (name.compare(QStringLiteral("ui"), Qt::CaseInsensitive) == 0) { // 4.4
+ } else if (name.compare("ui"_L1, Qt::CaseInsensitive) == 0) { // 4.4
ui = new DomUI;
ui->read(reader);
} else {
@@ -207,7 +208,7 @@ DomUI *QDesignerWidgetBox::xmlToUi(const QString &name, const QString &xml, bool
if (insertFakeTopLevel) {
DomWidget *fakeTopLevel = new DomWidget;
- fakeTopLevel->setAttributeClass(QStringLiteral("QWidget"));
+ fakeTopLevel->setAttributeClass(u"QWidget"_s);
QList<DomWidget *> children;
children.push_back(ui->takeElementWidget());
fakeTopLevel->setElementWidget(children);
diff --git a/src/designer/src/lib/shared/qsimpleresource.cpp b/src/designer/src/lib/shared/qsimpleresource.cpp
index 2b753401a..2b0ef4a07 100644
--- a/src/designer/src/lib/shared/qsimpleresource.cpp
+++ b/src/designer/src/lib/shared/qsimpleresource.cpp
@@ -26,6 +26,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace qdesigner_internal {
bool QSimpleResource::m_warningsEnabled = true;
@@ -142,7 +144,7 @@ void QSimpleResource::addCustomWidgetsToWidgetDatabase(const QDesignerFormEditor
IncludeType includeType = IncludeLocal;
if (const DomHeader *header = custom_widget->elementHeader()) {
includeFile = header->text();
- if (header->hasAttributeLocation() && header->attributeLocation() == QStringLiteral("global"))
+ if (header->hasAttributeLocation() && header->attributeLocation() == "global"_L1)
includeType = IncludeGlobal;
}
const bool domIsContainer = custom_widget->elementContainer();
@@ -203,7 +205,7 @@ void QSimpleResource::handleDomCustomWidgets(const QDesignerFormEditorInterface
}
// Oops, there are classes left whose base class could not be found.
// Default them to QWidget with warnings.
- const QString fallBackBaseClass = QStringLiteral("QWidget");
+ const QString fallBackBaseClass = u"QWidget"_s;
for (DomCustomWidget *custom_widget : std::as_const(custom_widget_list)) {
const QString customClassName = custom_widget->elementClass();
const QString base_class = custom_widget->elementExtends();
diff --git a/src/designer/src/lib/shared/qtresourceeditordialog.cpp b/src/designer/src/lib/shared/qtresourceeditordialog.cpp
index fbbb37736..30223bb11 100644
--- a/src/designer/src/lib/shared/qtresourceeditordialog.cpp
+++ b/src/designer/src/lib/shared/qtresourceeditordialog.cpp
@@ -24,6 +24,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
static const char *rccRootTag = "RCC";
static const char *rccTag = "qresource";
static const char *rccFileTag = "file";
@@ -1340,7 +1342,7 @@ void QtResourceEditorDialogPrivate::slotNewQrcFile()
QCoreApplication::translate("QtResourceEditorDialog", "New Resource File"),
m_firstQrcFileDialog ? qrcStartDirectory() : QString(),
QCoreApplication::translate("QtResourceEditorDialog", "Resource files (*.qrc)"),
- QStringLiteral("qrc"));
+ u"qrc"_s);
if (qrcPath.isEmpty())
return;
@@ -1540,7 +1542,7 @@ void QtResourceEditorDialogPrivate::slotAddFiles()
const QDir dir(fi.absolutePath());
for (QString resourcePath : resourcePaths) {
QString relativePath = dir.relativeFilePath(resourcePath);
- if (relativePath.startsWith(QStringLiteral(".."))) {
+ if (relativePath.startsWith(".."_L1)) {
QMessageBox msgBox(QMessageBox::Warning,
QCoreApplication::translate("QtResourceEditorDialog", "Incorrect Path"),
outOfPathWarning(relativePath), QMessageBox::Cancel);
@@ -1753,7 +1755,7 @@ QString QtResourceEditorDialogPrivate::browseForNewLocation(const QString &resou
QCoreApplication::translate("QtResourceEditorDialog", "Copy As"),
initialPath);
QString relativePath = rootDir.relativeFilePath(newPath);
- if (relativePath.startsWith(QStringLiteral(".."))) {
+ if (relativePath.startsWith(".."_L1)) {
if (warning(QCoreApplication::translate("QtResourceEditorDialog", "Copy As"),
QCoreApplication::translate("QtResourceEditorDialog", "<p>The selected file:</p>"
"<p>%1</p><p>is outside of the current resource file's directory:</p><p>%2</p>"
@@ -2070,8 +2072,8 @@ QString QtResourceEditorDialog::selectedResource() const
if (!currentResourceFile->alias().isEmpty())
resourceEnding = currentResourceFile->alias();
- const QString dotSlash(QStringLiteral("./"));
- const QString dotDotSlash(QStringLiteral("../"));
+ const auto dotSlash = "./"_L1;
+ const auto dotDotSlash = "../"_L1;
while (true) {
if (resourceEnding.startsWith(slash))
resourceEnding = resourceEnding.mid(1);
diff --git a/src/designer/src/lib/shared/qtresourceview.cpp b/src/designer/src/lib/shared/qtresourceview.cpp
index 1d38ce7c9..c9f3fdfcc 100644
--- a/src/designer/src/lib/shared/qtresourceview.cpp
+++ b/src/designer/src/lib/shared/qtresourceview.cpp
@@ -40,6 +40,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
static const char *elementResourceData = "resource";
static const char *typeAttribute = "type";
static const char *typeImage = "image";
@@ -337,7 +339,7 @@ void QtResourceViewPrivate::createPaths()
return;
// Resource root up until 4.6 was ':', changed to ":/" as of 4.7
- const QString root(QStringLiteral(":/"));
+ const QString root(u":/"_s);
QMap<QString, QString> contents = m_resourceModel->contents();
for (auto it = contents.cbegin(), end = contents.cend(); it != end; ++it) {
@@ -377,7 +379,7 @@ void QtResourceViewPrivate::filterOutResources()
// 3) we hide these items which has pathToVisible value false.
const bool matchAll = m_filterPattern.isEmpty();
- const QString root(QStringLiteral(":/"));
+ const QString root(u":/"_s);
QQueue<QString> pathQueue;
pathQueue.enqueue(root);
@@ -485,7 +487,7 @@ QTreeWidgetItem *QtResourceViewPrivate::createPath(const QString &path, QTreeWid
QFileInfo di(path);
substPath = di.fileName();
} else {
- substPath = QStringLiteral("<resource root>");
+ substPath = u"<resource root>"_s;
}
item->setText(0, substPath);
item->setToolTip(0, path);
@@ -530,14 +532,16 @@ QtResourceView::QtResourceView(QDesignerFormEditorInterface *core, QWidget *pare
{
d_ptr->q_ptr = this;
- QIcon editIcon = QIcon::fromTheme(QStringLiteral("document-properties"), qdesigner_internal::createIconSet(QStringLiteral("edit.png")));
+ QIcon editIcon = QIcon::fromTheme(u"document-properties"_s,
+ qdesigner_internal::createIconSet(u"edit.png"_s));
d_ptr->m_editResourcesAction = new QAction(editIcon, tr("Edit Resources..."), this);
d_ptr->m_toolBar->addAction(d_ptr->m_editResourcesAction);
connect(d_ptr->m_editResourcesAction, &QAction::triggered,
this, [this] { d_ptr->slotEditResources(); });
d_ptr->m_editResourcesAction->setEnabled(false);
- QIcon refreshIcon = QIcon::fromTheme(QStringLiteral("view-refresh"), qdesigner_internal::createIconSet(QStringLiteral("reload.png")));
+ QIcon refreshIcon = QIcon::fromTheme(u"view-refresh"_s,
+ qdesigner_internal::createIconSet(u"reload.png"_s));
d_ptr->m_reloadResourcesAction = new QAction(refreshIcon, tr("Reload"), this);
d_ptr->m_toolBar->addAction(d_ptr->m_reloadResourcesAction);
@@ -546,7 +550,8 @@ QtResourceView::QtResourceView(QDesignerFormEditorInterface *core, QWidget *pare
d_ptr->m_reloadResourcesAction->setEnabled(false);
#if QT_CONFIG(clipboard)
- QIcon copyIcon = QIcon::fromTheme(QStringLiteral("edit-copy"), qdesigner_internal::createIconSet(QStringLiteral("editcopy.png")));
+ QIcon copyIcon = QIcon::fromTheme(u"edit-copy"_s,
+ qdesigner_internal::createIconSet(u"editcopy.png"_s));
d_ptr->m_copyResourcePathAction = new QAction(copyIcon, tr("Copy Path"), this);
connect(d_ptr->m_copyResourcePathAction, &QAction::triggered,
this, [this] { d_ptr->slotCopyResourcePath(); });
diff --git a/src/designer/src/lib/shared/richtexteditor.cpp b/src/designer/src/lib/shared/richtexteditor.cpp
index 48b55ac00..eb1d2534c 100644
--- a/src/designer/src/lib/shared/richtexteditor.cpp
+++ b/src/designer/src/lib/shared/richtexteditor.cpp
@@ -53,7 +53,7 @@ namespace qdesigner_internal {
// Richtext simplification filter helpers: Elements to be discarded
static inline bool filterElement(QStringView name)
{
- return name != QStringLiteral("meta") && name != QStringLiteral("style");
+ return name != "meta"_L1 && name != "style"_L1;
}
// Richtext simplification filter helpers: Filter attributes of elements
@@ -65,15 +65,15 @@ static inline void filterAttributes(QStringView name,
return;
// No style attributes for <body>
- if (name == QStringLiteral("body")) {
+ if (name == "body"_L1) {
atts->clear();
return;
}
// Clean out everything except 'align' for 'p'
- if (name == QStringLiteral("p")) {
+ if (name == "p"_L1) {
for (auto it = atts->begin(); it != atts->end(); ) {
- if (it->name() == QStringLiteral("align")) {
+ if (it->name() == "align"_L1) {
++it;
*paragraphAlignmentFound = true;
} else {
@@ -214,12 +214,7 @@ void AddLinkDialog::accept()
const QString url = m_ui->urlInput->text();
if (!title.isEmpty()) {
- QString html = QStringLiteral("<a href=\"");
- html += url;
- html += QStringLiteral("\">");
- html += title;
- html += QStringLiteral("</a>");
-
+ const QString html = "<a href=\""_L1 + url + "\">"_L1 + title + "</a>"_L1;
m_editor->insertHtml(html);
}
@@ -478,12 +473,12 @@ RichTextEditorToolBar::RichTextEditorToolBar(QDesignerFormEditorInterface *core,
// Insert hyperlink and image buttons
- m_link_action->setIcon(createIconSet(QStringLiteral("textanchor.png")));
+ m_link_action->setIcon(createIconSet(u"textanchor.png"_s));
m_link_action->setText(tr("Insert &Link"));
connect(m_link_action, &QAction::triggered, this, &RichTextEditorToolBar::insertLink);
addAction(m_link_action);
- m_image_action->setIcon(createIconSet(QStringLiteral("insertimage.png")));
+ m_image_action->setIcon(createIconSet(u"insertimage.png"_s));
m_image_action->setText(tr("Insert &Image"));
connect(m_image_action, &QAction::triggered, this, &RichTextEditorToolBar::insertImage);
addAction(m_image_action);
diff --git a/src/designer/src/lib/shared/shared_settings.cpp b/src/designer/src/lib/shared/shared_settings.cpp
index c5d754f71..73ad10689 100644
--- a/src/designer/src/lib/shared/shared_settings.cpp
+++ b/src/designer/src/lib/shared/shared_settings.cpp
@@ -32,9 +32,9 @@ static const char *deviceProfilesKey = "DeviceProfiles";
static const char *formTemplatePathsKey = "FormTemplatePaths";
static const char *formTemplateKey = "FormTemplate";
static const char *newFormSizeKey = "NewFormSize";
-static inline QString namingModeKey() { return QStringLiteral("naming"); }
-static inline QString underScoreNamingMode() { return QStringLiteral("underscore"); }
-static inline QString camelCaseNamingMode() { return QStringLiteral("camelcase"); }
+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 bool checkTemplatePath(const QString &path, bool create)
{
@@ -79,7 +79,7 @@ const QStringList &QDesignerSharedSettings::defaultFormTemplatePaths()
static QStringList rc;
if (rc.isEmpty()) {
// Ensure default form template paths
- const QString templatePath = QStringLiteral("/templates");
+ const auto templatePath = "/templates"_L1;
// home
QString path = dataDirectory() + templatePath;
if (checkTemplatePath(path, true))
diff --git a/src/designer/src/lib/shared/signalslotdialog.cpp b/src/designer/src/lib/shared/signalslotdialog.cpp
index 720ccdf66..afb0ccd20 100644
--- a/src/designer/src/lib/shared/signalslotdialog.cpp
+++ b/src/designer/src/lib/shared/signalslotdialog.cpp
@@ -28,6 +28,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
// Regexp to match a function signature, arguments potentially
// with namespace colons.
static const char *signatureRegExp = "^[\\w+_]+\\(([\\w+:]\\*?,?)*\\)$";
@@ -88,7 +90,7 @@ namespace {
QString signature = le->text();
if (!m_signatureRegexp.match(signature).hasMatch()) {
if (m_methodNameRegexp.match(signature).hasMatch()) {
- signature += QStringLiteral("()");
+ signature += "()"_L1;
le->setText(signature);
} else {
return;
@@ -298,8 +300,10 @@ SignalSlotDialog::SignalSlotDialog(QDesignerDialogGuiInterface *dialogGui, QWidg
m_ui->addSignalButton->setIcon(plusIcon);
m_ui->removeSignalButton->setIcon(minusIcon);
- m_slotPanel = new SignaturePanel(this, m_ui->slotListView, m_ui->addSlotButton, m_ui->removeSlotButton, QStringLiteral("slot"));
- m_signalPanel = new SignaturePanel(this, m_ui->signalListView, m_ui->addSignalButton, m_ui->removeSignalButton, QStringLiteral("signal"));
+ m_slotPanel = new SignaturePanel(this, m_ui->slotListView, m_ui->addSlotButton,
+ m_ui->removeSlotButton, u"slot"_s);
+ m_signalPanel = new SignaturePanel(this, m_ui->signalListView, m_ui->addSignalButton,
+ m_ui->removeSignalButton, u"signal"_s);
connect(m_slotPanel, &SignaturePanel::checkSignature,
this, &SignalSlotDialog::slotCheckSignature);
connect(m_signalPanel, &SignaturePanel::checkSignature,
diff --git a/src/designer/src/lib/shared/spacer_widget.cpp b/src/designer/src/lib/shared/spacer_widget.cpp
index 7eaeafc85..ac08a67be 100644
--- a/src/designer/src/lib/shared/spacer_widget.cpp
+++ b/src/designer/src/lib/shared/spacer_widget.cpp
@@ -16,6 +16,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
// The Spacer widget is Designer representation of QLayoutItem.
// It uses QLayoutItem's sizeHint property as QWidget
// sizeHint and the QLayoutItem's sizeType property as QWidget size policy.
@@ -127,7 +129,7 @@ void Spacer::resizeEvent(QResizeEvent* e)
const QSize oldSize = e->oldSize();
if (oldSize.isNull() || oldSize.width() <= m_SizeOffset.width() || oldSize.height() <= m_SizeOffset.height())
if (QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(m_formWindow->core()->extensionManager(), this))
- sheet->setChanged(sheet->indexOf(QStringLiteral("sizeHint")), true);
+ sheet->setChanged(sheet->indexOf(u"sizeHint"_s), true);
}
updateMask();
diff --git a/src/designer/src/lib/shared/stylesheeteditor.cpp b/src/designer/src/lib/shared/stylesheeteditor.cpp
index 827d91e4c..8141c4990 100644
--- a/src/designer/src/lib/shared/stylesheeteditor.cpp
+++ b/src/designer/src/lib/shared/stylesheeteditor.cpp
@@ -35,6 +35,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
static const char *styleSheetProperty = "styleSheet";
static const char *StyleSheetDialogC = "StyleSheetDialog";
static const char *seGeometry = "Geometry";
@@ -208,7 +210,7 @@ void StyleSheetEditorDialog::slotAddResource(const QString &property)
{
const QString path = IconSelector::choosePixmapResource(m_core, m_core->resourceModel(), QString(), this);
if (!path.isEmpty())
- insertCssProperty(property, QString(QStringLiteral("url(%1)")).arg(path));
+ insertCssProperty(property, "url("_L1 + path + u')');
}
void StyleSheetEditorDialog::slotAddGradient(const QString &property)
@@ -228,11 +230,12 @@ void StyleSheetEditorDialog::slotAddColor(const QString &property)
QString colorStr;
if (color.alpha() == 255) {
- colorStr = QString(QStringLiteral("rgb(%1, %2, %3)")).arg(
- color.red()).arg(color.green()).arg(color.blue());
+ colorStr = QString::asprintf("rgb(%d, %d, %d)",
+ color.red(), color.green(), color.blue());
} else {
- colorStr = QString(QStringLiteral("rgba(%1, %2, %3, %4)")).arg(
- color.red()).arg(color.green()).arg(color.blue()).arg(color.alpha());
+ colorStr = QString::asprintf("rgba(%d, %d, %d, %d)",
+ color.red(), color.green(), color.blue(),
+ color.alpha());
}
insertCssProperty(property, colorStr);
@@ -251,29 +254,29 @@ void StyleSheetEditorDialog::slotAddFont()
switch (font.style()) {
case QFont::StyleItalic:
- fontStr += QStringLiteral("italic ");
+ fontStr += "italic "_L1;
break;
case QFont::StyleOblique:
- fontStr += QStringLiteral("oblique ");
+ fontStr += "oblique "_L1;
break;
default:
break;
}
fontStr += QString::number(font.pointSize());
- fontStr += QStringLiteral("pt \"");
+ fontStr += "pt \""_L1;
fontStr += font.family();
fontStr += QLatin1Char('"');
- insertCssProperty(QStringLiteral("font"), fontStr);
+ insertCssProperty(u"font"_s, fontStr);
QString decoration;
if (font.underline())
- decoration += QStringLiteral("underline");
+ decoration += "underline"_L1;
if (font.strikeOut()) {
if (!decoration.isEmpty())
decoration += QLatin1Char(' ');
- decoration += QStringLiteral("line-through");
+ decoration += "line-through"_L1;
}
- insertCssProperty(QStringLiteral("text-decoration"), decoration);
+ insertCssProperty(u"text-decoration"_s, decoration);
}
}
@@ -288,8 +291,8 @@ void StyleSheetEditorDialog::insertCssProperty(const QString &name, const QStrin
// Simple check to see if we're in a selector scope
const QTextDocument *doc = m_editor->document();
- const QTextCursor closing = doc->find(QStringLiteral("}"), cursor, QTextDocument::FindBackward);
- const QTextCursor opening = doc->find(QStringLiteral("{"), cursor, QTextDocument::FindBackward);
+ const QTextCursor closing = doc->find(u"}"_s, cursor, QTextDocument::FindBackward);
+ const QTextCursor opening = doc->find(u"{"_s, cursor, QTextDocument::FindBackward);
const bool inSelector = !opening.isNull() && (closing.isNull() ||
closing.position() < opening.position());
QString insertion;
@@ -298,7 +301,7 @@ void StyleSheetEditorDialog::insertCssProperty(const QString &name, const QStrin
if (inSelector)
insertion += QLatin1Char('\t');
insertion += name;
- insertion += QStringLiteral(": ");
+ insertion += ": "_L1;
insertion += value;
insertion += QLatin1Char(';');
cursor.insertText(insertion);
@@ -311,8 +314,8 @@ void StyleSheetEditorDialog::insertCssProperty(const QString &name, const QStrin
void StyleSheetEditorDialog::slotRequestHelp()
{
- m_core->integration()->emitHelpRequested(QStringLiteral("qtwidgets"),
- QStringLiteral("stylesheet-reference.html"));
+ m_core->integration()->emitHelpRequested(u"qtwidgets"_s,
+ u"stylesheet-reference.html"_s);
}
// See QDialog::keyPressEvent()
@@ -353,10 +356,7 @@ bool StyleSheetEditorDialog::isStyleSheetValid(const QString &styleSheet)
QCss::StyleSheet sheet;
if (parser.parse(&sheet))
return true;
- QString fullSheet = QStringLiteral("* { ");
- fullSheet += styleSheet;
- fullSheet += QLatin1Char('}');
- QCss::Parser parser2(fullSheet);
+ QCss::Parser parser2("* { "_L1 + styleSheet + '}'_L1);
return parser2.parse(&sheet);
}
@@ -366,10 +366,10 @@ void StyleSheetEditorDialog::validateStyleSheet()
setOkButtonEnabled(valid);
if (valid) {
m_validityLabel->setText(tr("Valid Style Sheet"));
- m_validityLabel->setStyleSheet(QStringLiteral("color: green"));
+ m_validityLabel->setStyleSheet(u"color: green"_s);
} else {
m_validityLabel->setText(tr("Invalid Style Sheet"));
- m_validityLabel->setStyleSheet(QStringLiteral("color: red"));
+ m_validityLabel->setStyleSheet(u"color: red"_s);
}
}
diff --git a/src/designer/src/lib/shared/textpropertyeditor.cpp b/src/designer/src/lib/shared/textpropertyeditor.cpp
index a31112202..52418c904 100644
--- a/src/designer/src/lib/shared/textpropertyeditor.cpp
+++ b/src/designer/src/lib/shared/textpropertyeditor.cpp
@@ -17,6 +17,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace {
const QChar NewLineChar(QLatin1Char('\n'));
const QLatin1String EscapedNewLine("\\n");
@@ -130,7 +132,7 @@ namespace {
QUrl UrlValidator::guessUrlFromString(const QString &string) const
{
const QString urlStr = string.trimmed();
- const QRegularExpression qualifiedUrl(QStringLiteral("^[a-zA-Z]+\\:.*$"));
+ const QRegularExpression qualifiedUrl(u"^[a-zA-Z]+\\:.*$"_s);
Q_ASSERT(qualifiedUrl.isValid());
// Check if it looks like a qualified URL. Try parsing it and see.
@@ -142,8 +144,8 @@ namespace {
}
// Might be a Qt resource
- if (string.startsWith(QStringLiteral(":/")))
- return QUrl(QStringLiteral("qrc") + string);
+ if (string.startsWith(":/"_L1))
+ return QUrl("qrc"_L1 + string);
// Might be a file.
if (QFile::exists(urlStr))
@@ -155,11 +157,11 @@ namespace {
if (dotIndex != -1) {
const QString prefix = urlStr.left(dotIndex).toLower();
QString urlString;
- if (prefix == QStringLiteral("ftp"))
+ if (prefix == "ftp"_L1)
urlString += prefix;
else
- urlString += QStringLiteral("http");
- urlString += QStringLiteral("://");
+ urlString += "http"_L1;
+ urlString += "://"_L1;
urlString += urlStr;
const QUrl url(urlString, QUrl::TolerantMode);
if (url.isValid())
@@ -225,26 +227,25 @@ namespace qdesigner_internal {
m_lineEdit->setCompleter(nullptr);
break;
case ValidationObjectName:
- setRegularExpressionValidator(QStringLiteral("^[_a-zA-Z][_a-zA-Z0-9]{1,1023}$"));
+ setRegularExpressionValidator(u"^[_a-zA-Z][_a-zA-Z0-9]{1,1023}$"_s);
m_lineEdit->setCompleter(nullptr);
break;
case ValidationObjectNameScope:
- setRegularExpressionValidator(QStringLiteral("^[_a-zA-Z:][_a-zA-Z0-9:]{1,1023}$"));
+ setRegularExpressionValidator(u"^[_a-zA-Z:][_a-zA-Z0-9:]{1,1023}$"_s);
m_lineEdit->setCompleter(nullptr);
break;
case ValidationURL: {
- static QStringList urlCompletions;
- if (urlCompletions.isEmpty()) {
- urlCompletions.push_back(QStringLiteral("about:blank"));
- urlCompletions.push_back(QStringLiteral("http://"));
- urlCompletions.push_back(QStringLiteral("http://www."));
- urlCompletions.push_back(QStringLiteral("http://qt.io"));
- urlCompletions.push_back(QStringLiteral("file://"));
- urlCompletions.push_back(QStringLiteral("ftp://"));
- urlCompletions.push_back(QStringLiteral("data:"));
- urlCompletions.push_back(QStringLiteral("data:text/html,"));
- urlCompletions.push_back(QStringLiteral("qrc:/"));
- }
+ static const QStringList urlCompletions = {
+ u"about:blank"_s,
+ u"http://"_s,
+ u"http://www."_s,
+ u"http://qt.io"_s,
+ u"file://"_s,
+ u"ftp://"_s,
+ u"data:"_s,
+ u"data:text/html,"_s,
+ u"qrc:/"_s,
+ };
QCompleter *completer = new QCompleter(urlCompletions, m_lineEdit);
m_lineEdit->setCompleter(completer);
m_lineEdit->setValidator(new UrlValidator(completer, m_lineEdit));
@@ -351,7 +352,7 @@ namespace qdesigner_internal {
QString rc(s);
// protect backslashes
- rc.replace(QLatin1Char('\\'), QStringLiteral("\\\\"));
+ rc.replace('\\'_L1, "\\\\"_L1);
// escape newlines
rc.replace(NewLineChar, QString(EscapedNewLine));
return rc;
diff --git a/src/designer/src/lib/shared/widgetdatabase.cpp b/src/designer/src/lib/shared/widgetdatabase.cpp
index ffe991285..c09b634ed 100644
--- a/src/designer/src/lib/shared/widgetdatabase.cpp
+++ b/src/designer/src/lib/shared/widgetdatabase.cpp
@@ -305,28 +305,28 @@ WidgetDataBase::WidgetDataBase(QDesignerFormEditorInterface *core, QObject *pare
// ### check the casts
#if 0 // ### enable me after 4.1
- item(indexOfClassName(QStringLiteral("QToolBar")))->setContainer(true);
+ item(indexOfClassName(u"QToolBar"_s))->setContainer(true);
#endif
- item(indexOfClassName(QStringLiteral("QTabWidget")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QGroupBox")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QScrollArea")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QStackedWidget")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QToolBox")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QFrame")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QLayoutWidget")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QDesignerWidget")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QDesignerDialog")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QSplitter")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QMainWindow")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QDockWidget")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QDesignerDockWidget")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QMdiArea")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QWizard")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QWizardPage")))->setContainer(true);
-
- item(indexOfClassName(QStringLiteral("QWidget")))->setContainer(true);
- item(indexOfClassName(QStringLiteral("QDialog")))->setContainer(true);
+ item(indexOfClassName(u"QTabWidget"_s))->setContainer(true);
+ item(indexOfClassName(u"QGroupBox"_s))->setContainer(true);
+ item(indexOfClassName(u"QScrollArea"_s))->setContainer(true);
+ item(indexOfClassName(u"QStackedWidget"_s))->setContainer(true);
+ item(indexOfClassName(u"QToolBox"_s))->setContainer(true);
+ item(indexOfClassName(u"QFrame"_s))->setContainer(true);
+ item(indexOfClassName(u"QLayoutWidget"_s))->setContainer(true);
+ item(indexOfClassName(u"QDesignerWidget"_s))->setContainer(true);
+ item(indexOfClassName(u"QDesignerDialog"_s))->setContainer(true);
+ item(indexOfClassName(u"QSplitter"_s))->setContainer(true);
+ item(indexOfClassName(u"QMainWindow"_s))->setContainer(true);
+ item(indexOfClassName(u"QDockWidget"_s))->setContainer(true);
+ item(indexOfClassName(u"QDesignerDockWidget"_s))->setContainer(true);
+ item(indexOfClassName(u"QMdiArea"_s))->setContainer(true);
+ item(indexOfClassName(u"QWizard"_s))->setContainer(true);
+ item(indexOfClassName(u"QWizardPage"_s))->setContainer(true);
+
+ item(indexOfClassName(u"QWidget"_s))->setContainer(true);
+ item(indexOfClassName(u"QDialog"_s))->setContainer(true);
}
WidgetDataBase::~WidgetDataBase() = default;
@@ -478,7 +478,6 @@ void WidgetDataBase::grabStandardWidgetBoxIcons()
// At this point, grab the default icons for the non-custom widgets from
// the widget box. They will show up in the object inspector.
if (const QDesignerWidgetBox *wb = qobject_cast<const QDesignerWidgetBox *>(m_core->widgetBox())) {
- const QString qWidgetClass = QStringLiteral("QWidget");
const int itemCount = count();
for (int i = 0; i < itemCount; ++i) {
QDesignerWidgetDataBaseItemInterface *dbItem = item(i);
@@ -486,8 +485,8 @@ void WidgetDataBase::grabStandardWidgetBoxIcons()
// Careful not to catch the layout icons when looking for
// QWidget
const QString name = dbItem->name();
- if (name == qWidgetClass) {
- dbItem->setIcon(wb->iconForWidget(name, QStringLiteral("Containers")));
+ if (name == "QWidget"_L1) {
+ dbItem->setIcon(wb->iconForWidget(name, u"Containers"_s));
} else {
dbItem->setIcon(wb->iconForWidget(name));
}
@@ -503,7 +502,7 @@ enum { NewFormWidth = 400, NewFormHeight = 300 };
// Check if class is suitable to generate a form from
static inline bool isExistingTemplate(const QString &className)
{
- return className == QStringLiteral("QWidget") || className == QStringLiteral("QDialog") || className == QStringLiteral("QMainWindow");
+ return className == "QWidget"_L1 || className == "QDialog"_L1 || className == "QMainWindow"_L1;
}
// Check if class is suitable to generate a form from
@@ -511,9 +510,9 @@ static inline bool suitableForNewForm(const QString &className)
{
if (className.isEmpty()) // Missing custom widget information
return false;
- if (className == QStringLiteral("QSplitter"))
+ if (className == "QSplitter"_L1)
return false;
- if (className.startsWith(QStringLiteral("QDesigner")) || className.startsWith(QStringLiteral("QLayout")))
+ if (className.startsWith("QDesigner"_L1) || className.startsWith("QLayout"_L1))
return false;
return true;
}
@@ -568,22 +567,20 @@ static QString xmlFromWidgetBox(const QDesignerFormEditorInterface *core, const
QScopedPointer<DomUI> domUI(QDesignerWidgetBox::xmlToUi(className, widget.domXml(), false));
if (domUI.isNull())
return QString();
- domUI->setAttributeVersion(QStringLiteral("4.0"));
+ domUI->setAttributeVersion(u"4.0"_s);
DomWidget *domWidget = domUI->elementWidget();
if (!domWidget)
return QString();
// Properties: Remove the "objectName" property in favour of the name attribute and check geometry.
domWidget->setAttributeName(objectName);
- const QString geometryProperty = QStringLiteral("geometry");
- const QString objectNameProperty = QStringLiteral("objectName");
PropertyList properties = domWidget->elementProperty();
for (PropertyList::iterator it = properties.begin(); it != properties.end(); ) {
DomProperty *property = *it;
- if (property->attributeName() == objectNameProperty) { // remove "objectName"
+ if (property->attributeName() == "objectName"_L1) { // remove "objectName"
it = properties.erase(it);
delete property;
} else {
- if (property->attributeName() == geometryProperty) { // Make sure form is at least 400, 300
+ if (property->attributeName() == "geometry"_L1) { // Make sure form is at least 400, 300
if (DomRect *geom = property->elementRect()) {
if (geom->elementWidth() < NewFormWidth)
geom->setElementWidth(NewFormWidth);
@@ -598,7 +595,7 @@ static QString xmlFromWidgetBox(const QDesignerFormEditorInterface *core, const
DomString *windowTitleString = new DomString;
windowTitleString->setText(objectName);
DomProperty *windowTitleProperty = new DomProperty;
- windowTitleProperty->setAttributeName(QStringLiteral("windowTitle"));
+ windowTitleProperty->setAttributeName(u"windowTitle"_s);
windowTitleProperty->setElementString(windowTitleString);
properties.push_back(windowTitleProperty);
// ------
@@ -651,7 +648,7 @@ QString WidgetDataBase::formTemplate(const QDesignerFormEditorInterface *core, c
// 2) If that fails, only custom main windows, custom dialogs and unsupported Qt Widgets should
// be left over. Generate something that is similar to the default templates. Find a similar class.
const QDesignerWidgetDataBaseInterface *wdb = core->widgetDataBase();
- QString similarClass = QStringLiteral("QWidget");
+ QString similarClass = u"QWidget"_s;
const int index = wdb->indexOfClassName(className);
if (index != -1) {
const QDesignerWidgetDataBaseItemInterface *item = wdb->item(index);
@@ -665,16 +662,16 @@ QString WidgetDataBase::formTemplate(const QDesignerFormEditorInterface *core, c
// Set a fixed size on a XML template
QString WidgetDataBase::scaleFormTemplate(const QString &xml, const QSize &size, bool fixed)
{
- QScopedPointer<DomUI> domUI(QDesignerWidgetBox::xmlToUi(QStringLiteral("Form"), xml, false));
+ QScopedPointer<DomUI> domUI(QDesignerWidgetBox::xmlToUi(u"Form"_s, xml, false));
if (!domUI)
return QString();
DomWidget *domWidget = domUI->elementWidget();
if (!domWidget)
return QString();
// Properties: Find/Ensure the geometry, minimum and maximum sizes properties
- const QString geometryPropertyName = QStringLiteral("geometry");
- const QString minimumSizePropertyName = QStringLiteral("minimumSize");
- const QString maximumSizePropertyName = QStringLiteral("maximumSize");
+ const QString geometryPropertyName = u"geometry"_s;
+ const QString minimumSizePropertyName = u"minimumSize"_s;
+ const QString maximumSizePropertyName = u"maximumSize"_s;
DomProperty *geomProperty = nullptr;
DomProperty *minimumSizeProperty = nullptr;
DomProperty *maximumSizeProperty = nullptr;
@@ -684,13 +681,10 @@ QString WidgetDataBase::scaleFormTemplate(const QString &xml, const QSize &size,
const QString name = p->attributeName();
if (name == geometryPropertyName) {
geomProperty = p;
- } else {
- if (name == minimumSizePropertyName) {
- minimumSizeProperty = p;
- } else {
- if (name == maximumSizePropertyName)
- maximumSizeProperty = p;
- }
+ } else if (name == minimumSizePropertyName) {
+ minimumSizeProperty = p;
+ } else if (name == maximumSizePropertyName) {
+ maximumSizeProperty = p;
}
}
if (!geomProperty) {
@@ -825,8 +819,7 @@ QDESIGNER_SHARED_EXPORT QDesignerWidgetDataBaseItemInterface *
derivedItem = WidgetDataBaseItem::clone(baseItem);
// Sort of hack: If base class is QWidget, we most likely
// do not want to inherit the container attribute.
- static const QString qWidgetName = QStringLiteral("QWidget");
- if (baseItem->name() == qWidgetName)
+ if (baseItem->name() == "QWidget"_L1)
derivedItem->setContainer(false);
// set new props
derivedItem->setName(className);
diff --git a/src/designer/src/lib/shared/widgetfactory.cpp b/src/designer/src/lib/shared/widgetfactory.cpp
index 7942f4cc8..413cac53a 100644
--- a/src/designer/src/lib/shared/widgetfactory.cpp
+++ b/src/designer/src/lib/shared/widgetfactory.cpp
@@ -60,6 +60,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
#ifdef Q_OS_WIN
static inline bool isAxWidget(const QObject *o)
{
@@ -201,31 +203,31 @@ void WizardPageChangeWatcher::pageChanged()
// ---------------- WidgetFactory::Strings
WidgetFactory::Strings::Strings() :
- m_alignment(QStringLiteral("alignment")),
- m_bottomMargin(QStringLiteral("bottomMargin")),
- m_geometry(QStringLiteral("geometry")),
- m_leftMargin(QStringLiteral("leftMargin")),
- m_line(QStringLiteral("Line")),
- m_objectName(QStringLiteral("objectName")),
- m_spacerName(QStringLiteral("spacerName")),
- m_orientation(QStringLiteral("orientation")),
- m_qAction(QStringLiteral("QAction")),
- m_qButtonGroup(QStringLiteral("QButtonGroup")),
- m_qAxWidget(QStringLiteral("QAxWidget")),
- m_qDialog(QStringLiteral("QDialog")),
- m_qDockWidget(QStringLiteral("QDockWidget")),
- m_qLayoutWidget(QStringLiteral("QLayoutWidget")),
- m_qMenu(QStringLiteral("QMenu")),
- m_qMenuBar(QStringLiteral("QMenuBar")),
- m_qWidget(QStringLiteral("QWidget")),
- m_rightMargin(QStringLiteral("rightMargin")),
- m_sizeHint(QStringLiteral("sizeHint")),
- m_spacer(QStringLiteral("Spacer")),
- m_text(QStringLiteral("text")),
- m_title(QStringLiteral("title")),
- m_topMargin(QStringLiteral("topMargin")),
- m_windowIcon(QStringLiteral("windowIcon")),
- m_windowTitle(QStringLiteral("windowTitle"))
+ m_alignment(u"alignment"_s),
+ m_bottomMargin(u"bottomMargin"_s),
+ m_geometry(u"geometry"_s),
+ m_leftMargin(u"leftMargin"_s),
+ m_line(u"Line"_s),
+ m_objectName(u"objectName"_s),
+ m_spacerName(u"spacerName"_s),
+ m_orientation(u"orientation"_s),
+ m_qAction(u"QAction"_s),
+ m_qButtonGroup(u"QButtonGroup"_s),
+ m_qAxWidget(u"QAxWidget"_s),
+ m_qDialog(u"QDialog"_s),
+ m_qDockWidget(u"QDockWidget"_s),
+ m_qLayoutWidget(u"QLayoutWidget"_s),
+ m_qMenu(u"QMenu"_s),
+ m_qMenuBar(u"QMenuBar"_s),
+ m_qWidget(u"QWidget"_s),
+ m_rightMargin(u"rightMargin"_s),
+ m_sizeHint(u"sizeHint"_s),
+ m_spacer(u"Spacer"_s),
+ m_text(u"text"_s),
+ m_title(u"title"_s),
+ m_topMargin(u"topMargin"_s),
+ m_windowIcon(u"windowIcon"_s),
+ m_windowTitle(u"windowTitle"_s)
{
}
// ---------------- WidgetFactory
@@ -440,7 +442,7 @@ QWidget *WidgetFactory::createWidget(const QString &widgetName, QWidget *parentW
if (item == nullptr) {
// Emergency: Create, derived from QWidget
QString includeFile = widgetName.toLower();
- includeFile += QStringLiteral(".h");
+ includeFile += ".h"_L1;
item = appendDerived(db,widgetName, tr("%1 Widget").arg(widgetName),fallBackBaseClass,
includeFile, true, true);
Q_ASSERT(item);
@@ -482,18 +484,18 @@ QString WidgetFactory::classNameOf(QDesignerFormEditorInterface *c, const QObjec
if (!customClassName.isEmpty())
return customClassName;
if (qobject_cast<const QDesignerMenuBar*>(w))
- return QStringLiteral("QMenuBar");
+ return u"QMenuBar"_s;
if (qobject_cast<const QDesignerMenu*>(w))
- return QStringLiteral("QMenu");
+ return u"QMenu"_s;
if (qobject_cast<const QDesignerDockWidget*>(w))
- return QStringLiteral("QDockWidget");
+ return u"QDockWidget"_s;
if (qobject_cast<const QDesignerDialog*>(w))
- return QStringLiteral("QDialog");
+ return u"QDialog"_s;
if (qobject_cast<const QDesignerWidget*>(w))
- return QStringLiteral("QWidget");
+ return u"QWidget"_s;
#ifdef Q_OS_WIN
if (isAxWidget(w))
- return QStringLiteral("QAxWidget");
+ return u"QAxWidget"_s;
#endif
return QLatin1String(className);
}
@@ -834,9 +836,6 @@ static bool isTabBarInteractor(const QTabBar *tabBar)
static bool isPassiveInteractorHelper(const QWidget *widget)
{
- static const QString qtPassive = QStringLiteral("__qt__passive_");
- static const QString qtMainWindowSplitter = QStringLiteral("qt_qmainwindow_extended_splitter");
-
if (qobject_cast<const QMenuBar*>(widget)
#if QT_CONFIG(sizegrip)
|| qobject_cast<const QSizeGrip*>(widget)
@@ -856,10 +855,8 @@ static bool isPassiveInteractorHelper(const QWidget *widget)
} else if (qobject_cast<const QScrollBar*>(widget)) {
// A scroll bar is an interactor on a QAbstractScrollArea only.
if (auto parent = widget->parentWidget()) {
- const QString objectName = parent->objectName();
- static const QString scrollAreaVContainer = QStringLiteral("qt_scrollarea_vcontainer");
- static const QString scrollAreaHContainer = QStringLiteral("qt_scrollarea_hcontainer");
- if (objectName == scrollAreaVContainer || objectName == scrollAreaHContainer)
+ const QString &objectName = parent->objectName();
+ if (objectName == "qt_scrollarea_vcontainer"_L1 || objectName == "qt_scrollarea_hcontainer"_L1)
return true;
}
} else if (qstrcmp(widget->metaObject()->className(), "QDockWidgetTitle") == 0) {
@@ -868,7 +865,8 @@ static bool isPassiveInteractorHelper(const QWidget *widget)
return true;
}
const QString &name = widget->objectName();
- return name.startsWith(qtPassive) || name == qtMainWindowSplitter;
+ return name.startsWith("__qt__passive_"_L1)
+ || name == "qt_qmainwindow_extended_splitter"_L1;
}
bool WidgetFactory::isPassiveInteractor(QWidget *widget)