diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-01-31 11:12:20 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-31 12:07:59 +0100 |
commit | de27b71c1983768186b7f9df0a5158a7c5e6c903 (patch) | |
tree | 5c195eeafc85eacdae02d2d87dd119383474b554 /src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp | |
parent | 6953f3a501dfee5064a12558a2e2515b69b35189 (diff) |
Windows: Fixed alert sound of QMessageBox.
Task-number: QTBUG-33303
Change-Id: I184f169a2ae0e1fa5e21b906c1f7659316030b34
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Diffstat (limited to 'src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp')
-rw-r--r-- | src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp index 885bc37cff..307f2fc3bb 100644 --- a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp +++ b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp @@ -100,6 +100,25 @@ QWindowsAccessibility::QWindowsAccessibility() { } +// Retrieve sound name by checking the icon property of a message box +static inline QString messageBoxAlertSound(const QObject *messageBox) +{ + enum MessageBoxIcon { // Keep in sync with QMessageBox::Icon + Information = 1, + Warning = 2, + Critical = 3 + }; + switch (messageBox->property("icon").toInt()) { + case Information: + return QStringLiteral("SystemAsterisk"); + case Warning: + return QStringLiteral("SystemExclamation"); + case Critical: + return QStringLiteral("SystemHand"); + } + return QString(); +} + void QWindowsAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) { QString soundName; @@ -113,32 +132,8 @@ void QWindowsAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) break; case QAccessible::Alert: - { - /* ### FIXME -#ifndef QT_NO_MESSAGEBOX - QMessageBox *mb = qobject_cast<QMessageBox*>(o); - if (mb) { - switch (mb->icon()) { - case QMessageBox::Warning: - soundName = QLatin1String("SystemExclamation"); - break; - case QMessageBox::Critical: - soundName = QLatin1String("SystemHand"); - break; - case QMessageBox::Information: - soundName = QLatin1String("SystemAsterisk"); - break; - default: - break; - } - } else -#endif // QT_NO_MESSAGEBOX -*/ - { - soundName = QLatin1String("SystemAsterisk"); - } - - } + soundName = event->object()->inherits("QMessageBox") ? + messageBoxAlertSound(event->object()) : QStringLiteral("SystemAsterisk"); break; default: break; |