Only send progress bar updates when visible.
authorFrederik Gladhorn <frederik.gladhorn@nokia.com>
Thu, 12 Apr 2012 06:15:46 +0000 (08:15 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 17 Apr 2012 21:16:51 +0000 (23:16 +0200)
Screen readers tend to announce progress.
Some applications (for example KMail) have hidden
progress bars that update frequently.

While the applications should be fixed, it's better
not to spam the user with continous progress announcements.

Ported from Qt 4 patch.

Change-Id: I5f3b5a83dc80594d995b10e58527115de8601c77
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
(cherry picked from commit 90dc28900d3abfb00a65fef1d9daf36e727dfdca)

src/widgets/widgets/qprogressbar.cpp

index c02aa0e..33c6179 100644 (file)
@@ -314,8 +314,10 @@ void QProgressBar::setValue(int value)
     d->value = value;
     emit valueChanged(value);
 #ifndef QT_NO_ACCESSIBILITY
-    QAccessibleValueChangeEvent event(this, value);
-    QAccessible::updateAccessibility(&event);
+    if (isVisible()) {
+        QAccessibleValueChangeEvent event(this, value);
+        QAccessible::updateAccessibility(&event);
+    }
 #endif
     if (d->repaintRequired())
         repaint();