forked from qt-creator/qt-creator
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:
@@ -306,9 +306,14 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
|
|||||||
static const QCommonStyle* const style = qobject_cast<QCommonStyle*>(QApplication::style());
|
static const QCommonStyle* const style = qobject_cast<QCommonStyle*>(QApplication::style());
|
||||||
if (!style)
|
if (!style)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Workaround for QTCREATORBUG-28470
|
||||||
QPalette pal = tweakedOption.palette;
|
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());
|
pal.setColor(QPalette::ButtonText, color.rgb());
|
||||||
tweakedOption.palette = pal; // Workaround for QTCREATORBUG-28470
|
|
||||||
|
tweakedOption.palette = pal;
|
||||||
tweakedOption.rect = rect;
|
tweakedOption.rect = rect;
|
||||||
painter.setOpacity(color.alphaF());
|
painter.setOpacity(color.alphaF());
|
||||||
style->QCommonStyle::drawPrimitive(element, &tweakedOption, &painter);
|
style->QCommonStyle::drawPrimitive(element, &tweakedOption, &painter);
|
||||||
|
Reference in New Issue
Block a user