QWindows11Style: Default PE_IndicatorRadioButton to selected/unselected

In case there is no valid QStyleOption::styleObject, default the
PE_IndicatorRadioButton to the selected and unselected appearances.

Fixes: QTBUG-132906
Pick-to: 6.8
Change-Id: I5e9c13cb3384321e025e5af08ee3dab81feb07fe
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit b717945812b16f957421bc2a2b1c4220f8148e64)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Wladimir Leuschner 2025-01-22 12:39:52 +01:00 committed by Qt Cherry-pick Bot
parent eac8f36080
commit acbfeca2b3

View File

@ -854,14 +854,14 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
break; break;
case PE_IndicatorRadioButton: case PE_IndicatorRadioButton:
{ {
if (option->styleObject->property("_q_end_radius").isNull()) qreal innerRadius = option->state & State_On ? 4.0f :7.0f;
option->styleObject->setProperty("_q_end_radius", option->state & State_On ? 4.0f :7.0f); if (option->styleObject) {
QNumberStyleAnimation* animation = qobject_cast<QNumberStyleAnimation*>(d->animation(option->styleObject)); if (option->styleObject->property("_q_end_radius").isNull())
if (animation != nullptr) option->styleObject->setProperty("_q_end_radius", innerRadius);
option->styleObject->setProperty("_q_inner_radius", animation->currentValue()); QNumberStyleAnimation *animation = qobject_cast<QNumberStyleAnimation *>(d->animation(option->styleObject));
else innerRadius = animation ? animation->currentValue() : option->styleObject->property("_q_end_radius").toFloat();
option->styleObject->setProperty("_q_inner_radius", option->styleObject->property("_q_end_radius")); option->styleObject->setProperty("_q_inner_radius", innerRadius);
int innerRadius = option->styleObject->property("_q_inner_radius").toFloat(); }
QPainterPath path; QPainterPath path;
QRectF rect = option->rect; QRectF rect = option->rect;