diff options
author | Marc Mutz <marc.mutz@qt.io> | 2023-06-05 11:01:28 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-06-07 13:23:29 +0000 |
commit | 010b9adb9552bc380bc93481fdbdffed61c175a8 (patch) | |
tree | 2aa0907d2b3703a85556b436542de1d82da10e44 | |
parent | a95930282e60050d592d2688a5203f385e90e196 (diff) |
QFusionStyle: optimize cache-key generation for qt_fusion_draw_button():
Instead of passing a QLatin1StringView to QStyleHelper::uniqueName(),
which takes a QString, allocating, and then using QStringBuilder to
append something to the result of uniqueHelper(), allocating again,
pull the appends to before the call to uniqueName(), folding these two
allocations into one.
Task-number: QTBUG-112200
Change-Id: I501dd4a3df4b9f5267ca931b550d521f4dafe493
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 362b5b84281ac4f31237166763f565e331876887)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/widgets/styles/qfusionstyle.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index fd0458b49e..64a0b3c721 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -224,9 +224,10 @@ static void qt_fusion_draw_arrow(Qt::ArrowType type, QPainter *painter, const QS const int size = qMin(arrowMax, rectMax); QPixmap cachePixmap; - QString cacheKey = QStyleHelper::uniqueName("fusion-arrow"_L1, option, rect.size()) - % HexString<uint>(type) - % HexString<uint>(color.rgba()); + const QString cacheKey = QStyleHelper::uniqueName("fusion-arrow"_L1 + % HexString<uint>(type) + % HexString<uint>(color.rgba()), + option, rect.size()); if (!QPixmapCache::find(cacheKey, &cachePixmap)) { cachePixmap = styleCachePixmap(rect.size()); cachePixmap.fill(Qt::transparent); |