diff options
author | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-03-28 10:58:29 +0300 |
---|---|---|
committer | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-03-29 10:21:09 +0000 |
commit | a54a5fee80e3cf0dffd9498db2d1948ce906e21d (patch) | |
tree | ad991268c67d5a898041ab63719fa0e3f774c8c9 /src | |
parent | fcd7d9b22fa65fd7e6747f1f44b25bc54037d06b (diff) |
QQuickUniversalFocusRectangle: optimize string usage
Replace QString::arg() chain with multi-arg overloaded function.
It's faster because of args are replaced in one pass.
While touching the code, also cache width and height of bound.
Change-Id: Id8d19143f426ed1998713204dc9c8d4b51e58db5
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/controls/universal/qquickuniversalfocusrectangle.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/imports/controls/universal/qquickuniversalfocusrectangle.cpp b/src/imports/controls/universal/qquickuniversalfocusrectangle.cpp index a9b77ee0..3850e4be 100644 --- a/src/imports/controls/universal/qquickuniversalfocusrectangle.cpp +++ b/src/imports/controls/universal/qquickuniversalfocusrectangle.cpp @@ -55,9 +55,11 @@ void QQuickUniversalFocusRectangle::paint(QPainter *painter) return; QRect bounds = boundingRect().toAlignedRect(); - const QString key = QStringLiteral("qquickuniversalfocusrectangle_%1_%2").arg(bounds.width()).arg(bounds.height()); + const int boundsWidth = bounds.width(); + const int boundsHeight = bounds.width(); + const QString key = QStringLiteral("qquickuniversalfocusrectangle_%1_%2").arg(QString::number(boundsWidth), QString::number(boundsHeight)); - QPixmap pixmap(bounds.width(), bounds.height()); + QPixmap pixmap(boundsWidth, boundsHeight); if (!QPixmapCache::find(key, &pixmap)) { bounds.adjust(0, 0, -1, -1); pixmap.fill(Qt::transparent); |