diff options
author | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2009-07-07 09:39:43 (GMT) |
---|---|---|
committer | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2009-07-07 09:54:03 (GMT) |
commit | f70f321c8b5769476796e2bae540a57b3b62c684 (patch) | |
tree | dd6b4cfe816bfcd0b8b881f3fcc72c98ac0ee331 | |
parent | 53b116be1bbadd416449d9a0104f514139f495c8 (diff) | |
download | Qt-f70f321c8b5769476796e2bae540a57b3b62c684.zip Qt-f70f321c8b5769476796e2bae540a57b3b62c684.tar.gz Qt-f70f321c8b5769476796e2bae540a57b3b62c684.tar.bz2 |
Make sure we send a ValueChanged event if the spinbox value has changed
Unfortunately the codepath for keyPressEvent does not call updateState,
so we have to add the same line in two places.
Note that updateState() is only called from mousePressEvent() and
mouseMoveEvent().
Task-number: 254053
-rw-r--r-- | src/gui/widgets/qabstractspinbox.cpp | 9 | ||||
-rw-r--r-- | tests/auto/qaccessibility/tst_qaccessibility.cpp | 7 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp index 25acd6e..da18d13 100644 --- a/src/gui/widgets/qabstractspinbox.cpp +++ b/src/gui/widgets/qabstractspinbox.cpp @@ -57,6 +57,9 @@ #include <qpalette.h> #include <qstylepainter.h> #include <qdebug.h> +#ifndef QT_NO_ACCESSIBILITY +# include <qaccessible.h> +#endif #if defined(Q_WS_X11) #include <limits.h> @@ -951,6 +954,9 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event) d->buttonState = (Keyboard | (up ? Up : Down)); } stepBy(steps); +#ifndef QT_NO_ACCESSIBILITY + QAccessible::updateAccessibility(this, 0, QAccessible::ValueChanged); +#endif return; } #ifdef QT_KEYPAD_NAVIGATION @@ -1548,6 +1554,9 @@ void QAbstractSpinBoxPrivate::updateState(bool up) spinClickThresholdTimerId = q->startTimer(spinClickThresholdTimerInterval); buttonState = (up ? (Mouse | Up) : (Mouse | Down)); q->stepBy(up ? 1 : -1); +#ifndef QT_NO_ACCESSIBILITY + QAccessible::updateAccessibility(q, 0, QAccessible::ValueChanged); +#endif } } diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 8a88b59..b8aec50 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -2623,6 +2623,13 @@ void tst_QAccessibility::spinBoxTest() QVERIFY(childRect.isNull() == false); } + spinBox->setFocus(); + QTestAccessibility::clearEvents(); + QTest::keyPress(spinBox, Qt::Key_Up); + QTest::qWait(200); + EventList events = QTestAccessibility::events(); + QTestAccessibilityEvent expectedEvent(spinBox, 0, (int)QAccessible::ValueChanged); + QVERIFY(events.contains(expectedEvent)); delete spinBox; QTestAccessibility::clearEvents(); #else |