diff options
Diffstat (limited to 'src')
78 files changed, 411 insertions, 258 deletions
diff --git a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontextmain.cpp b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontextmain.cpp index d062d4fd6a2..34aeaf540c9 100644 --- a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontextmain.cpp +++ b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontextmain.cpp @@ -45,6 +45,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  class QComposePlatformInputContextPlugin : public QPlatformInputContextPlugin  {      Q_OBJECT @@ -58,8 +60,8 @@ QComposeInputContext *QComposePlatformInputContextPlugin::create(const QString &  {      Q_UNUSED(paramList); -    if (system.compare(system, QLatin1String("compose"), Qt::CaseInsensitive) == 0 -            || system.compare(system, QLatin1String("xim"), Qt::CaseInsensitive) == 0) +    if (system.compare(system, "compose"_L1, Qt::CaseInsensitive) == 0 +            || system.compare(system, "xim"_L1, Qt::CaseInsensitive) == 0)          return new QComposeInputContext;      return nullptr;  } diff --git a/src/plugins/platforminputcontexts/ibus/main.cpp b/src/plugins/platforminputcontexts/ibus/main.cpp index 0a7da3b14ca..af458be1173 100644 --- a/src/plugins/platforminputcontexts/ibus/main.cpp +++ b/src/plugins/platforminputcontexts/ibus/main.cpp @@ -45,6 +45,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  class QIbusPlatformInputContextPlugin : public QPlatformInputContextPlugin  {      Q_OBJECT @@ -58,7 +60,7 @@ QIBusPlatformInputContext *QIbusPlatformInputContextPlugin::create(const QString  {      Q_UNUSED(paramList); -    if (system.compare(system, QLatin1String("ibus"), Qt::CaseInsensitive) == 0) { +    if (system.compare(system, "ibus"_L1, Qt::CaseInsensitive) == 0) {          qDBusRegisterMetaType<QIBusAttribute>();          qDBusRegisterMetaType<QIBusAttributeList>();          qDBusRegisterMetaType<QIBusText>(); diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp index 886ebfaad84..e52e0110384 100644 --- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp @@ -76,6 +76,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  enum { debug = 0 };  class QIBusPlatformInputContextPrivate @@ -537,7 +539,7 @@ void QIBusPlatformInputContext::socketChanged(const QString &str)      if (d->bus && d->bus->isValid())          disconnect(d->bus);      if (d->connection) -        d->connection->disconnectFromBus(QLatin1String("QIBusProxy")); +        d->connection->disconnectFromBus("QIBusProxy"_L1);      m_timer.start(100);  } @@ -605,7 +607,7 @@ void QIBusPlatformInputContext::connectToContextSignals()  static inline bool checkRunningUnderFlatpak()  { -    return !QStandardPaths::locate(QStandardPaths::RuntimeLocation, QLatin1String("flatpak-info")).isEmpty(); +    return !QStandardPaths::locate(QStandardPaths::RuntimeLocation, "flatpak-info"_L1).isEmpty();  }  static bool shouldConnectIbusPortal() @@ -657,24 +659,24 @@ void QIBusPlatformInputContextPrivate::createBusProxy()      QDBusReply<QDBusObjectPath> ic;      if (usePortal) {          portalBus = new QIBusProxyPortal(QLatin1String(ibusService), -                                         QLatin1String("/org/freedesktop/IBus"), +                                         "/org/freedesktop/IBus"_L1,                                           *connection);          if (!portalBus->isValid()) {              qWarning("QIBusPlatformInputContext: invalid portal bus.");              return;          } -        ic = portalBus->CreateInputContext(QLatin1String("QIBusInputContext")); +        ic = portalBus->CreateInputContext("QIBusInputContext"_L1);      } else {          bus = new QIBusProxy(QLatin1String(ibusService), -                             QLatin1String("/org/freedesktop/IBus"), +                             "/org/freedesktop/IBus"_L1,                               *connection);          if (!bus->isValid()) {              qWarning("QIBusPlatformInputContext: invalid bus.");              return;          } -        ic = bus->CreateInputContext(QLatin1String("QIBusInputContext")); +        ic = bus->CreateInputContext("QIBusInputContext"_L1);      }      serviceWatcher.removeWatchedService(ibusService); @@ -743,7 +745,7 @@ QString QIBusPlatformInputContextPrivate::getSocketPath()          qDebug() << "host=" << host << "displayNumber" << displayNumber;      return QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + -               QLatin1String("/ibus/bus/") + +               "/ibus/bus/"_L1 +                 QLatin1String(QDBusConnection::localMachineId()) +                 u'-' + QString::fromLocal8Bit(host) + u'-' + QString::fromLocal8Bit(displayNumber);  } @@ -751,7 +753,7 @@ QString QIBusPlatformInputContextPrivate::getSocketPath()  QDBusConnection *QIBusPlatformInputContextPrivate::createConnection()  {      if (usePortal) -        return new QDBusConnection(QDBusConnection::connectToBus(QDBusConnection::SessionBus, QLatin1String("QIBusProxy"))); +        return new QDBusConnection(QDBusConnection::connectToBus(QDBusConnection::SessionBus, "QIBusProxy"_L1));      QFile file(getSocketPath());      if (!file.open(QFile::ReadOnly)) @@ -776,7 +778,7 @@ QDBusConnection *QIBusPlatformInputContextPrivate::createConnection()      if (address.isEmpty() || pid < 0 || kill(pid, 0) != 0)          return 0; -    return new QDBusConnection(QDBusConnection::connectToBus(QString::fromLatin1(address), QLatin1String("QIBusProxy"))); +    return new QDBusConnection(QDBusConnection::connectToBus(QString::fromLatin1(address), "QIBusProxy"_L1));  }  QT_END_NAMESPACE diff --git a/src/plugins/platforms/bsdfb/main.cpp b/src/plugins/platforms/bsdfb/main.cpp index b2cd1373a74..13fe7df0283 100644 --- a/src/plugins/platforms/bsdfb/main.cpp +++ b/src/plugins/platforms/bsdfb/main.cpp @@ -43,6 +43,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  class QBsdFbIntegrationPlugin : public QPlatformIntegrationPlugin  {      Q_OBJECT @@ -54,7 +56,7 @@ public:  QPlatformIntegration* QBsdFbIntegrationPlugin::create(const QString& system, const QStringList& paramList)  {      Q_UNUSED(paramList); -    if (!system.compare(QLatin1String("bsdfb"), Qt::CaseInsensitive)) +    if (!system.compare("bsdfb"_L1, Qt::CaseInsensitive))          return new QBsdFbIntegration(paramList);      return nullptr; diff --git a/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp b/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp index db6d9fd968d..8d72aa9f630 100644 --- a/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp +++ b/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp @@ -61,6 +61,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  QBsdFbIntegration::QBsdFbIntegration(const QStringList ¶mList)  {      m_fontDb.reset(new QGenericUnixFontDatabase); @@ -139,7 +141,7 @@ void QBsdFbIntegration::createInputHandlers()  #if QT_CONFIG(tslib)      const bool useTslib = qEnvironmentVariableIntValue("QT_QPA_FB_TSLIB");      if (useTslib) -        new QTsLibMouseHandler(QLatin1String("TsLib"), QString()); +        new QTsLibMouseHandler("TsLib"_L1, QString());  #endif  } diff --git a/src/plugins/platforms/bsdfb/qbsdfbscreen.cpp b/src/plugins/platforms/bsdfb/qbsdfbscreen.cpp index 10d45dd0e93..58a22097b34 100644 --- a/src/plugins/platforms/bsdfb/qbsdfbscreen.cpp +++ b/src/plugins/platforms/bsdfb/qbsdfbscreen.cpp @@ -66,6 +66,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  enum {      DefaultDPI = 100  }; @@ -152,10 +154,10 @@ QBsdFbScreen::~QBsdFbScreen()  bool QBsdFbScreen::initialize()  { -    QRegularExpression fbRx(QLatin1String("fb=(.*)")); -    QRegularExpression mmSizeRx(QLatin1String("mmsize=(\\d+)x(\\d+)")); -    QRegularExpression sizeRx(QLatin1String("size=(\\d+)x(\\d+)")); -    QRegularExpression offsetRx(QLatin1String("offset=(\\d+)x(\\d+)")); +    QRegularExpression fbRx("fb=(.*)"_L1); +    QRegularExpression mmSizeRx("mmsize=(\\d+)x(\\d+)"_L1); +    QRegularExpression sizeRx("size=(\\d+)x(\\d+)"_L1); +    QRegularExpression offsetRx("offset=(\\d+)x(\\d+)"_L1);      QString fbDevice;      QSize userMmSize; diff --git a/src/plugins/platforms/cocoa/main.mm b/src/plugins/platforms/cocoa/main.mm index 89ecdf46f97..45ebd10127a 100644 --- a/src/plugins/platforms/cocoa/main.mm +++ b/src/plugins/platforms/cocoa/main.mm @@ -46,6 +46,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  class QCocoaIntegrationPlugin : public QPlatformIntegrationPlugin  {      Q_OBJECT @@ -57,7 +59,7 @@ public:  QPlatformIntegration * QCocoaIntegrationPlugin::create(const QString& system, const QStringList& paramList)  {      QMacAutoReleasePool pool; -    if (system.compare(QLatin1String("cocoa"), Qt::CaseInsensitive) == 0) +    if (system.compare("cocoa"_L1, Qt::CaseInsensitive) == 0)          return new QCocoaIntegration(paramList);      return nullptr; diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm index 1ec4c5a1144..b7651c98f28 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm @@ -47,6 +47,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  #ifndef QT_NO_ACCESSIBILITY  QCocoaAccessibility::QCocoaAccessibility() @@ -253,7 +255,7 @@ bool shouldBeIgnored(QAccessibleInterface *interface)          // VoiceOver focusing on tool tips can be confusing. The contents of the          // tool tip is available through the description attribute anyway, so          // we disable accessibility for tool tips. -        if (className == QLatin1String("QTipLabel")) +        if (className == "QTipLabel"_L1)              return true;      } diff --git a/src/plugins/platforms/cocoa/qcocoacursor.mm b/src/plugins/platforms/cocoa/qcocoacursor.mm index 77d7fe2003d..58b1fae6e3a 100644 --- a/src/plugins/platforms/cocoa/qcocoacursor.mm +++ b/src/plugins/platforms/cocoa/qcocoacursor.mm @@ -58,6 +58,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  QCocoaCursor::QCocoaCursor()  {  } @@ -284,15 +286,15 @@ NSCursor *QCocoaCursor::createCursorData(QCursor *cursor)          return createCursorFromPixmap(pixmap);          break; }      case Qt::WaitCursor: { -        QPixmap pixmap = QPixmap(QLatin1String(":/qt-project.org/mac/cursors/images/spincursor.png")); +        QPixmap pixmap = QPixmap(":/qt-project.org/mac/cursors/images/spincursor.png"_L1);          return createCursorFromPixmap(pixmap, hotspot);          break; }      case Qt::SizeAllCursor: { -        QPixmap pixmap = QPixmap(QLatin1String(":/qt-project.org/mac/cursors/images/sizeallcursor.png")); +        QPixmap pixmap = QPixmap(":/qt-project.org/mac/cursors/images/sizeallcursor.png"_L1);          return createCursorFromPixmap(pixmap, QPoint(8, 8));          break; }      case Qt::BusyCursor: { -        QPixmap pixmap = QPixmap(QLatin1String(":/qt-project.org/mac/cursors/images/waitcursor.png")); +        QPixmap pixmap = QPixmap(":/qt-project.org/mac/cursors/images/waitcursor.png"_L1);          return createCursorFromPixmap(pixmap, hotspot);          break; }  #define QT_USE_APPROXIMATE_CURSORS diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm index fa073e5e294..47688dd2312 100644 --- a/src/plugins/platforms/cocoa/qcocoadrag.mm +++ b/src/plugins/platforms/cocoa/qcocoadrag.mm @@ -49,6 +49,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  static const int dragImageMaxChars = 26;  QCocoaDrag::QCocoaDrag() : @@ -131,7 +133,7 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o)      m_executed_drop_action = Qt::IgnoreAction;      QMacPasteboard dragBoard(CFStringRef(NSPasteboardNameDrag), QMacInternalPasteboardMime::MIME_DND); -    m_drag->mimeData()->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy")); +    m_drag->mimeData()->setData("application/x-qt-mime-type-name"_L1, QByteArray("dummy"));      dragBoard.setMimeData(m_drag->mimeData(), QMacPasteboard::LazyRequest);      if (maybeDragMultipleItems()) diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 8801b5fb8e5..b71155a430d 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -63,9 +63,11 @@  QT_USE_NAMESPACE +using namespace Qt::StringLiterals; +  static NSString *strippedText(QString s)  { -    s.remove(QLatin1String("...")); +    s.remove("..."_L1);      return QPlatformTheme::removeMnemonics(s).trimmed().toNSString();  } @@ -443,7 +445,7 @@ typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;      QStringList fileTypes;      for (const QString &filter : *m_selectedNameFilter) { -        if (!filter.startsWith(QLatin1String("*."))) +        if (!filter.startsWith("*."_L1))              continue;          if (filter.contains(u'?')) diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index ffd762b012c..7e2b14dc7ae 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -80,6 +80,8 @@ static void initResources()  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  Q_LOGGING_CATEGORY(lcQpa, "qt.qpa", QtWarningMsg);  static void logVersionInformation() @@ -114,7 +116,7 @@ static QCocoaIntegration::Options parseOptions(const QStringList ¶mList)      QCocoaIntegration::Options options;      for (const QString ¶m : paramList) {  #ifndef QT_NO_FREETYPE -        if (param == QLatin1String("fontengine=freetype")) +        if (param == "fontengine=freetype"_L1)              options |= QCocoaIntegration::UseFreeTypeFontEngine;          else  #endif diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm index 4b4a0b93164..777c6d1bec0 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm @@ -58,6 +58,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  static const char *application_menu_strings[] =  {      QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","About %1"), @@ -220,7 +222,7 @@ static QPlatformMenuItem::MenuRole detectMenuRole(const QString &caption)      const QString aboutString = QCoreApplication::translate("QCocoaMenuItem", "About");      if (captionNoAmpersand.startsWith(aboutString, Qt::CaseInsensitive)          || captionNoAmpersand.endsWith(aboutString, Qt::CaseInsensitive)) { -        static const QRegularExpression qtRegExp(QLatin1String("qt$"), QRegularExpression::CaseInsensitiveOption); +        static const QRegularExpression qtRegExp("qt$"_L1, QRegularExpression::CaseInsensitiveOption);          if (captionNoAmpersand.contains(qtRegExp))              return QPlatformMenuItem::AboutQtRole;          return QPlatformMenuItem::AboutRole; @@ -345,7 +347,7 @@ NSMenuItem *QCocoaMenuItem::sync()      // Show multiple key sequences as part of the menu text.      if (accel.count() > 1) -        text += QLatin1String(" (") + accel.toString(QKeySequence::NativeText) + QLatin1String(")"); +        text += " ("_L1 + accel.toString(QKeySequence::NativeText) + ")"_L1;  #endif      m_native.title = QPlatformTheme::removeMnemonics(text).toNSString(); diff --git a/src/plugins/platforms/cocoa/qcocoamimetypes.mm b/src/plugins/platforms/cocoa/qcocoamimetypes.mm index 82ff8fe002a..6229084fdd9 100644 --- a/src/plugins/platforms/cocoa/qcocoamimetypes.mm +++ b/src/plugins/platforms/cocoa/qcocoamimetypes.mm @@ -46,6 +46,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  class QMacPasteboardMimeTraditionalMacPlainText : public QMacInternalPasteboardMime {  public:      QMacPasteboardMimeTraditionalMacPlainText() : QMacInternalPasteboardMime(MIME_ALL) { } @@ -60,20 +62,20 @@ public:  QString QMacPasteboardMimeTraditionalMacPlainText::convertorName()  { -    return QLatin1String("PlainText (traditional-mac-plain-text)"); +    return "PlainText (traditional-mac-plain-text)"_L1;  }  QString QMacPasteboardMimeTraditionalMacPlainText::flavorFor(const QString &mime)  { -    if (mime == QLatin1String("text/plain")) -        return QLatin1String("com.apple.traditional-mac-plain-text"); +    if (mime == "text/plain"_L1) +        return "com.apple.traditional-mac-plain-text"_L1;      return QString();  }  QString QMacPasteboardMimeTraditionalMacPlainText::mimeFor(QString flav)  { -    if (flav == QLatin1String("com.apple.traditional-mac-plain-text")) -        return QLatin1String("text/plain"); +    if (flav == "com.apple.traditional-mac-plain-text"_L1) +        return "text/plain"_L1;      return QString();  } @@ -88,7 +90,7 @@ QVariant QMacPasteboardMimeTraditionalMacPlainText::convertToMime(const QString          qWarning("QMacPasteboardMimeTraditionalMacPlainText: Cannot handle multiple member data");      const QByteArray &firstData = data.first();      QVariant ret; -    if (flavor == QLatin1String("com.apple.traditional-mac-plain-text")) { +    if (flavor == "com.apple.traditional-mac-plain-text"_L1) {          return QString(QCFString(CFStringCreateWithBytes(kCFAllocatorDefault,                                               reinterpret_cast<const UInt8 *>(firstData.constData()),                                               firstData.size(), CFStringGetSystemEncoding(), false))); @@ -102,7 +104,7 @@ QList<QByteArray> QMacPasteboardMimeTraditionalMacPlainText::convertFromMime(con  {      QList<QByteArray> ret;      QString string = data.toString(); -    if (flavor == QLatin1String("com.apple.traditional-mac-plain-text")) +    if (flavor == "com.apple.traditional-mac-plain-text"_L1)          ret.append(string.toLatin1());      return ret;  } diff --git a/src/plugins/platforms/cocoa/qmacclipboard.mm b/src/plugins/platforms/cocoa/qmacclipboard.mm index 23c8749b5d4..97f11be9d38 100644 --- a/src/plugins/platforms/cocoa/qmacclipboard.mm +++ b/src/plugins/platforms/cocoa/qmacclipboard.mm @@ -55,6 +55,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  /*****************************************************************************     QMacPasteboard code  *****************************************************************************/ @@ -180,7 +182,7 @@ OSStatus QMacPasteboard::promiseKeeper(PasteboardRef paste, PasteboardItemID id,          }      } -    if (!promise.itemId && flavorAsQString == QLatin1String("com.trolltech.qt.MimeTypeName")) { +    if (!promise.itemId && flavorAsQString == "com.trolltech.qt.MimeTypeName"_L1) {          // we have promised this data, but won't be able to convert, so return null data.          // This helps in making the application/x-qt-mime-type-name hidden from normal use.          QByteArray ba; @@ -328,7 +330,7 @@ QMacPasteboard::setMimeData(QMimeData *mime_src, DataRequestType dataRequestType          // QMimeData sub classes reimplementing the formats() might not expose the          // temporary "application/x-qt-mime-type-name" mimetype. So check the existence          // of this mime type while doing drag and drop. -        QString dummyMimeType(QLatin1String("application/x-qt-mime-type-name")); +        QString dummyMimeType("application/x-qt-mime-type-name"_L1);          if (!formats.contains(dummyMimeType)) {              QByteArray dummyType = mime_src->data(dummyMimeType);              if (!dummyType.isEmpty()) { @@ -342,7 +344,7 @@ QMacPasteboard::setMimeData(QMimeData *mime_src, DataRequestType dataRequestType                  // Hack: The Rtf handler converts incoming Rtf to Html. We do                  // not want to convert outgoing Html to Rtf but instead keep                  // posting it as Html. Skip the Rtf handler here. -                if (c->convertorName() == QLatin1String("Rtf")) +                if (c->convertorName() == "Rtf"_L1)                      continue;                  QString flavor(c->flavorFor(mimeType));                  if (!flavor.isEmpty()) { @@ -463,9 +465,9 @@ QMacPasteboard::retrieveData(const QString &format, QMetaType) const              // Converting via PasteboardCopyItemFlavorData below will for some UITs result              // in newlines mapping to '\r' instead of '\n'. To work around this we shortcut              // the conversion via NSPasteboard's NSStringPboardType if possible. -            if (c_flavor == QLatin1String("com.apple.traditional-mac-plain-text") -             || c_flavor == QLatin1String("public.utf8-plain-text") -             || c_flavor == QLatin1String("public.utf16-plain-text")) { +            if (c_flavor == "com.apple.traditional-mac-plain-text"_L1 +             || c_flavor == "public.utf8-plain-text"_L1 +             || c_flavor == "public.utf16-plain-text"_L1) {                  QString str = qt_mac_get_pasteboardString(paste);                  if (!str.isEmpty())                      return str; diff --git a/src/plugins/platforms/cocoa/qmultitouch_mac.mm b/src/plugins/platforms/cocoa/qmultitouch_mac.mm index 5521b7525c4..6bb16fb8a54 100644 --- a/src/plugins/platforms/cocoa/qmultitouch_mac.mm +++ b/src/plugins/platforms/cocoa/qmultitouch_mac.mm @@ -46,6 +46,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  QHash<qint64, QCocoaTouch*> QCocoaTouch::_currentTouches;  QHash<quint64, QPointingDevice*> QCocoaTouch::_touchDevices;  QPointF QCocoaTouch::_screenReferencePos; @@ -221,7 +223,7 @@ QPointingDevice *QCocoaTouch::getTouchDevice(QInputDevice::DeviceType type, quin  {      QPointingDevice *ret = _touchDevices.value(id);      if (!ret) { -        ret = new QPointingDevice(type == QInputDevice::DeviceType::TouchScreen ? QLatin1String("touchscreen") : QLatin1String("trackpad"), +        ret = new QPointingDevice(type == QInputDevice::DeviceType::TouchScreen ? "touchscreen"_L1 : "trackpad"_L1,                                    id, type, QPointingDevice::PointerType::Finger,                                    QInputDevice::Capability::Position |                                    QInputDevice::Capability::NormalizedPosition | diff --git a/src/plugins/platforms/cocoa/qnsview_mouse.mm b/src/plugins/platforms/cocoa/qnsview_mouse.mm index d9778678900..c0063f81a94 100644 --- a/src/plugins/platforms/cocoa/qnsview_mouse.mm +++ b/src/plugins/platforms/cocoa/qnsview_mouse.mm @@ -39,6 +39,8 @@  // This file is included from qnsview.mm, and only used to organize the code +using namespace Qt::StringLiterals; +  static const QPointingDevice *pointingDeviceFor(qint64 deviceID)  {      // macOS will in many cases not report a deviceID (0 value). @@ -60,7 +62,7 @@ static const QPointingDevice *pointingDeviceFor(qint64 deviceID)          return primaryDevice;      } else {          // Register a new device. Name and capabilities may need updating later. -        const auto *device = new QPointingDevice(QLatin1String("mouse"), deviceID, +        const auto *device = new QPointingDevice("mouse"_L1, deviceID,              QInputDevice::DeviceType::Mouse, QPointingDevice::PointerType::Generic,              QInputDevice::Capability::Scroll | QInputDevice::Capability::Position,              1, 3, QString(), QPointingDeviceUniqueId(), QCocoaIntegration::instance()); @@ -770,7 +772,7 @@ static const QPointingDevice *pointingDeviceFor(qint64 deviceID)      if (theEvent.hasPreciseScrollingDeltas) {          auto *devicePriv = QPointingDevicePrivate::get(const_cast<QPointingDevice *>(device));          if (!devicePriv->capabilities.testFlag(QInputDevice::Capability::PixelScroll)) { -            devicePriv->name = QLatin1String("trackpad or magic mouse"); +            devicePriv->name = "trackpad or magic mouse"_L1;              devicePriv->deviceType = QInputDevice::DeviceType::TouchPad;              devicePriv->capabilities |= QInputDevice::Capability::PixelScroll;              qCDebug(lcInputDevices) << "mouse scrolling: updated capabilities" << device; diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dplatformplugin.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dplatformplugin.cpp index f8a28c395d0..fa480fac415 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dplatformplugin.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dplatformplugin.cpp @@ -44,6 +44,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  class QWindowsDirect2DIntegrationPlugin : public QPlatformIntegrationPlugin  {      Q_OBJECT @@ -54,7 +56,7 @@ public:  QPlatformIntegration *QWindowsDirect2DIntegrationPlugin::create(const QString& system, const QStringList& paramList)  { -    if (system.compare(system, QLatin1String("direct2d"), Qt::CaseInsensitive) == 0) +    if (system.compare(system, "direct2d"_L1, Qt::CaseInsensitive) == 0)          return QWindowsDirect2DIntegration::create(paramList);      return nullptr;  } diff --git a/src/plugins/platforms/directfb/main.cpp b/src/plugins/platforms/directfb/main.cpp index 85e7f089170..0465c6e60b4 100644 --- a/src/plugins/platforms/directfb/main.cpp +++ b/src/plugins/platforms/directfb/main.cpp @@ -43,6 +43,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  #ifdef DIRECTFB_GL_EGL  #define QT_EGL_BACKEND_STRING(list) list << "directfbegl";  #define QT_EGL_BACKEND_CREATE(list, out) \ @@ -66,7 +68,7 @@ QPlatformIntegration * QDirectFbIntegrationPlugin::create(const QString& system,      Q_UNUSED(paramList);      QDirectFbIntegration *integration = nullptr; -    if (!system.compare(QLatin1String("directfb"), Qt::CaseInsensitive)) +    if (!system.compare("directfb"_L1, Qt::CaseInsensitive))          integration = new QDirectFbIntegration;      QT_EGL_BACKEND_CREATE(system, integration) diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp index 29b15e59266..63fac24cfcf 100644 --- a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp @@ -58,6 +58,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  QEglFSCursor::QEglFSCursor(QPlatformScreen *screen)    : m_visible(true),      m_screen(static_cast<QEglFSScreen *>(screen)), @@ -178,14 +180,14 @@ void QEglFSCursor::initCursorAtlas()      QJsonDocument doc = QJsonDocument::fromJson(file.readAll());      QJsonObject object = doc.object(); -    QString atlas = object.value(QLatin1String("image")).toString(); +    QString atlas = object.value("image"_L1).toString();      Q_ASSERT(!atlas.isEmpty()); -    const int cursorsPerRow = object.value(QLatin1String("cursorsPerRow")).toDouble(); +    const int cursorsPerRow = object.value("cursorsPerRow"_L1).toDouble();      Q_ASSERT(cursorsPerRow);      m_cursorAtlas.cursorsPerRow = cursorsPerRow; -    const QJsonArray hotSpots = object.value(QLatin1String("hotSpots")).toArray(); +    const QJsonArray hotSpots = object.value("hotSpots"_L1).toArray();      Q_ASSERT(hotSpots.count() == Qt::LastCursor + 1);      for (int i = 0; i < hotSpots.count(); i++) {          QPoint hotSpot(hotSpots[i].toArray()[0].toDouble(), hotSpots[i].toArray()[1].toDouble()); diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp index 09c102b66fd..faca562bce3 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp @@ -69,10 +69,12 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  Q_LOGGING_CATEGORY(qLcEglDevDebug, "qt.qpa.egldeviceintegration")  Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, -                          (QEglFSDeviceIntegrationFactoryInterface_iid, QLatin1String("/egldeviceintegrations"), Qt::CaseInsensitive)) +                          (QEglFSDeviceIntegrationFactoryInterface_iid, "/egldeviceintegrations"_L1, Qt::CaseInsensitive))  QStringList QEglFSDeviceIntegrationFactory::keys()  { @@ -114,7 +116,7 @@ int QEglFSDeviceIntegration::framebufferIndex() const  {      int fbIndex = 0;  #if QT_CONFIG(regularexpression) -    QRegularExpression fbIndexRx(QLatin1String("fb(\\d+)")); +    QRegularExpression fbIndexRx("fb(\\d+)"_L1);      QFileInfo fbinfo(QString::fromLocal8Bit(fbDeviceName()));      QRegularExpressionMatch match;      if (fbinfo.isSymLink()) diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp index 33b57353fc7..0dd80b04736 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp @@ -103,6 +103,8 @@ static void initResources()  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  QEglFSIntegration::QEglFSIntegration()      : m_kbdMgr(nullptr),        m_display(EGL_NO_DISPLAY), @@ -442,7 +444,7 @@ void QEglFSIntegration::createInputHandlers()  {  #if QT_CONFIG(libinput)      if (!qEnvironmentVariableIntValue("QT_QPA_EGLFS_NO_LIBINPUT")) { -        new QLibInputHandler(QLatin1String("libinput"), QString()); +        new QLibInputHandler("libinput"_L1, QString());          return;      }  #endif @@ -450,16 +452,16 @@ void QEglFSIntegration::createInputHandlers()  #if QT_CONFIG(tslib)      bool useTslib = qEnvironmentVariableIntValue("QT_QPA_EGLFS_TSLIB");      if (useTslib) -        new QTsLibMouseHandler(QLatin1String("TsLib"), QString() /* spec */); +        new QTsLibMouseHandler("TsLib"_L1, QString() /* spec */);  #endif  #if QT_CONFIG(evdev) -    m_kbdMgr = new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString() /* spec */, this); -    new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString() /* spec */, this); +    m_kbdMgr = new QEvdevKeyboardManager("EvdevKeyboard"_L1, QString() /* spec */, this); +    new QEvdevMouseManager("EvdevMouse"_L1, QString() /* spec */, this);  #if QT_CONFIG(tslib)      if (!useTslib)  #endif -        new QEvdevTouchManager(QLatin1String("EvdevTouch"), QString() /* spec */, this); +        new QEvdevTouchManager("EvdevTouch"_L1, QString() /* spec */, this);  #endif  #if QT_CONFIG(integrityhid) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.cpp index 697d92a5ca5..1ab354afe5f 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.cpp @@ -41,6 +41,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  QEglFSEmulatorScreen::QEglFSEmulatorScreen(const QJsonObject &screenDescription)      : QEglFSScreen(eglGetDisplay(EGL_DEFAULT_DISPLAY))      , m_id(0) @@ -112,60 +114,60 @@ void QEglFSEmulatorScreen::initFromJsonObject(const QJsonObject &description)  {      QJsonValue value; -    value = description.value(QLatin1String("id")); +    value = description.value("id"_L1);      if (!value.isUndefined() && value.isDouble())          m_id = value.toInt(); -    value = description.value(QLatin1String("description")); +    value = description.value("description"_L1);      if (!value.isUndefined() && value.isString())          m_description = value.toString(); -    value = description.value(QLatin1String("geometry")); +    value = description.value("geometry"_L1);      if (!value.isUndefined() && value.isObject()) {          QJsonObject geometryObject = value.toObject(); -        value = geometryObject.value(QLatin1String("x")); +        value = geometryObject.value("x"_L1);          if (!value.isUndefined() && value.isDouble())              m_geometry.setX(value.toInt()); -        value = geometryObject.value(QLatin1String("y")); +        value = geometryObject.value("y"_L1);          if (!value.isUndefined() && value.isDouble())              m_geometry.setY(value.toInt()); -        value = geometryObject.value(QLatin1String("width")); +        value = geometryObject.value("width"_L1);          if (!value.isUndefined() && value.isDouble())              m_geometry.setWidth(value.toInt()); -        value = geometryObject.value(QLatin1String("height")); +        value = geometryObject.value("height"_L1);          if (!value.isUndefined() && value.isDouble())              m_geometry.setHeight(value.toInt());      } -    value = description.value(QLatin1String("depth")); +    value = description.value("depth"_L1);      if (!value.isUndefined() && value.isDouble())          m_depth = value.toInt(); -    value = description.value(QLatin1String("format")); +    value = description.value("format"_L1);      if (!value.isUndefined() && value.isDouble())          m_format = static_cast<QImage::Format>(value.toInt()); -    value = description.value(QLatin1String("physicalSize")); +    value = description.value("physicalSize"_L1);      if (!value.isUndefined() && value.isObject()) {          QJsonObject physicalSizeObject = value.toObject(); -        value = physicalSizeObject.value(QLatin1String("width")); +        value = physicalSizeObject.value("width"_L1);          if (!value.isUndefined() && value.isDouble())              m_physicalSize.setWidth(value.toInt()); -        value = physicalSizeObject.value(QLatin1String("height")); +        value = physicalSizeObject.value("height"_L1);          if (!value.isUndefined() && value.isDouble())              m_physicalSize.setHeight(value.toInt());      } -    value = description.value(QLatin1String("refreshRate")); +    value = description.value("refreshRate"_L1);      if (!value.isUndefined() && value.isDouble())          m_refreshRate = value.toDouble(); -    value = description.value(QLatin1String("nativeOrientation")); +    value = description.value("nativeOrientation"_L1);      if (!value.isUndefined() && value.isDouble())          m_nativeOrientation = static_cast<Qt::ScreenOrientation>(value.toInt()); -    value = description.value(QLatin1String("orientation")); +    value = description.value("orientation"_L1);      if (!value.isUndefined() && value.isDouble())          m_orientation = static_cast<Qt::ScreenOrientation>(value.toInt());  } diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp index 52db076b749..1aac34dd43e 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp @@ -64,6 +64,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  Q_DECLARE_LOGGING_CATEGORY(qLcEglfsKmsDebug)  QEglFSKmsGbmCursor::QEglFSKmsGbmCursor(QEglFSKmsGbmScreen *screen) @@ -289,14 +291,14 @@ void QEglFSKmsGbmCursor::initCursorAtlas()      QJsonDocument doc = QJsonDocument::fromJson(file.readAll());      QJsonObject object = doc.object(); -    QString atlas = object.value(QLatin1String("image")).toString(); +    QString atlas = object.value("image"_L1).toString();      Q_ASSERT(!atlas.isEmpty()); -    const int cursorsPerRow = object.value(QLatin1String("cursorsPerRow")).toDouble(); +    const int cursorsPerRow = object.value("cursorsPerRow"_L1).toDouble();      Q_ASSERT(cursorsPerRow);      m_cursorAtlas.cursorsPerRow = cursorsPerRow; -    const QJsonArray hotSpots = object.value(QLatin1String("hotSpots")).toArray(); +    const QJsonArray hotSpots = object.value("hotSpots"_L1).toArray();      Q_ASSERT(hotSpots.count() == Qt::LastCursor + 1);      for (int i = 0; i < hotSpots.count(); i++) {          QPoint hotSpot(hotSpots[i].toArray()[0].toDouble(), hotSpots[i].toArray()[1].toDouble()); diff --git a/src/plugins/platforms/eglfs/qeglfsmain.cpp b/src/plugins/platforms/eglfs/qeglfsmain.cpp index aefa1e23f83..5a6cb286df2 100644 --- a/src/plugins/platforms/eglfs/qeglfsmain.cpp +++ b/src/plugins/platforms/eglfs/qeglfsmain.cpp @@ -42,6 +42,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  class QEglFSIntegrationPlugin : public QPlatformIntegrationPlugin  {      Q_OBJECT @@ -53,7 +55,7 @@ public:  QPlatformIntegration* QEglFSIntegrationPlugin::create(const QString& system, const QStringList& paramList)  {      Q_UNUSED(paramList); -    if (!system.compare(QLatin1String("eglfs"), Qt::CaseInsensitive)) +    if (!system.compare("eglfs"_L1, Qt::CaseInsensitive))          return new QEglFSIntegration;      return nullptr; diff --git a/src/plugins/platforms/haiku/main.cpp b/src/plugins/platforms/haiku/main.cpp index 841891970d9..25771995331 100644 --- a/src/plugins/platforms/haiku/main.cpp +++ b/src/plugins/platforms/haiku/main.cpp @@ -42,9 +42,11 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  QPlatformIntegration *QHaikuIntegrationPlugin::create(const QString& system, const QStringList& paramList)  { -    if (!system.compare(QLatin1String("haiku"), Qt::CaseInsensitive)) +    if (!system.compare("haiku"_L1, Qt::CaseInsensitive))          return new QHaikuIntegration(paramList);      return nullptr; diff --git a/src/plugins/platforms/haiku/qhaikuclipboard.cpp b/src/plugins/platforms/haiku/qhaikuclipboard.cpp index 20519e21d05..4da473a1d1b 100644 --- a/src/plugins/platforms/haiku/qhaikuclipboard.cpp +++ b/src/plugins/platforms/haiku/qhaikuclipboard.cpp @@ -46,6 +46,8 @@  #include <Clipboard.h> +using namespace Qt::StringLiterals; +  QHaikuClipboard::QHaikuClipboard()      : m_systemMimeData(nullptr)      , m_userMimeData(nullptr) @@ -92,9 +94,9 @@ QMimeData *QHaikuClipboard::mimeData(QClipboard::Mode mode)              const status_t status = clipboard->FindData(name, B_MIME_TYPE, &data, &dataLen);              if (dataLen && (status == B_OK)) {                  const QLatin1String format(name); -                if (format == QLatin1String("text/plain")) { +                if (format == "text/plain"_L1) {                      m_systemMimeData->setText(QString::fromLocal8Bit(reinterpret_cast<const char*>(data), dataLen)); -                } else if (format == QLatin1String("text/html")) { +                } else if (format == "text/html"_L1) {                      m_systemMimeData->setHtml(QString::fromLocal8Bit(reinterpret_cast<const char*>(data), dataLen));                  } else {                      m_systemMimeData->setData(format, QByteArray(reinterpret_cast<const char*>(data), dataLen)); diff --git a/src/plugins/platforms/integrity/main.cpp b/src/plugins/platforms/integrity/main.cpp index 6313aa47e59..16e022b4703 100644 --- a/src/plugins/platforms/integrity/main.cpp +++ b/src/plugins/platforms/integrity/main.cpp @@ -42,6 +42,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  class QIntegrityFbIntegrationPlugin : public QPlatformIntegrationPlugin  {      Q_OBJECT @@ -53,7 +55,7 @@ public:  QPlatformIntegration* QIntegrityFbIntegrationPlugin::create(const QString& system, const QStringList& paramList)  {      Q_UNUSED(paramList); -    if (!system.compare(QLatin1String("integrityfb"), Qt::CaseInsensitive)) +    if (!system.compare("integrityfb"_L1, Qt::CaseInsensitive))          return new QIntegrityFbIntegration(paramList);      return 0; diff --git a/src/plugins/platforms/integrity/qintegrityfbscreen.cpp b/src/plugins/platforms/integrity/qintegrityfbscreen.cpp index d64b96ca4cb..250cecdc297 100644 --- a/src/plugins/platforms/integrity/qintegrityfbscreen.cpp +++ b/src/plugins/platforms/integrity/qintegrityfbscreen.cpp @@ -51,6 +51,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  static QImage::Format determineFormat(const FBInfo *fbinfo)  {      QImage::Format format = QImage::Format_Invalid; @@ -109,9 +111,9 @@ QIntegrityFbScreen::~QIntegrityFbScreen()  bool QIntegrityFbScreen::initialize()  {      Error err; -    QRegularExpression fbRx(QLatin1String("fb=(.*)")); -    QRegularExpression sizeRx(QLatin1String("size=(\\d+)x(\\d+)")); -    QRegularExpression offsetRx(QLatin1String("offset=(\\d+)x(\\d+)")); +    QRegularExpression fbRx("fb=(.*)"_L1); +    QRegularExpression sizeRx("size=(\\d+)x(\\d+)"_L1); +    QRegularExpression offsetRx("offset=(\\d+)x(\\d+)"_L1);      QString fbDevice;      QRect userGeometry; diff --git a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm index 9cb38a3461d..e41bba1fb17 100644 --- a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm +++ b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm @@ -50,6 +50,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  static QThreadStorage<QString> g_iteratorCurrentUrl;  static QThreadStorage<QPointer<QIOSAssetData> > g_assetDataCache; @@ -249,7 +251,7 @@ public:                  }                  if (!asset) -                    engine->setError(QFile::OpenError, QLatin1String("could not open image")); +                    engine->setError(QFile::OpenError, "could not open image"_L1);                  m_asset = [asset retain];                  dispatch_semaphore_signal(semaphore); @@ -377,7 +379,7 @@ bool QIOSFileEngineAssetsLibrary::close()  QAbstractFileEngine::FileFlags QIOSFileEngineAssetsLibrary::fileFlags(QAbstractFileEngine::FileFlags type) const  {      QAbstractFileEngine::FileFlags flags; -    const bool isDir = (m_assetUrl == QLatin1String("assets-library://")); +    const bool isDir = (m_assetUrl == "assets-library://"_L1);      const bool exists = isDir || m_assetUrl == g_iteratorCurrentUrl.localData() || loadAsset();      if (!exists) @@ -452,11 +454,11 @@ void QIOSFileEngineAssetsLibrary::setFileName(const QString &file)      // QUrl::fromLocalFile() will remove double slashes. Since the asset url is      // passed around as a file name in the app (and converted to/from a file url, e.g      // in QFileDialog), we need to ensure that m_assetUrl ends up being valid. -    int index = file.indexOf(QLatin1String("/asset")); +    qsizetype index = file.indexOf("/asset"_L1);      if (index == -1) -        m_assetUrl = QLatin1String("assets-library://"); +        m_assetUrl = "assets-library://"_L1;      else -        m_assetUrl = QLatin1String("assets-library:/") + file.mid(index); +        m_assetUrl = "assets-library:/"_L1 + file.mid(index);  }  #ifndef QT_NO_FILESYSTEMITERATOR diff --git a/src/plugins/platforms/ios/plugin.mm b/src/plugins/platforms/ios/plugin.mm index 83760f2f39a..195660220e5 100644 --- a/src/plugins/platforms/ios/plugin.mm +++ b/src/plugins/platforms/ios/plugin.mm @@ -43,6 +43,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  class QIOSIntegrationPlugin : public QPlatformIntegrationPlugin  {      Q_OBJECT @@ -54,8 +56,8 @@ class QIOSIntegrationPlugin : public QPlatformIntegrationPlugin  QPlatformIntegration * QIOSIntegrationPlugin::create(const QString& system, const QStringList& paramList)  {      Q_UNUSED(paramList); -    if (!system.compare(QLatin1String("ios"), Qt::CaseInsensitive) -        || !system.compare(QLatin1String("tvos"), Qt::CaseInsensitive)) { +    if (!system.compare("ios"_L1, Qt::CaseInsensitive) +        || !system.compare("tvos"_L1, Qt::CaseInsensitive)) {          return new QIOSIntegration;      } diff --git a/src/plugins/platforms/ios/qiosapplicationstate.mm b/src/plugins/platforms/ios/qiosapplicationstate.mm index bf4e9cc900f..73b60fbd33c 100644 --- a/src/plugins/platforms/ios/qiosapplicationstate.mm +++ b/src/plugins/platforms/ios/qiosapplicationstate.mm @@ -50,6 +50,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  static void qRegisterApplicationStateNotifications()  {      NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; @@ -83,11 +85,11 @@ static void qRegisterApplicationStateNotifications()      if (qt_apple_isApplicationExtension()) {          // Extensions are not allowed to access UIApplication, so we assume the state is active          QIOSApplicationState::handleApplicationStateChanged(UIApplicationStateActive, -            QLatin1String("Extension loaded, assuming state is active")); +            "Extension loaded, assuming state is active"_L1);      } else {          // Initialize correct startup state, which may not be the Qt default (inactive)          UIApplicationState startupState = qt_apple_sharedApplication().applicationState; -        QIOSApplicationState::handleApplicationStateChanged(startupState, QLatin1String("Application loaded")); +        QIOSApplicationState::handleApplicationStateChanged(startupState, "Application loaded"_L1);      }  }  Q_CONSTRUCTOR_FUNCTION(qRegisterApplicationStateNotifications) @@ -96,7 +98,7 @@ QIOSApplicationState::QIOSApplicationState()  {      if (!qt_apple_isApplicationExtension()) {          UIApplicationState startupState = qt_apple_sharedApplication().applicationState; -        QIOSApplicationState::handleApplicationStateChanged(startupState, QLatin1String("Application launched")); +        QIOSApplicationState::handleApplicationStateChanged(startupState, "Application launched"_L1);      }  } diff --git a/src/plugins/platforms/ios/qiosfiledialog.mm b/src/plugins/platforms/ios/qiosfiledialog.mm index a56bf25c16e..d9d7285910d 100644 --- a/src/plugins/platforms/ios/qiosfiledialog.mm +++ b/src/plugins/platforms/ios/qiosfiledialog.mm @@ -50,6 +50,8 @@  #include "qiosoptionalplugininterface.h"  #include "qiosdocumentpickercontroller.h" +using namespace Qt::StringLiterals; +  QIOSFileDialog::QIOSFileDialog()      : m_viewController(nullptr)  { @@ -74,7 +76,7 @@ bool QIOSFileDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality window      QString directory = options()->initialDirectory().toLocalFile();      if (acceptOpen) { -        if (directory.startsWith(QLatin1String("assets-library:"))) +        if (directory.startsWith("assets-library:"_L1))              return showImagePickerDialog(parent);          else              return showNativeDocumentPickerDialog(parent); diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm index 54ef5b25670..4aa1e4207fd 100644 --- a/src/plugins/platforms/ios/qiosintegration.mm +++ b/src/plugins/platforms/ios/qiosintegration.mm @@ -70,6 +70,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  class QCoreTextFontEngine;  QIOSIntegration *QIOSIntegration::instance() @@ -85,7 +87,7 @@ QIOSIntegration::QIOSIntegration()      , m_inputContext(0)      , m_platformServices(new QIOSServices)      , m_accessibility(0) -    , m_optionalPlugins(new QFactoryLoader(QIosOptionalPluginInterface_iid, QLatin1String("/platforms/darwin"))) +    , m_optionalPlugins(new QFactoryLoader(QIosOptionalPluginInterface_iid, "/platforms/darwin"_L1))  {      if (Q_UNLIKELY(!qt_apple_isApplicationExtension() && !qt_apple_sharedApplication())) {          qFatal("Error: You are creating QApplication before calling UIApplicationMain.\n" \ diff --git a/src/plugins/platforms/ios/qiosmessagedialog.mm b/src/plugins/platforms/ios/qiosmessagedialog.mm index 254922701a0..334edddcfe4 100644 --- a/src/plugins/platforms/ios/qiosmessagedialog.mm +++ b/src/plugins/platforms/ios/qiosmessagedialog.mm @@ -49,6 +49,8 @@  #include "quiview.h"  #include "qiosmessagedialog.h" +using namespace Qt::StringLiterals; +  QIOSMessageDialog::QIOSMessageDialog()      : m_alertController(nullptr)  { @@ -73,7 +75,7 @@ inline QString QIOSMessageDialog::messageTextPlain()      if (!detailedText.isEmpty())          text += lineShift + detailedText; -    text.replace(QLatin1String("<p>"), QStringLiteral("\n"), Qt::CaseInsensitive); +    text.replace("<p>"_L1, QStringLiteral("\n"), Qt::CaseInsensitive);      text.remove(QRegularExpression(QStringLiteral("<[^>]*>")));      return text; diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index 69ec393b123..6b1d6621a61 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -229,6 +229,8 @@ static QIOSScreen* qtPlatformScreenFor(UIScreen *uiScreen)  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  /*!      Returns the model identifier of the device.  */ @@ -321,12 +323,10 @@ QIOSScreen::~QIOSScreen()  QString QIOSScreen::name() const  { -    if (m_uiScreen == [UIScreen mainScreen]) { -        return QString::fromNSString([UIDevice currentDevice].model) -            + QLatin1String(" built-in display"); -    } else { -        return QLatin1String("External display"); -    } +    if (m_uiScreen == [UIScreen mainScreen]) +        return QString::fromNSString([UIDevice currentDevice].model) + " built-in display"_L1; +    else +        return "External display"_L1;  }  void QIOSScreen::updateProperties() diff --git a/src/plugins/platforms/linuxfb/main.cpp b/src/plugins/platforms/linuxfb/main.cpp index 24156b68e80..8ed57ab1acf 100644 --- a/src/plugins/platforms/linuxfb/main.cpp +++ b/src/plugins/platforms/linuxfb/main.cpp @@ -42,6 +42,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  class QLinuxFbIntegrationPlugin : public QPlatformIntegrationPlugin  {      Q_OBJECT @@ -53,7 +55,7 @@ public:  QPlatformIntegration* QLinuxFbIntegrationPlugin::create(const QString& system, const QStringList& paramList)  {      Q_UNUSED(paramList); -    if (!system.compare(QLatin1String("linuxfb"), Qt::CaseInsensitive)) +    if (!system.compare("linuxfb"_L1, Qt::CaseInsensitive))          return new QLinuxFbIntegration(paramList);      return 0; diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp index e9f41e1a5ca..0bb0310fa73 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp @@ -72,6 +72,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  QLinuxFbIntegration::QLinuxFbIntegration(const QStringList ¶mList)      : m_primaryScreen(nullptr),        m_fontDb(new QGenericUnixFontDatabase), @@ -152,7 +154,7 @@ void QLinuxFbIntegration::createInputHandlers()  {  #if QT_CONFIG(libinput)      if (!qEnvironmentVariableIntValue("QT_QPA_FB_NO_LIBINPUT")) { -        new QLibInputHandler(QLatin1String("libinput"), QString()); +        new QLibInputHandler("libinput"_L1, QString());          return;      }  #endif @@ -160,16 +162,16 @@ void QLinuxFbIntegration::createInputHandlers()  #if QT_CONFIG(tslib)      bool useTslib = qEnvironmentVariableIntValue("QT_QPA_FB_TSLIB");      if (useTslib) -        new QTsLibMouseHandler(QLatin1String("TsLib"), QString()); +        new QTsLibMouseHandler("TsLib"_L1, QString());  #endif  #if QT_CONFIG(evdev) -    m_kbdMgr = new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString(), this); -    new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString(), this); +    m_kbdMgr = new QEvdevKeyboardManager("EvdevKeyboard"_L1, QString(), this); +    new QEvdevMouseManager("EvdevMouse"_L1, QString(), this);  #if QT_CONFIG(tslib)      if (!useTslib)  #endif -        new QEvdevTouchManager(QLatin1String("EvdevTouch"), QString() /* spec */, this); +        new QEvdevTouchManager("EvdevTouch"_L1, QString() /* spec */, this);  #endif  } diff --git a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp index 7467df2b93b..ad32ebce70a 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp @@ -65,6 +65,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  static int openFramebufferDevice(const QString &dev)  {      int fd = -1; @@ -308,11 +310,11 @@ QLinuxFbScreen::~QLinuxFbScreen()  bool QLinuxFbScreen::initialize()  { -    QRegularExpression ttyRx(QLatin1String("tty=(.*)")); -    QRegularExpression fbRx(QLatin1String("fb=(.*)")); -    QRegularExpression mmSizeRx(QLatin1String("mmsize=(\\d+)x(\\d+)")); -    QRegularExpression sizeRx(QLatin1String("size=(\\d+)x(\\d+)")); -    QRegularExpression offsetRx(QLatin1String("offset=(\\d+)x(\\d+)")); +    QRegularExpression ttyRx("tty=(.*)"_L1); +    QRegularExpression fbRx("fb=(.*)"_L1); +    QRegularExpression mmSizeRx("mmsize=(\\d+)x(\\d+)"_L1); +    QRegularExpression sizeRx("size=(\\d+)x(\\d+)"_L1); +    QRegularExpression offsetRx("offset=(\\d+)x(\\d+)"_L1);      QString fbDevice, ttyDevice;      QSize userMmSize; @@ -322,7 +324,7 @@ bool QLinuxFbScreen::initialize()      // Parse arguments      for (const QString &arg : qAsConst(mArgs)) {          QRegularExpressionMatch match; -        if (arg == QLatin1String("nographicsmodeswitch")) +        if (arg == "nographicsmodeswitch"_L1)              doSwitchToGraphicsMode = false;          else if (arg.contains(mmSizeRx, &match))              userMmSize = QSize(match.captured(1).toInt(), match.captured(2).toInt()); @@ -337,9 +339,9 @@ bool QLinuxFbScreen::initialize()      }      if (fbDevice.isEmpty()) { -        fbDevice = QLatin1String("/dev/fb0"); +        fbDevice = "/dev/fb0"_L1;          if (!QFile::exists(fbDevice)) -            fbDevice = QLatin1String("/dev/graphics/fb0"); +            fbDevice = "/dev/graphics/fb0"_L1;          if (!QFile::exists(fbDevice)) {              qWarning("Unable to figure out framebuffer device. Specify it manually.");              return false; diff --git a/src/plugins/platforms/minimal/main.cpp b/src/plugins/platforms/minimal/main.cpp index f9a0c17509b..1e3823504fb 100644 --- a/src/plugins/platforms/minimal/main.cpp +++ b/src/plugins/platforms/minimal/main.cpp @@ -43,6 +43,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  class QMinimalIntegrationPlugin : public QPlatformIntegrationPlugin  {      Q_OBJECT @@ -53,7 +55,7 @@ public:  QPlatformIntegration *QMinimalIntegrationPlugin::create(const QString& system, const QStringList& paramList)  { -    if (!system.compare(QLatin1String("minimal"), Qt::CaseInsensitive)) +    if (!system.compare("minimal"_L1, Qt::CaseInsensitive))          return new QMinimalIntegration(paramList);      return 0; diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp index e58fadc1ef4..3cc374497f5 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.cpp +++ b/src/plugins/platforms/minimal/qminimalintegration.cpp @@ -72,6 +72,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  class QCoreTextFontEngine;  static const char debugBackingStoreEnvironmentVariable[] = "QT_DEBUG_BACKINGSTORE"; @@ -80,11 +82,11 @@ static inline unsigned parseOptions(const QStringList ¶mList)  {      unsigned options = 0;      for (const QString ¶m : paramList) { -        if (param == QLatin1String("enable_fonts")) +        if (param == "enable_fonts"_L1)              options |= QMinimalIntegration::EnableFonts; -        else if (param == QLatin1String("freetype")) +        else if (param == "freetype"_L1)              options |= QMinimalIntegration::FreeTypeFontDatabase; -        else if (param == QLatin1String("fontconfig")) +        else if (param == "fontconfig"_L1)              options |= QMinimalIntegration::FontconfigDatabase;      }      return options; diff --git a/src/plugins/platforms/minimalegl/main.cpp b/src/plugins/platforms/minimalegl/main.cpp index 5aac71e1404..a196bc270d8 100644 --- a/src/plugins/platforms/minimalegl/main.cpp +++ b/src/plugins/platforms/minimalegl/main.cpp @@ -42,6 +42,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  class QMinimalEglIntegrationPlugin : public QPlatformIntegrationPlugin  {      Q_OBJECT @@ -53,7 +55,7 @@ public:  QPlatformIntegration* QMinimalEglIntegrationPlugin::create(const QString& system, const QStringList& paramList)  {      Q_UNUSED(paramList); -    if (!system.compare(QLatin1String("minimalegl"), Qt::CaseInsensitive)) +    if (!system.compare("minimalegl"_L1, Qt::CaseInsensitive))          return new QMinimalEglIntegration;      return 0; diff --git a/src/plugins/platforms/offscreen/main.cpp b/src/plugins/platforms/offscreen/main.cpp index 6b696ed0738..da1ffcc599f 100644 --- a/src/plugins/platforms/offscreen/main.cpp +++ b/src/plugins/platforms/offscreen/main.cpp @@ -43,6 +43,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  class QOffscreenIntegrationPlugin : public QPlatformIntegrationPlugin  {      Q_OBJECT @@ -53,7 +55,7 @@ public:  QPlatformIntegration *QOffscreenIntegrationPlugin::create(const QString& system, const QStringList& paramList)  { -    if (!system.compare(QLatin1String("offscreen"), Qt::CaseInsensitive)) +    if (!system.compare("offscreen"_L1, Qt::CaseInsensitive))          return QOffscreenIntegration::createOffscreenIntegration(paramList);      return nullptr; diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp index 2613a42755c..8583cddeac4 100644 --- a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp +++ b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp @@ -74,6 +74,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  class QCoreTextFontEngine;  template <typename BaseEventDispatcher> @@ -176,7 +178,7 @@ std::optional<QJsonObject> QOffscreenIntegration::resolveConfigFileConfiguration      QString configFilePath;      for (const QString ¶m : paramList) {          // Look for "configfile=/path/to/file/" -        QString configPrefix(QLatin1String("configfile=")); +        QString configPrefix("configfile="_L1);          if (param.startsWith(configPrefix)) {              hasConfigFile = true;              configFilePath = param.mid(configPrefix.length()); @@ -419,8 +421,8 @@ public:      virtual const QFont *font(Font type = SystemFont) const override      { -        static QFont systemFont(QLatin1String("Sans Serif"), 9); -        static QFont fixedFont(QLatin1String("monospace"), 9); +        static QFont systemFont("Sans Serif"_L1, 9); +        static QFont fixedFont("monospace"_L1, 9);          switch (type) {          case QPlatformTheme::SystemFont:              return &systemFont; diff --git a/src/plugins/platforms/qnx/main.cpp b/src/plugins/platforms/qnx/main.cpp index b5869fa6034..1a2f20a689c 100644 --- a/src/plugins/platforms/qnx/main.cpp +++ b/src/plugins/platforms/qnx/main.cpp @@ -43,9 +43,11 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  QPlatformIntegration *QQnxIntegrationPlugin::create(const QString& system, const QStringList& paramList)  { -    if (!system.compare(QLatin1String("qnx"), Qt::CaseInsensitive)) { +    if (!system.compare("qnx"_L1, Qt::CaseInsensitive)) {          qqnxLgmonInit();          return new QQnxIntegration(paramList);      } diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index 02eafadae8f..a09de65a946 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -106,24 +106,26 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  QQnxIntegration *QQnxIntegration::ms_instance;  static inline QQnxIntegration::Options parseOptions(const QStringList ¶mList)  {      QQnxIntegration::Options options = QQnxIntegration::NoOptions; -    if (!paramList.contains(QLatin1String("no-fullscreen"))) { +    if (!paramList.contains("no-fullscreen"_L1)) {          options |= QQnxIntegration::FullScreenApplication;      } -    if (paramList.contains(QLatin1String("flush-screen-context"))) { +    if (paramList.contains("flush-screen-context"_L1)) {          options |= QQnxIntegration::AlwaysFlushScreenContext;      } -    if (paramList.contains(QLatin1String("rootwindow"))) { +    if (paramList.contains("rootwindow"_L1)) {          options |= QQnxIntegration::RootWindow;      } -    if (!paramList.contains(QLatin1String("disable-EGL_KHR_surfaceless_context"))) { +    if (!paramList.contains("disable-EGL_KHR_surfaceless_context"_L1)) {          options |= QQnxIntegration::SurfacelessEGLContext;      } @@ -570,7 +572,7 @@ static bool getRequestedDisplays(QJsonArray &requestedDisplays)      // Read the requested display order      const QJsonObject object = doc.object(); -    requestedDisplays = object.value(QLatin1String("displayOrder")).toArray(); +    requestedDisplays = object.value("displayOrder"_L1).toArray();      return true;  } diff --git a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp index ed83e2a958c..dd2e9c662df 100644 --- a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp +++ b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp @@ -60,6 +60,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  QQnxNativeInterface::QQnxNativeInterface(QQnxIntegration *integration)      : m_integration(integration)  { @@ -116,7 +118,7 @@ void QQnxNativeInterface::setWindowProperty(QPlatformWindow *window, const QStri  {      QQnxWindow *qnxWindow = static_cast<QQnxWindow*>(window); -    if (name == QLatin1String("qnxWindowGroup")) { +    if (name == "qnxWindowGroup"_L1) {          if (value.isNull())              qnxWindow->joinWindowGroup(QByteArray());          else if (value.canConvert<QByteArray>()) diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp index 84cfbea27d1..8341ecd8729 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp @@ -136,6 +136,8 @@ static void finishCloseEvent(screen_event_t event)  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  QQnxScreenEventHandler::QQnxScreenEventHandler(QQnxIntegration *integration)      : m_qnxIntegration(integration)      , m_lastButtonState(Qt::NoButton) @@ -147,7 +149,7 @@ QQnxScreenEventHandler::QQnxScreenEventHandler(QQnxIntegration *integration)  {      // Create a touch device      m_touchDevice = new QPointingDevice( -            QLatin1String("touchscreen"), 1, QInputDevice::DeviceType::TouchScreen, +            "touchscreen"_L1, 1, QInputDevice::DeviceType::TouchScreen,              QPointingDevice::PointerType::Finger,              QPointingDevice::Capability::Position | QPointingDevice::Capability::Area                      | QPointingDevice::Capability::Pressure @@ -155,7 +157,7 @@ QQnxScreenEventHandler::QQnxScreenEventHandler(QQnxIntegration *integration)              MaximumTouchPoints, 8);      QWindowSystemInterface::registerInputDevice(m_touchDevice); -    m_mouseDevice = new QPointingDevice(QLatin1String("mouse"), 2, QInputDevice::DeviceType::Mouse, +    m_mouseDevice = new QPointingDevice("mouse"_L1, 2, QInputDevice::DeviceType::Mouse,                                          QPointingDevice::PointerType::Generic,                                          QPointingDevice::Capability::Position, 1, 8);      QWindowSystemInterface::registerInputDevice(m_mouseDevice); diff --git a/src/plugins/platforms/vkkhrdisplay/main.cpp b/src/plugins/platforms/vkkhrdisplay/main.cpp index d9a0a155f49..e9354a62345 100644 --- a/src/plugins/platforms/vkkhrdisplay/main.cpp +++ b/src/plugins/platforms/vkkhrdisplay/main.cpp @@ -42,6 +42,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  class QVkKhrDisplayIntegrationPlugin : public QPlatformIntegrationPlugin  {      Q_OBJECT @@ -52,7 +54,7 @@ public:  QPlatformIntegration *QVkKhrDisplayIntegrationPlugin::create(const QString &system, const QStringList ¶mList)  { -    if (!system.compare(QLatin1String("vkkhrdisplay"), Qt::CaseInsensitive)) +    if (!system.compare("vkkhrdisplay"_L1, Qt::CaseInsensitive))          return new QVkKhrDisplayIntegration(paramList);      return 0; diff --git a/src/plugins/platforms/vkkhrdisplay/qvkkhrdisplayintegration.cpp b/src/plugins/platforms/vkkhrdisplay/qvkkhrdisplayintegration.cpp index 34f5ebb9624..9239d78ceb3 100644 --- a/src/plugins/platforms/vkkhrdisplay/qvkkhrdisplayintegration.cpp +++ b/src/plugins/platforms/vkkhrdisplay/qvkkhrdisplayintegration.cpp @@ -70,6 +70,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  class QVkKhrDisplayScreen : public QPlatformScreen  {  public: @@ -321,7 +323,7 @@ void QVkKhrDisplayIntegration::createInputHandlers()  {  #if QT_CONFIG(libinput)      if (!qEnvironmentVariableIntValue("QT_QPA_NO_LIBINPUT")) { -        new QLibInputHandler(QLatin1String("libinput"), QString()); +        new QLibInputHandler("libinput"_L1, QString());          return;      }  #endif @@ -329,16 +331,16 @@ void QVkKhrDisplayIntegration::createInputHandlers()  #if QT_CONFIG(tslib)      bool useTslib = qEnvironmentVariableIntValue("QT_QPA_TSLIB");      if (useTslib) -        new QTsLibMouseHandler(QLatin1String("TsLib"), QString()); +        new QTsLibMouseHandler("TsLib"_L1, QString());  #endif  #if QT_CONFIG(evdev) -    new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString(), this); -    new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString(), this); +    new QEvdevKeyboardManager("EvdevKeyboard"_L1, QString(), this); +    new QEvdevMouseManager("EvdevMouse"_L1, QString(), this);  #if QT_CONFIG(tslib)      if (!useTslib)  #endif -        new QEvdevTouchManager(QLatin1String("EvdevTouch"), QString() /* spec */, this); +        new QEvdevTouchManager("EvdevTouch"_L1, QString() /* spec */, this);  #endif  } diff --git a/src/plugins/platforms/vnc/main.cpp b/src/plugins/platforms/vnc/main.cpp index ac7e18e03f3..37de190a10b 100644 --- a/src/plugins/platforms/vnc/main.cpp +++ b/src/plugins/platforms/vnc/main.cpp @@ -43,6 +43,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  class QVncIntegrationPlugin : public QPlatformIntegrationPlugin  {      Q_OBJECT @@ -53,7 +55,7 @@ public:  QPlatformIntegration* QVncIntegrationPlugin::create(const QString& system, const QStringList& paramList)  { -    if (!system.compare(QLatin1String("vnc"), Qt::CaseInsensitive)) +    if (!system.compare("vnc"_L1, Qt::CaseInsensitive))          return new QVncIntegration(paramList);      return nullptr; diff --git a/src/plugins/platforms/vnc/qvncintegration.cpp b/src/plugins/platforms/vnc/qvncintegration.cpp index e6586ebfa6c..04bc644878e 100644 --- a/src/plugins/platforms/vnc/qvncintegration.cpp +++ b/src/plugins/platforms/vnc/qvncintegration.cpp @@ -58,11 +58,13 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  QVncIntegration::QVncIntegration(const QStringList ¶mList)      : m_fontDb(new QGenericUnixFontDatabase),        m_services(new QGenericUnixServices)  { -    QRegularExpression portRx(QLatin1String("port=(\\d+)")); +    QRegularExpression portRx("port=(\\d+)"_L1);      quint16 port = 5900;      for (const QString &arg : paramList) {          QRegularExpressionMatch match; diff --git a/src/plugins/platforms/vnc/qvncscreen.cpp b/src/plugins/platforms/vnc/qvncscreen.cpp index f3d711e5c9a..432132bdf57 100644 --- a/src/plugins/platforms/vnc/qvncscreen.cpp +++ b/src/plugins/platforms/vnc/qvncscreen.cpp @@ -49,6 +49,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  QVncScreen::QVncScreen(const QStringList &args)      : mArgs(args) @@ -66,9 +68,9 @@ QVncScreen::~QVncScreen()  bool QVncScreen::initialize()  { -    QRegularExpression sizeRx(QLatin1String("size=(\\d+)x(\\d+)")); -    QRegularExpression mmSizeRx(QLatin1String("mmsize=(?<width>(\\d*\\.)?\\d+)x(?<height>(\\d*\\.)?\\d+)")); -    QRegularExpression depthRx(QLatin1String("depth=(\\d+)")); +    QRegularExpression sizeRx("size=(\\d+)x(\\d+)"_L1); +    QRegularExpression mmSizeRx("mmsize=(?<width>(\\d*\\.)?\\d+)x(?<height>(\\d*\\.)?\\d+)"_L1); +    QRegularExpression depthRx("depth=(\\d+)"_L1);      mGeometry = QRect(0, 0, 1024, 768);      mFormat = QImage::Format_ARGB32_Premultiplied; diff --git a/src/plugins/platforms/wasm/qwasmfontdatabase.cpp b/src/plugins/platforms/wasm/qwasmfontdatabase.cpp index 7623444588e..7ca374c1d53 100644 --- a/src/plugins/platforms/wasm/qwasmfontdatabase.cpp +++ b/src/plugins/platforms/wasm/qwasmfontdatabase.cpp @@ -33,6 +33,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  void QWasmFontDatabase::populateFontDatabase()  {      // Load font file from resources. Currently @@ -81,7 +83,7 @@ void QWasmFontDatabase::releaseHandle(void *handle)  QFont QWasmFontDatabase::defaultFont() const  { -    return QFont(QLatin1String("Bitstream Vera Sans")); +    return QFont("Bitstream Vera Sans"_L1);  }  QT_END_NAMESPACE diff --git a/src/plugins/platforms/wasm/qwasmintegration.cpp b/src/plugins/platforms/wasm/qwasmintegration.cpp index 61e45c52d08..c66ca4ce4a1 100644 --- a/src/plugins/platforms/wasm/qwasmintegration.cpp +++ b/src/plugins/platforms/wasm/qwasmintegration.cpp @@ -61,6 +61,8 @@  using namespace emscripten;  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  static void addContainerElement(emscripten::val element)  {      QWasmIntegration::get()->addScreen(element); @@ -296,12 +298,12 @@ Qt::WindowState QWasmIntegration::defaultWindowState(Qt::WindowFlags flags) cons  QStringList QWasmIntegration::themeNames() const  { -    return QStringList() << QLatin1String("webassembly"); +    return QStringList() << "webassembly"_L1;  }  QPlatformTheme *QWasmIntegration::createPlatformTheme(const QString &name) const  { -    if (name == QLatin1String("webassembly")) +    if (name == "webassembly"_L1)          return new QWasmTheme;      return QPlatformIntegration::createPlatformTheme(name);  } diff --git a/src/plugins/platforms/wasm/qwasmtheme.cpp b/src/plugins/platforms/wasm/qwasmtheme.cpp index 438e3e11197..2f84707a00f 100644 --- a/src/plugins/platforms/wasm/qwasmtheme.cpp +++ b/src/plugins/platforms/wasm/qwasmtheme.cpp @@ -33,6 +33,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  QWasmTheme::QWasmTheme()  {      for (auto family : QFontDatabase::families()) @@ -49,7 +51,7 @@ QWasmTheme::~QWasmTheme()  QVariant QWasmTheme::themeHint(ThemeHint hint) const  {      if (hint == QPlatformTheme::StyleNames) -        return QVariant(QStringList() << QLatin1String("Fusion")); +        return QVariant(QStringList() << "Fusion"_L1);      return QPlatformTheme::themeHint(hint);  } diff --git a/src/plugins/platforms/windows/main.cpp b/src/plugins/platforms/windows/main.cpp index a3f81ec9fc8..5f5d2baf0d0 100644 --- a/src/plugins/platforms/windows/main.cpp +++ b/src/plugins/platforms/windows/main.cpp @@ -45,6 +45,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  /*!      \title Qt platform plugin for Windows @@ -106,7 +108,7 @@ public:  QPlatformIntegration *QWindowsIntegrationPlugin::create(const QString& system, const QStringList& paramList, int &, char **)  { -    if (system.compare(system, QLatin1String("windows"), Qt::CaseInsensitive) == 0) +    if (system.compare(system, "windows"_L1, Qt::CaseInsensitive) == 0)          return new QWindowsGdiIntegration(paramList);      return nullptr;  } diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 721e6a4929e..efbc410e053 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -94,6 +94,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  Q_LOGGING_CATEGORY(lcQpaWindows, "qt.qpa.windows")  Q_LOGGING_CATEGORY(lcQpaEvents, "qt.qpa.events")  Q_LOGGING_CATEGORY(lcQpaGl, "qt.qpa.gl") @@ -544,28 +546,28 @@ QString QWindowsContext::registerWindowClass(const QWindow *w)      }      // Create a unique name for the flag combination      QString cname = classNamePrefix(); -    cname += QLatin1String("QWindow"); +    cname += "QWindow"_L1;      switch (type) {      case Qt::Tool: -        cname += QLatin1String("Tool"); +        cname += "Tool"_L1;          break;      case Qt::ToolTip: -        cname += QLatin1String("ToolTip"); +        cname += "ToolTip"_L1;          break;      case Qt::Popup: -        cname += QLatin1String("Popup"); +        cname += "Popup"_L1;          break;      default:          break;      }      if (style & CS_DROPSHADOW) -        cname += QLatin1String("DropShadow"); +        cname += "DropShadow"_L1;      if (style & CS_SAVEBITS) -        cname += QLatin1String("SaveBits"); +        cname += "SaveBits"_L1;      if (style & CS_OWNDC) -        cname += QLatin1String("OwnDC"); +        cname += "OwnDC"_L1;      if (icon) -        cname += QLatin1String("Icon"); +        cname += "Icon"_L1;      return registerWindowClass(cname, qWindowsWndProc, style, GetSysColorBrush(COLOR_WINDOW), icon);  } diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index ec0a5045773..fa24c734cfe 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -79,6 +79,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  #ifndef QT_NO_DEBUG_STREAM  /* Output UID (IID, CLSID) as C++ constants.   * The constants are contained in the Windows SDK libs, but not for MinGW. */ @@ -666,13 +668,13 @@ QWindowsShellItem::IShellItems QWindowsShellItem::itemsFromItemArray(IShellItemA  bool QWindowsShellItem::copyData(QIODevice *out, QString *errorMessage)  {      if (!canStream()) { -        *errorMessage = QLatin1String("Item not streamable"); +        *errorMessage = "Item not streamable"_L1;          return false;      }      IStream *istream = nullptr;      HRESULT hr = m_item->BindToHandler(nullptr, BHID_Stream, IID_PPV_ARGS(&istream));      if (FAILED(hr)) { -        *errorMessage = QLatin1String("BindToHandler() failed: ") +        *errorMessage = "BindToHandler() failed: "_L1                          + QLatin1String(QWindowsContext::comErrorString(hr));          return false;      } @@ -689,7 +691,7 @@ bool QWindowsShellItem::copyData(QIODevice *out, QString *errorMessage)      }      istream->Release();      if (hr != S_OK && hr != S_FALSE) { -        *errorMessage = QLatin1String("Read() failed: ") +        *errorMessage = "Read() failed: "_L1                          + QLatin1String(QWindowsContext::comErrorString(hr));          return false;      } @@ -1439,14 +1441,14 @@ QString tempFilePattern(QString name)  static QString createTemporaryItemCopy(QWindowsShellItem &qItem, QString *errorMessage)  {      if (!qItem.canStream()) { -        *errorMessage = QLatin1String("Item not streamable"); +        *errorMessage = "Item not streamable"_L1;          return QString();      }      QTemporaryFile targetFile(tempFilePattern(qItem.normalDisplay()));      targetFile.setAutoRemove(false);      if (!targetFile.open())  { -        *errorMessage = QLatin1String("Cannot create temporary file: ") +        *errorMessage = "Cannot create temporary file: "_L1                          + targetFile.errorString();          return QString();      } diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index fc60e91aa12..11233585ce2 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -101,6 +101,8 @@ static inline void initOpenGlBlacklistResources()  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  /*!      \class QWindowsIntegration      \brief QPlatformIntegration implementation for Windows. @@ -211,9 +213,9 @@ static inline unsigned parseOptions(const QStringList ¶mList,              options |= QWindowsIntegration::DontUseColorFonts;          } else if (param == u"nomousefromtouch") {              options |= QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch; -        } else if (parseIntOption(param, QLatin1String("verbose"), 0, INT_MAX, &QWindowsContext::verbose) -            || parseIntOption(param, QLatin1String("tabletabsoluterange"), 0, INT_MAX, tabletAbsoluteRange) -            || parseIntOption(param, QLatin1String("dpiawareness"), QtWindows::ProcessDpiUnaware, QtWindows::ProcessPerMonitorV2DpiAware, dpiAwareness)) { +        } else if (parseIntOption(param, "verbose"_L1, 0, INT_MAX, &QWindowsContext::verbose) +            || parseIntOption(param, "tabletabsoluterange"_L1, 0, INT_MAX, tabletAbsoluteRange) +            || parseIntOption(param, "dpiawareness"_L1, QtWindows::ProcessDpiUnaware, QtWindows::ProcessPerMonitorV2DpiAware, dpiAwareness)) {          } else if (param == u"menus=native") {              options |= QWindowsIntegration::AlwaysUseNativeMenus;          } else if (param == u"menus=none") { diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp index 3dd9e3df41b..a858543f352 100644 --- a/src/plugins/platforms/windows/qwindowsmime.cpp +++ b/src/plugins/platforms/windows/qwindowsmime.cpp @@ -55,6 +55,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  /* The MSVC compilers allows multi-byte characters, that has the behavior of   * that each character gets shifted into position. 0x73524742 below is for MSVC   * equivalent to doing 'sRGB', but this does of course not work @@ -583,7 +585,7 @@ QVariant QWindowsMimeText::convertToMime(const QString &mime, LPDATAOBJECT pData          QByteArray data = getData(CF_UNICODETEXT, pDataObj);          if (!data.isEmpty()) {              str = QString::fromWCharArray(reinterpret_cast<const wchar_t *>(data.constData())); -            str.replace(QLatin1String("\r\n"), QLatin1String("\n")); +            str.replace("\r\n"_L1, "\n"_L1);          } else {              data = getData(CF_TEXT, pDataObj);              if (!data.isEmpty()) { diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index 44749057442..47f97691c54 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -60,6 +60,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  static inline QDpi deviceDPI(HDC hdc)  {      return QDpi(GetDeviceCaps(hdc, LOGPIXELSX), GetDeviceCaps(hdc, LOGPIXELSY)); @@ -485,9 +487,9 @@ QPlatformScreen::SubpixelAntialiasingType QWindowsScreen::subpixelAntialiasingTy  {      QPlatformScreen::SubpixelAntialiasingType type = QPlatformScreen::subpixelAntialiasingTypeHint();      if (type == QPlatformScreen::Subpixel_None) { -        QSettings settings(QLatin1String(R"(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Avalon.Graphics\DISPLAY1)"), +        QSettings settings(R"(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Avalon.Graphics\DISPLAY1)"_L1,                             QSettings::NativeFormat); -        int registryValue = settings.value(QLatin1String("PixelStructure"), -1).toInt(); +        int registryValue = settings.value("PixelStructure"_L1, -1).toInt();          switch (registryValue) {          case 0:              type = QPlatformScreen::Subpixel_None; diff --git a/src/plugins/platforms/windows/qwindowsservices.cpp b/src/plugins/platforms/windows/qwindowsservices.cpp index 6c3e4a9badf..a81787f47bd 100644 --- a/src/plugins/platforms/windows/qwindowsservices.cpp +++ b/src/plugins/platforms/windows/qwindowsservices.cpp @@ -54,6 +54,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  enum { debug = 0 };  class QWindowsShellExecuteThread : public QThread @@ -111,8 +113,8 @@ static inline QString mailCommand()      // Check if user has set preference, otherwise use default.      QString keyName = QWinRegistryKey(HKEY_CURRENT_USER, mailUserKey)                        .stringValue( L"Progid"); -    const QLatin1String mailto = keyName.isEmpty() ? QLatin1String("mailto") : QLatin1String(); -    keyName += mailto + QLatin1String("\\Shell\\Open\\Command"); +    const auto mailto = keyName.isEmpty() ? "mailto"_L1 : QLatin1String(); +    keyName += mailto + "\\Shell\\Open\\Command"_L1;      if (debug)          qDebug() << __FUNCTION__ << "keyName=" << keyName;      const QString command = QWinRegistryKey(HKEY_CLASSES_ROOT, keyName).stringValue(L""); @@ -146,7 +148,7 @@ static inline bool launchMail(const QUrl &url)      }      // Pass the url as the parameter. Should use QProcess::startDetached(),      // but that cannot handle a Windows command line [yet]. -    command.replace(QLatin1String("%1"), url.toString(QUrl::FullyEncoded)); +    command.replace("%1"_L1, url.toString(QUrl::FullyEncoded));      if (debug)          qDebug() << __FUNCTION__ << "Launching" << command;      //start the process diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp index 9ee6bbd79a1..f64022332d3 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -88,6 +88,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  static inline QColor COLORREFToQColor(COLORREF cr)  {      return QColor(GetRValue(cr), GetGValue(cr), GetBValue(cr)); @@ -460,7 +462,7 @@ QWindowsTheme::~QWindowsTheme()  static inline QStringList iconThemeSearchPaths()  { -    const QFileInfo appDir(QCoreApplication::applicationDirPath() + QLatin1String("/icons")); +    const QFileInfo appDir(QCoreApplication::applicationDirPath() + "/icons"_L1);      return appDir.isDir() ? QStringList(appDir.absoluteFilePath()) : QStringList();  } @@ -833,7 +835,7 @@ enum { // Shell image list ids  static QString dirIconPixmapCacheKey(int iIcon, int iconSize, int imageListSize)  { -    QString key = QLatin1String("qt_dir_") + QString::number(iIcon); +    QString key = "qt_dir_"_L1 + QString::number(iIcon);      if (iconSize == SHGFI_LARGEICON)          key += u'l';      switch (imageListSize) { @@ -924,7 +926,7 @@ QString QWindowsFileIconEngine::cacheKey() const          || !suffix.compare(u"ico", Qt::CaseInsensitive)) {          return QString();      } -    return QLatin1String("qt_.") +    return "qt_."_L1          + (suffix.isEmpty() ? fileInfo().fileName() : std::move(suffix).toUpper()); // handle "Makefile"                                    ;)  } diff --git a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp index 8412663e3c8..6a33b085097 100644 --- a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp @@ -47,8 +47,10 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, -    (QXcbGlIntegrationFactoryInterface_iid, QLatin1String("/xcbglintegrations"), Qt::CaseInsensitive)) +    (QXcbGlIntegrationFactoryInterface_iid, "/xcbglintegrations"_L1, Qt::CaseInsensitive))  QXcbGlIntegration *QXcbGlIntegrationFactory::create(const QString &platform)  { diff --git a/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp b/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp index 1e3c60ccd58..83533c974eb 100644 --- a/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp +++ b/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp @@ -60,6 +60,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  #if QT_CONFIG(xrender)  class QXRenderTessellator : public QTessellator @@ -451,7 +453,7 @@ static const uchar base_dither_matrix[DITHER_SIZE][DITHER_SIZE] = {  static QPixmap qt_patternForAlpha(uchar alpha, int screen)  {      QPixmap pm; -    QString key = QLatin1String("$qt-alpha-brush$") +    QString key = "$qt-alpha-brush$"_L1                    % HexString<uchar>(alpha)                    % HexString<int>(screen); diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 191d5af26c1..8d0bfbb916e 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -73,6 +73,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  Q_LOGGING_CATEGORY(lcQpaXInput, "qt.qpa.input")  Q_LOGGING_CATEGORY(lcQpaXInputDevices, "qt.qpa.input.devices")  Q_LOGGING_CATEGORY(lcQpaXInputEvents, "qt.qpa.input.events") @@ -898,7 +900,7 @@ xcb_window_t QXcbConnection::qtSelectionOwner()                            nullptr);                           // value list          QXcbWindow::setWindowTitle(connection(), m_qtSelectionOwner, -                                   QLatin1String("Qt Selection Owner for ") + QCoreApplication::applicationName()); +                                   "Qt Selection Owner for "_L1 + QCoreApplication::applicationName());      }      return m_qtSelectionOwner;  } @@ -1162,7 +1164,7 @@ QXcbGlIntegration *QXcbConnection::glIntegration() const      QString glIntegrationName = QString::fromLocal8Bit(qgetenv("QT_XCB_GL_INTEGRATION"));      if (!glIntegrationName.isEmpty()) {          qCDebug(lcQpaGl) << "QT_XCB_GL_INTEGRATION is set to" << glIntegrationName; -        if (glIntegrationName != QLatin1String("none")) { +        if (glIntegrationName != "none"_L1) {              glIntegrationNames.removeAll(glIntegrationName);              glIntegrationNames.prepend(glIntegrationName);          } else { diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index d09e598114b..c9e45e623ab 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -53,6 +53,8 @@  #define QT_XCB_HAS_TOUCHPAD_GESTURES (XCB_INPUT_MINOR_VERSION >= 4) +using namespace Qt::StringLiterals; +  using qt_xcb_input_device_event_t = xcb_input_button_press_event_t;  #if QT_XCB_HAS_TOUCHPAD_GESTURES  using qt_xcb_input_pinch_event_t = xcb_input_gesture_pinch_begin_event_t; @@ -371,42 +373,42 @@ void QXcbConnection::xi2SetupSlavePointerDevice(void *info, bool removeExisting,      // But we need to be careful not to take the touch and tablet-button devices as tablets.      QByteArray nameLower = nameRaw.toLower(); -    QString dbgType = QLatin1String("UNKNOWN"); +    QString dbgType = "UNKNOWN"_L1;      if (nameLower.contains("eraser")) {          isTablet = true;          tabletData.pointerType = QPointingDevice::PointerType::Eraser; -        dbgType = QLatin1String("eraser"); +        dbgType = "eraser"_L1;      } else if (nameLower.contains("cursor") && !(nameLower.contains("cursor controls") && nameLower.contains("trackball"))) {          isTablet = true;          tabletData.pointerType = QPointingDevice::PointerType::Cursor; -        dbgType = QLatin1String("cursor"); +        dbgType = "cursor"_L1;      } else if (nameLower.contains("wacom") && nameLower.contains("finger touch")) {          isTablet = false;      } else if ((nameLower.contains("pen") || nameLower.contains("stylus")) && isTablet) {          tabletData.pointerType = QPointingDevice::PointerType::Pen; -        dbgType = QLatin1String("pen"); +        dbgType = "pen"_L1;      } else if (nameLower.contains("wacom") && isTablet && !nameLower.contains("touch")) {          // combined device (evdev) rather than separate pen/eraser (wacom driver)          tabletData.pointerType = QPointingDevice::PointerType::Pen; -        dbgType = QLatin1String("pen"); +        dbgType = "pen"_L1;      } else if (nameLower.contains("aiptek") /* && device == QXcbAtom::KEYBOARD */) {          // some "Genius" tablets          isTablet = true;          tabletData.pointerType = QPointingDevice::PointerType::Pen; -        dbgType = QLatin1String("pen"); +        dbgType = "pen"_L1;      } else if (nameLower.contains("waltop") && nameLower.contains("tablet")) {          // other "Genius" tablets          // WALTOP International Corp. Slim Tablet          isTablet = true;          tabletData.pointerType = QPointingDevice::PointerType::Pen; -        dbgType = QLatin1String("pen"); +        dbgType = "pen"_L1;      } else if (nameLower.contains("uc-logic") && isTablet) {          tabletData.pointerType = QPointingDevice::PointerType::Pen; -        dbgType = QLatin1String("pen"); +        dbgType = "pen"_L1;      } else if (nameLower.contains("ugee")) {          isTablet = true;          tabletData.pointerType = QPointingDevice::PointerType::Pen; -        dbgType = QLatin1String("pen"); +        dbgType = "pen"_L1;      } else {          isTablet = false;      } diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp index 9f8007066d7..d539b0c8492 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.cpp +++ b/src/plugins/platforms/xcb/qxcbcursor.cpp @@ -55,6 +55,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  typedef int (*PtrXcursorLibraryLoadCursor)(void *, const char *);  typedef char *(*PtrXcursorLibraryGetTheme)(void *);  typedef int (*PtrXcursorLibrarySetTheme)(void *, const char *); @@ -317,10 +319,10 @@ QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen)  #if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)      static bool function_ptrs_not_initialized = true;      if (function_ptrs_not_initialized) { -        QLibrary xcursorLib(QLatin1String("Xcursor"), 1); +        QLibrary xcursorLib("Xcursor"_L1, 1);          bool xcursorFound = xcursorLib.load();          if (!xcursorFound) { // try without the version number -            xcursorLib.setFileName(QLatin1String("Xcursor")); +            xcursorLib.setFileName("Xcursor"_L1);              xcursorFound = xcursorLib.load();          }          if (xcursorFound) { diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 672e6d92a8b..c4947615d0a 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -100,16 +100,18 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  // Find out if our parent process is gdb by looking at the 'exe' symlink under /proc,.  // or, for older Linuxes, read out 'cmdline'.  static bool runningUnderDebugger()  {  #if defined(QT_DEBUG) && defined(Q_OS_LINUX) -    const QString parentProc = QLatin1String("/proc/") + QString::number(getppid()); -    const QFileInfo parentProcExe(parentProc + QLatin1String("/exe")); +    const QString parentProc = "/proc/"_L1 + QString::number(getppid()); +    const QFileInfo parentProcExe(parentProc + "/exe"_L1);      if (parentProcExe.isSymLink()) -        return parentProcExe.symLinkTarget().endsWith(QLatin1String("/gdb")); -    QFile f(parentProc + QLatin1String("/cmdline")); +        return parentProcExe.symLinkTarget().endsWith("/gdb"_L1); +    QFile f(parentProc + "/cmdline"_L1);      if (!f.open(QIODevice::ReadOnly))          return false;      QByteArray s; @@ -360,14 +362,14 @@ QAbstractEventDispatcher *QXcbIntegration::createEventDispatcher() const  void QXcbIntegration::initialize()  { -    const QLatin1String defaultInputContext("compose"); +    const auto defaultInputContext = "compose"_L1;      // Perform everything that may potentially need the event dispatcher (timers, socket      // notifiers) here instead of the constructor.      QString icStr = QPlatformInputContextFactory::requested();      if (icStr.isNull())          icStr = defaultInputContext;      m_inputContext.reset(QPlatformInputContextFactory::create(icStr)); -    if (!m_inputContext && icStr != defaultInputContext && icStr != QLatin1String("none")) +    if (!m_inputContext && icStr != defaultInputContext && icStr != "none"_L1)          m_inputContext.reset(QPlatformInputContextFactory::create(defaultInputContext));      connection()->keyboard()->initialize(); diff --git a/src/plugins/platforms/xcb/qxcbmain.cpp b/src/plugins/platforms/xcb/qxcbmain.cpp index 1fb5f4a8413..6df863ccce6 100644 --- a/src/plugins/platforms/xcb/qxcbmain.cpp +++ b/src/plugins/platforms/xcb/qxcbmain.cpp @@ -42,6 +42,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  class QXcbIntegrationPlugin : public QPlatformIntegrationPlugin  {     Q_OBJECT @@ -52,7 +54,7 @@ public:  QPlatformIntegration* QXcbIntegrationPlugin::create(const QString& system, const QStringList& parameters, int &argc, char **argv)  { -    if (!system.compare(QLatin1String("xcb"), Qt::CaseInsensitive)) { +    if (!system.compare("xcb"_L1, Qt::CaseInsensitive)) {          auto xcbIntegration = new QXcbIntegration(parameters, argc, argv);          if (!xcbIntegration->hasConnection()) {              delete xcbIntegration; diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp index f4672c3f75c..0a42953eecf 100644 --- a/src/plugins/platforms/xcb/qxcbmime.cpp +++ b/src/plugins/platforms/xcb/qxcbmime.cpp @@ -45,6 +45,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  QXcbMime::QXcbMime()      : QInternalMimeData()  { } @@ -63,11 +65,11 @@ QString QXcbMime::mimeAtomToString(QXcbConnection *connection, xcb_atom_t a)      if (a == XCB_ATOM_STRING          || a == connection->atom(QXcbAtom::UTF8_STRING)          || a == connection->atom(QXcbAtom::TEXT)) -        return QLatin1String("text/plain"); +        return "text/plain"_L1;      // special case for images      if (a == XCB_ATOM_PIXMAP) -        return QLatin1String("image/ppm"); +        return "image/ppm"_L1;      QByteArray atomName = connection->atomName(a); @@ -91,15 +93,15 @@ bool QXcbMime::mimeDataForAtom(QXcbConnection *connection, xcb_atom_t a, QMimeDa      if ((a == connection->atom(QXcbAtom::UTF8_STRING)           || a == XCB_ATOM_STRING           || a == connection->atom(QXcbAtom::TEXT)) -        && QInternalMimeData::hasFormatHelper(QLatin1String("text/plain"), mimeData)) { +        && QInternalMimeData::hasFormatHelper("text/plain"_L1, mimeData)) {          if (a == connection->atom(QXcbAtom::UTF8_STRING)) { -            *data = QInternalMimeData::renderDataHelper(QLatin1String("text/plain"), mimeData); +            *data = QInternalMimeData::renderDataHelper("text/plain"_L1, mimeData);              ret = true;          } else if (a == XCB_ATOM_STRING ||                     a == connection->atom(QXcbAtom::TEXT)) {              // ICCCM says STRING is latin1              *data = QString::fromUtf8(QInternalMimeData::renderDataHelper( -                        QLatin1String("text/plain"), mimeData)).toLatin1(); +                        "text/plain"_L1, mimeData)).toLatin1();              ret = true;          }          return ret; @@ -110,18 +112,17 @@ bool QXcbMime::mimeDataForAtom(QXcbConnection *connection, xcb_atom_t a, QMimeDa          *data = QInternalMimeData::renderDataHelper(atomName, mimeData);          // mimeAtomToString() converts "text/x-moz-url" to "text/uri-list",          // so QXcbConnection::atomName() has to be used. -        if (atomName == QLatin1String("text/uri-list") +        if (atomName == "text/uri-list"_L1              && connection->atomName(a) == "text/x-moz-url") {              const QString mozUri = QLatin1String(data->split('\n').constFirst()) + u'\n';              *data = QByteArray(reinterpret_cast<const char *>(mozUri.data()),                                 mozUri.length() * 2); -        } else if (atomName == QLatin1String("application/x-color")) +        } else if (atomName == "application/x-color"_L1)              *dataFormat = 16;          ret = true;      } else if ((a == XCB_ATOM_PIXMAP || a == XCB_ATOM_BITMAP) && mimeData->hasImage()) {          ret = true; -    } else if (atomName == QLatin1String("text/plain") -               && mimeData->hasFormat(QLatin1String("text/uri-list"))) { +    } else if (atomName == "text/plain"_L1 && mimeData->hasFormat("text/uri-list"_L1)) {          // Return URLs also as plain text.          *data = QInternalMimeData::renderDataHelper(atomName, mimeData);          ret = true; @@ -136,22 +137,22 @@ QList<xcb_atom_t> QXcbMime::mimeAtomsForFormat(QXcbConnection *connection, const      atoms.append(connection->internAtom(format.toLatin1()));      // special cases for strings -    if (format == QLatin1String("text/plain")) { +    if (format == "text/plain"_L1) {          atoms.append(connection->atom(QXcbAtom::UTF8_STRING));          atoms.append(XCB_ATOM_STRING);          atoms.append(connection->atom(QXcbAtom::TEXT));      }      // special cases for uris -    if (format == QLatin1String("text/uri-list")) { +    if (format == "text/uri-list"_L1) {          atoms.append(connection->internAtom("text/x-moz-url"));          atoms.append(connection->internAtom("text/plain"));      }      //special cases for images -    if (format == QLatin1String("image/ppm")) +    if (format == "image/ppm"_L1)          atoms.append(XCB_ATOM_PIXMAP); -    if (format == QLatin1String("image/pbm")) +    if (format == "image/pbm"_L1)          atoms.append(XCB_ATOM_BITMAP);      return atoms; @@ -164,14 +165,14 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a,      QString atomName = mimeAtomToString(connection, a);  //    qDebug() << "mimeConvertDataToFormat" << format << atomName << data; -    if (hasUtf8 && atomName == format + QLatin1String(";charset=utf-8")) { +    if (hasUtf8 && atomName == format + ";charset=utf-8"_L1) {          if (requestedType.id() == QMetaType::QString)              return QString::fromUtf8(data);          return data;      }      // special cases for string types -    if (format == QLatin1String("text/plain")) { +    if (format == "text/plain"_L1) {          if (data.endsWith('\0'))              data.chop(1);          if (a == connection->atom(QXcbAtom::UTF8_STRING)) { @@ -185,7 +186,7 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a,      // Firefox uses UTF16 without BOM for text/x-moz-url, "text/html",      // Google Chrome uses UTF16 without BOM for "text/x-moz-url",      // UTF16 with BOM for "text/html". -    if ((format == QLatin1String("text/html") || format == QLatin1String("text/uri-list")) +    if ((format == "text/html"_L1 || format == "text/uri-list"_L1)          && data.size() > 1) {          const quint8 byte0 = data.at(0);          const quint8 byte1 = data.at(1); @@ -194,7 +195,7 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a,              const QString str = QString::fromUtf16(                    reinterpret_cast<const char16_t *>(data.constData()), data.size() / 2);              if (!str.isNull()) { -                if (format == QLatin1String("text/uri-list")) { +                if (format == "text/uri-list"_L1) {                      const auto urls = QStringView{str}.split(u'\n');                      QList<QVariant> list;                      list.reserve(urls.size()); @@ -224,7 +225,7 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a,  #if 0 // ###      // special case for images -    if (format == QLatin1String("image/ppm")) { +    if (format == "image/ppm"_L1) {          if (a == XCB_ATOM_PIXMAP && data.size() == sizeof(Pixmap)) {              Pixmap xpm = *((Pixmap*)data.data());              if (!xpm) @@ -261,7 +262,7 @@ xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString      *hasUtf8 = false;      // find matches for string types -    if (format == QLatin1String("text/plain")) { +    if (format == "text/plain"_L1) {          if (atoms.contains(connection->atom(QXcbAtom::UTF8_STRING)))              return connection->atom(QXcbAtom::UTF8_STRING);          if (atoms.contains(XCB_ATOM_STRING)) @@ -271,7 +272,7 @@ xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString      }      // find matches for uri types -    if (format == QLatin1String("text/uri-list")) { +    if (format == "text/uri-list"_L1) {          xcb_atom_t a = connection->internAtom(format.toLatin1());          if (a && atoms.contains(a))              return a; @@ -281,7 +282,7 @@ xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString      }      // find match for image -    if (format == QLatin1String("image/ppm")) { +    if (format == "image/ppm"_L1) {          if (atoms.contains(XCB_ATOM_PIXMAP))              return XCB_ATOM_PIXMAP;      } @@ -289,11 +290,11 @@ xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString      // for string/text requests try to use a format with a well-defined charset      // first to avoid encoding problems      if (requestedType.id() == QMetaType::QString -        && format.startsWith(QLatin1String("text/")) -        && !format.contains(QLatin1String("charset="))) { +        && format.startsWith("text/"_L1) +        && !format.contains("charset="_L1)) {          QString formatWithCharset = format; -        formatWithCharset.append(QLatin1String(";charset=utf-8")); +        formatWithCharset.append(";charset=utf-8"_L1);          xcb_atom_t a = connection->internAtom(std::move(formatWithCharset).toLatin1());          if (a && atoms.contains(a)) { diff --git a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp index 64fb29f8df5..b6a11ccfeaa 100644 --- a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp +++ b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp @@ -55,6 +55,8 @@  #include <cerrno> // ERANGE +using namespace Qt::StringLiterals; +  class QSmSocketReceiver : public QObject  {      Q_OBJECT @@ -228,11 +230,11 @@ static void sm_performSaveYourself(QXcbSessionManager *sm)      // generate a restart and discard command that makes sense      QStringList restart; -    restart << argument0 << QLatin1String("-session") << sm->sessionId() + u'_' + sm->sessionKey(); +    restart << argument0 << "-session"_L1 << sm->sessionId() + u'_' + sm->sessionKey();      QFileInfo fi(QCoreApplication::applicationFilePath());      if (qAppName().compare(fi.fileName(), Qt::CaseInsensitive) != 0) -        restart << QLatin1String("-name") << qAppName(); +        restart << "-name"_L1 << qAppName();      sm->setRestartCommand(restart);      QStringList discard;      sm->setDiscardCommand(discard); diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 0aee3835129..2d204a5691d 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -92,6 +92,8 @@ enum {  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  Q_LOGGING_CATEGORY(lcQpaWindow, "qt.qpa.window");  Q_DECLARE_TYPEINFO(xcb_rectangle_t, Q_PRIMITIVE_TYPE); @@ -2354,7 +2356,7 @@ bool QXcbWindow::startSystemMoveResize(const QPoint &pos, int edges)      bool startedByTouch = connection()->startSystemMoveResizeForTouch(m_window, edges);      if (startedByTouch) {          const QString wmname = connection()->windowManagerName(); -        if (wmname != QLatin1String("kwin") && wmname != QLatin1String("openbox")) { +        if (wmname != "kwin"_L1 && wmname != "openbox"_L1) {              qCDebug(lcQpaXInputDevices) << "only KDE and OpenBox support startSystemMove/Resize which is triggered from touch events: XDG_CURRENT_DESKTOP="                                          << qgetenv("XDG_CURRENT_DESKTOP");              connection()->abortSystemMoveResize(m_window); diff --git a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp index 9ffd5fd496a..e9d622c7888 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp @@ -66,6 +66,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  class QGtk3Dialog : public QWindow  {      Q_OBJECT @@ -524,7 +526,7 @@ void QGtk3FileDialogHelper::setNameFilters(const QStringList &filters)          const QString name = filter.left(filter.indexOf(u'('));          const QStringList extensions = cleanFilterList(filter); -        gtk_file_filter_set_name(gtkFilter, qUtf8Printable(name.isEmpty() ? extensions.join(QLatin1String(", ")) : name)); +        gtk_file_filter_set_name(gtkFilter, qUtf8Printable(name.isEmpty() ? extensions.join(", "_L1) : name));          foreach (const QString &ext, extensions)              gtk_file_filter_add_pattern(gtkFilter, qUtf8Printable(ext)); diff --git a/src/plugins/platformthemes/xdgdesktopportal/main.cpp b/src/plugins/platformthemes/xdgdesktopportal/main.cpp index 64a03d479fd..06565d876cc 100644 --- a/src/plugins/platformthemes/xdgdesktopportal/main.cpp +++ b/src/plugins/platformthemes/xdgdesktopportal/main.cpp @@ -42,6 +42,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  class QXdgDesktopPortalThemePlugin : public QPlatformThemePlugin  {     Q_OBJECT @@ -54,9 +56,9 @@ public:  QPlatformTheme *QXdgDesktopPortalThemePlugin::create(const QString &key, const QStringList ¶ms)  {      Q_UNUSED(params); -    if (!key.compare(QLatin1String("xdgdesktopportal"), Qt::CaseInsensitive) || -        !key.compare(QLatin1String("flatpak"), Qt::CaseInsensitive) || -        !key.compare(QLatin1String("snap"), Qt::CaseInsensitive)) +    if (!key.compare("xdgdesktopportal"_L1, Qt::CaseInsensitive) || +        !key.compare("flatpak"_L1, Qt::CaseInsensitive) || +        !key.compare("snap"_L1, Qt::CaseInsensitive))          return new QXdgDesktopPortalTheme;      return nullptr; diff --git a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp index 92ac792b9cd..5a51864d1cb 100644 --- a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp +++ b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp @@ -58,6 +58,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  QDBusArgument &operator <<(QDBusArgument &arg, const QXdgDesktopPortalFileDialog::FilterCondition &filterCondition)  {      arg.beginStructure(); @@ -182,29 +184,29 @@ void QXdgDesktopPortalFileDialog::openPortal()  {      Q_D(QXdgDesktopPortalFileDialog); -    QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"), -                                                          QLatin1String("/org/freedesktop/portal/desktop"), -                                                          QLatin1String("org.freedesktop.portal.FileChooser"), -                                                          d->saveFile ? QLatin1String("SaveFile") : QLatin1String("OpenFile")); -    QString parentWindowId = QLatin1String("x11:") + QString::number(d->winId, 16); +    QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.portal.Desktop"_L1, +                                                          "/org/freedesktop/portal/desktop"_L1, +                                                          "org.freedesktop.portal.FileChooser"_L1, +                                                          d->saveFile ? "SaveFile"_L1 : "OpenFile"_L1); +    QString parentWindowId = "x11:"_L1 + QString::number(d->winId, 16);      QVariantMap options;      if (!d->acceptLabel.isEmpty()) -        options.insert(QLatin1String("accept_label"), d->acceptLabel); +        options.insert("accept_label"_L1, d->acceptLabel); -    options.insert(QLatin1String("modal"), d->modal); -    options.insert(QLatin1String("multiple"), d->multipleFiles); -    options.insert(QLatin1String("directory"), d->directoryMode); +    options.insert("modal"_L1, d->modal); +    options.insert("multiple"_L1, d->multipleFiles); +    options.insert("directory"_L1, d->directoryMode);      if (d->saveFile) {          if (!d->directory.isEmpty()) -            options.insert(QLatin1String("current_folder"), QFile::encodeName(d->directory).append('\0')); +            options.insert("current_folder"_L1, QFile::encodeName(d->directory).append('\0'));          if (!d->selectedFiles.isEmpty()) {              // current_file for the file to be pre-selected, current_name for the file name to be pre-filled              // current_file accepts absolute path while current_name accepts just file name -            options.insert(QLatin1String("current_file"), QFile::encodeName(d->selectedFiles.first()).append('\0')); -            options.insert(QLatin1String("current_name"), QFileInfo(d->selectedFiles.first()).fileName()); +            options.insert("current_file"_L1, QFile::encodeName(d->selectedFiles.first()).append('\0')); +            options.insert("current_name"_L1, QFileInfo(d->selectedFiles.first()).fileName());          }      } @@ -281,12 +283,12 @@ void QXdgDesktopPortalFileDialog::openPortal()      }      if (!filterList.isEmpty()) -        options.insert(QLatin1String("filters"), QVariant::fromValue(filterList)); +        options.insert("filters"_L1, QVariant::fromValue(filterList));      if (selectedFilterIndex != -1) -        options.insert(QLatin1String("current_filter"), QVariant::fromValue(filterList[selectedFilterIndex])); +        options.insert("current_filter"_L1, QVariant::fromValue(filterList[selectedFilterIndex])); -    options.insert(QLatin1String("handle_token"), QStringLiteral("qt%1").arg(QRandomGenerator::global()->generate())); +    options.insert("handle_token"_L1, QStringLiteral("qt%1").arg(QRandomGenerator::global()->generate()));      // TODO choices a(ssa(ss)s)      // List of serialized combo boxes to add to the file chooser. @@ -302,8 +304,8 @@ void QXdgDesktopPortalFileDialog::openPortal()          } else {              QDBusConnection::sessionBus().connect(nullptr,                                                    reply.value().path(), -                                                  QLatin1String("org.freedesktop.portal.Request"), -                                                  QLatin1String("Response"), +                                                  "org.freedesktop.portal.Request"_L1, +                                                  "Response"_L1,                                                    this,                                                    SLOT(gotResponse(uint,QVariantMap)));          } @@ -451,10 +453,10 @@ void QXdgDesktopPortalFileDialog::gotResponse(uint response, const QVariantMap &      Q_D(QXdgDesktopPortalFileDialog);      if (!response) { -        if (results.contains(QLatin1String("uris"))) -            d->selectedFiles = results.value(QLatin1String("uris")).toStringList(); +        if (results.contains("uris"_L1)) +            d->selectedFiles = results.value("uris"_L1).toStringList(); -        if (results.contains(QLatin1String("current_filter"))) { +        if (results.contains("current_filter"_L1)) {              const Filter selectedFilter = qdbus_cast<Filter>(results.value(QStringLiteral("current_filter")));              if (!selectedFilter.filterConditions.empty() && selectedFilter.filterConditions[0].type == MimeType) {                  // s.a. QXdgDesktopPortalFileDialog::openPortal which basically does the inverse diff --git a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp index 87b9f20a4c1..0b9d211fa9c 100644 --- a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp +++ b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp @@ -54,6 +54,8 @@  QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; +  class QXdgDesktopPortalThemePrivate : public QPlatformThemePrivate  {  public: @@ -131,11 +133,11 @@ QXdgDesktopPortalTheme::QXdgDesktopPortalTheme()          d->baseTheme = new QPlatformTheme;      // Get information about portal version -    QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"), -                                                          QLatin1String("/org/freedesktop/portal/desktop"), -                                                          QLatin1String("org.freedesktop.DBus.Properties"), -                                                          QLatin1String("Get")); -    message << QLatin1String("org.freedesktop.portal.FileChooser") << QLatin1String("version"); +    QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.portal.Desktop"_L1, +                                                          "/org/freedesktop/portal/desktop"_L1, +                                                          "org.freedesktop.DBus.Properties"_L1, +                                                          "Get"_L1); +    message << "org.freedesktop.portal.FileChooser"_L1 << "version"_L1;      QDBusPendingCall pendingCall = QDBusConnection::sessionBus().asyncCall(message);      QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall);      QObject::connect(watcher, &QDBusPendingCallWatcher::finished, [d] (QDBusPendingCallWatcher *watcher) { @@ -147,11 +149,11 @@ QXdgDesktopPortalTheme::QXdgDesktopPortalTheme()      });      // Get information about system theme preference -    message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"), -                                             QLatin1String("/org/freedesktop/portal/desktop"), -                                             QLatin1String("org.freedesktop.portal.Settings"), -                                             QLatin1String("Read")); -    message << QLatin1String("org.freedesktop.appearance") << QLatin1String("color-scheme"); +    message = QDBusMessage::createMethodCall("org.freedesktop.portal.Desktop"_L1, +                                             "/org/freedesktop/portal/desktop"_L1, +                                             "org.freedesktop.portal.Settings"_L1, +                                             "Read"_L1); +    message << "org.freedesktop.appearance"_L1 << "color-scheme"_L1;      // this must not be asyncCall() because we have to set appearance now      QDBusReply<QVariant> reply = QDBusConnection::sessionBus().call(message);  | 
