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 Change-Id: I4b278f7f720b55e11c550977b666410d85b65382 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> (cherry picked from commit 57361de3a9814808bb575f8d01c1b12cbed9dbe9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
0ac0ca8124
commit
d8ed810029
@ -881,6 +881,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);
|
||||
@ -893,18 +894,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