Utils: Workaround StyleHelper::drawArrow for Qt 6.4.1

A change in Qt 6.4.1 influences the behavior of QPalette::setColor, so
that the arrows appear in a wrong color. An enforeced detachment of the
palette in style option works as a workaround.

Fixes: QTCREATORBUG-28470
Change-Id: I4a44ff59c368105fdf448152d83e96cdedd46495
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Alessandro Portale
2022-11-18 14:27:51 +01:00
parent f5efd9acc0
commit 9d32093421

View File

@@ -306,7 +306,9 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
static const QCommonStyle* const style = qobject_cast<QCommonStyle*>(QApplication::style());
if (!style)
return;
tweakedOption.palette.setColor(QPalette::ButtonText, color.rgb());
QPalette pal = tweakedOption.palette;
pal.setColor(QPalette::ButtonText, color.rgb());
tweakedOption.palette = pal; // Workaround for QTCREATORBUG-28470
tweakedOption.rect = rect;
painter.setOpacity(color.alphaF());
style->QCommonStyle::drawPrimitive(element, &tweakedOption, &painter);