Plugins: use _L1 for for creating Latin-1 string literals

As a drive-by, fix qsizetype -> int narrowing conversion warnings for
the touched lines.

Task-number: QTBUG-98434
Change-Id: I7fadd3cf27ad099028d70f05956303e3af62c0f5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Sona Kurazyan 2022-04-13 11:42:38 +02:00
parent 5020d1b22a
commit ceaa7d6341
78 changed files with 411 additions and 258 deletions

View File

@ -45,6 +45,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QComposePlatformInputContextPlugin : public QPlatformInputContextPlugin class QComposePlatformInputContextPlugin : public QPlatformInputContextPlugin
{ {
Q_OBJECT Q_OBJECT
@ -58,8 +60,8 @@ QComposeInputContext *QComposePlatformInputContextPlugin::create(const QString &
{ {
Q_UNUSED(paramList); Q_UNUSED(paramList);
if (system.compare(system, QLatin1String("compose"), Qt::CaseInsensitive) == 0 if (system.compare(system, "compose"_L1, Qt::CaseInsensitive) == 0
|| system.compare(system, QLatin1String("xim"), Qt::CaseInsensitive) == 0) || system.compare(system, "xim"_L1, Qt::CaseInsensitive) == 0)
return new QComposeInputContext; return new QComposeInputContext;
return nullptr; return nullptr;
} }

View File

@ -45,6 +45,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QIbusPlatformInputContextPlugin : public QPlatformInputContextPlugin class QIbusPlatformInputContextPlugin : public QPlatformInputContextPlugin
{ {
Q_OBJECT Q_OBJECT
@ -58,7 +60,7 @@ QIBusPlatformInputContext *QIbusPlatformInputContextPlugin::create(const QString
{ {
Q_UNUSED(paramList); Q_UNUSED(paramList);
if (system.compare(system, QLatin1String("ibus"), Qt::CaseInsensitive) == 0) { if (system.compare(system, "ibus"_L1, Qt::CaseInsensitive) == 0) {
qDBusRegisterMetaType<QIBusAttribute>(); qDBusRegisterMetaType<QIBusAttribute>();
qDBusRegisterMetaType<QIBusAttributeList>(); qDBusRegisterMetaType<QIBusAttributeList>();
qDBusRegisterMetaType<QIBusText>(); qDBusRegisterMetaType<QIBusText>();

View File

@ -76,6 +76,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
enum { debug = 0 }; enum { debug = 0 };
class QIBusPlatformInputContextPrivate class QIBusPlatformInputContextPrivate
@ -537,7 +539,7 @@ void QIBusPlatformInputContext::socketChanged(const QString &str)
if (d->bus && d->bus->isValid()) if (d->bus && d->bus->isValid())
disconnect(d->bus); disconnect(d->bus);
if (d->connection) if (d->connection)
d->connection->disconnectFromBus(QLatin1String("QIBusProxy")); d->connection->disconnectFromBus("QIBusProxy"_L1);
m_timer.start(100); m_timer.start(100);
} }
@ -605,7 +607,7 @@ void QIBusPlatformInputContext::connectToContextSignals()
static inline bool checkRunningUnderFlatpak() 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() static bool shouldConnectIbusPortal()
@ -657,24 +659,24 @@ void QIBusPlatformInputContextPrivate::createBusProxy()
QDBusReply<QDBusObjectPath> ic; QDBusReply<QDBusObjectPath> ic;
if (usePortal) { if (usePortal) {
portalBus = new QIBusProxyPortal(QLatin1String(ibusService), portalBus = new QIBusProxyPortal(QLatin1String(ibusService),
QLatin1String("/org/freedesktop/IBus"), "/org/freedesktop/IBus"_L1,
*connection); *connection);
if (!portalBus->isValid()) { if (!portalBus->isValid()) {
qWarning("QIBusPlatformInputContext: invalid portal bus."); qWarning("QIBusPlatformInputContext: invalid portal bus.");
return; return;
} }
ic = portalBus->CreateInputContext(QLatin1String("QIBusInputContext")); ic = portalBus->CreateInputContext("QIBusInputContext"_L1);
} else { } else {
bus = new QIBusProxy(QLatin1String(ibusService), bus = new QIBusProxy(QLatin1String(ibusService),
QLatin1String("/org/freedesktop/IBus"), "/org/freedesktop/IBus"_L1,
*connection); *connection);
if (!bus->isValid()) { if (!bus->isValid()) {
qWarning("QIBusPlatformInputContext: invalid bus."); qWarning("QIBusPlatformInputContext: invalid bus.");
return; return;
} }
ic = bus->CreateInputContext(QLatin1String("QIBusInputContext")); ic = bus->CreateInputContext("QIBusInputContext"_L1);
} }
serviceWatcher.removeWatchedService(ibusService); serviceWatcher.removeWatchedService(ibusService);
@ -743,7 +745,7 @@ QString QIBusPlatformInputContextPrivate::getSocketPath()
qDebug() << "host=" << host << "displayNumber" << displayNumber; qDebug() << "host=" << host << "displayNumber" << displayNumber;
return QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + return QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) +
QLatin1String("/ibus/bus/") + "/ibus/bus/"_L1 +
QLatin1String(QDBusConnection::localMachineId()) + QLatin1String(QDBusConnection::localMachineId()) +
u'-' + QString::fromLocal8Bit(host) + u'-' + QString::fromLocal8Bit(displayNumber); u'-' + QString::fromLocal8Bit(host) + u'-' + QString::fromLocal8Bit(displayNumber);
} }
@ -751,7 +753,7 @@ QString QIBusPlatformInputContextPrivate::getSocketPath()
QDBusConnection *QIBusPlatformInputContextPrivate::createConnection() QDBusConnection *QIBusPlatformInputContextPrivate::createConnection()
{ {
if (usePortal) if (usePortal)
return new QDBusConnection(QDBusConnection::connectToBus(QDBusConnection::SessionBus, QLatin1String("QIBusProxy"))); return new QDBusConnection(QDBusConnection::connectToBus(QDBusConnection::SessionBus, "QIBusProxy"_L1));
QFile file(getSocketPath()); QFile file(getSocketPath());
if (!file.open(QFile::ReadOnly)) if (!file.open(QFile::ReadOnly))
@ -776,7 +778,7 @@ QDBusConnection *QIBusPlatformInputContextPrivate::createConnection()
if (address.isEmpty() || pid < 0 || kill(pid, 0) != 0) if (address.isEmpty() || pid < 0 || kill(pid, 0) != 0)
return 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 QT_END_NAMESPACE

View File

@ -43,6 +43,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QBsdFbIntegrationPlugin : public QPlatformIntegrationPlugin class QBsdFbIntegrationPlugin : public QPlatformIntegrationPlugin
{ {
Q_OBJECT Q_OBJECT
@ -54,7 +56,7 @@ public:
QPlatformIntegration* QBsdFbIntegrationPlugin::create(const QString& system, const QStringList& paramList) QPlatformIntegration* QBsdFbIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{ {
Q_UNUSED(paramList); Q_UNUSED(paramList);
if (!system.compare(QLatin1String("bsdfb"), Qt::CaseInsensitive)) if (!system.compare("bsdfb"_L1, Qt::CaseInsensitive))
return new QBsdFbIntegration(paramList); return new QBsdFbIntegration(paramList);
return nullptr; return nullptr;

View File

@ -61,6 +61,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
QBsdFbIntegration::QBsdFbIntegration(const QStringList &paramList) QBsdFbIntegration::QBsdFbIntegration(const QStringList &paramList)
{ {
m_fontDb.reset(new QGenericUnixFontDatabase); m_fontDb.reset(new QGenericUnixFontDatabase);
@ -139,7 +141,7 @@ void QBsdFbIntegration::createInputHandlers()
#if QT_CONFIG(tslib) #if QT_CONFIG(tslib)
const bool useTslib = qEnvironmentVariableIntValue("QT_QPA_FB_TSLIB"); const bool useTslib = qEnvironmentVariableIntValue("QT_QPA_FB_TSLIB");
if (useTslib) if (useTslib)
new QTsLibMouseHandler(QLatin1String("TsLib"), QString()); new QTsLibMouseHandler("TsLib"_L1, QString());
#endif #endif
} }

View File

@ -66,6 +66,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
enum { enum {
DefaultDPI = 100 DefaultDPI = 100
}; };
@ -152,10 +154,10 @@ QBsdFbScreen::~QBsdFbScreen()
bool QBsdFbScreen::initialize() bool QBsdFbScreen::initialize()
{ {
QRegularExpression fbRx(QLatin1String("fb=(.*)")); QRegularExpression fbRx("fb=(.*)"_L1);
QRegularExpression mmSizeRx(QLatin1String("mmsize=(\\d+)x(\\d+)")); QRegularExpression mmSizeRx("mmsize=(\\d+)x(\\d+)"_L1);
QRegularExpression sizeRx(QLatin1String("size=(\\d+)x(\\d+)")); QRegularExpression sizeRx("size=(\\d+)x(\\d+)"_L1);
QRegularExpression offsetRx(QLatin1String("offset=(\\d+)x(\\d+)")); QRegularExpression offsetRx("offset=(\\d+)x(\\d+)"_L1);
QString fbDevice; QString fbDevice;
QSize userMmSize; QSize userMmSize;

View File

@ -46,6 +46,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QCocoaIntegrationPlugin : public QPlatformIntegrationPlugin class QCocoaIntegrationPlugin : public QPlatformIntegrationPlugin
{ {
Q_OBJECT Q_OBJECT
@ -57,7 +59,7 @@ public:
QPlatformIntegration * QCocoaIntegrationPlugin::create(const QString& system, const QStringList& paramList) QPlatformIntegration * QCocoaIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{ {
QMacAutoReleasePool pool; QMacAutoReleasePool pool;
if (system.compare(QLatin1String("cocoa"), Qt::CaseInsensitive) == 0) if (system.compare("cocoa"_L1, Qt::CaseInsensitive) == 0)
return new QCocoaIntegration(paramList); return new QCocoaIntegration(paramList);
return nullptr; return nullptr;

View File

@ -47,6 +47,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
#ifndef QT_NO_ACCESSIBILITY #ifndef QT_NO_ACCESSIBILITY
QCocoaAccessibility::QCocoaAccessibility() QCocoaAccessibility::QCocoaAccessibility()
@ -253,7 +255,7 @@ bool shouldBeIgnored(QAccessibleInterface *interface)
// VoiceOver focusing on tool tips can be confusing. The contents of the // VoiceOver focusing on tool tips can be confusing. The contents of the
// tool tip is available through the description attribute anyway, so // tool tip is available through the description attribute anyway, so
// we disable accessibility for tool tips. // we disable accessibility for tool tips.
if (className == QLatin1String("QTipLabel")) if (className == "QTipLabel"_L1)
return true; return true;
} }

View File

@ -58,6 +58,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
QCocoaCursor::QCocoaCursor() QCocoaCursor::QCocoaCursor()
{ {
} }
@ -284,15 +286,15 @@ NSCursor *QCocoaCursor::createCursorData(QCursor *cursor)
return createCursorFromPixmap(pixmap); return createCursorFromPixmap(pixmap);
break; } break; }
case Qt::WaitCursor: { 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); return createCursorFromPixmap(pixmap, hotspot);
break; } break; }
case Qt::SizeAllCursor: { 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)); return createCursorFromPixmap(pixmap, QPoint(8, 8));
break; } break; }
case Qt::BusyCursor: { 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); return createCursorFromPixmap(pixmap, hotspot);
break; } break; }
#define QT_USE_APPROXIMATE_CURSORS #define QT_USE_APPROXIMATE_CURSORS

View File

@ -49,6 +49,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
static const int dragImageMaxChars = 26; static const int dragImageMaxChars = 26;
QCocoaDrag::QCocoaDrag() : QCocoaDrag::QCocoaDrag() :
@ -131,7 +133,7 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o)
m_executed_drop_action = Qt::IgnoreAction; m_executed_drop_action = Qt::IgnoreAction;
QMacPasteboard dragBoard(CFStringRef(NSPasteboardNameDrag), QMacInternalPasteboardMime::MIME_DND); 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); dragBoard.setMimeData(m_drag->mimeData(), QMacPasteboard::LazyRequest);
if (maybeDragMultipleItems()) if (maybeDragMultipleItems())

View File

@ -63,9 +63,11 @@
QT_USE_NAMESPACE QT_USE_NAMESPACE
using namespace Qt::StringLiterals;
static NSString *strippedText(QString s) static NSString *strippedText(QString s)
{ {
s.remove(QLatin1String("...")); s.remove("..."_L1);
return QPlatformTheme::removeMnemonics(s).trimmed().toNSString(); return QPlatformTheme::removeMnemonics(s).trimmed().toNSString();
} }
@ -443,7 +445,7 @@ typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
QStringList fileTypes; QStringList fileTypes;
for (const QString &filter : *m_selectedNameFilter) { for (const QString &filter : *m_selectedNameFilter) {
if (!filter.startsWith(QLatin1String("*."))) if (!filter.startsWith("*."_L1))
continue; continue;
if (filter.contains(u'?')) if (filter.contains(u'?'))

View File

@ -80,6 +80,8 @@ static void initResources()
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
Q_LOGGING_CATEGORY(lcQpa, "qt.qpa", QtWarningMsg); Q_LOGGING_CATEGORY(lcQpa, "qt.qpa", QtWarningMsg);
static void logVersionInformation() static void logVersionInformation()
@ -114,7 +116,7 @@ static QCocoaIntegration::Options parseOptions(const QStringList &paramList)
QCocoaIntegration::Options options; QCocoaIntegration::Options options;
for (const QString &param : paramList) { for (const QString &param : paramList) {
#ifndef QT_NO_FREETYPE #ifndef QT_NO_FREETYPE
if (param == QLatin1String("fontengine=freetype")) if (param == "fontengine=freetype"_L1)
options |= QCocoaIntegration::UseFreeTypeFontEngine; options |= QCocoaIntegration::UseFreeTypeFontEngine;
else else
#endif #endif

View File

@ -58,6 +58,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
static const char *application_menu_strings[] = static const char *application_menu_strings[] =
{ {
QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","About %1"), 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"); const QString aboutString = QCoreApplication::translate("QCocoaMenuItem", "About");
if (captionNoAmpersand.startsWith(aboutString, Qt::CaseInsensitive) if (captionNoAmpersand.startsWith(aboutString, Qt::CaseInsensitive)
|| captionNoAmpersand.endsWith(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)) if (captionNoAmpersand.contains(qtRegExp))
return QPlatformMenuItem::AboutQtRole; return QPlatformMenuItem::AboutQtRole;
return QPlatformMenuItem::AboutRole; return QPlatformMenuItem::AboutRole;
@ -345,7 +347,7 @@ NSMenuItem *QCocoaMenuItem::sync()
// Show multiple key sequences as part of the menu text. // Show multiple key sequences as part of the menu text.
if (accel.count() > 1) if (accel.count() > 1)
text += QLatin1String(" (") + accel.toString(QKeySequence::NativeText) + QLatin1String(")"); text += " ("_L1 + accel.toString(QKeySequence::NativeText) + ")"_L1;
#endif #endif
m_native.title = QPlatformTheme::removeMnemonics(text).toNSString(); m_native.title = QPlatformTheme::removeMnemonics(text).toNSString();

View File

@ -46,6 +46,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QMacPasteboardMimeTraditionalMacPlainText : public QMacInternalPasteboardMime { class QMacPasteboardMimeTraditionalMacPlainText : public QMacInternalPasteboardMime {
public: public:
QMacPasteboardMimeTraditionalMacPlainText() : QMacInternalPasteboardMime(MIME_ALL) { } QMacPasteboardMimeTraditionalMacPlainText() : QMacInternalPasteboardMime(MIME_ALL) { }
@ -60,20 +62,20 @@ public:
QString QMacPasteboardMimeTraditionalMacPlainText::convertorName() QString QMacPasteboardMimeTraditionalMacPlainText::convertorName()
{ {
return QLatin1String("PlainText (traditional-mac-plain-text)"); return "PlainText (traditional-mac-plain-text)"_L1;
} }
QString QMacPasteboardMimeTraditionalMacPlainText::flavorFor(const QString &mime) QString QMacPasteboardMimeTraditionalMacPlainText::flavorFor(const QString &mime)
{ {
if (mime == QLatin1String("text/plain")) if (mime == "text/plain"_L1)
return QLatin1String("com.apple.traditional-mac-plain-text"); return "com.apple.traditional-mac-plain-text"_L1;
return QString(); return QString();
} }
QString QMacPasteboardMimeTraditionalMacPlainText::mimeFor(QString flav) QString QMacPasteboardMimeTraditionalMacPlainText::mimeFor(QString flav)
{ {
if (flav == QLatin1String("com.apple.traditional-mac-plain-text")) if (flav == "com.apple.traditional-mac-plain-text"_L1)
return QLatin1String("text/plain"); return "text/plain"_L1;
return QString(); return QString();
} }
@ -88,7 +90,7 @@ QVariant QMacPasteboardMimeTraditionalMacPlainText::convertToMime(const QString
qWarning("QMacPasteboardMimeTraditionalMacPlainText: Cannot handle multiple member data"); qWarning("QMacPasteboardMimeTraditionalMacPlainText: Cannot handle multiple member data");
const QByteArray &firstData = data.first(); const QByteArray &firstData = data.first();
QVariant ret; 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, return QString(QCFString(CFStringCreateWithBytes(kCFAllocatorDefault,
reinterpret_cast<const UInt8 *>(firstData.constData()), reinterpret_cast<const UInt8 *>(firstData.constData()),
firstData.size(), CFStringGetSystemEncoding(), false))); firstData.size(), CFStringGetSystemEncoding(), false)));
@ -102,7 +104,7 @@ QList<QByteArray> QMacPasteboardMimeTraditionalMacPlainText::convertFromMime(con
{ {
QList<QByteArray> ret; QList<QByteArray> ret;
QString string = data.toString(); 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()); ret.append(string.toLatin1());
return ret; return ret;
} }

View File

@ -55,6 +55,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
/***************************************************************************** /*****************************************************************************
QMacPasteboard code 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. // 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. // This helps in making the application/x-qt-mime-type-name hidden from normal use.
QByteArray ba; QByteArray ba;
@ -328,7 +330,7 @@ QMacPasteboard::setMimeData(QMimeData *mime_src, DataRequestType dataRequestType
// QMimeData sub classes reimplementing the formats() might not expose the // QMimeData sub classes reimplementing the formats() might not expose the
// temporary "application/x-qt-mime-type-name" mimetype. So check the existence // temporary "application/x-qt-mime-type-name" mimetype. So check the existence
// of this mime type while doing drag and drop. // 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)) { if (!formats.contains(dummyMimeType)) {
QByteArray dummyType = mime_src->data(dummyMimeType); QByteArray dummyType = mime_src->data(dummyMimeType);
if (!dummyType.isEmpty()) { 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 // Hack: The Rtf handler converts incoming Rtf to Html. We do
// not want to convert outgoing Html to Rtf but instead keep // not want to convert outgoing Html to Rtf but instead keep
// posting it as Html. Skip the Rtf handler here. // posting it as Html. Skip the Rtf handler here.
if (c->convertorName() == QLatin1String("Rtf")) if (c->convertorName() == "Rtf"_L1)
continue; continue;
QString flavor(c->flavorFor(mimeType)); QString flavor(c->flavorFor(mimeType));
if (!flavor.isEmpty()) { if (!flavor.isEmpty()) {
@ -463,9 +465,9 @@ QMacPasteboard::retrieveData(const QString &format, QMetaType) const
// Converting via PasteboardCopyItemFlavorData below will for some UITs result // Converting via PasteboardCopyItemFlavorData below will for some UITs result
// in newlines mapping to '\r' instead of '\n'. To work around this we shortcut // in newlines mapping to '\r' instead of '\n'. To work around this we shortcut
// the conversion via NSPasteboard's NSStringPboardType if possible. // the conversion via NSPasteboard's NSStringPboardType if possible.
if (c_flavor == QLatin1String("com.apple.traditional-mac-plain-text") if (c_flavor == "com.apple.traditional-mac-plain-text"_L1
|| c_flavor == QLatin1String("public.utf8-plain-text") || c_flavor == "public.utf8-plain-text"_L1
|| c_flavor == QLatin1String("public.utf16-plain-text")) { || c_flavor == "public.utf16-plain-text"_L1) {
QString str = qt_mac_get_pasteboardString(paste); QString str = qt_mac_get_pasteboardString(paste);
if (!str.isEmpty()) if (!str.isEmpty())
return str; return str;

View File

@ -46,6 +46,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
QHash<qint64, QCocoaTouch*> QCocoaTouch::_currentTouches; QHash<qint64, QCocoaTouch*> QCocoaTouch::_currentTouches;
QHash<quint64, QPointingDevice*> QCocoaTouch::_touchDevices; QHash<quint64, QPointingDevice*> QCocoaTouch::_touchDevices;
QPointF QCocoaTouch::_screenReferencePos; QPointF QCocoaTouch::_screenReferencePos;
@ -221,7 +223,7 @@ QPointingDevice *QCocoaTouch::getTouchDevice(QInputDevice::DeviceType type, quin
{ {
QPointingDevice *ret = _touchDevices.value(id); QPointingDevice *ret = _touchDevices.value(id);
if (!ret) { 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, id, type, QPointingDevice::PointerType::Finger,
QInputDevice::Capability::Position | QInputDevice::Capability::Position |
QInputDevice::Capability::NormalizedPosition | QInputDevice::Capability::NormalizedPosition |

View File

@ -39,6 +39,8 @@
// This file is included from qnsview.mm, and only used to organize the code // This file is included from qnsview.mm, and only used to organize the code
using namespace Qt::StringLiterals;
static const QPointingDevice *pointingDeviceFor(qint64 deviceID) static const QPointingDevice *pointingDeviceFor(qint64 deviceID)
{ {
// macOS will in many cases not report a deviceID (0 value). // macOS will in many cases not report a deviceID (0 value).
@ -60,7 +62,7 @@ static const QPointingDevice *pointingDeviceFor(qint64 deviceID)
return primaryDevice; return primaryDevice;
} else { } else {
// Register a new device. Name and capabilities may need updating later. // 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::DeviceType::Mouse, QPointingDevice::PointerType::Generic,
QInputDevice::Capability::Scroll | QInputDevice::Capability::Position, QInputDevice::Capability::Scroll | QInputDevice::Capability::Position,
1, 3, QString(), QPointingDeviceUniqueId(), QCocoaIntegration::instance()); 1, 3, QString(), QPointingDeviceUniqueId(), QCocoaIntegration::instance());
@ -770,7 +772,7 @@ static const QPointingDevice *pointingDeviceFor(qint64 deviceID)
if (theEvent.hasPreciseScrollingDeltas) { if (theEvent.hasPreciseScrollingDeltas) {
auto *devicePriv = QPointingDevicePrivate::get(const_cast<QPointingDevice *>(device)); auto *devicePriv = QPointingDevicePrivate::get(const_cast<QPointingDevice *>(device));
if (!devicePriv->capabilities.testFlag(QInputDevice::Capability::PixelScroll)) { 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->deviceType = QInputDevice::DeviceType::TouchPad;
devicePriv->capabilities |= QInputDevice::Capability::PixelScroll; devicePriv->capabilities |= QInputDevice::Capability::PixelScroll;
qCDebug(lcInputDevices) << "mouse scrolling: updated capabilities" << device; qCDebug(lcInputDevices) << "mouse scrolling: updated capabilities" << device;

View File

@ -44,6 +44,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QWindowsDirect2DIntegrationPlugin : public QPlatformIntegrationPlugin class QWindowsDirect2DIntegrationPlugin : public QPlatformIntegrationPlugin
{ {
Q_OBJECT Q_OBJECT
@ -54,7 +56,7 @@ public:
QPlatformIntegration *QWindowsDirect2DIntegrationPlugin::create(const QString& system, const QStringList& paramList) 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 QWindowsDirect2DIntegration::create(paramList);
return nullptr; return nullptr;
} }

View File

@ -43,6 +43,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
#ifdef DIRECTFB_GL_EGL #ifdef DIRECTFB_GL_EGL
#define QT_EGL_BACKEND_STRING(list) list << "directfbegl"; #define QT_EGL_BACKEND_STRING(list) list << "directfbegl";
#define QT_EGL_BACKEND_CREATE(list, out) \ #define QT_EGL_BACKEND_CREATE(list, out) \
@ -66,7 +68,7 @@ QPlatformIntegration * QDirectFbIntegrationPlugin::create(const QString& system,
Q_UNUSED(paramList); Q_UNUSED(paramList);
QDirectFbIntegration *integration = nullptr; QDirectFbIntegration *integration = nullptr;
if (!system.compare(QLatin1String("directfb"), Qt::CaseInsensitive)) if (!system.compare("directfb"_L1, Qt::CaseInsensitive))
integration = new QDirectFbIntegration; integration = new QDirectFbIntegration;
QT_EGL_BACKEND_CREATE(system, integration) QT_EGL_BACKEND_CREATE(system, integration)

View File

@ -58,6 +58,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
QEglFSCursor::QEglFSCursor(QPlatformScreen *screen) QEglFSCursor::QEglFSCursor(QPlatformScreen *screen)
: m_visible(true), : m_visible(true),
m_screen(static_cast<QEglFSScreen *>(screen)), m_screen(static_cast<QEglFSScreen *>(screen)),
@ -178,14 +180,14 @@ void QEglFSCursor::initCursorAtlas()
QJsonDocument doc = QJsonDocument::fromJson(file.readAll()); QJsonDocument doc = QJsonDocument::fromJson(file.readAll());
QJsonObject object = doc.object(); QJsonObject object = doc.object();
QString atlas = object.value(QLatin1String("image")).toString(); QString atlas = object.value("image"_L1).toString();
Q_ASSERT(!atlas.isEmpty()); Q_ASSERT(!atlas.isEmpty());
const int cursorsPerRow = object.value(QLatin1String("cursorsPerRow")).toDouble(); const int cursorsPerRow = object.value("cursorsPerRow"_L1).toDouble();
Q_ASSERT(cursorsPerRow); Q_ASSERT(cursorsPerRow);
m_cursorAtlas.cursorsPerRow = 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); Q_ASSERT(hotSpots.count() == Qt::LastCursor + 1);
for (int i = 0; i < hotSpots.count(); i++) { for (int i = 0; i < hotSpots.count(); i++) {
QPoint hotSpot(hotSpots[i].toArray()[0].toDouble(), hotSpots[i].toArray()[1].toDouble()); QPoint hotSpot(hotSpots[i].toArray()[0].toDouble(), hotSpots[i].toArray()[1].toDouble());

View File

@ -69,10 +69,12 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
Q_LOGGING_CATEGORY(qLcEglDevDebug, "qt.qpa.egldeviceintegration") Q_LOGGING_CATEGORY(qLcEglDevDebug, "qt.qpa.egldeviceintegration")
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QEglFSDeviceIntegrationFactoryInterface_iid, QLatin1String("/egldeviceintegrations"), Qt::CaseInsensitive)) (QEglFSDeviceIntegrationFactoryInterface_iid, "/egldeviceintegrations"_L1, Qt::CaseInsensitive))
QStringList QEglFSDeviceIntegrationFactory::keys() QStringList QEglFSDeviceIntegrationFactory::keys()
{ {
@ -114,7 +116,7 @@ int QEglFSDeviceIntegration::framebufferIndex() const
{ {
int fbIndex = 0; int fbIndex = 0;
#if QT_CONFIG(regularexpression) #if QT_CONFIG(regularexpression)
QRegularExpression fbIndexRx(QLatin1String("fb(\\d+)")); QRegularExpression fbIndexRx("fb(\\d+)"_L1);
QFileInfo fbinfo(QString::fromLocal8Bit(fbDeviceName())); QFileInfo fbinfo(QString::fromLocal8Bit(fbDeviceName()));
QRegularExpressionMatch match; QRegularExpressionMatch match;
if (fbinfo.isSymLink()) if (fbinfo.isSymLink())

View File

@ -103,6 +103,8 @@ static void initResources()
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
QEglFSIntegration::QEglFSIntegration() QEglFSIntegration::QEglFSIntegration()
: m_kbdMgr(nullptr), : m_kbdMgr(nullptr),
m_display(EGL_NO_DISPLAY), m_display(EGL_NO_DISPLAY),
@ -442,7 +444,7 @@ void QEglFSIntegration::createInputHandlers()
{ {
#if QT_CONFIG(libinput) #if QT_CONFIG(libinput)
if (!qEnvironmentVariableIntValue("QT_QPA_EGLFS_NO_LIBINPUT")) { if (!qEnvironmentVariableIntValue("QT_QPA_EGLFS_NO_LIBINPUT")) {
new QLibInputHandler(QLatin1String("libinput"), QString()); new QLibInputHandler("libinput"_L1, QString());
return; return;
} }
#endif #endif
@ -450,16 +452,16 @@ void QEglFSIntegration::createInputHandlers()
#if QT_CONFIG(tslib) #if QT_CONFIG(tslib)
bool useTslib = qEnvironmentVariableIntValue("QT_QPA_EGLFS_TSLIB"); bool useTslib = qEnvironmentVariableIntValue("QT_QPA_EGLFS_TSLIB");
if (useTslib) if (useTslib)
new QTsLibMouseHandler(QLatin1String("TsLib"), QString() /* spec */); new QTsLibMouseHandler("TsLib"_L1, QString() /* spec */);
#endif #endif
#if QT_CONFIG(evdev) #if QT_CONFIG(evdev)
m_kbdMgr = new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString() /* spec */, this); m_kbdMgr = new QEvdevKeyboardManager("EvdevKeyboard"_L1, QString() /* spec */, this);
new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString() /* spec */, this); new QEvdevMouseManager("EvdevMouse"_L1, QString() /* spec */, this);
#if QT_CONFIG(tslib) #if QT_CONFIG(tslib)
if (!useTslib) if (!useTslib)
#endif #endif
new QEvdevTouchManager(QLatin1String("EvdevTouch"), QString() /* spec */, this); new QEvdevTouchManager("EvdevTouch"_L1, QString() /* spec */, this);
#endif #endif
#if QT_CONFIG(integrityhid) #if QT_CONFIG(integrityhid)

View File

@ -41,6 +41,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
QEglFSEmulatorScreen::QEglFSEmulatorScreen(const QJsonObject &screenDescription) QEglFSEmulatorScreen::QEglFSEmulatorScreen(const QJsonObject &screenDescription)
: QEglFSScreen(eglGetDisplay(EGL_DEFAULT_DISPLAY)) : QEglFSScreen(eglGetDisplay(EGL_DEFAULT_DISPLAY))
, m_id(0) , m_id(0)
@ -112,60 +114,60 @@ void QEglFSEmulatorScreen::initFromJsonObject(const QJsonObject &description)
{ {
QJsonValue value; QJsonValue value;
value = description.value(QLatin1String("id")); value = description.value("id"_L1);
if (!value.isUndefined() && value.isDouble()) if (!value.isUndefined() && value.isDouble())
m_id = value.toInt(); m_id = value.toInt();
value = description.value(QLatin1String("description")); value = description.value("description"_L1);
if (!value.isUndefined() && value.isString()) if (!value.isUndefined() && value.isString())
m_description = value.toString(); m_description = value.toString();
value = description.value(QLatin1String("geometry")); value = description.value("geometry"_L1);
if (!value.isUndefined() && value.isObject()) { if (!value.isUndefined() && value.isObject()) {
QJsonObject geometryObject = value.toObject(); QJsonObject geometryObject = value.toObject();
value = geometryObject.value(QLatin1String("x")); value = geometryObject.value("x"_L1);
if (!value.isUndefined() && value.isDouble()) if (!value.isUndefined() && value.isDouble())
m_geometry.setX(value.toInt()); m_geometry.setX(value.toInt());
value = geometryObject.value(QLatin1String("y")); value = geometryObject.value("y"_L1);
if (!value.isUndefined() && value.isDouble()) if (!value.isUndefined() && value.isDouble())
m_geometry.setY(value.toInt()); m_geometry.setY(value.toInt());
value = geometryObject.value(QLatin1String("width")); value = geometryObject.value("width"_L1);
if (!value.isUndefined() && value.isDouble()) if (!value.isUndefined() && value.isDouble())
m_geometry.setWidth(value.toInt()); m_geometry.setWidth(value.toInt());
value = geometryObject.value(QLatin1String("height")); value = geometryObject.value("height"_L1);
if (!value.isUndefined() && value.isDouble()) if (!value.isUndefined() && value.isDouble())
m_geometry.setHeight(value.toInt()); m_geometry.setHeight(value.toInt());
} }
value = description.value(QLatin1String("depth")); value = description.value("depth"_L1);
if (!value.isUndefined() && value.isDouble()) if (!value.isUndefined() && value.isDouble())
m_depth = value.toInt(); m_depth = value.toInt();
value = description.value(QLatin1String("format")); value = description.value("format"_L1);
if (!value.isUndefined() && value.isDouble()) if (!value.isUndefined() && value.isDouble())
m_format = static_cast<QImage::Format>(value.toInt()); m_format = static_cast<QImage::Format>(value.toInt());
value = description.value(QLatin1String("physicalSize")); value = description.value("physicalSize"_L1);
if (!value.isUndefined() && value.isObject()) { if (!value.isUndefined() && value.isObject()) {
QJsonObject physicalSizeObject = value.toObject(); QJsonObject physicalSizeObject = value.toObject();
value = physicalSizeObject.value(QLatin1String("width")); value = physicalSizeObject.value("width"_L1);
if (!value.isUndefined() && value.isDouble()) if (!value.isUndefined() && value.isDouble())
m_physicalSize.setWidth(value.toInt()); m_physicalSize.setWidth(value.toInt());
value = physicalSizeObject.value(QLatin1String("height")); value = physicalSizeObject.value("height"_L1);
if (!value.isUndefined() && value.isDouble()) if (!value.isUndefined() && value.isDouble())
m_physicalSize.setHeight(value.toInt()); m_physicalSize.setHeight(value.toInt());
} }
value = description.value(QLatin1String("refreshRate")); value = description.value("refreshRate"_L1);
if (!value.isUndefined() && value.isDouble()) if (!value.isUndefined() && value.isDouble())
m_refreshRate = value.toDouble(); m_refreshRate = value.toDouble();
value = description.value(QLatin1String("nativeOrientation")); value = description.value("nativeOrientation"_L1);
if (!value.isUndefined() && value.isDouble()) if (!value.isUndefined() && value.isDouble())
m_nativeOrientation = static_cast<Qt::ScreenOrientation>(value.toInt()); m_nativeOrientation = static_cast<Qt::ScreenOrientation>(value.toInt());
value = description.value(QLatin1String("orientation")); value = description.value("orientation"_L1);
if (!value.isUndefined() && value.isDouble()) if (!value.isUndefined() && value.isDouble())
m_orientation = static_cast<Qt::ScreenOrientation>(value.toInt()); m_orientation = static_cast<Qt::ScreenOrientation>(value.toInt());
} }

View File

@ -64,6 +64,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
Q_DECLARE_LOGGING_CATEGORY(qLcEglfsKmsDebug) Q_DECLARE_LOGGING_CATEGORY(qLcEglfsKmsDebug)
QEglFSKmsGbmCursor::QEglFSKmsGbmCursor(QEglFSKmsGbmScreen *screen) QEglFSKmsGbmCursor::QEglFSKmsGbmCursor(QEglFSKmsGbmScreen *screen)
@ -289,14 +291,14 @@ void QEglFSKmsGbmCursor::initCursorAtlas()
QJsonDocument doc = QJsonDocument::fromJson(file.readAll()); QJsonDocument doc = QJsonDocument::fromJson(file.readAll());
QJsonObject object = doc.object(); QJsonObject object = doc.object();
QString atlas = object.value(QLatin1String("image")).toString(); QString atlas = object.value("image"_L1).toString();
Q_ASSERT(!atlas.isEmpty()); Q_ASSERT(!atlas.isEmpty());
const int cursorsPerRow = object.value(QLatin1String("cursorsPerRow")).toDouble(); const int cursorsPerRow = object.value("cursorsPerRow"_L1).toDouble();
Q_ASSERT(cursorsPerRow); Q_ASSERT(cursorsPerRow);
m_cursorAtlas.cursorsPerRow = 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); Q_ASSERT(hotSpots.count() == Qt::LastCursor + 1);
for (int i = 0; i < hotSpots.count(); i++) { for (int i = 0; i < hotSpots.count(); i++) {
QPoint hotSpot(hotSpots[i].toArray()[0].toDouble(), hotSpots[i].toArray()[1].toDouble()); QPoint hotSpot(hotSpots[i].toArray()[0].toDouble(), hotSpots[i].toArray()[1].toDouble());

View File

@ -42,6 +42,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QEglFSIntegrationPlugin : public QPlatformIntegrationPlugin class QEglFSIntegrationPlugin : public QPlatformIntegrationPlugin
{ {
Q_OBJECT Q_OBJECT
@ -53,7 +55,7 @@ public:
QPlatformIntegration* QEglFSIntegrationPlugin::create(const QString& system, const QStringList& paramList) QPlatformIntegration* QEglFSIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{ {
Q_UNUSED(paramList); Q_UNUSED(paramList);
if (!system.compare(QLatin1String("eglfs"), Qt::CaseInsensitive)) if (!system.compare("eglfs"_L1, Qt::CaseInsensitive))
return new QEglFSIntegration; return new QEglFSIntegration;
return nullptr; return nullptr;

View File

@ -42,9 +42,11 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
QPlatformIntegration *QHaikuIntegrationPlugin::create(const QString& system, const QStringList& paramList) 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 new QHaikuIntegration(paramList);
return nullptr; return nullptr;

View File

@ -46,6 +46,8 @@
#include <Clipboard.h> #include <Clipboard.h>
using namespace Qt::StringLiterals;
QHaikuClipboard::QHaikuClipboard() QHaikuClipboard::QHaikuClipboard()
: m_systemMimeData(nullptr) : m_systemMimeData(nullptr)
, m_userMimeData(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); const status_t status = clipboard->FindData(name, B_MIME_TYPE, &data, &dataLen);
if (dataLen && (status == B_OK)) { if (dataLen && (status == B_OK)) {
const QLatin1String format(name); 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)); 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)); m_systemMimeData->setHtml(QString::fromLocal8Bit(reinterpret_cast<const char*>(data), dataLen));
} else { } else {
m_systemMimeData->setData(format, QByteArray(reinterpret_cast<const char*>(data), dataLen)); m_systemMimeData->setData(format, QByteArray(reinterpret_cast<const char*>(data), dataLen));

View File

@ -42,6 +42,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QIntegrityFbIntegrationPlugin : public QPlatformIntegrationPlugin class QIntegrityFbIntegrationPlugin : public QPlatformIntegrationPlugin
{ {
Q_OBJECT Q_OBJECT
@ -53,7 +55,7 @@ public:
QPlatformIntegration* QIntegrityFbIntegrationPlugin::create(const QString& system, const QStringList& paramList) QPlatformIntegration* QIntegrityFbIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{ {
Q_UNUSED(paramList); Q_UNUSED(paramList);
if (!system.compare(QLatin1String("integrityfb"), Qt::CaseInsensitive)) if (!system.compare("integrityfb"_L1, Qt::CaseInsensitive))
return new QIntegrityFbIntegration(paramList); return new QIntegrityFbIntegration(paramList);
return 0; return 0;

View File

@ -51,6 +51,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
static QImage::Format determineFormat(const FBInfo *fbinfo) static QImage::Format determineFormat(const FBInfo *fbinfo)
{ {
QImage::Format format = QImage::Format_Invalid; QImage::Format format = QImage::Format_Invalid;
@ -109,9 +111,9 @@ QIntegrityFbScreen::~QIntegrityFbScreen()
bool QIntegrityFbScreen::initialize() bool QIntegrityFbScreen::initialize()
{ {
Error err; Error err;
QRegularExpression fbRx(QLatin1String("fb=(.*)")); QRegularExpression fbRx("fb=(.*)"_L1);
QRegularExpression sizeRx(QLatin1String("size=(\\d+)x(\\d+)")); QRegularExpression sizeRx("size=(\\d+)x(\\d+)"_L1);
QRegularExpression offsetRx(QLatin1String("offset=(\\d+)x(\\d+)")); QRegularExpression offsetRx("offset=(\\d+)x(\\d+)"_L1);
QString fbDevice; QString fbDevice;
QRect userGeometry; QRect userGeometry;

View File

@ -50,6 +50,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
static QThreadStorage<QString> g_iteratorCurrentUrl; static QThreadStorage<QString> g_iteratorCurrentUrl;
static QThreadStorage<QPointer<QIOSAssetData> > g_assetDataCache; static QThreadStorage<QPointer<QIOSAssetData> > g_assetDataCache;
@ -249,7 +251,7 @@ public:
} }
if (!asset) if (!asset)
engine->setError(QFile::OpenError, QLatin1String("could not open image")); engine->setError(QFile::OpenError, "could not open image"_L1);
m_asset = [asset retain]; m_asset = [asset retain];
dispatch_semaphore_signal(semaphore); dispatch_semaphore_signal(semaphore);
@ -377,7 +379,7 @@ bool QIOSFileEngineAssetsLibrary::close()
QAbstractFileEngine::FileFlags QIOSFileEngineAssetsLibrary::fileFlags(QAbstractFileEngine::FileFlags type) const QAbstractFileEngine::FileFlags QIOSFileEngineAssetsLibrary::fileFlags(QAbstractFileEngine::FileFlags type) const
{ {
QAbstractFileEngine::FileFlags flags; 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(); const bool exists = isDir || m_assetUrl == g_iteratorCurrentUrl.localData() || loadAsset();
if (!exists) if (!exists)
@ -452,11 +454,11 @@ void QIOSFileEngineAssetsLibrary::setFileName(const QString &file)
// QUrl::fromLocalFile() will remove double slashes. Since the asset url is // 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 // 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. // 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) if (index == -1)
m_assetUrl = QLatin1String("assets-library://"); m_assetUrl = "assets-library://"_L1;
else else
m_assetUrl = QLatin1String("assets-library:/") + file.mid(index); m_assetUrl = "assets-library:/"_L1 + file.mid(index);
} }
#ifndef QT_NO_FILESYSTEMITERATOR #ifndef QT_NO_FILESYSTEMITERATOR

View File

@ -43,6 +43,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QIOSIntegrationPlugin : public QPlatformIntegrationPlugin class QIOSIntegrationPlugin : public QPlatformIntegrationPlugin
{ {
Q_OBJECT Q_OBJECT
@ -54,8 +56,8 @@ class QIOSIntegrationPlugin : public QPlatformIntegrationPlugin
QPlatformIntegration * QIOSIntegrationPlugin::create(const QString& system, const QStringList& paramList) QPlatformIntegration * QIOSIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{ {
Q_UNUSED(paramList); Q_UNUSED(paramList);
if (!system.compare(QLatin1String("ios"), Qt::CaseInsensitive) if (!system.compare("ios"_L1, Qt::CaseInsensitive)
|| !system.compare(QLatin1String("tvos"), Qt::CaseInsensitive)) { || !system.compare("tvos"_L1, Qt::CaseInsensitive)) {
return new QIOSIntegration; return new QIOSIntegration;
} }

View File

@ -50,6 +50,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
static void qRegisterApplicationStateNotifications() static void qRegisterApplicationStateNotifications()
{ {
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
@ -83,11 +85,11 @@ static void qRegisterApplicationStateNotifications()
if (qt_apple_isApplicationExtension()) { if (qt_apple_isApplicationExtension()) {
// Extensions are not allowed to access UIApplication, so we assume the state is active // Extensions are not allowed to access UIApplication, so we assume the state is active
QIOSApplicationState::handleApplicationStateChanged(UIApplicationStateActive, QIOSApplicationState::handleApplicationStateChanged(UIApplicationStateActive,
QLatin1String("Extension loaded, assuming state is active")); "Extension loaded, assuming state is active"_L1);
} else { } else {
// Initialize correct startup state, which may not be the Qt default (inactive) // Initialize correct startup state, which may not be the Qt default (inactive)
UIApplicationState startupState = qt_apple_sharedApplication().applicationState; UIApplicationState startupState = qt_apple_sharedApplication().applicationState;
QIOSApplicationState::handleApplicationStateChanged(startupState, QLatin1String("Application loaded")); QIOSApplicationState::handleApplicationStateChanged(startupState, "Application loaded"_L1);
} }
} }
Q_CONSTRUCTOR_FUNCTION(qRegisterApplicationStateNotifications) Q_CONSTRUCTOR_FUNCTION(qRegisterApplicationStateNotifications)
@ -96,7 +98,7 @@ QIOSApplicationState::QIOSApplicationState()
{ {
if (!qt_apple_isApplicationExtension()) { if (!qt_apple_isApplicationExtension()) {
UIApplicationState startupState = qt_apple_sharedApplication().applicationState; UIApplicationState startupState = qt_apple_sharedApplication().applicationState;
QIOSApplicationState::handleApplicationStateChanged(startupState, QLatin1String("Application launched")); QIOSApplicationState::handleApplicationStateChanged(startupState, "Application launched"_L1);
} }
} }

View File

@ -50,6 +50,8 @@
#include "qiosoptionalplugininterface.h" #include "qiosoptionalplugininterface.h"
#include "qiosdocumentpickercontroller.h" #include "qiosdocumentpickercontroller.h"
using namespace Qt::StringLiterals;
QIOSFileDialog::QIOSFileDialog() QIOSFileDialog::QIOSFileDialog()
: m_viewController(nullptr) : m_viewController(nullptr)
{ {
@ -74,7 +76,7 @@ bool QIOSFileDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality window
QString directory = options()->initialDirectory().toLocalFile(); QString directory = options()->initialDirectory().toLocalFile();
if (acceptOpen) { if (acceptOpen) {
if (directory.startsWith(QLatin1String("assets-library:"))) if (directory.startsWith("assets-library:"_L1))
return showImagePickerDialog(parent); return showImagePickerDialog(parent);
else else
return showNativeDocumentPickerDialog(parent); return showNativeDocumentPickerDialog(parent);

View File

@ -70,6 +70,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QCoreTextFontEngine; class QCoreTextFontEngine;
QIOSIntegration *QIOSIntegration::instance() QIOSIntegration *QIOSIntegration::instance()
@ -85,7 +87,7 @@ QIOSIntegration::QIOSIntegration()
, m_inputContext(0) , m_inputContext(0)
, m_platformServices(new QIOSServices) , m_platformServices(new QIOSServices)
, m_accessibility(0) , 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())) { if (Q_UNLIKELY(!qt_apple_isApplicationExtension() && !qt_apple_sharedApplication())) {
qFatal("Error: You are creating QApplication before calling UIApplicationMain.\n" \ qFatal("Error: You are creating QApplication before calling UIApplicationMain.\n" \

View File

@ -49,6 +49,8 @@
#include "quiview.h" #include "quiview.h"
#include "qiosmessagedialog.h" #include "qiosmessagedialog.h"
using namespace Qt::StringLiterals;
QIOSMessageDialog::QIOSMessageDialog() QIOSMessageDialog::QIOSMessageDialog()
: m_alertController(nullptr) : m_alertController(nullptr)
{ {
@ -73,7 +75,7 @@ inline QString QIOSMessageDialog::messageTextPlain()
if (!detailedText.isEmpty()) if (!detailedText.isEmpty())
text += lineShift + detailedText; text += lineShift + detailedText;
text.replace(QLatin1String("<p>"), QStringLiteral("\n"), Qt::CaseInsensitive); text.replace("<p>"_L1, QStringLiteral("\n"), Qt::CaseInsensitive);
text.remove(QRegularExpression(QStringLiteral("<[^>]*>"))); text.remove(QRegularExpression(QStringLiteral("<[^>]*>")));
return text; return text;

View File

@ -229,6 +229,8 @@ static QIOSScreen* qtPlatformScreenFor(UIScreen *uiScreen)
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
/*! /*!
Returns the model identifier of the device. Returns the model identifier of the device.
*/ */
@ -321,12 +323,10 @@ QIOSScreen::~QIOSScreen()
QString QIOSScreen::name() const QString QIOSScreen::name() const
{ {
if (m_uiScreen == [UIScreen mainScreen]) { if (m_uiScreen == [UIScreen mainScreen])
return QString::fromNSString([UIDevice currentDevice].model) return QString::fromNSString([UIDevice currentDevice].model) + " built-in display"_L1;
+ QLatin1String(" built-in display"); else
} else { return "External display"_L1;
return QLatin1String("External display");
}
} }
void QIOSScreen::updateProperties() void QIOSScreen::updateProperties()

View File

@ -42,6 +42,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QLinuxFbIntegrationPlugin : public QPlatformIntegrationPlugin class QLinuxFbIntegrationPlugin : public QPlatformIntegrationPlugin
{ {
Q_OBJECT Q_OBJECT
@ -53,7 +55,7 @@ public:
QPlatformIntegration* QLinuxFbIntegrationPlugin::create(const QString& system, const QStringList& paramList) QPlatformIntegration* QLinuxFbIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{ {
Q_UNUSED(paramList); Q_UNUSED(paramList);
if (!system.compare(QLatin1String("linuxfb"), Qt::CaseInsensitive)) if (!system.compare("linuxfb"_L1, Qt::CaseInsensitive))
return new QLinuxFbIntegration(paramList); return new QLinuxFbIntegration(paramList);
return 0; return 0;

View File

@ -72,6 +72,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
QLinuxFbIntegration::QLinuxFbIntegration(const QStringList &paramList) QLinuxFbIntegration::QLinuxFbIntegration(const QStringList &paramList)
: m_primaryScreen(nullptr), : m_primaryScreen(nullptr),
m_fontDb(new QGenericUnixFontDatabase), m_fontDb(new QGenericUnixFontDatabase),
@ -152,7 +154,7 @@ void QLinuxFbIntegration::createInputHandlers()
{ {
#if QT_CONFIG(libinput) #if QT_CONFIG(libinput)
if (!qEnvironmentVariableIntValue("QT_QPA_FB_NO_LIBINPUT")) { if (!qEnvironmentVariableIntValue("QT_QPA_FB_NO_LIBINPUT")) {
new QLibInputHandler(QLatin1String("libinput"), QString()); new QLibInputHandler("libinput"_L1, QString());
return; return;
} }
#endif #endif
@ -160,16 +162,16 @@ void QLinuxFbIntegration::createInputHandlers()
#if QT_CONFIG(tslib) #if QT_CONFIG(tslib)
bool useTslib = qEnvironmentVariableIntValue("QT_QPA_FB_TSLIB"); bool useTslib = qEnvironmentVariableIntValue("QT_QPA_FB_TSLIB");
if (useTslib) if (useTslib)
new QTsLibMouseHandler(QLatin1String("TsLib"), QString()); new QTsLibMouseHandler("TsLib"_L1, QString());
#endif #endif
#if QT_CONFIG(evdev) #if QT_CONFIG(evdev)
m_kbdMgr = new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString(), this); m_kbdMgr = new QEvdevKeyboardManager("EvdevKeyboard"_L1, QString(), this);
new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString(), this); new QEvdevMouseManager("EvdevMouse"_L1, QString(), this);
#if QT_CONFIG(tslib) #if QT_CONFIG(tslib)
if (!useTslib) if (!useTslib)
#endif #endif
new QEvdevTouchManager(QLatin1String("EvdevTouch"), QString() /* spec */, this); new QEvdevTouchManager("EvdevTouch"_L1, QString() /* spec */, this);
#endif #endif
} }

View File

@ -65,6 +65,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
static int openFramebufferDevice(const QString &dev) static int openFramebufferDevice(const QString &dev)
{ {
int fd = -1; int fd = -1;
@ -308,11 +310,11 @@ QLinuxFbScreen::~QLinuxFbScreen()
bool QLinuxFbScreen::initialize() bool QLinuxFbScreen::initialize()
{ {
QRegularExpression ttyRx(QLatin1String("tty=(.*)")); QRegularExpression ttyRx("tty=(.*)"_L1);
QRegularExpression fbRx(QLatin1String("fb=(.*)")); QRegularExpression fbRx("fb=(.*)"_L1);
QRegularExpression mmSizeRx(QLatin1String("mmsize=(\\d+)x(\\d+)")); QRegularExpression mmSizeRx("mmsize=(\\d+)x(\\d+)"_L1);
QRegularExpression sizeRx(QLatin1String("size=(\\d+)x(\\d+)")); QRegularExpression sizeRx("size=(\\d+)x(\\d+)"_L1);
QRegularExpression offsetRx(QLatin1String("offset=(\\d+)x(\\d+)")); QRegularExpression offsetRx("offset=(\\d+)x(\\d+)"_L1);
QString fbDevice, ttyDevice; QString fbDevice, ttyDevice;
QSize userMmSize; QSize userMmSize;
@ -322,7 +324,7 @@ bool QLinuxFbScreen::initialize()
// Parse arguments // Parse arguments
for (const QString &arg : qAsConst(mArgs)) { for (const QString &arg : qAsConst(mArgs)) {
QRegularExpressionMatch match; QRegularExpressionMatch match;
if (arg == QLatin1String("nographicsmodeswitch")) if (arg == "nographicsmodeswitch"_L1)
doSwitchToGraphicsMode = false; doSwitchToGraphicsMode = false;
else if (arg.contains(mmSizeRx, &match)) else if (arg.contains(mmSizeRx, &match))
userMmSize = QSize(match.captured(1).toInt(), match.captured(2).toInt()); userMmSize = QSize(match.captured(1).toInt(), match.captured(2).toInt());
@ -337,9 +339,9 @@ bool QLinuxFbScreen::initialize()
} }
if (fbDevice.isEmpty()) { if (fbDevice.isEmpty()) {
fbDevice = QLatin1String("/dev/fb0"); fbDevice = "/dev/fb0"_L1;
if (!QFile::exists(fbDevice)) if (!QFile::exists(fbDevice))
fbDevice = QLatin1String("/dev/graphics/fb0"); fbDevice = "/dev/graphics/fb0"_L1;
if (!QFile::exists(fbDevice)) { if (!QFile::exists(fbDevice)) {
qWarning("Unable to figure out framebuffer device. Specify it manually."); qWarning("Unable to figure out framebuffer device. Specify it manually.");
return false; return false;

View File

@ -43,6 +43,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QMinimalIntegrationPlugin : public QPlatformIntegrationPlugin class QMinimalIntegrationPlugin : public QPlatformIntegrationPlugin
{ {
Q_OBJECT Q_OBJECT
@ -53,7 +55,7 @@ public:
QPlatformIntegration *QMinimalIntegrationPlugin::create(const QString& system, const QStringList& paramList) 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 new QMinimalIntegration(paramList);
return 0; return 0;

View File

@ -72,6 +72,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QCoreTextFontEngine; class QCoreTextFontEngine;
static const char debugBackingStoreEnvironmentVariable[] = "QT_DEBUG_BACKINGSTORE"; static const char debugBackingStoreEnvironmentVariable[] = "QT_DEBUG_BACKINGSTORE";
@ -80,11 +82,11 @@ static inline unsigned parseOptions(const QStringList &paramList)
{ {
unsigned options = 0; unsigned options = 0;
for (const QString &param : paramList) { for (const QString &param : paramList) {
if (param == QLatin1String("enable_fonts")) if (param == "enable_fonts"_L1)
options |= QMinimalIntegration::EnableFonts; options |= QMinimalIntegration::EnableFonts;
else if (param == QLatin1String("freetype")) else if (param == "freetype"_L1)
options |= QMinimalIntegration::FreeTypeFontDatabase; options |= QMinimalIntegration::FreeTypeFontDatabase;
else if (param == QLatin1String("fontconfig")) else if (param == "fontconfig"_L1)
options |= QMinimalIntegration::FontconfigDatabase; options |= QMinimalIntegration::FontconfigDatabase;
} }
return options; return options;

View File

@ -42,6 +42,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QMinimalEglIntegrationPlugin : public QPlatformIntegrationPlugin class QMinimalEglIntegrationPlugin : public QPlatformIntegrationPlugin
{ {
Q_OBJECT Q_OBJECT
@ -53,7 +55,7 @@ public:
QPlatformIntegration* QMinimalEglIntegrationPlugin::create(const QString& system, const QStringList& paramList) QPlatformIntegration* QMinimalEglIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{ {
Q_UNUSED(paramList); Q_UNUSED(paramList);
if (!system.compare(QLatin1String("minimalegl"), Qt::CaseInsensitive)) if (!system.compare("minimalegl"_L1, Qt::CaseInsensitive))
return new QMinimalEglIntegration; return new QMinimalEglIntegration;
return 0; return 0;

View File

@ -43,6 +43,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QOffscreenIntegrationPlugin : public QPlatformIntegrationPlugin class QOffscreenIntegrationPlugin : public QPlatformIntegrationPlugin
{ {
Q_OBJECT Q_OBJECT
@ -53,7 +55,7 @@ public:
QPlatformIntegration *QOffscreenIntegrationPlugin::create(const QString& system, const QStringList& paramList) 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 QOffscreenIntegration::createOffscreenIntegration(paramList);
return nullptr; return nullptr;

View File

@ -74,6 +74,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QCoreTextFontEngine; class QCoreTextFontEngine;
template <typename BaseEventDispatcher> template <typename BaseEventDispatcher>
@ -176,7 +178,7 @@ std::optional<QJsonObject> QOffscreenIntegration::resolveConfigFileConfiguration
QString configFilePath; QString configFilePath;
for (const QString &param : paramList) { for (const QString &param : paramList) {
// Look for "configfile=/path/to/file/" // Look for "configfile=/path/to/file/"
QString configPrefix(QLatin1String("configfile=")); QString configPrefix("configfile="_L1);
if (param.startsWith(configPrefix)) { if (param.startsWith(configPrefix)) {
hasConfigFile = true; hasConfigFile = true;
configFilePath = param.mid(configPrefix.length()); configFilePath = param.mid(configPrefix.length());
@ -419,8 +421,8 @@ public:
virtual const QFont *font(Font type = SystemFont) const override virtual const QFont *font(Font type = SystemFont) const override
{ {
static QFont systemFont(QLatin1String("Sans Serif"), 9); static QFont systemFont("Sans Serif"_L1, 9);
static QFont fixedFont(QLatin1String("monospace"), 9); static QFont fixedFont("monospace"_L1, 9);
switch (type) { switch (type) {
case QPlatformTheme::SystemFont: case QPlatformTheme::SystemFont:
return &systemFont; return &systemFont;

View File

@ -43,9 +43,11 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
QPlatformIntegration *QQnxIntegrationPlugin::create(const QString& system, const QStringList& paramList) QPlatformIntegration *QQnxIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{ {
if (!system.compare(QLatin1String("qnx"), Qt::CaseInsensitive)) { if (!system.compare("qnx"_L1, Qt::CaseInsensitive)) {
qqnxLgmonInit(); qqnxLgmonInit();
return new QQnxIntegration(paramList); return new QQnxIntegration(paramList);
} }

View File

@ -106,24 +106,26 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
QQnxIntegration *QQnxIntegration::ms_instance; QQnxIntegration *QQnxIntegration::ms_instance;
static inline QQnxIntegration::Options parseOptions(const QStringList &paramList) static inline QQnxIntegration::Options parseOptions(const QStringList &paramList)
{ {
QQnxIntegration::Options options = QQnxIntegration::NoOptions; QQnxIntegration::Options options = QQnxIntegration::NoOptions;
if (!paramList.contains(QLatin1String("no-fullscreen"))) { if (!paramList.contains("no-fullscreen"_L1)) {
options |= QQnxIntegration::FullScreenApplication; options |= QQnxIntegration::FullScreenApplication;
} }
if (paramList.contains(QLatin1String("flush-screen-context"))) { if (paramList.contains("flush-screen-context"_L1)) {
options |= QQnxIntegration::AlwaysFlushScreenContext; options |= QQnxIntegration::AlwaysFlushScreenContext;
} }
if (paramList.contains(QLatin1String("rootwindow"))) { if (paramList.contains("rootwindow"_L1)) {
options |= QQnxIntegration::RootWindow; options |= QQnxIntegration::RootWindow;
} }
if (!paramList.contains(QLatin1String("disable-EGL_KHR_surfaceless_context"))) { if (!paramList.contains("disable-EGL_KHR_surfaceless_context"_L1)) {
options |= QQnxIntegration::SurfacelessEGLContext; options |= QQnxIntegration::SurfacelessEGLContext;
} }
@ -570,7 +572,7 @@ static bool getRequestedDisplays(QJsonArray &requestedDisplays)
// Read the requested display order // Read the requested display order
const QJsonObject object = doc.object(); const QJsonObject object = doc.object();
requestedDisplays = object.value(QLatin1String("displayOrder")).toArray(); requestedDisplays = object.value("displayOrder"_L1).toArray();
return true; return true;
} }

View File

@ -60,6 +60,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
QQnxNativeInterface::QQnxNativeInterface(QQnxIntegration *integration) QQnxNativeInterface::QQnxNativeInterface(QQnxIntegration *integration)
: m_integration(integration) : m_integration(integration)
{ {
@ -116,7 +118,7 @@ void QQnxNativeInterface::setWindowProperty(QPlatformWindow *window, const QStri
{ {
QQnxWindow *qnxWindow = static_cast<QQnxWindow*>(window); QQnxWindow *qnxWindow = static_cast<QQnxWindow*>(window);
if (name == QLatin1String("qnxWindowGroup")) { if (name == "qnxWindowGroup"_L1) {
if (value.isNull()) if (value.isNull())
qnxWindow->joinWindowGroup(QByteArray()); qnxWindow->joinWindowGroup(QByteArray());
else if (value.canConvert<QByteArray>()) else if (value.canConvert<QByteArray>())

View File

@ -136,6 +136,8 @@ static void finishCloseEvent(screen_event_t event)
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
QQnxScreenEventHandler::QQnxScreenEventHandler(QQnxIntegration *integration) QQnxScreenEventHandler::QQnxScreenEventHandler(QQnxIntegration *integration)
: m_qnxIntegration(integration) : m_qnxIntegration(integration)
, m_lastButtonState(Qt::NoButton) , m_lastButtonState(Qt::NoButton)
@ -147,7 +149,7 @@ QQnxScreenEventHandler::QQnxScreenEventHandler(QQnxIntegration *integration)
{ {
// Create a touch device // Create a touch device
m_touchDevice = new QPointingDevice( m_touchDevice = new QPointingDevice(
QLatin1String("touchscreen"), 1, QInputDevice::DeviceType::TouchScreen, "touchscreen"_L1, 1, QInputDevice::DeviceType::TouchScreen,
QPointingDevice::PointerType::Finger, QPointingDevice::PointerType::Finger,
QPointingDevice::Capability::Position | QPointingDevice::Capability::Area QPointingDevice::Capability::Position | QPointingDevice::Capability::Area
| QPointingDevice::Capability::Pressure | QPointingDevice::Capability::Pressure
@ -155,7 +157,7 @@ QQnxScreenEventHandler::QQnxScreenEventHandler(QQnxIntegration *integration)
MaximumTouchPoints, 8); MaximumTouchPoints, 8);
QWindowSystemInterface::registerInputDevice(m_touchDevice); 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::PointerType::Generic,
QPointingDevice::Capability::Position, 1, 8); QPointingDevice::Capability::Position, 1, 8);
QWindowSystemInterface::registerInputDevice(m_mouseDevice); QWindowSystemInterface::registerInputDevice(m_mouseDevice);

View File

@ -42,6 +42,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QVkKhrDisplayIntegrationPlugin : public QPlatformIntegrationPlugin class QVkKhrDisplayIntegrationPlugin : public QPlatformIntegrationPlugin
{ {
Q_OBJECT Q_OBJECT
@ -52,7 +54,7 @@ public:
QPlatformIntegration *QVkKhrDisplayIntegrationPlugin::create(const QString &system, const QStringList &paramList) QPlatformIntegration *QVkKhrDisplayIntegrationPlugin::create(const QString &system, const QStringList &paramList)
{ {
if (!system.compare(QLatin1String("vkkhrdisplay"), Qt::CaseInsensitive)) if (!system.compare("vkkhrdisplay"_L1, Qt::CaseInsensitive))
return new QVkKhrDisplayIntegration(paramList); return new QVkKhrDisplayIntegration(paramList);
return 0; return 0;

View File

@ -70,6 +70,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QVkKhrDisplayScreen : public QPlatformScreen class QVkKhrDisplayScreen : public QPlatformScreen
{ {
public: public:
@ -321,7 +323,7 @@ void QVkKhrDisplayIntegration::createInputHandlers()
{ {
#if QT_CONFIG(libinput) #if QT_CONFIG(libinput)
if (!qEnvironmentVariableIntValue("QT_QPA_NO_LIBINPUT")) { if (!qEnvironmentVariableIntValue("QT_QPA_NO_LIBINPUT")) {
new QLibInputHandler(QLatin1String("libinput"), QString()); new QLibInputHandler("libinput"_L1, QString());
return; return;
} }
#endif #endif
@ -329,16 +331,16 @@ void QVkKhrDisplayIntegration::createInputHandlers()
#if QT_CONFIG(tslib) #if QT_CONFIG(tslib)
bool useTslib = qEnvironmentVariableIntValue("QT_QPA_TSLIB"); bool useTslib = qEnvironmentVariableIntValue("QT_QPA_TSLIB");
if (useTslib) if (useTslib)
new QTsLibMouseHandler(QLatin1String("TsLib"), QString()); new QTsLibMouseHandler("TsLib"_L1, QString());
#endif #endif
#if QT_CONFIG(evdev) #if QT_CONFIG(evdev)
new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString(), this); new QEvdevKeyboardManager("EvdevKeyboard"_L1, QString(), this);
new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString(), this); new QEvdevMouseManager("EvdevMouse"_L1, QString(), this);
#if QT_CONFIG(tslib) #if QT_CONFIG(tslib)
if (!useTslib) if (!useTslib)
#endif #endif
new QEvdevTouchManager(QLatin1String("EvdevTouch"), QString() /* spec */, this); new QEvdevTouchManager("EvdevTouch"_L1, QString() /* spec */, this);
#endif #endif
} }

View File

@ -43,6 +43,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QVncIntegrationPlugin : public QPlatformIntegrationPlugin class QVncIntegrationPlugin : public QPlatformIntegrationPlugin
{ {
Q_OBJECT Q_OBJECT
@ -53,7 +55,7 @@ public:
QPlatformIntegration* QVncIntegrationPlugin::create(const QString& system, const QStringList& paramList) 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 new QVncIntegration(paramList);
return nullptr; return nullptr;

View File

@ -58,11 +58,13 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
QVncIntegration::QVncIntegration(const QStringList &paramList) QVncIntegration::QVncIntegration(const QStringList &paramList)
: m_fontDb(new QGenericUnixFontDatabase), : m_fontDb(new QGenericUnixFontDatabase),
m_services(new QGenericUnixServices) m_services(new QGenericUnixServices)
{ {
QRegularExpression portRx(QLatin1String("port=(\\d+)")); QRegularExpression portRx("port=(\\d+)"_L1);
quint16 port = 5900; quint16 port = 5900;
for (const QString &arg : paramList) { for (const QString &arg : paramList) {
QRegularExpressionMatch match; QRegularExpressionMatch match;

View File

@ -49,6 +49,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
QVncScreen::QVncScreen(const QStringList &args) QVncScreen::QVncScreen(const QStringList &args)
: mArgs(args) : mArgs(args)
@ -66,9 +68,9 @@ QVncScreen::~QVncScreen()
bool QVncScreen::initialize() bool QVncScreen::initialize()
{ {
QRegularExpression sizeRx(QLatin1String("size=(\\d+)x(\\d+)")); QRegularExpression sizeRx("size=(\\d+)x(\\d+)"_L1);
QRegularExpression mmSizeRx(QLatin1String("mmsize=(?<width>(\\d*\\.)?\\d+)x(?<height>(\\d*\\.)?\\d+)")); QRegularExpression mmSizeRx("mmsize=(?<width>(\\d*\\.)?\\d+)x(?<height>(\\d*\\.)?\\d+)"_L1);
QRegularExpression depthRx(QLatin1String("depth=(\\d+)")); QRegularExpression depthRx("depth=(\\d+)"_L1);
mGeometry = QRect(0, 0, 1024, 768); mGeometry = QRect(0, 0, 1024, 768);
mFormat = QImage::Format_ARGB32_Premultiplied; mFormat = QImage::Format_ARGB32_Premultiplied;

View File

@ -33,6 +33,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
void QWasmFontDatabase::populateFontDatabase() void QWasmFontDatabase::populateFontDatabase()
{ {
// Load font file from resources. Currently // Load font file from resources. Currently
@ -81,7 +83,7 @@ void QWasmFontDatabase::releaseHandle(void *handle)
QFont QWasmFontDatabase::defaultFont() const QFont QWasmFontDatabase::defaultFont() const
{ {
return QFont(QLatin1String("Bitstream Vera Sans")); return QFont("Bitstream Vera Sans"_L1);
} }
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -61,6 +61,8 @@
using namespace emscripten; using namespace emscripten;
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
static void addContainerElement(emscripten::val element) static void addContainerElement(emscripten::val element)
{ {
QWasmIntegration::get()->addScreen(element); QWasmIntegration::get()->addScreen(element);
@ -296,12 +298,12 @@ Qt::WindowState QWasmIntegration::defaultWindowState(Qt::WindowFlags flags) cons
QStringList QWasmIntegration::themeNames() const QStringList QWasmIntegration::themeNames() const
{ {
return QStringList() << QLatin1String("webassembly"); return QStringList() << "webassembly"_L1;
} }
QPlatformTheme *QWasmIntegration::createPlatformTheme(const QString &name) const QPlatformTheme *QWasmIntegration::createPlatformTheme(const QString &name) const
{ {
if (name == QLatin1String("webassembly")) if (name == "webassembly"_L1)
return new QWasmTheme; return new QWasmTheme;
return QPlatformIntegration::createPlatformTheme(name); return QPlatformIntegration::createPlatformTheme(name);
} }

View File

@ -33,6 +33,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
QWasmTheme::QWasmTheme() QWasmTheme::QWasmTheme()
{ {
for (auto family : QFontDatabase::families()) for (auto family : QFontDatabase::families())
@ -49,7 +51,7 @@ QWasmTheme::~QWasmTheme()
QVariant QWasmTheme::themeHint(ThemeHint hint) const QVariant QWasmTheme::themeHint(ThemeHint hint) const
{ {
if (hint == QPlatformTheme::StyleNames) if (hint == QPlatformTheme::StyleNames)
return QVariant(QStringList() << QLatin1String("Fusion")); return QVariant(QStringList() << "Fusion"_L1);
return QPlatformTheme::themeHint(hint); return QPlatformTheme::themeHint(hint);
} }

View File

@ -45,6 +45,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
/*! /*!
\title Qt platform plugin for Windows \title Qt platform plugin for Windows
@ -106,7 +108,7 @@ public:
QPlatformIntegration *QWindowsIntegrationPlugin::create(const QString& system, const QStringList& paramList, int &, char **) 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 new QWindowsGdiIntegration(paramList);
return nullptr; return nullptr;
} }

View File

@ -94,6 +94,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
Q_LOGGING_CATEGORY(lcQpaWindows, "qt.qpa.windows") Q_LOGGING_CATEGORY(lcQpaWindows, "qt.qpa.windows")
Q_LOGGING_CATEGORY(lcQpaEvents, "qt.qpa.events") Q_LOGGING_CATEGORY(lcQpaEvents, "qt.qpa.events")
Q_LOGGING_CATEGORY(lcQpaGl, "qt.qpa.gl") 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 // Create a unique name for the flag combination
QString cname = classNamePrefix(); QString cname = classNamePrefix();
cname += QLatin1String("QWindow"); cname += "QWindow"_L1;
switch (type) { switch (type) {
case Qt::Tool: case Qt::Tool:
cname += QLatin1String("Tool"); cname += "Tool"_L1;
break; break;
case Qt::ToolTip: case Qt::ToolTip:
cname += QLatin1String("ToolTip"); cname += "ToolTip"_L1;
break; break;
case Qt::Popup: case Qt::Popup:
cname += QLatin1String("Popup"); cname += "Popup"_L1;
break; break;
default: default:
break; break;
} }
if (style & CS_DROPSHADOW) if (style & CS_DROPSHADOW)
cname += QLatin1String("DropShadow"); cname += "DropShadow"_L1;
if (style & CS_SAVEBITS) if (style & CS_SAVEBITS)
cname += QLatin1String("SaveBits"); cname += "SaveBits"_L1;
if (style & CS_OWNDC) if (style & CS_OWNDC)
cname += QLatin1String("OwnDC"); cname += "OwnDC"_L1;
if (icon) if (icon)
cname += QLatin1String("Icon"); cname += "Icon"_L1;
return registerWindowClass(cname, qWindowsWndProc, style, GetSysColorBrush(COLOR_WINDOW), icon); return registerWindowClass(cname, qWindowsWndProc, style, GetSysColorBrush(COLOR_WINDOW), icon);
} }

View File

@ -79,6 +79,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
#ifndef QT_NO_DEBUG_STREAM #ifndef QT_NO_DEBUG_STREAM
/* Output UID (IID, CLSID) as C++ constants. /* Output UID (IID, CLSID) as C++ constants.
* The constants are contained in the Windows SDK libs, but not for MinGW. */ * 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) bool QWindowsShellItem::copyData(QIODevice *out, QString *errorMessage)
{ {
if (!canStream()) { if (!canStream()) {
*errorMessage = QLatin1String("Item not streamable"); *errorMessage = "Item not streamable"_L1;
return false; return false;
} }
IStream *istream = nullptr; IStream *istream = nullptr;
HRESULT hr = m_item->BindToHandler(nullptr, BHID_Stream, IID_PPV_ARGS(&istream)); HRESULT hr = m_item->BindToHandler(nullptr, BHID_Stream, IID_PPV_ARGS(&istream));
if (FAILED(hr)) { if (FAILED(hr)) {
*errorMessage = QLatin1String("BindToHandler() failed: ") *errorMessage = "BindToHandler() failed: "_L1
+ QLatin1String(QWindowsContext::comErrorString(hr)); + QLatin1String(QWindowsContext::comErrorString(hr));
return false; return false;
} }
@ -689,7 +691,7 @@ bool QWindowsShellItem::copyData(QIODevice *out, QString *errorMessage)
} }
istream->Release(); istream->Release();
if (hr != S_OK && hr != S_FALSE) { if (hr != S_OK && hr != S_FALSE) {
*errorMessage = QLatin1String("Read() failed: ") *errorMessage = "Read() failed: "_L1
+ QLatin1String(QWindowsContext::comErrorString(hr)); + QLatin1String(QWindowsContext::comErrorString(hr));
return false; return false;
} }
@ -1439,14 +1441,14 @@ QString tempFilePattern(QString name)
static QString createTemporaryItemCopy(QWindowsShellItem &qItem, QString *errorMessage) static QString createTemporaryItemCopy(QWindowsShellItem &qItem, QString *errorMessage)
{ {
if (!qItem.canStream()) { if (!qItem.canStream()) {
*errorMessage = QLatin1String("Item not streamable"); *errorMessage = "Item not streamable"_L1;
return QString(); return QString();
} }
QTemporaryFile targetFile(tempFilePattern(qItem.normalDisplay())); QTemporaryFile targetFile(tempFilePattern(qItem.normalDisplay()));
targetFile.setAutoRemove(false); targetFile.setAutoRemove(false);
if (!targetFile.open()) { if (!targetFile.open()) {
*errorMessage = QLatin1String("Cannot create temporary file: ") *errorMessage = "Cannot create temporary file: "_L1
+ targetFile.errorString(); + targetFile.errorString();
return QString(); return QString();
} }

View File

@ -101,6 +101,8 @@ static inline void initOpenGlBlacklistResources()
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
/*! /*!
\class QWindowsIntegration \class QWindowsIntegration
\brief QPlatformIntegration implementation for Windows. \brief QPlatformIntegration implementation for Windows.
@ -211,9 +213,9 @@ static inline unsigned parseOptions(const QStringList &paramList,
options |= QWindowsIntegration::DontUseColorFonts; options |= QWindowsIntegration::DontUseColorFonts;
} else if (param == u"nomousefromtouch") { } else if (param == u"nomousefromtouch") {
options |= QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch; options |= QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch;
} else if (parseIntOption(param, QLatin1String("verbose"), 0, INT_MAX, &QWindowsContext::verbose) } else if (parseIntOption(param, "verbose"_L1, 0, INT_MAX, &QWindowsContext::verbose)
|| parseIntOption(param, QLatin1String("tabletabsoluterange"), 0, INT_MAX, tabletAbsoluteRange) || parseIntOption(param, "tabletabsoluterange"_L1, 0, INT_MAX, tabletAbsoluteRange)
|| parseIntOption(param, QLatin1String("dpiawareness"), QtWindows::ProcessDpiUnaware, QtWindows::ProcessPerMonitorV2DpiAware, dpiAwareness)) { || parseIntOption(param, "dpiawareness"_L1, QtWindows::ProcessDpiUnaware, QtWindows::ProcessPerMonitorV2DpiAware, dpiAwareness)) {
} else if (param == u"menus=native") { } else if (param == u"menus=native") {
options |= QWindowsIntegration::AlwaysUseNativeMenus; options |= QWindowsIntegration::AlwaysUseNativeMenus;
} else if (param == u"menus=none") { } else if (param == u"menus=none") {

View File

@ -55,6 +55,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
/* The MSVC compilers allows multi-byte characters, that has the behavior of /* The MSVC compilers allows multi-byte characters, that has the behavior of
* that each character gets shifted into position. 0x73524742 below is for MSVC * that each character gets shifted into position. 0x73524742 below is for MSVC
* equivalent to doing 'sRGB', but this does of course not work * 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); QByteArray data = getData(CF_UNICODETEXT, pDataObj);
if (!data.isEmpty()) { if (!data.isEmpty()) {
str = QString::fromWCharArray(reinterpret_cast<const wchar_t *>(data.constData())); 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 { } else {
data = getData(CF_TEXT, pDataObj); data = getData(CF_TEXT, pDataObj);
if (!data.isEmpty()) { if (!data.isEmpty()) {

View File

@ -60,6 +60,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
static inline QDpi deviceDPI(HDC hdc) static inline QDpi deviceDPI(HDC hdc)
{ {
return QDpi(GetDeviceCaps(hdc, LOGPIXELSX), GetDeviceCaps(hdc, LOGPIXELSY)); return QDpi(GetDeviceCaps(hdc, LOGPIXELSX), GetDeviceCaps(hdc, LOGPIXELSY));
@ -485,9 +487,9 @@ QPlatformScreen::SubpixelAntialiasingType QWindowsScreen::subpixelAntialiasingTy
{ {
QPlatformScreen::SubpixelAntialiasingType type = QPlatformScreen::subpixelAntialiasingTypeHint(); QPlatformScreen::SubpixelAntialiasingType type = QPlatformScreen::subpixelAntialiasingTypeHint();
if (type == QPlatformScreen::Subpixel_None) { 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); QSettings::NativeFormat);
int registryValue = settings.value(QLatin1String("PixelStructure"), -1).toInt(); int registryValue = settings.value("PixelStructure"_L1, -1).toInt();
switch (registryValue) { switch (registryValue) {
case 0: case 0:
type = QPlatformScreen::Subpixel_None; type = QPlatformScreen::Subpixel_None;

View File

@ -54,6 +54,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
enum { debug = 0 }; enum { debug = 0 };
class QWindowsShellExecuteThread : public QThread class QWindowsShellExecuteThread : public QThread
@ -111,8 +113,8 @@ static inline QString mailCommand()
// Check if user has set preference, otherwise use default. // Check if user has set preference, otherwise use default.
QString keyName = QWinRegistryKey(HKEY_CURRENT_USER, mailUserKey) QString keyName = QWinRegistryKey(HKEY_CURRENT_USER, mailUserKey)
.stringValue( L"Progid"); .stringValue( L"Progid");
const QLatin1String mailto = keyName.isEmpty() ? QLatin1String("mailto") : QLatin1String(); const auto mailto = keyName.isEmpty() ? "mailto"_L1 : QLatin1String();
keyName += mailto + QLatin1String("\\Shell\\Open\\Command"); keyName += mailto + "\\Shell\\Open\\Command"_L1;
if (debug) if (debug)
qDebug() << __FUNCTION__ << "keyName=" << keyName; qDebug() << __FUNCTION__ << "keyName=" << keyName;
const QString command = QWinRegistryKey(HKEY_CLASSES_ROOT, keyName).stringValue(L""); 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(), // Pass the url as the parameter. Should use QProcess::startDetached(),
// but that cannot handle a Windows command line [yet]. // 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) if (debug)
qDebug() << __FUNCTION__ << "Launching" << command; qDebug() << __FUNCTION__ << "Launching" << command;
//start the process //start the process

View File

@ -88,6 +88,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
static inline QColor COLORREFToQColor(COLORREF cr) static inline QColor COLORREFToQColor(COLORREF cr)
{ {
return QColor(GetRValue(cr), GetGValue(cr), GetBValue(cr)); return QColor(GetRValue(cr), GetGValue(cr), GetBValue(cr));
@ -460,7 +462,7 @@ QWindowsTheme::~QWindowsTheme()
static inline QStringList iconThemeSearchPaths() 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(); 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) 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) if (iconSize == SHGFI_LARGEICON)
key += u'l'; key += u'l';
switch (imageListSize) { switch (imageListSize) {
@ -924,7 +926,7 @@ QString QWindowsFileIconEngine::cacheKey() const
|| !suffix.compare(u"ico", Qt::CaseInsensitive)) { || !suffix.compare(u"ico", Qt::CaseInsensitive)) {
return QString(); return QString();
} }
return QLatin1String("qt_.") return "qt_."_L1
+ (suffix.isEmpty() ? fileInfo().fileName() : std::move(suffix).toUpper()); // handle "Makefile" ;) + (suffix.isEmpty() ? fileInfo().fileName() : std::move(suffix).toUpper()); // handle "Makefile" ;)
} }

View File

@ -47,8 +47,10 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, 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) QXcbGlIntegration *QXcbGlIntegrationFactory::create(const QString &platform)
{ {

View File

@ -60,6 +60,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
#if QT_CONFIG(xrender) #if QT_CONFIG(xrender)
class QXRenderTessellator : public QTessellator 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) static QPixmap qt_patternForAlpha(uchar alpha, int screen)
{ {
QPixmap pm; QPixmap pm;
QString key = QLatin1String("$qt-alpha-brush$") QString key = "$qt-alpha-brush$"_L1
% HexString<uchar>(alpha) % HexString<uchar>(alpha)
% HexString<int>(screen); % HexString<int>(screen);

View File

@ -73,6 +73,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
Q_LOGGING_CATEGORY(lcQpaXInput, "qt.qpa.input") Q_LOGGING_CATEGORY(lcQpaXInput, "qt.qpa.input")
Q_LOGGING_CATEGORY(lcQpaXInputDevices, "qt.qpa.input.devices") Q_LOGGING_CATEGORY(lcQpaXInputDevices, "qt.qpa.input.devices")
Q_LOGGING_CATEGORY(lcQpaXInputEvents, "qt.qpa.input.events") Q_LOGGING_CATEGORY(lcQpaXInputEvents, "qt.qpa.input.events")
@ -898,7 +900,7 @@ xcb_window_t QXcbConnection::qtSelectionOwner()
nullptr); // value list nullptr); // value list
QXcbWindow::setWindowTitle(connection(), m_qtSelectionOwner, QXcbWindow::setWindowTitle(connection(), m_qtSelectionOwner,
QLatin1String("Qt Selection Owner for ") + QCoreApplication::applicationName()); "Qt Selection Owner for "_L1 + QCoreApplication::applicationName());
} }
return m_qtSelectionOwner; return m_qtSelectionOwner;
} }
@ -1162,7 +1164,7 @@ QXcbGlIntegration *QXcbConnection::glIntegration() const
QString glIntegrationName = QString::fromLocal8Bit(qgetenv("QT_XCB_GL_INTEGRATION")); QString glIntegrationName = QString::fromLocal8Bit(qgetenv("QT_XCB_GL_INTEGRATION"));
if (!glIntegrationName.isEmpty()) { if (!glIntegrationName.isEmpty()) {
qCDebug(lcQpaGl) << "QT_XCB_GL_INTEGRATION is set to" << glIntegrationName; qCDebug(lcQpaGl) << "QT_XCB_GL_INTEGRATION is set to" << glIntegrationName;
if (glIntegrationName != QLatin1String("none")) { if (glIntegrationName != "none"_L1) {
glIntegrationNames.removeAll(glIntegrationName); glIntegrationNames.removeAll(glIntegrationName);
glIntegrationNames.prepend(glIntegrationName); glIntegrationNames.prepend(glIntegrationName);
} else { } else {

View File

@ -53,6 +53,8 @@
#define QT_XCB_HAS_TOUCHPAD_GESTURES (XCB_INPUT_MINOR_VERSION >= 4) #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; using qt_xcb_input_device_event_t = xcb_input_button_press_event_t;
#if QT_XCB_HAS_TOUCHPAD_GESTURES #if QT_XCB_HAS_TOUCHPAD_GESTURES
using qt_xcb_input_pinch_event_t = xcb_input_gesture_pinch_begin_event_t; 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. // But we need to be careful not to take the touch and tablet-button devices as tablets.
QByteArray nameLower = nameRaw.toLower(); QByteArray nameLower = nameRaw.toLower();
QString dbgType = QLatin1String("UNKNOWN"); QString dbgType = "UNKNOWN"_L1;
if (nameLower.contains("eraser")) { if (nameLower.contains("eraser")) {
isTablet = true; isTablet = true;
tabletData.pointerType = QPointingDevice::PointerType::Eraser; tabletData.pointerType = QPointingDevice::PointerType::Eraser;
dbgType = QLatin1String("eraser"); dbgType = "eraser"_L1;
} else if (nameLower.contains("cursor") && !(nameLower.contains("cursor controls") && nameLower.contains("trackball"))) { } else if (nameLower.contains("cursor") && !(nameLower.contains("cursor controls") && nameLower.contains("trackball"))) {
isTablet = true; isTablet = true;
tabletData.pointerType = QPointingDevice::PointerType::Cursor; tabletData.pointerType = QPointingDevice::PointerType::Cursor;
dbgType = QLatin1String("cursor"); dbgType = "cursor"_L1;
} else if (nameLower.contains("wacom") && nameLower.contains("finger touch")) { } else if (nameLower.contains("wacom") && nameLower.contains("finger touch")) {
isTablet = false; isTablet = false;
} else if ((nameLower.contains("pen") || nameLower.contains("stylus")) && isTablet) { } else if ((nameLower.contains("pen") || nameLower.contains("stylus")) && isTablet) {
tabletData.pointerType = QPointingDevice::PointerType::Pen; tabletData.pointerType = QPointingDevice::PointerType::Pen;
dbgType = QLatin1String("pen"); dbgType = "pen"_L1;
} else if (nameLower.contains("wacom") && isTablet && !nameLower.contains("touch")) { } else if (nameLower.contains("wacom") && isTablet && !nameLower.contains("touch")) {
// combined device (evdev) rather than separate pen/eraser (wacom driver) // combined device (evdev) rather than separate pen/eraser (wacom driver)
tabletData.pointerType = QPointingDevice::PointerType::Pen; tabletData.pointerType = QPointingDevice::PointerType::Pen;
dbgType = QLatin1String("pen"); dbgType = "pen"_L1;
} else if (nameLower.contains("aiptek") /* && device == QXcbAtom::KEYBOARD */) { } else if (nameLower.contains("aiptek") /* && device == QXcbAtom::KEYBOARD */) {
// some "Genius" tablets // some "Genius" tablets
isTablet = true; isTablet = true;
tabletData.pointerType = QPointingDevice::PointerType::Pen; tabletData.pointerType = QPointingDevice::PointerType::Pen;
dbgType = QLatin1String("pen"); dbgType = "pen"_L1;
} else if (nameLower.contains("waltop") && nameLower.contains("tablet")) { } else if (nameLower.contains("waltop") && nameLower.contains("tablet")) {
// other "Genius" tablets // other "Genius" tablets
// WALTOP International Corp. Slim Tablet // WALTOP International Corp. Slim Tablet
isTablet = true; isTablet = true;
tabletData.pointerType = QPointingDevice::PointerType::Pen; tabletData.pointerType = QPointingDevice::PointerType::Pen;
dbgType = QLatin1String("pen"); dbgType = "pen"_L1;
} else if (nameLower.contains("uc-logic") && isTablet) { } else if (nameLower.contains("uc-logic") && isTablet) {
tabletData.pointerType = QPointingDevice::PointerType::Pen; tabletData.pointerType = QPointingDevice::PointerType::Pen;
dbgType = QLatin1String("pen"); dbgType = "pen"_L1;
} else if (nameLower.contains("ugee")) { } else if (nameLower.contains("ugee")) {
isTablet = true; isTablet = true;
tabletData.pointerType = QPointingDevice::PointerType::Pen; tabletData.pointerType = QPointingDevice::PointerType::Pen;
dbgType = QLatin1String("pen"); dbgType = "pen"_L1;
} else { } else {
isTablet = false; isTablet = false;
} }

View File

@ -55,6 +55,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
typedef int (*PtrXcursorLibraryLoadCursor)(void *, const char *); typedef int (*PtrXcursorLibraryLoadCursor)(void *, const char *);
typedef char *(*PtrXcursorLibraryGetTheme)(void *); typedef char *(*PtrXcursorLibraryGetTheme)(void *);
typedef int (*PtrXcursorLibrarySetTheme)(void *, const char *); typedef int (*PtrXcursorLibrarySetTheme)(void *, const char *);
@ -317,10 +319,10 @@ QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen)
#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) #if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
static bool function_ptrs_not_initialized = true; static bool function_ptrs_not_initialized = true;
if (function_ptrs_not_initialized) { if (function_ptrs_not_initialized) {
QLibrary xcursorLib(QLatin1String("Xcursor"), 1); QLibrary xcursorLib("Xcursor"_L1, 1);
bool xcursorFound = xcursorLib.load(); bool xcursorFound = xcursorLib.load();
if (!xcursorFound) { // try without the version number if (!xcursorFound) { // try without the version number
xcursorLib.setFileName(QLatin1String("Xcursor")); xcursorLib.setFileName("Xcursor"_L1);
xcursorFound = xcursorLib.load(); xcursorFound = xcursorLib.load();
} }
if (xcursorFound) { if (xcursorFound) {

View File

@ -100,16 +100,18 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
// Find out if our parent process is gdb by looking at the 'exe' symlink under /proc,. // Find out if our parent process is gdb by looking at the 'exe' symlink under /proc,.
// or, for older Linuxes, read out 'cmdline'. // or, for older Linuxes, read out 'cmdline'.
static bool runningUnderDebugger() static bool runningUnderDebugger()
{ {
#if defined(QT_DEBUG) && defined(Q_OS_LINUX) #if defined(QT_DEBUG) && defined(Q_OS_LINUX)
const QString parentProc = QLatin1String("/proc/") + QString::number(getppid()); const QString parentProc = "/proc/"_L1 + QString::number(getppid());
const QFileInfo parentProcExe(parentProc + QLatin1String("/exe")); const QFileInfo parentProcExe(parentProc + "/exe"_L1);
if (parentProcExe.isSymLink()) if (parentProcExe.isSymLink())
return parentProcExe.symLinkTarget().endsWith(QLatin1String("/gdb")); return parentProcExe.symLinkTarget().endsWith("/gdb"_L1);
QFile f(parentProc + QLatin1String("/cmdline")); QFile f(parentProc + "/cmdline"_L1);
if (!f.open(QIODevice::ReadOnly)) if (!f.open(QIODevice::ReadOnly))
return false; return false;
QByteArray s; QByteArray s;
@ -360,14 +362,14 @@ QAbstractEventDispatcher *QXcbIntegration::createEventDispatcher() const
void QXcbIntegration::initialize() void QXcbIntegration::initialize()
{ {
const QLatin1String defaultInputContext("compose"); const auto defaultInputContext = "compose"_L1;
// Perform everything that may potentially need the event dispatcher (timers, socket // Perform everything that may potentially need the event dispatcher (timers, socket
// notifiers) here instead of the constructor. // notifiers) here instead of the constructor.
QString icStr = QPlatformInputContextFactory::requested(); QString icStr = QPlatformInputContextFactory::requested();
if (icStr.isNull()) if (icStr.isNull())
icStr = defaultInputContext; icStr = defaultInputContext;
m_inputContext.reset(QPlatformInputContextFactory::create(icStr)); 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)); m_inputContext.reset(QPlatformInputContextFactory::create(defaultInputContext));
connection()->keyboard()->initialize(); connection()->keyboard()->initialize();

View File

@ -42,6 +42,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QXcbIntegrationPlugin : public QPlatformIntegrationPlugin class QXcbIntegrationPlugin : public QPlatformIntegrationPlugin
{ {
Q_OBJECT Q_OBJECT
@ -52,7 +54,7 @@ public:
QPlatformIntegration* QXcbIntegrationPlugin::create(const QString& system, const QStringList& parameters, int &argc, char **argv) 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); auto xcbIntegration = new QXcbIntegration(parameters, argc, argv);
if (!xcbIntegration->hasConnection()) { if (!xcbIntegration->hasConnection()) {
delete xcbIntegration; delete xcbIntegration;

View File

@ -45,6 +45,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
QXcbMime::QXcbMime() QXcbMime::QXcbMime()
: QInternalMimeData() : QInternalMimeData()
{ } { }
@ -63,11 +65,11 @@ QString QXcbMime::mimeAtomToString(QXcbConnection *connection, xcb_atom_t a)
if (a == XCB_ATOM_STRING if (a == XCB_ATOM_STRING
|| a == connection->atom(QXcbAtom::UTF8_STRING) || a == connection->atom(QXcbAtom::UTF8_STRING)
|| a == connection->atom(QXcbAtom::TEXT)) || a == connection->atom(QXcbAtom::TEXT))
return QLatin1String("text/plain"); return "text/plain"_L1;
// special case for images // special case for images
if (a == XCB_ATOM_PIXMAP) if (a == XCB_ATOM_PIXMAP)
return QLatin1String("image/ppm"); return "image/ppm"_L1;
QByteArray atomName = connection->atomName(a); 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) if ((a == connection->atom(QXcbAtom::UTF8_STRING)
|| a == XCB_ATOM_STRING || a == XCB_ATOM_STRING
|| a == connection->atom(QXcbAtom::TEXT)) || a == connection->atom(QXcbAtom::TEXT))
&& QInternalMimeData::hasFormatHelper(QLatin1String("text/plain"), mimeData)) { && QInternalMimeData::hasFormatHelper("text/plain"_L1, mimeData)) {
if (a == connection->atom(QXcbAtom::UTF8_STRING)) { if (a == connection->atom(QXcbAtom::UTF8_STRING)) {
*data = QInternalMimeData::renderDataHelper(QLatin1String("text/plain"), mimeData); *data = QInternalMimeData::renderDataHelper("text/plain"_L1, mimeData);
ret = true; ret = true;
} else if (a == XCB_ATOM_STRING || } else if (a == XCB_ATOM_STRING ||
a == connection->atom(QXcbAtom::TEXT)) { a == connection->atom(QXcbAtom::TEXT)) {
// ICCCM says STRING is latin1 // ICCCM says STRING is latin1
*data = QString::fromUtf8(QInternalMimeData::renderDataHelper( *data = QString::fromUtf8(QInternalMimeData::renderDataHelper(
QLatin1String("text/plain"), mimeData)).toLatin1(); "text/plain"_L1, mimeData)).toLatin1();
ret = true; ret = true;
} }
return ret; return ret;
@ -110,18 +112,17 @@ bool QXcbMime::mimeDataForAtom(QXcbConnection *connection, xcb_atom_t a, QMimeDa
*data = QInternalMimeData::renderDataHelper(atomName, mimeData); *data = QInternalMimeData::renderDataHelper(atomName, mimeData);
// mimeAtomToString() converts "text/x-moz-url" to "text/uri-list", // mimeAtomToString() converts "text/x-moz-url" to "text/uri-list",
// so QXcbConnection::atomName() has to be used. // 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") { && connection->atomName(a) == "text/x-moz-url") {
const QString mozUri = QLatin1String(data->split('\n').constFirst()) + u'\n'; const QString mozUri = QLatin1String(data->split('\n').constFirst()) + u'\n';
*data = QByteArray(reinterpret_cast<const char *>(mozUri.data()), *data = QByteArray(reinterpret_cast<const char *>(mozUri.data()),
mozUri.length() * 2); mozUri.length() * 2);
} else if (atomName == QLatin1String("application/x-color")) } else if (atomName == "application/x-color"_L1)
*dataFormat = 16; *dataFormat = 16;
ret = true; ret = true;
} else if ((a == XCB_ATOM_PIXMAP || a == XCB_ATOM_BITMAP) && mimeData->hasImage()) { } else if ((a == XCB_ATOM_PIXMAP || a == XCB_ATOM_BITMAP) && mimeData->hasImage()) {
ret = true; ret = true;
} else if (atomName == QLatin1String("text/plain") } else if (atomName == "text/plain"_L1 && mimeData->hasFormat("text/uri-list"_L1)) {
&& mimeData->hasFormat(QLatin1String("text/uri-list"))) {
// Return URLs also as plain text. // Return URLs also as plain text.
*data = QInternalMimeData::renderDataHelper(atomName, mimeData); *data = QInternalMimeData::renderDataHelper(atomName, mimeData);
ret = true; ret = true;
@ -136,22 +137,22 @@ QList<xcb_atom_t> QXcbMime::mimeAtomsForFormat(QXcbConnection *connection, const
atoms.append(connection->internAtom(format.toLatin1())); atoms.append(connection->internAtom(format.toLatin1()));
// special cases for strings // special cases for strings
if (format == QLatin1String("text/plain")) { if (format == "text/plain"_L1) {
atoms.append(connection->atom(QXcbAtom::UTF8_STRING)); atoms.append(connection->atom(QXcbAtom::UTF8_STRING));
atoms.append(XCB_ATOM_STRING); atoms.append(XCB_ATOM_STRING);
atoms.append(connection->atom(QXcbAtom::TEXT)); atoms.append(connection->atom(QXcbAtom::TEXT));
} }
// special cases for uris // 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/x-moz-url"));
atoms.append(connection->internAtom("text/plain")); atoms.append(connection->internAtom("text/plain"));
} }
//special cases for images //special cases for images
if (format == QLatin1String("image/ppm")) if (format == "image/ppm"_L1)
atoms.append(XCB_ATOM_PIXMAP); atoms.append(XCB_ATOM_PIXMAP);
if (format == QLatin1String("image/pbm")) if (format == "image/pbm"_L1)
atoms.append(XCB_ATOM_BITMAP); atoms.append(XCB_ATOM_BITMAP);
return atoms; return atoms;
@ -164,14 +165,14 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a,
QString atomName = mimeAtomToString(connection, a); QString atomName = mimeAtomToString(connection, a);
// qDebug() << "mimeConvertDataToFormat" << format << atomName << data; // 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) if (requestedType.id() == QMetaType::QString)
return QString::fromUtf8(data); return QString::fromUtf8(data);
return data; return data;
} }
// special cases for string types // special cases for string types
if (format == QLatin1String("text/plain")) { if (format == "text/plain"_L1) {
if (data.endsWith('\0')) if (data.endsWith('\0'))
data.chop(1); data.chop(1);
if (a == connection->atom(QXcbAtom::UTF8_STRING)) { 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", // Firefox uses UTF16 without BOM for text/x-moz-url, "text/html",
// Google Chrome uses UTF16 without BOM for "text/x-moz-url", // Google Chrome uses UTF16 without BOM for "text/x-moz-url",
// UTF16 with BOM for "text/html". // 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) { && data.size() > 1) {
const quint8 byte0 = data.at(0); const quint8 byte0 = data.at(0);
const quint8 byte1 = data.at(1); const quint8 byte1 = data.at(1);
@ -194,7 +195,7 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a,
const QString str = QString::fromUtf16( const QString str = QString::fromUtf16(
reinterpret_cast<const char16_t *>(data.constData()), data.size() / 2); reinterpret_cast<const char16_t *>(data.constData()), data.size() / 2);
if (!str.isNull()) { if (!str.isNull()) {
if (format == QLatin1String("text/uri-list")) { if (format == "text/uri-list"_L1) {
const auto urls = QStringView{str}.split(u'\n'); const auto urls = QStringView{str}.split(u'\n');
QList<QVariant> list; QList<QVariant> list;
list.reserve(urls.size()); list.reserve(urls.size());
@ -224,7 +225,7 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a,
#if 0 // ### #if 0 // ###
// special case for images // special case for images
if (format == QLatin1String("image/ppm")) { if (format == "image/ppm"_L1) {
if (a == XCB_ATOM_PIXMAP && data.size() == sizeof(Pixmap)) { if (a == XCB_ATOM_PIXMAP && data.size() == sizeof(Pixmap)) {
Pixmap xpm = *((Pixmap*)data.data()); Pixmap xpm = *((Pixmap*)data.data());
if (!xpm) if (!xpm)
@ -261,7 +262,7 @@ xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString
*hasUtf8 = false; *hasUtf8 = false;
// find matches for string types // find matches for string types
if (format == QLatin1String("text/plain")) { if (format == "text/plain"_L1) {
if (atoms.contains(connection->atom(QXcbAtom::UTF8_STRING))) if (atoms.contains(connection->atom(QXcbAtom::UTF8_STRING)))
return connection->atom(QXcbAtom::UTF8_STRING); return connection->atom(QXcbAtom::UTF8_STRING);
if (atoms.contains(XCB_ATOM_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 // 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()); xcb_atom_t a = connection->internAtom(format.toLatin1());
if (a && atoms.contains(a)) if (a && atoms.contains(a))
return a; return a;
@ -281,7 +282,7 @@ xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString
} }
// find match for image // find match for image
if (format == QLatin1String("image/ppm")) { if (format == "image/ppm"_L1) {
if (atoms.contains(XCB_ATOM_PIXMAP)) if (atoms.contains(XCB_ATOM_PIXMAP))
return 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 // for string/text requests try to use a format with a well-defined charset
// first to avoid encoding problems // first to avoid encoding problems
if (requestedType.id() == QMetaType::QString if (requestedType.id() == QMetaType::QString
&& format.startsWith(QLatin1String("text/")) && format.startsWith("text/"_L1)
&& !format.contains(QLatin1String("charset="))) { && !format.contains("charset="_L1)) {
QString formatWithCharset = format; 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()); xcb_atom_t a = connection->internAtom(std::move(formatWithCharset).toLatin1());
if (a && atoms.contains(a)) { if (a && atoms.contains(a)) {

View File

@ -55,6 +55,8 @@
#include <cerrno> // ERANGE #include <cerrno> // ERANGE
using namespace Qt::StringLiterals;
class QSmSocketReceiver : public QObject class QSmSocketReceiver : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -228,11 +230,11 @@ static void sm_performSaveYourself(QXcbSessionManager *sm)
// generate a restart and discard command that makes sense // generate a restart and discard command that makes sense
QStringList restart; QStringList restart;
restart << argument0 << QLatin1String("-session") << sm->sessionId() + u'_' + sm->sessionKey(); restart << argument0 << "-session"_L1 << sm->sessionId() + u'_' + sm->sessionKey();
QFileInfo fi(QCoreApplication::applicationFilePath()); QFileInfo fi(QCoreApplication::applicationFilePath());
if (qAppName().compare(fi.fileName(), Qt::CaseInsensitive) != 0) if (qAppName().compare(fi.fileName(), Qt::CaseInsensitive) != 0)
restart << QLatin1String("-name") << qAppName(); restart << "-name"_L1 << qAppName();
sm->setRestartCommand(restart); sm->setRestartCommand(restart);
QStringList discard; QStringList discard;
sm->setDiscardCommand(discard); sm->setDiscardCommand(discard);

View File

@ -92,6 +92,8 @@ enum {
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
Q_LOGGING_CATEGORY(lcQpaWindow, "qt.qpa.window"); Q_LOGGING_CATEGORY(lcQpaWindow, "qt.qpa.window");
Q_DECLARE_TYPEINFO(xcb_rectangle_t, Q_PRIMITIVE_TYPE); 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); bool startedByTouch = connection()->startSystemMoveResizeForTouch(m_window, edges);
if (startedByTouch) { if (startedByTouch) {
const QString wmname = connection()->windowManagerName(); 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=" qCDebug(lcQpaXInputDevices) << "only KDE and OpenBox support startSystemMove/Resize which is triggered from touch events: XDG_CURRENT_DESKTOP="
<< qgetenv("XDG_CURRENT_DESKTOP"); << qgetenv("XDG_CURRENT_DESKTOP");
connection()->abortSystemMoveResize(m_window); connection()->abortSystemMoveResize(m_window);

View File

@ -66,6 +66,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QGtk3Dialog : public QWindow class QGtk3Dialog : public QWindow
{ {
Q_OBJECT Q_OBJECT
@ -524,7 +526,7 @@ void QGtk3FileDialogHelper::setNameFilters(const QStringList &filters)
const QString name = filter.left(filter.indexOf(u'(')); const QString name = filter.left(filter.indexOf(u'('));
const QStringList extensions = cleanFilterList(filter); 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) foreach (const QString &ext, extensions)
gtk_file_filter_add_pattern(gtkFilter, qUtf8Printable(ext)); gtk_file_filter_add_pattern(gtkFilter, qUtf8Printable(ext));

View File

@ -42,6 +42,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QXdgDesktopPortalThemePlugin : public QPlatformThemePlugin class QXdgDesktopPortalThemePlugin : public QPlatformThemePlugin
{ {
Q_OBJECT Q_OBJECT
@ -54,9 +56,9 @@ public:
QPlatformTheme *QXdgDesktopPortalThemePlugin::create(const QString &key, const QStringList &params) QPlatformTheme *QXdgDesktopPortalThemePlugin::create(const QString &key, const QStringList &params)
{ {
Q_UNUSED(params); Q_UNUSED(params);
if (!key.compare(QLatin1String("xdgdesktopportal"), Qt::CaseInsensitive) || if (!key.compare("xdgdesktopportal"_L1, Qt::CaseInsensitive) ||
!key.compare(QLatin1String("flatpak"), Qt::CaseInsensitive) || !key.compare("flatpak"_L1, Qt::CaseInsensitive) ||
!key.compare(QLatin1String("snap"), Qt::CaseInsensitive)) !key.compare("snap"_L1, Qt::CaseInsensitive))
return new QXdgDesktopPortalTheme; return new QXdgDesktopPortalTheme;
return nullptr; return nullptr;

View File

@ -58,6 +58,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
QDBusArgument &operator <<(QDBusArgument &arg, const QXdgDesktopPortalFileDialog::FilterCondition &filterCondition) QDBusArgument &operator <<(QDBusArgument &arg, const QXdgDesktopPortalFileDialog::FilterCondition &filterCondition)
{ {
arg.beginStructure(); arg.beginStructure();
@ -182,29 +184,29 @@ void QXdgDesktopPortalFileDialog::openPortal()
{ {
Q_D(QXdgDesktopPortalFileDialog); Q_D(QXdgDesktopPortalFileDialog);
QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"), QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.portal.Desktop"_L1,
QLatin1String("/org/freedesktop/portal/desktop"), "/org/freedesktop/portal/desktop"_L1,
QLatin1String("org.freedesktop.portal.FileChooser"), "org.freedesktop.portal.FileChooser"_L1,
d->saveFile ? QLatin1String("SaveFile") : QLatin1String("OpenFile")); d->saveFile ? "SaveFile"_L1 : "OpenFile"_L1);
QString parentWindowId = QLatin1String("x11:") + QString::number(d->winId, 16); QString parentWindowId = "x11:"_L1 + QString::number(d->winId, 16);
QVariantMap options; QVariantMap options;
if (!d->acceptLabel.isEmpty()) 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("modal"_L1, d->modal);
options.insert(QLatin1String("multiple"), d->multipleFiles); options.insert("multiple"_L1, d->multipleFiles);
options.insert(QLatin1String("directory"), d->directoryMode); options.insert("directory"_L1, d->directoryMode);
if (d->saveFile) { if (d->saveFile) {
if (!d->directory.isEmpty()) 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()) { 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 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 // 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("current_file"_L1, QFile::encodeName(d->selectedFiles.first()).append('\0'));
options.insert(QLatin1String("current_name"), QFileInfo(d->selectedFiles.first()).fileName()); options.insert("current_name"_L1, QFileInfo(d->selectedFiles.first()).fileName());
} }
} }
@ -281,12 +283,12 @@ void QXdgDesktopPortalFileDialog::openPortal()
} }
if (!filterList.isEmpty()) if (!filterList.isEmpty())
options.insert(QLatin1String("filters"), QVariant::fromValue(filterList)); options.insert("filters"_L1, QVariant::fromValue(filterList));
if (selectedFilterIndex != -1) 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) // TODO choices a(ssa(ss)s)
// List of serialized combo boxes to add to the file chooser. // List of serialized combo boxes to add to the file chooser.
@ -302,8 +304,8 @@ void QXdgDesktopPortalFileDialog::openPortal()
} else { } else {
QDBusConnection::sessionBus().connect(nullptr, QDBusConnection::sessionBus().connect(nullptr,
reply.value().path(), reply.value().path(),
QLatin1String("org.freedesktop.portal.Request"), "org.freedesktop.portal.Request"_L1,
QLatin1String("Response"), "Response"_L1,
this, this,
SLOT(gotResponse(uint,QVariantMap))); SLOT(gotResponse(uint,QVariantMap)));
} }
@ -451,10 +453,10 @@ void QXdgDesktopPortalFileDialog::gotResponse(uint response, const QVariantMap &
Q_D(QXdgDesktopPortalFileDialog); Q_D(QXdgDesktopPortalFileDialog);
if (!response) { if (!response) {
if (results.contains(QLatin1String("uris"))) if (results.contains("uris"_L1))
d->selectedFiles = results.value(QLatin1String("uris")).toStringList(); 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"))); const Filter selectedFilter = qdbus_cast<Filter>(results.value(QStringLiteral("current_filter")));
if (!selectedFilter.filterConditions.empty() && selectedFilter.filterConditions[0].type == MimeType) { if (!selectedFilter.filterConditions.empty() && selectedFilter.filterConditions[0].type == MimeType) {
// s.a. QXdgDesktopPortalFileDialog::openPortal which basically does the inverse // s.a. QXdgDesktopPortalFileDialog::openPortal which basically does the inverse

View File

@ -54,6 +54,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
class QXdgDesktopPortalThemePrivate : public QPlatformThemePrivate class QXdgDesktopPortalThemePrivate : public QPlatformThemePrivate
{ {
public: public:
@ -131,11 +133,11 @@ QXdgDesktopPortalTheme::QXdgDesktopPortalTheme()
d->baseTheme = new QPlatformTheme; d->baseTheme = new QPlatformTheme;
// Get information about portal version // Get information about portal version
QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"), QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.portal.Desktop"_L1,
QLatin1String("/org/freedesktop/portal/desktop"), "/org/freedesktop/portal/desktop"_L1,
QLatin1String("org.freedesktop.DBus.Properties"), "org.freedesktop.DBus.Properties"_L1,
QLatin1String("Get")); "Get"_L1);
message << QLatin1String("org.freedesktop.portal.FileChooser") << QLatin1String("version"); message << "org.freedesktop.portal.FileChooser"_L1 << "version"_L1;
QDBusPendingCall pendingCall = QDBusConnection::sessionBus().asyncCall(message); QDBusPendingCall pendingCall = QDBusConnection::sessionBus().asyncCall(message);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall);
QObject::connect(watcher, &QDBusPendingCallWatcher::finished, [d] (QDBusPendingCallWatcher *watcher) { QObject::connect(watcher, &QDBusPendingCallWatcher::finished, [d] (QDBusPendingCallWatcher *watcher) {
@ -147,11 +149,11 @@ QXdgDesktopPortalTheme::QXdgDesktopPortalTheme()
}); });
// Get information about system theme preference // Get information about system theme preference
message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"), message = QDBusMessage::createMethodCall("org.freedesktop.portal.Desktop"_L1,
QLatin1String("/org/freedesktop/portal/desktop"), "/org/freedesktop/portal/desktop"_L1,
QLatin1String("org.freedesktop.portal.Settings"), "org.freedesktop.portal.Settings"_L1,
QLatin1String("Read")); "Read"_L1);
message << QLatin1String("org.freedesktop.appearance") << QLatin1String("color-scheme"); message << "org.freedesktop.appearance"_L1 << "color-scheme"_L1;
// this must not be asyncCall() because we have to set appearance now // this must not be asyncCall() because we have to set appearance now
QDBusReply<QVariant> reply = QDBusConnection::sessionBus().call(message); QDBusReply<QVariant> reply = QDBusConnection::sessionBus().call(message);