diff options
author | Andre de la Rocha <andre.rocha@qt.io> | 2017-10-19 17:03:11 +0200 |
---|---|---|
committer | Andre de la Rocha <andre.rocha@qt.io> | 2017-11-14 23:39:24 +0000 |
commit | 4c4ac0d976bc5daa89d6f845fa1a28479b00847f (patch) | |
tree | 47a919d576e75c7c1735945362b068f58793d28b /src/widgets/widgets/qcheckbox.cpp | |
parent | 0cf6297c15be45d852be98c862bd0211e6de1aa2 (diff) |
Fix accessibility info for tri-state checkboxes
The state information provided by QAccessibleInterface::state() was not
correctly reflecting the state of tri-state checkboxes: checkStateMixed
was never set. This change fixes this issue and also adds accessibility
update notifications for changes in checkStateMixed, which were missing.
Change-Id: Ia4a114559d5a957ca85bf2f169a6cece2c98d077
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/widgets/widgets/qcheckbox.cpp')
-rw-r--r-- | src/widgets/widgets/qcheckbox.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/widgets/widgets/qcheckbox.cpp b/src/widgets/widgets/qcheckbox.cpp index 9b49916774..235508535d 100644 --- a/src/widgets/widgets/qcheckbox.cpp +++ b/src/widgets/widgets/qcheckbox.cpp @@ -45,6 +45,9 @@ #include "qstyle.h" #include "qstyleoption.h" #include "qevent.h" +#ifndef QT_NO_ACCESSIBILITY +#include "qaccessible.h" +#endif #include "private/qabstractbutton_p.h" @@ -243,6 +246,9 @@ Qt::CheckState QCheckBox::checkState() const void QCheckBox::setCheckState(Qt::CheckState state) { Q_D(QCheckBox); +#ifndef QT_NO_ACCESSIBILITY + bool noChange = d->noChange; +#endif if (state == Qt::PartiallyChecked) { d->tristate = true; d->noChange = true; @@ -257,6 +263,15 @@ void QCheckBox::setCheckState(Qt::CheckState state) d->publishedState = state; emit stateChanged(state); } + +#ifndef QT_NO_ACCESSIBILITY + if (noChange != d->noChange) { + QAccessible::State s; + s.checkStateMixed = true; + QAccessibleStateChangeEvent event(this, s); + QAccessible::updateAccessibility(&event); + } +#endif } |