Don't use QStringLiteral in comparisons
For QLatin1String, operator== is overloaded, so comparing to a latin-1 (C) string literal is efficient, since strlen() is comparatively fast. OTOH, QStringLiteral, when not using RVO, litters the code with QString dtor calls, which are not inline. Worse, absent lambdas, it even allocates memory. So, just compare using QLatin1String instead. Change-Id: I7af3bf3a67c55dae33ffaf9922d004fa168a3f9c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
bf1df55846
commit
1a5c0b26d0
@ -196,7 +196,7 @@ static void rfcDateImpl(const QString &s, QDate *dd = 0, QTime *dt = 0, int *utc
|
|||||||
min = rex.cap(5).toInt();
|
min = rex.cap(5).toInt();
|
||||||
sec = rex.cap(6).toInt();
|
sec = rex.cap(6).toInt();
|
||||||
}
|
}
|
||||||
positiveOffset = (rex.cap(7) == QStringLiteral("+"));
|
positiveOffset = (rex.cap(7) == QLatin1String("+"));
|
||||||
hourOffset = rex.cap(8).toInt();
|
hourOffset = rex.cap(8).toInt();
|
||||||
minOffset = rex.cap(9).toInt();
|
minOffset = rex.cap(9).toInt();
|
||||||
}
|
}
|
||||||
@ -217,7 +217,7 @@ static void rfcDateImpl(const QString &s, QDate *dd = 0, QTime *dt = 0, int *utc
|
|||||||
min = rex.cap(4).toInt();
|
min = rex.cap(4).toInt();
|
||||||
sec = rex.cap(5).toInt();
|
sec = rex.cap(5).toInt();
|
||||||
}
|
}
|
||||||
positiveOffset = (rex.cap(7) == QStringLiteral("+"));
|
positiveOffset = (rex.cap(7) == QLatin1String("+"));
|
||||||
hourOffset = rex.cap(8).toInt();
|
hourOffset = rex.cap(8).toInt();
|
||||||
minOffset = rex.cap(9).toInt();
|
minOffset = rex.cap(9).toInt();
|
||||||
}
|
}
|
||||||
|
@ -935,7 +935,7 @@ QDataStream &operator>>(QDataStream &ds, QTimeZone &tz)
|
|||||||
{
|
{
|
||||||
QString ianaId;
|
QString ianaId;
|
||||||
ds >> ianaId;
|
ds >> ianaId;
|
||||||
if (ianaId == QStringLiteral("OffsetFromUtc")) {
|
if (ianaId == QLatin1String("OffsetFromUtc")) {
|
||||||
int utcOffset;
|
int utcOffset;
|
||||||
QString name;
|
QString name;
|
||||||
QString abbreviation;
|
QString abbreviation;
|
||||||
|
@ -940,9 +940,9 @@ QByteArray QTzTimeZonePrivate::systemTimeZoneId() const
|
|||||||
QString line;
|
QString line;
|
||||||
while (ianaId.isEmpty() && !ts.atEnd() && ts.status() == QTextStream::Ok) {
|
while (ianaId.isEmpty() && !ts.atEnd() && ts.status() == QTextStream::Ok) {
|
||||||
line = ts.readLine();
|
line = ts.readLine();
|
||||||
if (line.left(5) == QStringLiteral("ZONE=")) {
|
if (line.startsWith(QLatin1String("ZONE="))) {
|
||||||
ianaId = line.mid(6, line.size() - 7).toUtf8();
|
ianaId = line.mid(6, line.size() - 7).toUtf8();
|
||||||
} else if (line.left(9) == QStringLiteral("TIMEZONE=")) {
|
} else if (line.startsWith(QLatin1String("TIMEZONE="))) {
|
||||||
ianaId = line.mid(10, line.size() - 11).toUtf8();
|
ianaId = line.mid(10, line.size() - 11).toUtf8();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ bool QDesktopServices::openUrl(const QUrl &url)
|
|||||||
qWarning("%s: The platform plugin does not support services.", Q_FUNC_INFO);
|
qWarning("%s: The platform plugin does not support services.", Q_FUNC_INFO);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return url.scheme() == QStringLiteral("file") ?
|
return url.scheme() == QLatin1String("file") ?
|
||||||
platformServices->openDocument(url) : platformServices->openUrl(url);
|
platformServices->openDocument(url) : platformServices->openUrl(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ void QCoreTextFontDatabase::populateFontDatabase()
|
|||||||
QString familyName = QCFString::toQString(familyNameRef);
|
QString familyName = QCFString::toQString(familyNameRef);
|
||||||
|
|
||||||
// Don't populate internal fonts
|
// Don't populate internal fonts
|
||||||
if (familyName.startsWith(QLatin1Char('.')) || familyName == QStringLiteral("LastResort"))
|
if (familyName.startsWith(QLatin1Char('.')) || familyName == QLatin1String("LastResort"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QPlatformFontDatabase::registerFontFamily(familyName);
|
QPlatformFontDatabase::registerFontFamily(familyName);
|
||||||
|
@ -130,7 +130,7 @@ QByteArray QGenericUnixServices::desktopEnvironment() const
|
|||||||
|
|
||||||
bool QGenericUnixServices::openUrl(const QUrl &url)
|
bool QGenericUnixServices::openUrl(const QUrl &url)
|
||||||
{
|
{
|
||||||
if (url.scheme() == QStringLiteral("mailto"))
|
if (url.scheme() == QLatin1String("mailto"))
|
||||||
return openDocument(url);
|
return openDocument(url);
|
||||||
|
|
||||||
if (m_webBrowser.isEmpty() && !detectWebBrowser(desktopEnvironment(), true, &m_webBrowser)) {
|
if (m_webBrowser.isEmpty() && !detectWebBrowser(desktopEnvironment(), true, &m_webBrowser)) {
|
||||||
|
@ -234,11 +234,11 @@ void QKdeThemePrivate::refresh()
|
|||||||
const QVariant toolbarStyleValue = readKdeSetting(QStringLiteral("Toolbar style/ToolButtonStyle"), kdeDirs, kdeSettings);
|
const QVariant toolbarStyleValue = readKdeSetting(QStringLiteral("Toolbar style/ToolButtonStyle"), kdeDirs, kdeSettings);
|
||||||
if (toolbarStyleValue.isValid()) {
|
if (toolbarStyleValue.isValid()) {
|
||||||
const QString toolBarStyle = toolbarStyleValue.toString();
|
const QString toolBarStyle = toolbarStyleValue.toString();
|
||||||
if (toolBarStyle == QStringLiteral("TextBesideIcon"))
|
if (toolBarStyle == QLatin1String("TextBesideIcon"))
|
||||||
toolButtonStyle = Qt::ToolButtonTextBesideIcon;
|
toolButtonStyle = Qt::ToolButtonTextBesideIcon;
|
||||||
else if (toolBarStyle == QStringLiteral("TextOnly"))
|
else if (toolBarStyle == QLatin1String("TextOnly"))
|
||||||
toolButtonStyle = Qt::ToolButtonTextOnly;
|
toolButtonStyle = Qt::ToolButtonTextOnly;
|
||||||
else if (toolBarStyle == QStringLiteral("TextUnderIcon"))
|
else if (toolBarStyle == QLatin1String("TextUnderIcon"))
|
||||||
toolButtonStyle = Qt::ToolButtonTextUnderIcon;
|
toolButtonStyle = Qt::ToolButtonTextUnderIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -640,7 +640,7 @@ QStringList QGenericUnixTheme::themeNames()
|
|||||||
result.push_back(QLatin1String(QGnomeTheme::name));
|
result.push_back(QLatin1String(QGnomeTheme::name));
|
||||||
}
|
}
|
||||||
const QString session = QString::fromLocal8Bit(qgetenv("DESKTOP_SESSION"));
|
const QString session = QString::fromLocal8Bit(qgetenv("DESKTOP_SESSION"));
|
||||||
if (!session.isEmpty() && session != QStringLiteral("default") && !result.contains(session))
|
if (!session.isEmpty() && session != QLatin1String("default") && !result.contains(session))
|
||||||
result.push_back(session);
|
result.push_back(session);
|
||||||
} // desktopSettingsAware
|
} // desktopSettingsAware
|
||||||
if (result.isEmpty())
|
if (result.isEmpty())
|
||||||
|
@ -46,7 +46,7 @@ class QAndroidBearerEnginePlugin : public QBearerEnginePlugin
|
|||||||
public:
|
public:
|
||||||
QBearerEngine *create(const QString &key) const Q_DECL_OVERRIDE
|
QBearerEngine *create(const QString &key) const Q_DECL_OVERRIDE
|
||||||
{
|
{
|
||||||
return (key == QStringLiteral("android")) ? new QAndroidBearerEngine() : 0;
|
return (key == QLatin1String("android")) ? new QAndroidBearerEngine() : 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public:
|
|||||||
|
|
||||||
QBearerEngine *QBBEnginePlugin::create(const QString &key) const
|
QBearerEngine *QBBEnginePlugin::create(const QString &key) const
|
||||||
{
|
{
|
||||||
if (key == QStringLiteral("blackberry"))
|
if (key == QLatin1String("blackberry"))
|
||||||
return new QBBEngine;
|
return new QBBEngine;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -332,7 +332,7 @@ void QConnmanEngine::serviceStateChanged(const QString &state)
|
|||||||
QConnmanServiceInterface *service = qobject_cast<QConnmanServiceInterface *>(sender());
|
QConnmanServiceInterface *service = qobject_cast<QConnmanServiceInterface *>(sender());
|
||||||
configurationChange(service);
|
configurationChange(service);
|
||||||
|
|
||||||
if (state == QStringLiteral("failure")) {
|
if (state == QLatin1String("failure")) {
|
||||||
emit connectionError(service->path(), ConnectError);
|
emit connectionError(service->path(), ConnectError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -516,7 +516,7 @@ void QConnmanEngine::addServiceConfiguration(const QString &servicePath)
|
|||||||
cpPriv->id = servicePath;
|
cpPriv->id = servicePath;
|
||||||
cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
|
cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
|
||||||
|
|
||||||
if (service->security() == QStringLiteral("none")) {
|
if (service->security() == QLatin1String("none")) {
|
||||||
cpPriv->purpose = QNetworkConfiguration::PublicPurpose;
|
cpPriv->purpose = QNetworkConfiguration::PublicPurpose;
|
||||||
} else {
|
} else {
|
||||||
cpPriv->purpose = QNetworkConfiguration::PrivatePurpose;
|
cpPriv->purpose = QNetworkConfiguration::PrivatePurpose;
|
||||||
|
@ -338,7 +338,7 @@ void QConnmanServiceInterface::connectNotify(const QMetaMethod &signal)
|
|||||||
void QConnmanServiceInterface::changedProperty(const QString &name, const QDBusVariant &value)
|
void QConnmanServiceInterface::changedProperty(const QString &name, const QDBusVariant &value)
|
||||||
{
|
{
|
||||||
propertiesCacheMap[name] = value.variant();
|
propertiesCacheMap[name] = value.variant();
|
||||||
if (name == QStringLiteral("State"))
|
if (name == QLatin1String("State"))
|
||||||
Q_EMIT stateChanged(value.variant().toString());
|
Q_EMIT stateChanged(value.variant().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ QVariantMap QOfonoDataConnectionManagerInterface::getProperties()
|
|||||||
void QOfonoDataConnectionManagerInterface::propertyChanged(const QString &name, const QDBusVariant &value)
|
void QOfonoDataConnectionManagerInterface::propertyChanged(const QString &name, const QDBusVariant &value)
|
||||||
{
|
{
|
||||||
propertiesMap[name] = value.variant();
|
propertiesMap[name] = value.variant();
|
||||||
if (name == QStringLiteral("RoamingAllowed"))
|
if (name == QLatin1String("RoamingAllowed"))
|
||||||
Q_EMIT roamingAllowedChanged(value.variant().toBool());
|
Q_EMIT roamingAllowedChanged(value.variant().toBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ QComposeInputContext *QComposePlatformInputContextPlugin::create(const QString &
|
|||||||
{
|
{
|
||||||
Q_UNUSED(paramList);
|
Q_UNUSED(paramList);
|
||||||
|
|
||||||
if (system.compare(system, QStringLiteral("compose"), Qt::CaseInsensitive) == 0)
|
if (system.compare(system, QLatin1String("compose"), Qt::CaseInsensitive) == 0)
|
||||||
return new QComposeInputContext;
|
return new QComposeInputContext;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ QIBusPlatformInputContext *QIbusPlatformInputContextPlugin::create(const QString
|
|||||||
{
|
{
|
||||||
Q_UNUSED(paramList);
|
Q_UNUSED(paramList);
|
||||||
|
|
||||||
if (system.compare(system, QStringLiteral("ibus"), Qt::CaseInsensitive) == 0) {
|
if (system.compare(system, QLatin1String("ibus"), Qt::CaseInsensitive) == 0) {
|
||||||
qDBusRegisterMetaType<QIBusSerializable>();
|
qDBusRegisterMetaType<QIBusSerializable>();
|
||||||
qDBusRegisterMetaType<QIBusAttribute>();
|
qDBusRegisterMetaType<QIBusAttribute>();
|
||||||
qDBusRegisterMetaType<QIBusAttributeList>();
|
qDBusRegisterMetaType<QIBusAttributeList>();
|
||||||
|
@ -164,9 +164,9 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList ¶
|
|||||||
bool QAndroidPlatformIntegration::needsBasicRenderloopWorkaround()
|
bool QAndroidPlatformIntegration::needsBasicRenderloopWorkaround()
|
||||||
{
|
{
|
||||||
static bool needsWorkaround =
|
static bool needsWorkaround =
|
||||||
QtAndroid::deviceName().compare(QStringLiteral("samsung SM-T211"), Qt::CaseInsensitive) == 0
|
QtAndroid::deviceName().compare(QLatin1String("samsung SM-T211"), Qt::CaseInsensitive) == 0
|
||||||
|| QtAndroid::deviceName().compare(QStringLiteral("samsung SM-T210"), Qt::CaseInsensitive) == 0
|
|| QtAndroid::deviceName().compare(QLatin1String("samsung SM-T210"), Qt::CaseInsensitive) == 0
|
||||||
|| QtAndroid::deviceName().compare(QStringLiteral("samsung SM-T215"), Qt::CaseInsensitive) == 0;
|
|| QtAndroid::deviceName().compare(QLatin1String("samsung SM-T215"), Qt::CaseInsensitive) == 0;
|
||||||
return needsWorkaround;
|
return needsWorkaround;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ QMacPasteboard::setMimeData(QMimeData *mime_src)
|
|||||||
// 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() == QStringLiteral("Rtf"))
|
if (c->convertorName() == QLatin1String("Rtf"))
|
||||||
continue;
|
continue;
|
||||||
QString flavor(c->flavorFor(mimeType));
|
QString flavor(c->flavorFor(mimeType));
|
||||||
if (!flavor.isEmpty()) {
|
if (!flavor.isEmpty()) {
|
||||||
|
@ -301,7 +301,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
|
|||||||
|
|
||||||
// For widgets we need to do a bit of trickery as the window
|
// For widgets we need to do a bit of trickery as the window
|
||||||
// to activate is the window of the top-level widget.
|
// to activate is the window of the top-level widget.
|
||||||
if (m_window->metaObject()->className() == QStringLiteral("QWidgetWindow")) {
|
if (qstrcmp(m_window->metaObject()->className(), "QWidgetWindow") == 0) {
|
||||||
while (focusWindow->parent()) {
|
while (focusWindow->parent()) {
|
||||||
focusWindow = focusWindow->parent();
|
focusWindow = focusWindow->parent();
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ public:
|
|||||||
|
|
||||||
QPlatformIntegration *QWindowsDirect2DIntegrationPlugin::create(const QString& system, const QStringList& paramList)
|
QPlatformIntegration *QWindowsDirect2DIntegrationPlugin::create(const QString& system, const QStringList& paramList)
|
||||||
{
|
{
|
||||||
if (system.compare(system, QStringLiteral("direct2d"), Qt::CaseInsensitive) == 0)
|
if (system.compare(system, QLatin1String("direct2d"), Qt::CaseInsensitive) == 0)
|
||||||
return QWindowsDirect2DIntegration::create(paramList);
|
return QWindowsDirect2DIntegration::create(paramList);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -187,8 +187,8 @@ QIOSScreen::QIOSScreen(UIScreen *screen)
|
|||||||
if (screen == [UIScreen mainScreen]) {
|
if (screen == [UIScreen mainScreen]) {
|
||||||
QString deviceIdentifier = deviceModelIdentifier();
|
QString deviceIdentifier = deviceModelIdentifier();
|
||||||
|
|
||||||
if (deviceIdentifier == QStringLiteral("iPhone2,1") /* iPhone 3GS */
|
if (deviceIdentifier == QLatin1String("iPhone2,1") /* iPhone 3GS */
|
||||||
|| deviceIdentifier == QStringLiteral("iPod3,1") /* iPod touch 3G */) {
|
|| deviceIdentifier == QLatin1String("iPod3,1") /* iPod touch 3G */) {
|
||||||
m_depth = 18;
|
m_depth = 18;
|
||||||
} else {
|
} else {
|
||||||
m_depth = 24;
|
m_depth = 24;
|
||||||
|
@ -107,9 +107,9 @@ void QQnxNativeInterface::setWindowProperty(QPlatformWindow *window, const QStri
|
|||||||
{
|
{
|
||||||
QQnxWindow *qnxWindow = static_cast<QQnxWindow*>(window);
|
QQnxWindow *qnxWindow = static_cast<QQnxWindow*>(window);
|
||||||
|
|
||||||
if (name == QStringLiteral("mmRendererWindowName")) {
|
if (name == QLatin1String("mmRendererWindowName")) {
|
||||||
qnxWindow->setMMRendererWindowName(value.toString());
|
qnxWindow->setMMRendererWindowName(value.toString());
|
||||||
} else if (name == QStringLiteral("qnxWindowGroup")) {
|
} else if (name == QLatin1String("qnxWindowGroup")) {
|
||||||
if (value.isNull())
|
if (value.isNull())
|
||||||
qnxWindow->joinWindowGroup(QByteArray());
|
qnxWindow->joinWindowGroup(QByteArray());
|
||||||
else if (value.canConvert<QByteArray>())
|
else if (value.canConvert<QByteArray>())
|
||||||
|
@ -104,7 +104,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, QStringLiteral("windows"), Qt::CaseInsensitive) == 0)
|
if (system.compare(system, QLatin1String("windows"), Qt::CaseInsensitive) == 0)
|
||||||
return new QWindowsGdiIntegration(paramList);
|
return new QWindowsGdiIntegration(paramList);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -853,7 +853,7 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet,
|
|||||||
int type)
|
int type)
|
||||||
{
|
{
|
||||||
// the "@family" fonts are just the same as "family". Ignore them.
|
// the "@family" fonts are just the same as "family". Ignore them.
|
||||||
if (familyName.isEmpty() || familyName.at(0) == QLatin1Char('@') || familyName.startsWith(QStringLiteral("WST_")))
|
if (familyName.isEmpty() || familyName.at(0) == QLatin1Char('@') || familyName.startsWith(QLatin1String("WST_")))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
static const int SMOOTH_SCALABLE = 0xffff;
|
static const int SMOOTH_SCALABLE = 0xffff;
|
||||||
@ -918,7 +918,7 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet,
|
|||||||
// display Thai text by default. As a temporary work around, we special case Segoe UI
|
// display Thai text by default. As a temporary work around, we special case Segoe UI
|
||||||
// and remove the Thai script from its list of supported writing systems.
|
// and remove the Thai script from its list of supported writing systems.
|
||||||
if (writingSystems.supported(QFontDatabase::Thai) &&
|
if (writingSystems.supported(QFontDatabase::Thai) &&
|
||||||
familyName == QStringLiteral("Segoe UI"))
|
familyName == QLatin1String("Segoe UI"))
|
||||||
writingSystems.setSupported(QFontDatabase::Thai, false);
|
writingSystems.setSupported(QFontDatabase::Thai, false);
|
||||||
} else {
|
} else {
|
||||||
const QFontDatabase::WritingSystem ws = writingSystemFromCharSet(charSet);
|
const QFontDatabase::WritingSystem ws = writingSystemFromCharSet(charSet);
|
||||||
@ -1591,7 +1591,7 @@ LOGFONT QWindowsFontDatabase::fontDefToLOGFONT(const QFontDef &request)
|
|||||||
&& (request.style == QFont::StyleItalic || (-lf.lfHeight > 18 && -lf.lfHeight != 24))) {
|
&& (request.style == QFont::StyleItalic || (-lf.lfHeight > 18 && -lf.lfHeight != 24))) {
|
||||||
fam = QStringLiteral("Arial"); // MS Sans Serif has bearing problems in italic, and does not scale
|
fam = QStringLiteral("Arial"); // MS Sans Serif has bearing problems in italic, and does not scale
|
||||||
}
|
}
|
||||||
if (fam == QStringLiteral("Courier") && !(request.styleStrategy & QFont::PreferBitmap))
|
if (fam == QLatin1String("Courier") && !(request.styleStrategy & QFont::PreferBitmap))
|
||||||
fam = QStringLiteral("Courier New");
|
fam = QStringLiteral("Courier New");
|
||||||
|
|
||||||
memcpy(lf.lfFaceName, fam.utf16(), sizeof(wchar_t) * qMin(fam.length() + 1, 32)); // 32 = Windows hard-coded
|
memcpy(lf.lfFaceName, fam.utf16(), sizeof(wchar_t) * qMin(fam.length() + 1, 32)); // 32 = Windows hard-coded
|
||||||
@ -1703,18 +1703,18 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request,
|
|||||||
if (rawMode) { // will choose a stock font
|
if (rawMode) { // will choose a stock font
|
||||||
int f = SYSTEM_FONT;
|
int f = SYSTEM_FONT;
|
||||||
const QString fam = request.family.toLower();
|
const QString fam = request.family.toLower();
|
||||||
if (fam == QStringLiteral("default") || fam == QStringLiteral("system"))
|
if (fam == QLatin1String("default") || fam == QLatin1String("system"))
|
||||||
f = SYSTEM_FONT;
|
f = SYSTEM_FONT;
|
||||||
#ifndef Q_OS_WINCE
|
#ifndef Q_OS_WINCE
|
||||||
else if (fam == QStringLiteral("system_fixed"))
|
else if (fam == QLatin1String("system_fixed"))
|
||||||
f = SYSTEM_FIXED_FONT;
|
f = SYSTEM_FIXED_FONT;
|
||||||
else if (fam == QStringLiteral("ansi_fixed"))
|
else if (fam == QLatin1String("ansi_fixed"))
|
||||||
f = ANSI_FIXED_FONT;
|
f = ANSI_FIXED_FONT;
|
||||||
else if (fam == QStringLiteral("ansi_var"))
|
else if (fam == QLatin1String("ansi_var"))
|
||||||
f = ANSI_VAR_FONT;
|
f = ANSI_VAR_FONT;
|
||||||
else if (fam == QStringLiteral("device_default"))
|
else if (fam == QLatin1String("device_default"))
|
||||||
f = DEVICE_DEFAULT_FONT;
|
f = DEVICE_DEFAULT_FONT;
|
||||||
else if (fam == QStringLiteral("oem_fixed"))
|
else if (fam == QLatin1String("oem_fixed"))
|
||||||
f = OEM_FIXED_FONT;
|
f = OEM_FIXED_FONT;
|
||||||
#endif
|
#endif
|
||||||
else if (fam.at(0) == QLatin1Char('#'))
|
else if (fam.at(0) == QLatin1Char('#'))
|
||||||
@ -1835,7 +1835,7 @@ QFont QWindowsFontDatabase::systemDefaultFont()
|
|||||||
GetObject(GetStockObject(DEFAULT_GUI_FONT), sizeof(lf), &lf);
|
GetObject(GetStockObject(DEFAULT_GUI_FONT), sizeof(lf), &lf);
|
||||||
QFont systemFont = QWindowsFontDatabase::LOGFONT_to_QFont(lf);
|
QFont systemFont = QWindowsFontDatabase::LOGFONT_to_QFont(lf);
|
||||||
// "MS Shell Dlg 2" is the correct system font >= Win2k
|
// "MS Shell Dlg 2" is the correct system font >= Win2k
|
||||||
if (systemFont.family() == QStringLiteral("MS Shell Dlg"))
|
if (systemFont.family() == QLatin1String("MS Shell Dlg"))
|
||||||
systemFont.setFamily(QStringLiteral("MS Shell Dlg 2"));
|
systemFont.setFamily(QStringLiteral("MS Shell Dlg 2"));
|
||||||
qCDebug(lcQpaFonts) << __FUNCTION__ << systemFont;
|
qCDebug(lcQpaFonts) << __FUNCTION__ << systemFont;
|
||||||
return systemFont;
|
return systemFont;
|
||||||
|
@ -122,7 +122,7 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet,
|
|||||||
typedef QPair<QString, QStringList> FontKey;
|
typedef QPair<QString, QStringList> FontKey;
|
||||||
|
|
||||||
// the "@family" fonts are just the same as "family". Ignore them.
|
// the "@family" fonts are just the same as "family". Ignore them.
|
||||||
if (familyName.isEmpty() || familyName.at(0) == QLatin1Char('@') || familyName.startsWith(QStringLiteral("WST_")))
|
if (familyName.isEmpty() || familyName.at(0) == QLatin1Char('@') || familyName.startsWith(QLatin1String("WST_")))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const int separatorPos = familyName.indexOf(QStringLiteral("::"));
|
const int separatorPos = familyName.indexOf(QStringLiteral("::"));
|
||||||
@ -181,7 +181,7 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet,
|
|||||||
// display Thai text by default. As a temporary work around, we special case Segoe UI
|
// display Thai text by default. As a temporary work around, we special case Segoe UI
|
||||||
// and remove the Thai script from its list of supported writing systems.
|
// and remove the Thai script from its list of supported writing systems.
|
||||||
if (writingSystems.supported(QFontDatabase::Thai) &&
|
if (writingSystems.supported(QFontDatabase::Thai) &&
|
||||||
faceName == QStringLiteral("Segoe UI"))
|
faceName == QLatin1String("Segoe UI"))
|
||||||
writingSystems.setSupported(QFontDatabase::Thai, false);
|
writingSystems.setSupported(QFontDatabase::Thai, false);
|
||||||
} else {
|
} else {
|
||||||
const QFontDatabase::WritingSystem ws = writingSystemFromCharSet(charSet);
|
const QFontDatabase::WritingSystem ws = writingSystemFromCharSet(charSet);
|
||||||
|
@ -761,7 +761,7 @@ bool QWindowsMimeURI::convertFromMime(const FORMATETC &formatetc, const QMimeDat
|
|||||||
|
|
||||||
bool QWindowsMimeURI::canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const
|
bool QWindowsMimeURI::canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const
|
||||||
{
|
{
|
||||||
return mimeType == QStringLiteral("text/uri-list")
|
return mimeType == QLatin1String("text/uri-list")
|
||||||
&& (canGetData(CF_HDROP, pDataObj) || canGetData(CF_INETURL_W, pDataObj) || canGetData(CF_INETURL, pDataObj));
|
&& (canGetData(CF_HDROP, pDataObj) || canGetData(CF_INETURL_W, pDataObj) || canGetData(CF_INETURL, pDataObj));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -776,7 +776,7 @@ QString QWindowsMimeURI::mimeForFormat(const FORMATETC &formatetc) const
|
|||||||
QVector<FORMATETC> QWindowsMimeURI::formatsForMime(const QString &mimeType, const QMimeData *mimeData) const
|
QVector<FORMATETC> QWindowsMimeURI::formatsForMime(const QString &mimeType, const QMimeData *mimeData) const
|
||||||
{
|
{
|
||||||
QVector<FORMATETC> formatics;
|
QVector<FORMATETC> formatics;
|
||||||
if (mimeType == QStringLiteral("text/uri-list")) {
|
if (mimeType == QLatin1String("text/uri-list")) {
|
||||||
if (canConvertFromMime(setCf(CF_HDROP), mimeData))
|
if (canConvertFromMime(setCf(CF_HDROP), mimeData))
|
||||||
formatics += setCf(CF_HDROP);
|
formatics += setCf(CF_HDROP);
|
||||||
if (canConvertFromMime(setCf(CF_INETURL_W), mimeData))
|
if (canConvertFromMime(setCf(CF_INETURL_W), mimeData))
|
||||||
@ -789,7 +789,7 @@ QVector<FORMATETC> QWindowsMimeURI::formatsForMime(const QString &mimeType, cons
|
|||||||
|
|
||||||
QVariant QWindowsMimeURI::convertToMime(const QString &mimeType, LPDATAOBJECT pDataObj, QVariant::Type preferredType) const
|
QVariant QWindowsMimeURI::convertToMime(const QString &mimeType, LPDATAOBJECT pDataObj, QVariant::Type preferredType) const
|
||||||
{
|
{
|
||||||
if (mimeType == QStringLiteral("text/uri-list")) {
|
if (mimeType == QLatin1String("text/uri-list")) {
|
||||||
if (canGetData(CF_HDROP, pDataObj)) {
|
if (canGetData(CF_HDROP, pDataObj)) {
|
||||||
QByteArray texturi;
|
QByteArray texturi;
|
||||||
QList<QVariant> urls;
|
QList<QVariant> urls;
|
||||||
@ -862,7 +862,7 @@ QWindowsMimeHtml::QWindowsMimeHtml()
|
|||||||
QVector<FORMATETC> QWindowsMimeHtml::formatsForMime(const QString &mimeType, const QMimeData *mimeData) const
|
QVector<FORMATETC> QWindowsMimeHtml::formatsForMime(const QString &mimeType, const QMimeData *mimeData) const
|
||||||
{
|
{
|
||||||
QVector<FORMATETC> formatetcs;
|
QVector<FORMATETC> formatetcs;
|
||||||
if (mimeType == QStringLiteral("text/html") && (!mimeData->html().isEmpty()))
|
if (mimeType == QLatin1String("text/html") && (!mimeData->html().isEmpty()))
|
||||||
formatetcs += setCf(CF_HTML);
|
formatetcs += setCf(CF_HTML);
|
||||||
return formatetcs;
|
return formatetcs;
|
||||||
}
|
}
|
||||||
@ -876,7 +876,7 @@ QString QWindowsMimeHtml::mimeForFormat(const FORMATETC &formatetc) const
|
|||||||
|
|
||||||
bool QWindowsMimeHtml::canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const
|
bool QWindowsMimeHtml::canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const
|
||||||
{
|
{
|
||||||
return mimeType == QStringLiteral("text/html") && canGetData(CF_HTML, pDataObj);
|
return mimeType == QLatin1String("text/html") && canGetData(CF_HTML, pDataObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -998,7 +998,7 @@ QWindowsMimeImage::QWindowsMimeImage()
|
|||||||
QVector<FORMATETC> QWindowsMimeImage::formatsForMime(const QString &mimeType, const QMimeData *mimeData) const
|
QVector<FORMATETC> QWindowsMimeImage::formatsForMime(const QString &mimeType, const QMimeData *mimeData) const
|
||||||
{
|
{
|
||||||
QVector<FORMATETC> formatetcs;
|
QVector<FORMATETC> formatetcs;
|
||||||
if (mimeData->hasImage() && mimeType == QStringLiteral("application/x-qt-image")) {
|
if (mimeData->hasImage() && mimeType == QLatin1String("application/x-qt-image")) {
|
||||||
//add DIBV5 if image has alpha channel
|
//add DIBV5 if image has alpha channel
|
||||||
QImage image = qvariant_cast<QImage>(mimeData->imageData());
|
QImage image = qvariant_cast<QImage>(mimeData->imageData());
|
||||||
if (!image.isNull() && image.hasAlphaChannel())
|
if (!image.isNull() && image.hasAlphaChannel())
|
||||||
@ -1018,7 +1018,7 @@ QString QWindowsMimeImage::mimeForFormat(const FORMATETC &formatetc) const
|
|||||||
|
|
||||||
bool QWindowsMimeImage::canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const
|
bool QWindowsMimeImage::canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const
|
||||||
{
|
{
|
||||||
if ((mimeType == QStringLiteral("application/x-qt-image")) &&
|
if (mimeType == QLatin1String("application/x-qt-image") &&
|
||||||
(canGetData(CF_DIB, pDataObj) || canGetData(CF_PNG, pDataObj)))
|
(canGetData(CF_DIB, pDataObj) || canGetData(CF_PNG, pDataObj)))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
@ -1158,7 +1158,7 @@ bool QBuiltInMimes::convertFromMime(const FORMATETC &formatetc, const QMimeData
|
|||||||
{
|
{
|
||||||
if (canConvertFromMime(formatetc, mimeData)) {
|
if (canConvertFromMime(formatetc, mimeData)) {
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
if (outFormats.value(getCf(formatetc)) == QStringLiteral("text/html")) {
|
if (outFormats.value(getCf(formatetc)) == QLatin1String("text/html")) {
|
||||||
// text/html is in wide chars on windows (compatible with mozillia)
|
// text/html is in wide chars on windows (compatible with mozillia)
|
||||||
QString html = mimeData->html();
|
QString html = mimeData->html();
|
||||||
// same code as in the text converter up above
|
// same code as in the text converter up above
|
||||||
@ -1224,7 +1224,7 @@ QVariant QBuiltInMimes::convertToMime(const QString &mimeType, IDataObject *pDat
|
|||||||
#ifdef QMIME_DEBUG
|
#ifdef QMIME_DEBUG
|
||||||
qDebug("QBuiltInMimes::convertToMime()");
|
qDebug("QBuiltInMimes::convertToMime()");
|
||||||
#endif
|
#endif
|
||||||
if (mimeType == QStringLiteral("text/html") && preferredType == QVariant::String) {
|
if (mimeType == QLatin1String("text/html") && preferredType == QVariant::String) {
|
||||||
// text/html is in wide chars on windows (compatible with Mozilla)
|
// text/html is in wide chars on windows (compatible with Mozilla)
|
||||||
val = QString::fromWCharArray((const wchar_t *)data.data());
|
val = QString::fromWCharArray((const wchar_t *)data.data());
|
||||||
} else {
|
} else {
|
||||||
|
@ -146,7 +146,7 @@ static inline bool launchMail(const QUrl &url)
|
|||||||
bool QWindowsServices::openUrl(const QUrl &url)
|
bool QWindowsServices::openUrl(const QUrl &url)
|
||||||
{
|
{
|
||||||
const QString scheme = url.scheme();
|
const QString scheme = url.scheme();
|
||||||
if (scheme == QStringLiteral("mailto") && launchMail(url))
|
if (scheme == QLatin1String("mailto") && launchMail(url))
|
||||||
return true;
|
return true;
|
||||||
return shellExecute(url);
|
return shellExecute(url);
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ QStringList QCupsPrinterSupportPlugin::keys() const
|
|||||||
|
|
||||||
QPlatformPrinterSupport *QCupsPrinterSupportPlugin::create(const QString &key)
|
QPlatformPrinterSupport *QCupsPrinterSupportPlugin::create(const QString &key)
|
||||||
{
|
{
|
||||||
if (key.compare(key, QStringLiteral("cupsprintersupport"), Qt::CaseInsensitive) == 0)
|
if (key.compare(key, QLatin1String("cupsprintersupport"), Qt::CaseInsensitive) == 0)
|
||||||
return new QCupsPrinterSupport;
|
return new QCupsPrinterSupport;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ public:
|
|||||||
|
|
||||||
QPlatformPrinterSupport *QWindowsPrinterSupportPlugin::create(const QString &key)
|
QPlatformPrinterSupport *QWindowsPrinterSupportPlugin::create(const QString &key)
|
||||||
{
|
{
|
||||||
if (key.compare(key, QStringLiteral("windowsprintsupport"), Qt::CaseInsensitive) == 0)
|
if (key.compare(key, QLatin1String("windowsprintsupport"), Qt::CaseInsensitive) == 0)
|
||||||
return new QWindowsPrinterSupport;
|
return new QWindowsPrinterSupport;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2640,8 +2640,8 @@ void QTest::ignoreMessage(QtMsgType type, const QRegularExpression &messagePatte
|
|||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
static inline bool isWindowsBuildDirectory(const QString &dirName)
|
static inline bool isWindowsBuildDirectory(const QString &dirName)
|
||||||
{
|
{
|
||||||
return dirName.compare(QStringLiteral("Debug"), Qt::CaseInsensitive) == 0
|
return dirName.compare(QLatin1String("Debug"), Qt::CaseInsensitive) == 0
|
||||||
|| dirName.compare(QStringLiteral("Release"), Qt::CaseInsensitive) == 0;
|
|| dirName.compare(QLatin1String("Release"), Qt::CaseInsensitive) == 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -4439,7 +4439,7 @@ void HtmlGenerator::generateManifestFile(QString manifest, QString element)
|
|||||||
continue;
|
continue;
|
||||||
if (tag.at(0) == '-')
|
if (tag.at(0) == '-')
|
||||||
continue;
|
continue;
|
||||||
if (tag == QStringLiteral("qt"))
|
if (tag == QLatin1String("qt"))
|
||||||
continue;
|
continue;
|
||||||
if (tag.startsWith("example"))
|
if (tag.startsWith("example"))
|
||||||
continue;
|
continue;
|
||||||
|
@ -182,9 +182,9 @@ int runRcc(int argc, char *argv[])
|
|||||||
if (parser.isSet(binaryOption))
|
if (parser.isSet(binaryOption))
|
||||||
library.setFormat(RCCResourceLibrary::Binary);
|
library.setFormat(RCCResourceLibrary::Binary);
|
||||||
if (parser.isSet(passOption)) {
|
if (parser.isSet(passOption)) {
|
||||||
if (parser.value(passOption) == QStringLiteral("1"))
|
if (parser.value(passOption) == QLatin1String("1"))
|
||||||
library.setFormat(RCCResourceLibrary::Pass1);
|
library.setFormat(RCCResourceLibrary::Pass1);
|
||||||
else if (parser.value(passOption) == QStringLiteral("2"))
|
else if (parser.value(passOption) == QLatin1String("2"))
|
||||||
library.setFormat(RCCResourceLibrary::Pass2);
|
library.setFormat(RCCResourceLibrary::Pass2);
|
||||||
else
|
else
|
||||||
errorMsg = QLatin1String("Pass number must be 1 or 2");
|
errorMsg = QLatin1String("Pass number must be 1 or 2");
|
||||||
|
@ -326,7 +326,7 @@ bool QSystemTrayIconPrivate::isSystemTrayAvailable_sys()
|
|||||||
|
|
||||||
// no QPlatformSystemTrayIcon so fall back to default xcb platform behavior
|
// no QPlatformSystemTrayIcon so fall back to default xcb platform behavior
|
||||||
const QString platform = QGuiApplication::platformName();
|
const QString platform = QGuiApplication::platformName();
|
||||||
if (platform.compare(QStringLiteral("xcb"), Qt::CaseInsensitive) == 0)
|
if (platform.compare(QLatin1String("xcb"), Qt::CaseInsensitive) == 0)
|
||||||
return locateSystemTray();
|
return locateSystemTray();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user