summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfont.cpp
diff options
context:
space:
mode:
authorAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-03-31 17:34:32 +0300
committerAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-06-02 12:57:42 +0000
commit6030e63037cdc09d43ad372ecbcfeece72b6e353 (patch)
tree3a0fafeb111cbcd928a04233a1c42f1ab455de64 /src/gui/text/qfont.cpp
parent90988a2c6713e41937241e0848043a2e28973d68 (diff)
QtGui: use QStringRef to optimize memory allocation
Replace substring functions that return QString with corresponding functions that return QStringRef where it's possible. Create QString from QStringRef only where necessary. Change-Id: Id83c60cc7568b20ef008b51c582cfdf466a47e35 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/gui/text/qfont.cpp')
-rw-r--r--src/gui/text/qfont.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index f92e4ab457..828dbc318c 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -2033,7 +2033,7 @@ uint qHash(const QFont &font, uint seed) Q_DECL_NOTHROW
*/
bool QFont::fromString(const QString &descrip)
{
- QStringList l(descrip.split(QLatin1Char(',')));
+ const auto l = descrip.splitRef(QLatin1Char(','));
int count = l.count();
if (!count || (count > 2 && count < 9) || count > 11) {
@@ -2042,7 +2042,7 @@ bool QFont::fromString(const QString &descrip)
return false;
}
- setFamily(l[0]);
+ setFamily(l[0].toString());
if (count > 1 && l[1].toDouble() > 0.0)
setPointSizeF(l[1].toDouble());
if (count == 9) {