diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-02-28 15:19:44 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-02-24 17:14:07 +0000 |
commit | 68a85a03f96f5912151ff7412c508e52a27c9418 (patch) | |
tree | 95f74ce10cc6ec652d7df0785ba0b31a4fd6f721 /src | |
parent | 3ca2eea00d53ae1f75cead8dde763cb8e348d630 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/dialogs/qfiledialog.cpp | 2 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetwindow.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 4d74292e8f..50667e2a91 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -1527,7 +1527,7 @@ static QString nameFilterForMime(const QString &mimeType) return QFileDialog::tr("All files (*)"); } else { const QString patterns = mime.globPatterns().join(QLatin1Char(' ')); - return mime.comment() + QStringLiteral(" (") + patterns + QLatin1Char(')'); + return mime.comment() + QLatin1String(" (") + patterns + QLatin1Char(')'); } } return QString(); diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 90473c6642..6a3785ea03 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -1001,8 +1001,8 @@ void QWidgetWindow::updateObjectName() { QString name = m_widget->objectName(); if (name.isEmpty()) - name = QString::fromUtf8(m_widget->metaObject()->className()) + QStringLiteral("Class"); - name += QStringLiteral("Window"); + name = QString::fromUtf8(m_widget->metaObject()->className()) + QLatin1String("Class"); + name += QLatin1String("Window"); setObjectName(name); } |