Only send progress bar updates when visible.

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)
This commit is contained in:
Frederik Gladhorn 2012-04-12 08:15:46 +02:00 committed by Qt by Nokia
parent c65a558e00
commit 84e782e2bd

View 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();