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;
case PE_IndicatorRadioButton:
{
if (option->styleObject->property("_q_end_radius").isNull())
option->styleObject->setProperty("_q_end_radius", option->state & State_On ? 4.0f :7.0f);
QNumberStyleAnimation* animation = qobject_cast<QNumberStyleAnimation*>(d->animation(option->styleObject));
if (animation != nullptr)
option->styleObject->setProperty("_q_inner_radius", animation->currentValue());
else
option->styleObject->setProperty("_q_inner_radius", option->styleObject->property("_q_end_radius"));
int innerRadius = option->styleObject->property("_q_inner_radius").toFloat();
qreal innerRadius = option->state & State_On ? 4.0f :7.0f;
if (option->styleObject) {
if (option->styleObject->property("_q_end_radius").isNull())
option->styleObject->setProperty("_q_end_radius", innerRadius);
QNumberStyleAnimation *animation = qobject_cast<QNumberStyleAnimation *>(d->animation(option->styleObject));
innerRadius = animation ? animation->currentValue() : option->styleObject->property("_q_end_radius").toFloat();
option->styleObject->setProperty("_q_inner_radius", innerRadius);
}
QPainterPath path;
QRectF rect = option->rect;