diff options
19 files changed, 48 insertions, 31 deletions
diff --git a/examples/widgets/dialogs/standarddialogs/main.cpp b/examples/widgets/dialogs/standarddialogs/main.cpp index 7e7a5ce95b..7c738f577b 100644 --- a/examples/widgets/dialogs/standarddialogs/main.cpp +++ b/examples/widgets/dialogs/standarddialogs/main.cpp @@ -57,13 +57,15 @@ #include "dialog.h" +using namespace Qt::StringLiterals; + int main(int argc, char *argv[]) { QApplication app(argc, argv); #if QT_CONFIG(translation) QTranslator translator; - if (translator.load(QLocale::system(), u"qtbase"_qs, u"_"_qs, + if (translator.load(QLocale::system(), u"qtbase"_s, u"_"_s, QLibraryInfo::path(QLibraryInfo::TranslationsPath))) { app.installTranslator(&translator); } diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 08e9b759df..f1583609fc 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -46,6 +46,7 @@ //#define DEBUG_SOLUTION_GEN using namespace QMakeInternal; +using namespace Qt::StringLiterals; QT_BEGIN_NAMESPACE // Filter GUIDs (Do NOT change these!) ------------------------------ @@ -301,7 +302,7 @@ QString VcprojGenerator::retrievePlatformToolSet() const if (!envVar.isEmpty()) return envVar; - return u"v"_qs + project->first("MSVC_TOOLSET_VER"); + return u"v"_s + project->first("MSVC_TOOLSET_VER"); } bool VcprojGenerator::isStandardSuffix(const QString &suffix) const diff --git a/src/corelib/doc/snippets/qmetatype/registerConverters.cpp b/src/corelib/doc/snippets/qmetatype/registerConverters.cpp index 11e9ce1bfc..663962faff 100644 --- a/src/corelib/doc/snippets/qmetatype/registerConverters.cpp +++ b/src/corelib/doc/snippets/qmetatype/registerConverters.cpp @@ -58,7 +58,7 @@ int main() { int y; int z; - QString toString() const { return u"[x: %1; y: %2, z: %3]"_qs.arg(QString::number(x), + QString toString() const { return u"[x: %1; y: %2, z: %3]"_s.arg(QString::number(x), QString::number(y), QString::number(z)); } }; diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 8e9da7a2a5..1cec39ec3b 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -148,7 +148,7 @@ static QSettings *findConfiguration() #endif if (QCoreApplication::instance()) { QDir pwd(QCoreApplication::applicationDirPath()); - qtconfig = pwd.filePath(u"qt" QT_STRINGIFY(QT_VERSION_MAJOR) ".conf"_qs); + qtconfig = pwd.filePath(u"qt" QT_STRINGIFY(QT_VERSION_MAJOR) ".conf"_s); if (QFile::exists(qtconfig)) return new QSettings(qtconfig, QSettings::IniFormat); qtconfig = pwd.filePath("qt.conf"_L1); @@ -532,7 +532,7 @@ QLibraryInfoPrivate::LocationInfo QLibraryInfoPrivate::locationInfo(QLibraryInfo result.key = QLatin1StringView(qtConfEntries.viewAt(loc * 2)); result.defaultValue = QLatin1StringView(qtConfEntries.viewAt(loc * 2 + 1)); if (result.key == u"QmlImports") - result.fallbackKey = u"Qml2Imports"_qs; + result.fallbackKey = u"Qml2Imports"_s; #ifndef Q_OS_WIN // On Windows we use the registry } else if (loc == QLibraryInfo::SettingsPath) { result.key = "Settings"_L1; diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index a1207c6263..cd166caf8b 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -1648,7 +1648,7 @@ QString QFileSystemEngine::homePath() QString QFileSystemEngine::rootPath() { - return u"/"_qs; + return u"/"_s; } QString QFileSystemEngine::tempPath() diff --git a/src/corelib/io/qfilesystemiterator_win.cpp b/src/corelib/io/qfilesystemiterator_win.cpp index 91cfef644c..fe4d55e514 100644 --- a/src/corelib/io/qfilesystemiterator_win.cpp +++ b/src/corelib/io/qfilesystemiterator_win.cpp @@ -61,7 +61,7 @@ QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Fi { Q_UNUSED(nameFilters); Q_UNUSED(flags); - if (nativePath.endsWith(u".lnk"_qs) && !QFileSystemEngine::isDirPath(dirPath, nullptr)) { + if (nativePath.endsWith(u".lnk"_s) && !QFileSystemEngine::isDirPath(dirPath, nullptr)) { QFileSystemMetaData metaData; QFileSystemEntry link = QFileSystemEngine::getLinkTarget(entry, metaData); nativePath = link.nativeFilePath(); diff --git a/src/corelib/io/qstorageinfo_win.cpp b/src/corelib/io/qstorageinfo_win.cpp index e9929c9921..54a40ebcef 100644 --- a/src/corelib/io/qstorageinfo_win.cpp +++ b/src/corelib/io/qstorageinfo_win.cpp @@ -251,7 +251,7 @@ bool QStorageInfoPrivate::queryStorageProperty() struct Helper { QBasicMutex mutex; - QSystemLibrary ntdll {u"ntdll"_qs}; + QSystemLibrary ntdll {u"ntdll"_s}; }; Q_GLOBAL_STATIC(Helper, gNtdllHelper) diff --git a/src/corelib/kernel/qsystemerror.cpp b/src/corelib/kernel/qsystemerror.cpp index 1aea501416..3cb5bcccb2 100644 --- a/src/corelib/kernel/qsystemerror.cpp +++ b/src/corelib/kernel/qsystemerror.cpp @@ -154,7 +154,7 @@ QString QSystemError::string(ErrorScope errorScope, int errorCode) qWarning("invalid error scope"); Q_FALLTHROUGH(); case NoError: - return u"No error"_qs; + return u"No error"_s; } } diff --git a/src/corelib/mimetypes/qmimetype.cpp b/src/corelib/mimetypes/qmimetype.cpp index 746776fdf2..4049a65612 100644 --- a/src/corelib/mimetypes/qmimetype.cpp +++ b/src/corelib/mimetypes/qmimetype.cpp @@ -260,9 +260,9 @@ QString QMimeType::comment() const QStringList languageList; languageList << QLocale().name(); languageList << QLocale().uiLanguages(); - languageList << u"default"_qs; // use the default locale if possible. + languageList << u"default"_s; // use the default locale if possible. for (const QString &language : qAsConst(languageList)) { - const QString lang = language == "C"_L1 ? u"en_US"_qs : language; + const QString lang = language == "C"_L1 ? u"en_US"_s : language; const QString comm = d->localeComments.value(lang); if (!comm.isEmpty()) return comm; diff --git a/src/corelib/text/qlocale_win.cpp b/src/corelib/text/qlocale_win.cpp index c5f82b9500..0d3d4cae90 100644 --- a/src/corelib/text/qlocale_win.cpp +++ b/src/corelib/text/qlocale_win.cpp @@ -1113,7 +1113,7 @@ static QString winIso639LangName(LCID id) if (ok && *endptr == '\0') { switch (i) { case 0x814: - result = u"nn"_qs; // Nynorsk + result = u"nn"_s; // Nynorsk break; default: break; diff --git a/src/corelib/text/qregularexpression.cpp b/src/corelib/text/qregularexpression.cpp index e90ec6b1e6..eb16049f9a 100644 --- a/src/corelib/text/qregularexpression.cpp +++ b/src/corelib/text/qregularexpression.cpp @@ -1597,7 +1597,7 @@ QString QRegularExpression::errorString() const #endif } #ifdef QT_NO_TRANSLATION - return u"no error"_qs; + return u"no error"_s; #else return QCoreApplication::translate("QRegularExpression", "no error"); #endif diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp index 72865d5872..485e5b3150 100644 --- a/src/corelib/thread/qthreadpool.cpp +++ b/src/corelib/thread/qthreadpool.cpp @@ -279,7 +279,7 @@ void QThreadPoolPrivate::startThread(QRunnable *runnable) Q_ASSERT(runnable != nullptr); auto thread = std::make_unique<QThreadPoolThread>(this); if (objectName.isEmpty()) - objectName = u"Thread (pooled)"_qs; + objectName = u"Thread (pooled)"_s; thread->setObjectName(objectName); Q_ASSERT(!allThreads.contains(thread.get())); // if this assert hits, we have an ABA problem (deleted threads don't get removed here) allThreads.insert(thread.get()); diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp index 3e8ceb08e3..ee85bbccb8 100644 --- a/src/network/access/qnetworkcookie.cpp +++ b/src/network/access/qnetworkcookie.cpp @@ -55,6 +55,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + QT_IMPL_METATYPE_EXTERN(QNetworkCookie) /*! @@ -667,7 +669,7 @@ static QDateTime parseDateString(const QByteArray &dateString) // hour:minute:second.ms pm static const QRegularExpression timeRx( - u"(\\d\\d?):(\\d\\d?)(?::(\\d\\d?)(?:\\.(\\d{1,3}))?)?(?:\\s*(am|pm))?"_qs); + u"(\\d\\d?):(\\d\\d?)(?::(\\d\\d?)(?:\\.(\\d{1,3}))?)?(?:\\s*(am|pm))?"_s); int at = 0; while (at < dateString.length()) { diff --git a/src/network/kernel/qtldurl.cpp b/src/network/kernel/qtldurl.cpp index c25db21cb1..57fa3ee1bd 100644 --- a/src/network/kernel/qtldurl.cpp +++ b/src/network/kernel/qtldurl.cpp @@ -64,6 +64,8 @@ extern "C" int LookupStringInFixedSet(const unsigned char *graph, std::size_t le QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + Q_LOGGING_CATEGORY(lcTld, "qt.network.tld") static constexpr int PSL_NOT_FOUND = -1; @@ -106,7 +108,7 @@ int QPublicSuffixDatabase::lookupDomain(QByteArrayView domain) const static QStringList locatePublicSuffixFiles() { return QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, - u"publicsuffix/public_suffix_list.dafsa"_qs); + u"publicsuffix/public_suffix_list.dafsa"_s); } QPublicSuffixDatabase::QPublicSuffixDatabase() diff --git a/src/plugins/networkinformation/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/networkinformation/networkmanager/qnetworkmanagerservice.cpp index f892348992..f8fd100a7e 100644 --- a/src/plugins/networkinformation/networkmanager/qnetworkmanagerservice.cpp +++ b/src/plugins/networkinformation/networkmanager/qnetworkmanagerservice.cpp @@ -61,6 +61,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + QNetworkManagerInterfaceBase::QNetworkManagerInterfaceBase(QObject *parent) : QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE), QLatin1String(NM_DBUS_PATH), NM_DBUS_INTERFACE, QDBusConnection::systemBus(), parent) @@ -137,7 +139,7 @@ static QDBusInterface getPrimaryDevice(const QDBusObjectPath &devicePath) std::optional<QDBusObjectPath> QNetworkManagerInterface::primaryConnectionDevicePath() const { - auto it = propertyMap.constFind(u"PrimaryConnection"_qs); + auto it = propertyMap.constFind(u"PrimaryConnection"_s); if (it != propertyMap.cend()) return it->value<QDBusObjectPath>(); return std::nullopt; diff --git a/src/plugins/platforms/android/androidjniaccessibility.cpp b/src/plugins/platforms/android/androidjniaccessibility.cpp index 087946ccbf..e00db7b8ef 100644 --- a/src/plugins/platforms/android/androidjniaccessibility.cpp +++ b/src/plugins/platforms/android/androidjniaccessibility.cpp @@ -58,6 +58,8 @@ static const char m_classErrorMsg[] = "Can't find class \"%s\""; QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + namespace QtAndroidAccessibility { static jmethodID m_addActionMethodID = 0; @@ -374,7 +376,7 @@ if (!clazz) { \ const double step = qAbs(valueIface->minimumStepSize().toDouble(&stepIsValid)); if (!stepIsValid || qFuzzyIsNull(step)) { // Ignore step, use default precision - valueStr = qFuzzyIsNull(val) ? u"0"_qs : QString::number(val, 'f'); + valueStr = qFuzzyIsNull(val) ? u"0"_s : QString::number(val, 'f'); } else { const int precision = [](double s) { int count = 0; @@ -398,7 +400,7 @@ if (!clazz) { \ } return count; }(step); - valueStr = qFuzzyIsNull(val / step) ? u"0"_qs + valueStr = qFuzzyIsNull(val / step) ? u"0"_s : QString::number(val, 'f', precision); } } else { diff --git a/src/tools/uic/customwidgetsinfo.cpp b/src/tools/uic/customwidgetsinfo.cpp index 4facd2bd74..ce30aa9093 100644 --- a/src/tools/uic/customwidgetsinfo.cpp +++ b/src/tools/uic/customwidgetsinfo.cpp @@ -35,6 +35,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + CustomWidgetsInfo::CustomWidgetsInfo() = default; void CustomWidgetsInfo::acceptUI(DomUI *node) @@ -109,8 +111,8 @@ bool CustomWidgetsInfo::isAmbiguousSignal(const QString &className, if (signalSignature.startsWith(u"triggered") && extends(className, "QAction")) return true; if (signalSignature.startsWith(u"clicked(") - && extendsOneOf(className, {u"QCommandLinkButton"_qs, u"QCheckBox"_qs, - u"QPushButton"_qs, u"QRadioButton"_qs, u"QToolButton"_qs})) { + && extendsOneOf(className, {u"QCommandLinkButton"_s, u"QCheckBox"_s, + u"QPushButton"_s, u"QRadioButton"_s, u"QToolButton"_s})) { return true; } return false; @@ -137,12 +139,12 @@ QString CustomWidgetsInfo::simpleContainerAddPageMethod(const QString &name) con using AddPageMethod = std::pair<QString, QString>; static const AddPageMethod addPageMethods[] = { - {u"QStackedWidget"_qs, u"addWidget"_qs}, - {u"QToolBar"_qs, u"addWidget"_qs}, - {u"QDockWidget"_qs, u"setWidget"_qs}, - {u"QScrollArea"_qs, u"setWidget"_qs}, - {u"QSplitter"_qs, u"addWidget"_qs}, - {u"QMdiArea"_qs, u"addSubWindow"_qs} + {u"QStackedWidget"_s, u"addWidget"_s}, + {u"QToolBar"_s, u"addWidget"_s}, + {u"QDockWidget"_s, u"setWidget"_s}, + {u"QScrollArea"_s, u"setWidget"_s}, + {u"QSplitter"_s, u"addWidget"_s}, + {u"QMdiArea"_s, u"addSubWindow"_s} }; for (const auto &m : addPageMethods) { if (extends(name, m.first)) diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 54b7e3879a..2197c786a3 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -134,6 +134,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + using namespace QCss; @@ -1588,12 +1590,12 @@ public: if (propertyIndex == -1) { value = obj->property(name.toLatin1()); // might be a dynamic property if (!value.isValid()) { - if (name == u"class"_qs) { + if (name == "class"_L1) { QString className = QString::fromLatin1(obj->metaObject()->className()); if (className.contains(QLatin1Char(':'))) className.replace(QLatin1Char(':'), QLatin1Char('-')); valueStr = className; - } else if (name == u"style"_qs) { + } else if (name == "style"_L1) { QWidget *w = qobject_cast<QWidget *>(obj); QStyleSheetStyle *proxy = w ? qt_styleSheet(w->style()) : nullptr; if (proxy) diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index 376355b0d5..ac5d3c142a 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -70,6 +70,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + namespace { class CloseButton : public QAbstractButton { @@ -406,12 +408,12 @@ void QTabBarPrivate::init() { Q_Q(QTabBar); leftB = new QToolButton(q); - leftB->setObjectName(u"ScrollLeftButton"_qs); + leftB->setObjectName(u"ScrollLeftButton"_s); leftB->setAutoRepeat(true); QObject::connect(leftB, SIGNAL(clicked()), q, SLOT(_q_scrollTabs())); leftB->hide(); rightB = new QToolButton(q); - rightB->setObjectName(u"ScrollRightButton"_qs); + rightB->setObjectName(u"ScrollRightButton"_s); rightB->setAutoRepeat(true); QObject::connect(rightB, SIGNAL(clicked()), q, SLOT(_q_scrollTabs())); rightB->hide(); |