diff options
Diffstat (limited to 'src/designer/src/lib/shared')
21 files changed, 79 insertions, 102 deletions
diff --git a/src/designer/src/lib/shared/actioneditor.cpp b/src/designer/src/lib/shared/actioneditor.cpp index 057616217..24f3fbd8d 100644 --- a/src/designer/src/lib/shared/actioneditor.cpp +++ b/src/designer/src/lib/shared/actioneditor.cpp @@ -672,14 +672,13 @@ void ActionEditor::slotDelete() // UnderScore: "Open file" -> actionOpen_file static QString underscore(QString text) { - const QString underscore = QString(QLatin1Char('_')); static const QRegularExpression nonAsciiPattern(u"[^a-zA-Z_0-9]"_s); Q_ASSERT(nonAsciiPattern.isValid()); - text.replace(nonAsciiPattern, underscore); + text.replace(nonAsciiPattern, "_"_L1); static const QRegularExpression multipleSpacePattern(u"__*"_s); Q_ASSERT(multipleSpacePattern.isValid()); - text.replace(multipleSpacePattern, underscore); - if (text.endsWith(underscore.at(0))) + text.replace(multipleSpacePattern, "_"_L1); + if (text.endsWith(u'_')) text.chop(1); return text; } diff --git a/src/designer/src/lib/shared/actionrepository.cpp b/src/designer/src/lib/shared/actionrepository.cpp index 8f49a6dc7..1fa1e0ebc 100644 --- a/src/designer/src/lib/shared/actionrepository.cpp +++ b/src/designer/src/lib/shared/actionrepository.cpp @@ -153,10 +153,8 @@ void ActionModel::setItems(QDesignerFormEditorInterface *core, QAction *action, // Tooltip, mostly for icon view mode QString firstTooltip = action->objectName(); const QString text = action->text(); - if (!text.isEmpty()) { - firstTooltip += QLatin1Char('\n'); - firstTooltip += text; - } + if (!text.isEmpty()) + firstTooltip += u'\n' + text; Q_ASSERT(sl.size() == NumColumns); @@ -201,7 +199,7 @@ void ActionModel::setItems(QDesignerFormEditorInterface *core, QAction *action, QString toolTip = action->toolTip(); item = sl[ToolTipColumn]; item->setToolTip(toolTip); - item->setText(toolTip.replace(QLatin1Char('\n'), QLatin1Char(' '))); + item->setText(toolTip.replace(u'\n', u' ')); // menuRole const auto menuRole = action->menuRole(); item = sl[MenuRoleColumn]; diff --git a/src/designer/src/lib/shared/csshighlighter.cpp b/src/designer/src/lib/shared/csshighlighter.cpp index c74ed8508..d34e7e4de 100644 --- a/src/designer/src/lib/shared/csshighlighter.cpp +++ b/src/designer/src/lib/shared/csshighlighter.cpp @@ -5,6 +5,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + namespace qdesigner_internal { CssHighlighter::CssHighlighter(const CssHighlightColors &colors, @@ -41,8 +43,8 @@ void CssHighlighter::highlightBlock(const QString& text) // The initial state is based on the precense of a : and the absense of a {. // This is because Qt style sheets support both a full stylesheet as well as // an inline form with just properties. - state = save_state = (text.indexOf(QLatin1Char(':')) > -1 && - text.indexOf(QLatin1Char('{')) == -1) ? Property : Selector; + state = save_state = (text.indexOf(u':') > -1 && + text.indexOf(u'{') == -1) ? Property : Selector; } else { save_state = state>>16; state &= 0x00ff; diff --git a/src/designer/src/lib/shared/formlayoutmenu.cpp b/src/designer/src/lib/shared/formlayoutmenu.cpp index ba0dc6baa..4058e78b7 100644 --- a/src/designer/src/lib/shared/formlayoutmenu.cpp +++ b/src/designer/src/lib/shared/formlayoutmenu.cpp @@ -220,7 +220,7 @@ static inline QString postFixFromClassName(QString className) if (index != -1) className.remove(0, index + 2); if (className.size() > 2) - if (className.at(0) == QLatin1Char('Q') || className.at(0) == QLatin1Char('K')) + if (className.at(0) == u'Q' || className.at(0) == u'K') if (className.at(1).isUpper()) className.remove(0, 1); return className; diff --git a/src/designer/src/lib/shared/htmlhighlighter.cpp b/src/designer/src/lib/shared/htmlhighlighter.cpp index dead3a100..59e2a5efa 100644 --- a/src/designer/src/lib/shared/htmlhighlighter.cpp +++ b/src/designer/src/lib/shared/htmlhighlighter.cpp @@ -48,15 +48,8 @@ void HtmlHighlighter::setFormatFor(Construct construct, void HtmlHighlighter::highlightBlock(const QString &text) { - static const QLatin1Char tab = QLatin1Char('\t'); - static const QLatin1Char space = QLatin1Char(' '); - static const QLatin1Char amp = QLatin1Char('&'); - static const QLatin1Char startTag = QLatin1Char('<'); - static const QLatin1Char endTag = QLatin1Char('>'); - static const QLatin1Char quot = QLatin1Char('"'); - static const QLatin1Char apos = QLatin1Char('\''); - static const QLatin1Char semicolon = QLatin1Char(';'); - static const QLatin1Char equals = QLatin1Char('='); + static const QChar tab = u'\t'; + static const QChar space = u' '; int state = previousBlockState(); qsizetype len = text.size(); @@ -69,14 +62,14 @@ void HtmlHighlighter::highlightBlock(const QString &text) default: while (pos < len) { QChar ch = text.at(pos); - if (ch == startTag) { + if (ch == u'<') { if (QStringView{text}.sliced(pos).startsWith("<!--"_L1)) { state = InComment; } else { state = InTag; start = pos; while (pos < len && text.at(pos) != space - && text.at(pos) != endTag + && text.at(pos) != u'>' && text.at(pos) != tab && !QStringView{text}.sliced(pos).startsWith("/>"_L1)) { ++pos; @@ -89,9 +82,9 @@ void HtmlHighlighter::highlightBlock(const QString &text) } break; } - if (ch == amp) { + if (ch == u'&') { start = pos; - while (pos < len && text.at(pos++) != semicolon) + while (pos < len && text.at(pos++) != u';') ; setFormat(start, pos - start, m_formats[Entity]); @@ -118,9 +111,9 @@ void HtmlHighlighter::highlightBlock(const QString &text) QChar ch = text.at(pos); if (quote.isNull()) { start = pos; - if (ch == apos || ch == quot) { + if (ch == '\''_L1 || ch == u'"') { quote = ch; - } else if (ch == endTag) { + } else if (ch == u'>') { ++pos; setFormat(start, pos - start, m_formats[Tag]); state = NormalState; @@ -136,7 +129,7 @@ void HtmlHighlighter::highlightBlock(const QString &text) ++pos; while (pos < len && text.at(pos) != space && text.at(pos) != tab - && text.at(pos) != equals) + && text.at(pos) != u'=') ++pos; setFormat(start, pos - start, m_formats[Attribute]); start = pos; diff --git a/src/designer/src/lib/shared/iconselector.cpp b/src/designer/src/lib/shared/iconselector.cpp index 4ca634192..c6efbbbbd 100644 --- a/src/designer/src/lib/shared/iconselector.cpp +++ b/src/designer/src/lib/shared/iconselector.cpp @@ -321,7 +321,7 @@ static QString imageFilter() const qsizetype count = supportedImageFormats.size(); for (qsizetype i = 0; i < count; ++i) { if (i) - filter += QLatin1Char(' '); + filter += u' '; filter += "*."_L1; const QString outputFormat = QString::fromUtf8(supportedImageFormats.at(i)); if (outputFormat != "JPEG"_L1) @@ -329,7 +329,7 @@ static QString imageFilter() else filter += "jpg *.jpeg"_L1; } - filter += QLatin1Char(')'); + filter += u')'; return filter; } diff --git a/src/designer/src/lib/shared/morphmenu.cpp b/src/designer/src/lib/shared/morphmenu.cpp index 1ad8a4f3a..fb36d4680 100644 --- a/src/designer/src/lib/shared/morphmenu.cpp +++ b/src/designer/src/lib/shared/morphmenu.cpp @@ -188,9 +188,9 @@ static QString suggestObjectName(const QString &oldClassName, const QString &new { QString oldClassPart = oldClassName; QString newClassPart = newClassName; - if (oldClassPart.startsWith(QLatin1Char('Q'))) + if (oldClassPart.startsWith(u'Q')) oldClassPart.remove(0, 1); - if (newClassPart.startsWith(QLatin1Char('Q'))) + if (newClassPart.startsWith(u'Q')) newClassPart.remove(0, 1); QString newName = oldName; diff --git a/src/designer/src/lib/shared/newformwidget.cpp b/src/designer/src/lib/shared/newformwidget.cpp index 8ee2c4955..1ed86700a 100644 --- a/src/designer/src/lib/shared/newformwidget.cpp +++ b/src/designer/src/lib/shared/newformwidget.cpp @@ -50,7 +50,7 @@ static const char *newFormObjectNameC = "Form"; // else return "Form". static QString formName(const QString &className) { - if (!className.startsWith(QLatin1Char('Q'))) + if (!className.startsWith(u'Q')) return QLatin1String(newFormObjectNameC); QString rc = className; rc.remove(0, 1); @@ -386,7 +386,7 @@ void NewFormWidget::loadFrom(const QString &path, bool resourceFile, const QStri if (list.isEmpty()) return; - const QChar separator = resourceFile ? QChar(QLatin1Char('/')) + const QChar separator = resourceFile ? QChar(u'/') : QDir::separator(); QTreeWidgetItem *root = new QTreeWidgetItem(m_ui->treeWidget); root->setFlags(root->flags() & ~Qt::ItemIsSelectable); @@ -402,9 +402,7 @@ void NewFormWidget::loadFrom(const QString &path, bool resourceFile, const QStri visiblePath = QDir::toNativeSeparators(visiblePath); } - const QChar underscore = QLatin1Char('_'); - const QChar blank = QLatin1Char(' '); - root->setText(0, visiblePath.replace(underscore, blank)); + root->setText(0, visiblePath.replace(u'_', u' ')); root->setToolTip(0, path); for (const auto &fi : list) { @@ -412,7 +410,7 @@ void NewFormWidget::loadFrom(const QString &path, bool resourceFile, const QStri continue; QTreeWidgetItem *item = new QTreeWidgetItem(root); - const QString text = fi.baseName().replace(underscore, blank); + const QString text = fi.baseName().replace(u'_', u' '); if (selectedItemFound == nullptr && text == selectedItem) selectedItemFound = item; item->setText(0, text); @@ -479,7 +477,7 @@ QString NewFormWidget::itemToTemplate(const QTreeWidgetItem *item, QString *erro const QFileInfo fiBase(fileName); QString sizeFileName; QTextStream(&sizeFileName) << fiBase.path() << QDir::separator() - << size.width() << QLatin1Char('x') << size.height() << QDir::separator() + << size.width() << 'x' << size.height() << QDir::separator() << fiBase.fileName(); if (QFileInfo(sizeFileName).isFile()) return readAll(sizeFileName, errorMessage); diff --git a/src/designer/src/lib/shared/previewmanager.cpp b/src/designer/src/lib/shared/previewmanager.cpp index e4ab1526d..33e34c5a2 100644 --- a/src/designer/src/lib/shared/previewmanager.cpp +++ b/src/designer/src/lib/shared/previewmanager.cpp @@ -37,6 +37,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + static inline int compare(const qdesigner_internal::PreviewConfiguration &pc1, const qdesigner_internal::PreviewConfiguration &pc2) { int rc = pc1.style().compare(pc2.style()); @@ -484,8 +486,7 @@ void PreviewConfiguration::toSettings(const QString &prefix, QDesignerSettingsIn void PreviewConfiguration::fromSettings(const QString &prefix, const QDesignerSettingsInterface *settings) { clear(); - QString key = prefix; - key += QLatin1Char('/'); + QString key = prefix + u'/'; const auto prefixSize = key.size(); PreviewConfigurationData &d = *m_d; diff --git a/src/designer/src/lib/shared/qdesigner_formbuilder.cpp b/src/designer/src/lib/shared/qdesigner_formbuilder.cpp index 27b92c4e5..ff52bfd4b 100644 --- a/src/designer/src/lib/shared/qdesigner_formbuilder.cpp +++ b/src/designer/src/lib/shared/qdesigner_formbuilder.cpp @@ -323,12 +323,8 @@ QWidget *QDesignerFormBuilder::createPreview(const QDesignerFormWindowInterface } // Fake application style sheet by prepending. (If this doesn't work, fake by nesting // into parent widget). - if (!appStyleSheet.isEmpty()) { - QString styleSheet = appStyleSheet; - styleSheet += QLatin1Char('\n'); - styleSheet += widget->styleSheet(); - widget->setStyleSheet(styleSheet); - } + if (!appStyleSheet.isEmpty()) + widget->setStyleSheet(appStyleSheet + u'\n' + widget->styleSheet()); return widget; } diff --git a/src/designer/src/lib/shared/qdesigner_membersheet.cpp b/src/designer/src/lib/shared/qdesigner_membersheet.cpp index 29aec04dd..8eae5be07 100644 --- a/src/designer/src/lib/shared/qdesigner_membersheet.cpp +++ b/src/designer/src/lib/shared/qdesigner_membersheet.cpp @@ -164,24 +164,24 @@ bool QDesignerMemberSheet::signalMatchesSlot(const QString &signal, const QStrin bool result = true; do { - int signal_idx = signal.indexOf(QLatin1Char('(')); - int slot_idx = slot.indexOf(QLatin1Char('(')); + qsizetype signal_idx = signal.indexOf(u'('); + qsizetype slot_idx = slot.indexOf(u'('); if (signal_idx == -1 || slot_idx == -1) break; ++signal_idx; ++slot_idx; - if (slot.at(slot_idx) == QLatin1Char(')')) + if (slot.at(slot_idx) == u')') break; while (signal_idx < signal.size() && slot_idx < slot.size()) { const QChar signal_c = signal.at(signal_idx); const QChar slot_c = slot.at(slot_idx); - if (signal_c == QLatin1Char(',') && slot_c == QLatin1Char(')')) + if (signal_c == u',' && slot_c == u')') break; - if (signal_c == QLatin1Char(')') && slot_c == QLatin1Char(')')) + if (signal_c == u')' && slot_c == u')') break; if (signal_c != slot_c) { diff --git a/src/designer/src/lib/shared/qdesigner_promotion.cpp b/src/designer/src/lib/shared/qdesigner_promotion.cpp index 3f12808bd..53b9eb1df 100644 --- a/src/designer/src/lib/shared/qdesigner_promotion.cpp +++ b/src/designer/src/lib/shared/qdesigner_promotion.cpp @@ -67,7 +67,7 @@ namespace { if (pos == -1) return QString(); xml.remove(0, pos + tag.size()); - const int closingPos = xml.indexOf(QLatin1Char('"')); + const auto closingPos = xml.indexOf(u'"'); if (closingPos == -1) return QString(); xml.remove(closingPos, xml.size() - closingPos); diff --git a/src/designer/src/lib/shared/qdesigner_promotiondialog.cpp b/src/designer/src/lib/shared/qdesigner_promotiondialog.cpp index 004660891..219c675f4 100644 --- a/src/designer/src/lib/shared/qdesigner_promotiondialog.cpp +++ b/src/designer/src/lib/shared/qdesigner_promotiondialog.cpp @@ -131,12 +131,11 @@ namespace qdesigner_internal { void NewPromotedClassPanel::slotNameChanged(const QString &className) { // Suggest a name if (!className.isEmpty()) { - const QChar dot(QLatin1Char('.')); QString suggestedHeader = m_promotedHeaderLowerCase ? className.toLower() : className; suggestedHeader.replace("::"_L1, "_"_L1); - if (!m_promotedHeaderSuffix.startsWith(dot)) - suggestedHeader += dot; + if (!m_promotedHeaderSuffix.startsWith(u'.')) + suggestedHeader += u'.'; suggestedHeader += m_promotedHeaderSuffix; const bool blocked = m_includeFileEdit->blockSignals(true); diff --git a/src/designer/src/lib/shared/qdesigner_utils.cpp b/src/designer/src/lib/shared/qdesigner_utils.cpp index ec278645c..bb71f3f2e 100644 --- a/src/designer/src/lib/shared/qdesigner_utils.cpp +++ b/src/designer/src/lib/shared/qdesigner_utils.cpp @@ -197,11 +197,10 @@ namespace qdesigner_internal if (flagIds.isEmpty()) return QString(); - const QChar delimiter = QLatin1Char('|'); QString rc; for (const auto &id : flagIds) { if (!rc.isEmpty()) - rc += delimiter ; + rc += u'|'; if (sm == FullyQualified) appendQualifiedName(id, rc); else @@ -220,7 +219,7 @@ namespace qdesigner_internal } uint flags = 0; bool valueOk = true; - const QStringList keys = s.split(QString(QLatin1Char('|'))); + const QStringList keys = s.split(u'|'); for (const QString &key : keys) { const uint flagValue = keyToValue(key, &valueOk); if (!valueOk) { @@ -271,7 +270,7 @@ namespace qdesigner_internal { if (const QDesignerLanguageExtension *lang = qt_extension<QDesignerLanguageExtension *>(core->extensionManager(), core)) return lang->isLanguageResource(path) ? LanguageResourcePixmap : FilePixmap; - return path.startsWith(QLatin1Char(':')) ? ResourcePixmap : FilePixmap; + return path.startsWith(u':') ? ResourcePixmap : FilePixmap; } int PropertySheetPixmapValue::compare(const PropertySheetPixmapValue &other) const @@ -751,7 +750,7 @@ namespace qdesigner_internal if (qname.size() > 1 && qname.at(1).isUpper()) { const QChar first = qname.at(0); - if (first == QLatin1Char('Q') || first == QLatin1Char('K')) + if (first == u'Q' || first == u'K') qname.remove(0, 1); } diff --git a/src/designer/src/lib/shared/qtresourceeditordialog.cpp b/src/designer/src/lib/shared/qtresourceeditordialog.cpp index 588d7e3c7..3a9c7cac3 100644 --- a/src/designer/src/lib/shared/qtresourceeditordialog.cpp +++ b/src/designer/src/lib/shared/qtresourceeditordialog.cpp @@ -1302,8 +1302,6 @@ void QtResourceEditorDialogPrivate::slotTreeViewItemChanged(QStandardItem *item) QString QtResourceEditorDialogPrivate::getSaveFileNameWithExtension(QWidget *parent, const QString &title, QString dir, const QString &filter, const QString &extension) const { - const QChar dot = QLatin1Char('.'); - QString saveFile; while (true) { saveFile = m_dlgGui->getSaveFileName(parent, title, dir, filter, nullptr, QFileDialog::DontConfirmOverwrite); @@ -1311,10 +1309,8 @@ QString QtResourceEditorDialogPrivate::getSaveFileNameWithExtension(QWidget *par return saveFile; const QFileInfo fInfo(saveFile); - if (fInfo.suffix().isEmpty() && !fInfo.fileName().endsWith(dot)) { - saveFile += dot; - saveFile += extension; - } + if (fInfo.suffix().isEmpty() && !fInfo.fileName().endsWith(u'.')) + saveFile += u'.' + extension; const QFileInfo fi(saveFile); if (!fi.exists()) @@ -1657,7 +1653,7 @@ void QtResourceEditorDialogPrivate::slotClonePrefix() QDir dir(fi.dir()); QString oldSuffix = fi.completeSuffix(); if (!oldSuffix.isEmpty()) - oldSuffix = QLatin1Char('.') + oldSuffix; + oldSuffix = u'.' + oldSuffix; const QString newBaseName = fi.baseName() + suffix + oldSuffix; const QString newPath = QDir::cleanPath(dir.filePath(newBaseName)); m_qrcManager->insertResourceFile(newResourcePrefix, newPath, @@ -2056,13 +2052,13 @@ QString QtResourceEditorDialog::selectedResource() const if (!currentResourcePrefix) return QString(); - const QChar slash(QLatin1Char('/')); + const QChar slash(u'/'); QString resource = currentResourcePrefix->prefix(); if (!resource.startsWith(slash)) resource.prepend(slash); if (!resource.endsWith(slash)) resource.append(slash); - resource.prepend(QLatin1Char(':')); + resource.prepend(u':'); QtResourceFile *currentResourceFile = d_ptr->getCurrentResourceFile(); if (!currentResourceFile) diff --git a/src/designer/src/lib/shared/qtresourceview.cpp b/src/designer/src/lib/shared/qtresourceview.cpp index c9f3fdfcc..66b6bc40b 100644 --- a/src/designer/src/lib/shared/qtresourceview.cpp +++ b/src/designer/src/lib/shared/qtresourceview.cpp @@ -745,8 +745,8 @@ bool QtResourceView::decodeMimeData(const QMimeData *md, ResourceType *t, QStrin bool QtResourceView::decodeMimeData(const QString &text, ResourceType *t, QString *file) { - const QString docElementName = QLatin1String(elementResourceData); - static const QString docElementString = QLatin1Char('<') + docElementName; + static auto docElementName = QLatin1StringView(elementResourceData); + static const QString docElementString = u'<' + docElementName; if (text.isEmpty() || text.indexOf(docElementString) == -1) return false; diff --git a/src/designer/src/lib/shared/richtexteditor.cpp b/src/designer/src/lib/shared/richtexteditor.cpp index eb1d2534c..d7d84cf42 100644 --- a/src/designer/src/lib/shared/richtexteditor.cpp +++ b/src/designer/src/lib/shared/richtexteditor.cpp @@ -728,7 +728,7 @@ RichTextEditorDialog::RichTextEditorDialog(QDesignerFormEditorInterface *core, Q // Read settings const QDesignerSettingsInterface *settings = core->settingsManager(); - const QString rootKey = QLatin1String(RichTextDialogGroupC) + QLatin1Char('/'); + const QString rootKey = QLatin1StringView(RichTextDialogGroupC) + u'/'; const QByteArray lastGeometry = settings->value(rootKey + QLatin1String(GeometryKeyC)).toByteArray(); const int initialTab = settings->value(rootKey + QLatin1String(TabKeyC), QVariant(m_initialTab)).toInt(); if (initialTab == RichTextIndex || initialTab == SourceIndex) diff --git a/src/designer/src/lib/shared/signalslotdialog.cpp b/src/designer/src/lib/shared/signalslotdialog.cpp index c9016df57..0f6a3aad0 100644 --- a/src/designer/src/lib/shared/signalslotdialog.cpp +++ b/src/designer/src/lib/shared/signalslotdialog.cpp @@ -207,12 +207,11 @@ void SignaturePanel::slotAdd() m_listView->selectionModel()->clearSelection(); // find unique name for (int i = 1; ; i++) { - QString newSlot = m_newPrefix; - newSlot += QString::number(i); // Always add number, Avoid setting 'slot' for first entry - newSlot += QLatin1Char('('); + // Always add number, Avoid setting 'slot' for first entry + QString newSlot = m_newPrefix + QString::number(i) + u'('; // check for function name independent of parameters if (m_model->findItems(newSlot, Qt::MatchStartsWith, 0).isEmpty()) { - newSlot += QLatin1Char(')'); + newSlot += u')'; QStandardItem * item = createEditableItem(newSlot); m_model->appendRow(item); const QModelIndex index = m_model->indexFromItem (item); diff --git a/src/designer/src/lib/shared/stylesheeteditor.cpp b/src/designer/src/lib/shared/stylesheeteditor.cpp index 8141c4990..a77a51bd7 100644 --- a/src/designer/src/lib/shared/stylesheeteditor.cpp +++ b/src/designer/src/lib/shared/stylesheeteditor.cpp @@ -48,7 +48,7 @@ StyleSheetEditor::StyleSheetEditor(QWidget *parent) { enum : int { DarkThreshold = 200 }; // Observed 239 on KDE/Dark - setTabStopDistance(fontMetrics().horizontalAdvance(QLatin1Char(' ')) * 4); + setTabStopDistance(fontMetrics().horizontalAdvance(u' ') * 4); setAcceptRichText(false); const QColor textColor = palette().color(QPalette::WindowText); @@ -247,10 +247,8 @@ void StyleSheetEditorDialog::slotAddFont() QFont font = QFontDialog::getFont(&ok, this); if (ok) { QString fontStr; - if (font.weight() != QFont::Normal) { - fontStr += QString::number(font.weight()); - fontStr += QLatin1Char(' '); - } + if (font.weight() != QFont::Normal) + fontStr += QString::number(font.weight()) + u' '; switch (font.style()) { case QFont::StyleItalic: @@ -265,7 +263,7 @@ void StyleSheetEditorDialog::slotAddFont() fontStr += QString::number(font.pointSize()); fontStr += "pt \""_L1; fontStr += font.family(); - fontStr += QLatin1Char('"'); + fontStr += u'"'; insertCssProperty(u"font"_s, fontStr); QString decoration; @@ -273,7 +271,7 @@ void StyleSheetEditorDialog::slotAddFont() decoration += "underline"_L1; if (font.strikeOut()) { if (!decoration.isEmpty()) - decoration += QLatin1Char(' '); + decoration += u' '; decoration += "line-through"_L1; } insertCssProperty(u"text-decoration"_s, decoration); @@ -297,13 +295,13 @@ void StyleSheetEditorDialog::insertCssProperty(const QString &name, const QStrin closing.position() < opening.position()); QString insertion; if (m_editor->textCursor().block().length() != 1) - insertion += QLatin1Char('\n'); + insertion += u'\n'; if (inSelector) - insertion += QLatin1Char('\t'); + insertion += u'\t'; insertion += name; insertion += ": "_L1; insertion += value; - insertion += QLatin1Char(';'); + insertion += u';'; cursor.insertText(insertion); cursor.endEditBlock(); } else { diff --git a/src/designer/src/lib/shared/textpropertyeditor.cpp b/src/designer/src/lib/shared/textpropertyeditor.cpp index 52418c904..e345580ba 100644 --- a/src/designer/src/lib/shared/textpropertyeditor.cpp +++ b/src/designer/src/lib/shared/textpropertyeditor.cpp @@ -20,8 +20,8 @@ QT_BEGIN_NAMESPACE using namespace Qt::StringLiterals; namespace { - const QChar NewLineChar(QLatin1Char('\n')); - const QLatin1String EscapedNewLine("\\n"); + const QChar NewLineChar(u'\n'); + const auto EscapedNewLine = "\\n"_L1; // A validator that replaces offending strings class ReplacementValidator : public QValidator { @@ -153,7 +153,7 @@ namespace { // Might be a short url - try to detect the schema. if (!hasSchema) { - const int dotIndex = urlStr.indexOf(QLatin1Char('.')); + const int dotIndex = urlStr.indexOf(u'.'); if (dotIndex != -1) { const QString prefix = urlStr.left(dotIndex).toLower(); QString urlString; @@ -223,7 +223,7 @@ namespace qdesigner_internal { break; case ValidationSingleLine: // Set a validator that replaces newline characters by a blank. - m_lineEdit->setValidator(new ReplacementValidator(m_lineEdit, NewLineChar, QString(QLatin1Char(' ')))); + m_lineEdit->setValidator(new ReplacementValidator(m_lineEdit, NewLineChar, QString(u' '))); m_lineEdit->setCompleter(nullptr); break; case ValidationObjectName: @@ -354,7 +354,7 @@ namespace qdesigner_internal { // protect backslashes rc.replace('\\'_L1, "\\\\"_L1); // escape newlines - rc.replace(NewLineChar, QString(EscapedNewLine)); + rc.replace(u'\n', EscapedNewLine); return rc; } @@ -368,14 +368,14 @@ namespace qdesigner_internal { return s; QString rc(s); - for (qsizetype pos = 0; (pos = rc.indexOf(QLatin1Char('\\'),pos)) >= 0 ; ) { + for (qsizetype pos = 0; (pos = rc.indexOf(u'\\', pos)) >= 0 ; ) { // found an escaped character. If not a newline or at end of string, leave as is, else insert '\n' const qsizetype nextpos = pos + 1; if (nextpos >= rc.size()) // trailing '\\' break; // Escaped NewLine - if (rc.at(nextpos) == QChar(QLatin1Char('n'))) - rc[nextpos] = NewLineChar; + if (rc.at(nextpos) == u'n') + rc[nextpos] = u'\n'; // Remove escape, go past escaped rc.remove(pos,1); pos++; diff --git a/src/designer/src/lib/shared/widgetdatabase.cpp b/src/designer/src/lib/shared/widgetdatabase.cpp index 441c97887..5f4b770e1 100644 --- a/src/designer/src/lib/shared/widgetdatabase.cpp +++ b/src/designer/src/lib/shared/widgetdatabase.cpp @@ -745,20 +745,19 @@ QString WidgetDataBase::scaleFormTemplate(const QString &xml, const QSize &size, // ---- free functions QDESIGNER_SHARED_EXPORT IncludeSpecification includeSpecification(QString includeFile) { - const bool global = !includeFile.isEmpty() && - includeFile[0] == QLatin1Char('<') && - includeFile[includeFile.size() - 1] == QLatin1Char('>'); + const bool global = includeFile.startsWith(u'<') && includeFile.endsWith(u'>'); if (global) { - includeFile.remove(includeFile.size() - 1, 1); + includeFile.chop(1); includeFile.remove(0, 1); } return IncludeSpecification(includeFile, global ? IncludeGlobal : IncludeLocal); } -QDESIGNER_SHARED_EXPORT QString buildIncludeFile(QString includeFile, IncludeType includeType) { +QDESIGNER_SHARED_EXPORT QString buildIncludeFile(QString includeFile, IncludeType includeType) +{ if (includeType == IncludeGlobal && !includeFile.isEmpty()) { - includeFile.append(QLatin1Char('>')); - includeFile.insert(0, QLatin1Char('<')); + includeFile.append(u'>'); + includeFile.prepend(u'<'); } return includeFile; } |