QtGui: replace QStringLiteral with QLatin1String when appending
It makes little sense to use QStringLiteral for strings which are immediately appended to, or which are appended to other strings, because no dynamic memory allocation is saved by doing so. But if the only advantage of QStringLiteral does not apply, all its disadvantages dominate, to wit: injection of calls to qstring dtor, non-sharability of data between C strings and QStringLiterals and among QStringLiterals, and doubled storage requirements. Fix by replacing QStringLiteral with QLatin1String. Saves 104B in text size on stripped optimized Linux AMD64 GCC 4.9 builds. Change-Id: I36b6a9bb1963b69361cc3a3db0971e1db92f0080 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
parent
68a85a03f9
commit
215bda50f9
@ -258,7 +258,7 @@ void QColorDialogStaticData::readSettings()
|
||||
#ifndef QT_NO_SETTINGS
|
||||
const QSettings settings(QSettings::UserScope, QStringLiteral("QtProject"));
|
||||
for (int i = 0; i < int(CustomColorCount); ++i) {
|
||||
const QVariant v = settings.value(QStringLiteral("Qt/customColors/") + QString::number(i));
|
||||
const QVariant v = settings.value(QLatin1String("Qt/customColors/") + QString::number(i));
|
||||
if (v.isValid())
|
||||
customRgb[i] = v.toUInt();
|
||||
}
|
||||
@ -271,7 +271,7 @@ void QColorDialogStaticData::writeSettings() const
|
||||
if (!customSet) {
|
||||
QSettings settings(QSettings::UserScope, QStringLiteral("QtProject"));
|
||||
for (int i = 0; i < int(CustomColorCount); ++i)
|
||||
settings.setValue(QStringLiteral("Qt/customColors/") + QString::number(i), customRgb[i]);
|
||||
settings.setValue(QLatin1String("Qt/customColors/") + QString::number(i), customRgb[i]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -1066,7 +1066,7 @@ void QRegularExpressionValidatorPrivate::setRegularExpression(const QRegularExpr
|
||||
|
||||
if (origRe != re) {
|
||||
usedRe = origRe = re; // copies also the pattern options
|
||||
usedRe.setPattern(QStringLiteral("\\A(?:") + re.pattern() + QStringLiteral(")\\z"));
|
||||
usedRe.setPattern(QLatin1String("\\A(?:") + re.pattern() + QLatin1String(")\\z"));
|
||||
emit q->regularExpressionChanged(re);
|
||||
emit q->changed();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user