From 022657d7d03d804c10bb20b8303a6f4f023e96cb Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Fri, 30 Jun 2023 21:36:52 +0200 Subject: [PATCH] Refactor QStyle: const'ify some local variables Task-number: QTBUG-114473 Pick-to: 6.6 Change-Id: I49483dc9c000fac024c81a8210515c8dd5e35559 Reviewed-by: Axel Spoerl --- src/widgets/styles/qfusionstyle.cpp | 4 ++-- src/widgets/styles/qstyle_p.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 723549f3d10..df06205f23a 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -1955,7 +1955,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption case CC_SpinBox: if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast(option)) { QPixmap cache; - QString pixmapName = QStyleHelper::uniqueName("spinbox"_L1, spinBox, spinBox->rect.size()); + const QString pixmapName = QStyleHelper::uniqueName("spinbox"_L1, spinBox, spinBox->rect.size()); if (!QPixmapCache::find(pixmapName, &cache)) { cache = styleCachePixmap(spinBox->rect.size()); @@ -2921,7 +2921,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption } // draw handle if ((option->subControls & SC_SliderHandle) ) { - QString handlePixmapName = QStyleHelper::uniqueName("slider_handle"_L1, option, handle.size()); + const QString handlePixmapName = QStyleHelper::uniqueName("slider_handle"_L1, option, handle.size()); if (!QPixmapCache::find(handlePixmapName, &cache)) { cache = styleCachePixmap(handle.size()); cache.fill(Qt::transparent); diff --git a/src/widgets/styles/qstyle_p.h b/src/widgets/styles/qstyle_p.h index 5c1fd17130c..c4daa09c11e 100644 --- a/src/widgets/styles/qstyle_p.h +++ b/src/widgets/styles/qstyle_p.h @@ -60,9 +60,9 @@ inline QPixmap styleCachePixmap(const QSize &size) QPixmap internalPixmapCache; \ QImage imageCache; \ QPainter *p = painter; \ - QString unique = QStyleHelper::uniqueName((a), option, option->rect.size()); \ + const QString unique = QStyleHelper::uniqueName((a), option, option->rect.size()); \ int txType = painter->deviceTransform().type() | painter->worldTransform().type(); \ - bool doPixmapCache = (!option->rect.isEmpty()) \ + const bool doPixmapCache = (!option->rect.isEmpty()) \ && ((txType <= QTransform::TxTranslate) || (painter->deviceTransform().type() == QTransform::TxScale)); \ if (doPixmapCache && QPixmapCache::find(unique, &internalPixmapCache)) { \ painter->drawPixmap(option->rect.topLeft(), internalPixmapCache); \