From dfa5b546476d7b8fcb7792b9fc8bde6282b2b144 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Mon, 21 Nov 2022 15:02:57 +0100 Subject: 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: 9d32093421adec260a8abc0920257564d45c12bf Change-Id: I8917c99488cec4fb17ed148bb3b0f95d4ed7127c Reviewed-by: Eike Ziller --- src/libs/utils/stylehelper.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libs/utils/stylehelper.cpp b/src/libs/utils/stylehelper.cpp index ade12533db..b60a35c33f 100644 --- a/src/libs/utils/stylehelper.cpp +++ b/src/libs/utils/stylehelper.cpp @@ -306,9 +306,14 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter, static const QCommonStyle* const style = qobject_cast(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); -- cgit v1.2.3