From 010b9adb9552bc380bc93481fdbdffed61c175a8 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 5 Jun 2023 11:01:28 +0200 Subject: [PATCH] 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 (cherry picked from commit 362b5b84281ac4f31237166763f565e331876887) Reviewed-by: Qt Cherry-pick Bot --- src/widgets/styles/qfusionstyle.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index fd0458b49e8..64a0b3c7217 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(type) - % HexString(color.rgba()); + const QString cacheKey = QStyleHelper::uniqueName("fusion-arrow"_L1 + % HexString(type) + % HexString(color.rgba()), + option, rect.size()); if (!QPixmapCache::find(cacheKey, &cachePixmap)) { cachePixmap = styleCachePixmap(rect.size()); cachePixmap.fill(Qt::transparent);