QtWidgets: 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 288B in text size on stripped optimized Linux AMD64 GCC 4.9
builds.

Change-Id: Ie632f25883163f57991264b29e8753fe4c4f738e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
Marc Mutz 2015-02-28 15:19:44 +01:00
parent 3ca2eea00d
commit 68a85a03f9
2 changed files with 3 additions and 3 deletions

View File

@ -1527,7 +1527,7 @@ static QString nameFilterForMime(const QString &mimeType)
return QFileDialog::tr("All files (*)"); return QFileDialog::tr("All files (*)");
} else { } else {
const QString patterns = mime.globPatterns().join(QLatin1Char(' ')); const QString patterns = mime.globPatterns().join(QLatin1Char(' '));
return mime.comment() + QStringLiteral(" (") + patterns + QLatin1Char(')'); return mime.comment() + QLatin1String(" (") + patterns + QLatin1Char(')');
} }
} }
return QString(); return QString();

View File

@ -1001,8 +1001,8 @@ void QWidgetWindow::updateObjectName()
{ {
QString name = m_widget->objectName(); QString name = m_widget->objectName();
if (name.isEmpty()) if (name.isEmpty())
name = QString::fromUtf8(m_widget->metaObject()->className()) + QStringLiteral("Class"); name = QString::fromUtf8(m_widget->metaObject()->className()) + QLatin1String("Class");
name += QStringLiteral("Window"); name += QLatin1String("Window");
setObjectName(name); setObjectName(name);
} }