diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp index 218ec88f53..3b40ad5285 100644 --- a/src/widgets/widgets/qabstractbutton.cpp +++ b/src/widgets/widgets/qabstractbutton.cpp @@ -613,12 +613,13 @@ void QAbstractButton::setChecked(bool checked) if (guard) d->emitToggled(checked); - #if QT_CONFIG(accessibility) - QAccessible::State s; - s.checked = true; - QAccessibleStateChangeEvent event(this, s); - QAccessible::updateAccessibility(&event); + if (guard) { + QAccessible::State s; + s.checked = true; + QAccessibleStateChangeEvent event(this, s); + QAccessible::updateAccessibility(&event); + } #endif }