Micro-optimize QCalendarDateSectionValidator::highlightString()

Don't allocate QStrings just to concatenate them.

Change-Id: I340cd5c2b0d0b688a2323544c76c3cc6f5af1332
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
This commit is contained in:
Marc Mutz 2014-09-13 13:40:41 +02:00
parent a5e987bca9
commit b57592ebe6

View File

@ -95,7 +95,7 @@ QString QCalendarDateSectionValidator::highlightString(const QString &str, int p
if (pos == 0)
return QLatin1String("<b>") + str + QLatin1String("</b>");
int startPos = str.length() - pos;
return str.mid(0, startPos) + QLatin1String("<b>") + str.mid(startPos, pos) + QLatin1String("</b>");
return str.midRef(0, startPos) + QLatin1String("<b>") + str.midRef(startPos, pos) + QLatin1String("</b>");
}