QWindows11Style: Draw QRadioButton with QPainterPath
The drawing of QRadioButton in QWindows11Style was performed with overdrawing, leading to problems with the transparent background color for QGraphicsWidgets. This patch draws the ring of the RadioButton using QPainterPath, to avoid overdrawing. Fixes: QTBUG-130828 Pick-to: 6.8 Change-Id: I4b278f7f720b55e11c550977b666410d85b65382 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
This commit is contained in:
parent
ad568b859a
commit
57361de3a9
@ -897,6 +897,7 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
|
||||
option->styleObject->setProperty("_q_inner_radius", option->styleObject->property("_q_end_radius"));
|
||||
int innerRadius = option->styleObject->property("_q_inner_radius").toFloat();
|
||||
|
||||
QPainterPath path;
|
||||
QRectF rect = option->rect;
|
||||
QPointF center = QPoint(rect.x() + rect.width() / 2, rect.y() + rect.height() / 2);
|
||||
rect.setWidth(15);
|
||||
@ -909,18 +910,14 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
|
||||
|
||||
painter->setPen(Qt::NoPen);
|
||||
painter->setBrush(option->palette.accent());
|
||||
if (option->state & State_MouseOver && option->state & State_Enabled)
|
||||
painter->setBrush(QBrush(option->palette.accent().color().lighter(107)));
|
||||
painter->drawEllipse(center, 7, 7);
|
||||
path.addEllipse(center,7,7);
|
||||
path.addEllipse(center,innerRadius,innerRadius);
|
||||
painter->drawPath(path);
|
||||
|
||||
painter->setPen(QPen(WINUI3Colors[colorSchemeIndex][frameColorStrong]));
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
painter->drawEllipse(center, 7.5, 7.5);
|
||||
|
||||
painter->setPen(Qt::NoPen);
|
||||
painter->setBrush(QBrush(option->palette.window()));
|
||||
painter->drawEllipse(center,innerRadius, innerRadius);
|
||||
|
||||
painter->setPen(QPen(WINUI3Colors[colorSchemeIndex][frameColorStrong]));
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
painter->drawEllipse(center,innerRadius + 0.5, innerRadius + 0.5);
|
||||
|
Loading…
x
Reference in New Issue
Block a user