Utils: Fix StyleHelper::drawArrow workaround for 6.4.0

The workaround that fixed the drawing of arrows after a change between
6.4.0 and 6.4.1 broke the drawing of arrows with Qt 6.4.0.

This change add another enforced detachment of the palette (leading to a
modified cache key) that works with Qt 6.4.0. It still works with 6.4.1.

Amends: 9d32093421

Change-Id: I8917c99488cec4fb17ed148bb3b0f95d4ed7127c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Alessandro Portale
2022-11-21 15:02:57 +01:00
parent 83ddbaad23
commit dfa5b54647

View File

@@ -306,9 +306,14 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
static const QCommonStyle* const style = qobject_cast<QCommonStyle*>(QApplication::style());
if (!style)
return;
// Workaround for QTCREATORBUG-28470
QPalette pal = tweakedOption.palette;
pal.setBrush(QPalette::Base, pal.text()); // Base and Text differ, causing a detachment.
// Inspired by tst_QPalette::cacheKey()
pal.setColor(QPalette::ButtonText, color.rgb());
tweakedOption.palette = pal; // Workaround for QTCREATORBUG-28470
tweakedOption.palette = pal;
tweakedOption.rect = rect;
painter.setOpacity(color.alphaF());
style->QCommonStyle::drawPrimitive(element, &tweakedOption, &painter);