diff options
author | Jan Arve Saether <jan-arve.saether@digia.com> | 2014-06-05 13:29:24 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-06-20 17:20:32 +0200 |
commit | f360dc9297ab5d357e7bc381f88622054e5e412e (patch) | |
tree | 098f3841844f420ce88df4c3b38e468078699bda /src/gui/accessible | |
parent | a14aff64a1cb207c8e462ea4d59b3e393369b398 (diff) |
Windows a11y: Publish synthetic increase and decrease actions
Increase and decrease actions can be generally applied to any value
interface. We therefore make them available regardless of the
existence of any action interface.
Change-Id: I82ba01965dc869439b9d741ce681e0c0687263ca
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Diffstat (limited to 'src/gui/accessible')
-rw-r--r-- | src/gui/accessible/qaccessible.cpp | 40 | ||||
-rw-r--r-- | src/gui/accessible/qaccessible.h | 1 |
2 files changed, 26 insertions, 15 deletions
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index 736d66fdae..c715c5c7e0 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -2491,6 +2491,23 @@ struct QAccessibleActionStrings const QString showMenuAction; const QString setFocusAction; const QString toggleAction; + + QString localizedDescription(const QString &actionName) + { + if (actionName == pressAction) + return QAccessibleActionInterface::tr("Triggers the action"); + else if (actionName == increaseAction) + return QAccessibleActionInterface::tr("Increase the value"); + else if (actionName == decreaseAction) + return QAccessibleActionInterface::tr("Decrease the value"); + else if (actionName == showMenuAction) + return QAccessibleActionInterface::tr("Shows the menu"); + else if (actionName == setFocusAction) + return QAccessibleActionInterface::tr("Sets the focus"); + else if (actionName == toggleAction) + return QAccessibleActionInterface::tr("Toggles the state"); + return QString(); + } }; Q_GLOBAL_STATIC(QAccessibleActionStrings, accessibleActionStrings) @@ -2502,21 +2519,7 @@ QString QAccessibleActionInterface::localizedActionName(const QString &actionNam QString QAccessibleActionInterface::localizedActionDescription(const QString &actionName) const { - const QAccessibleActionStrings *strings = accessibleActionStrings(); - if (actionName == strings->pressAction) - return tr("Triggers the action"); - else if (actionName == strings->increaseAction) - return tr("Increase the value"); - else if (actionName == strings->decreaseAction) - return tr("Decrease the value"); - else if (actionName == strings->showMenuAction) - return tr("Shows the menu"); - else if (actionName == strings->setFocusAction) - return tr("Sets the focus"); - else if (actionName == strings->toggleAction) - return tr("Toggles the state"); - - return QString(); + return accessibleActionStrings()->localizedDescription(actionName); } /*! @@ -2573,6 +2576,13 @@ const QString &QAccessibleActionInterface::toggleAction() return accessibleActionStrings()->toggleAction; } +/*! \internal */ +QString qAccessibleLocalizedActionDescription(const QString &actionName) +{ + return accessibleActionStrings()->localizedDescription(actionName); +} + + #endif QT_END_NAMESPACE diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index 25ce161940..ddc8d630a3 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -889,6 +889,7 @@ Q_DECLARE_INTERFACE(QAccessibleInterface, QAccessibleInterface_iid) Q_GUI_EXPORT const char *qAccessibleRoleString(QAccessible::Role role); Q_GUI_EXPORT const char *qAccessibleEventString(QAccessible::Event event); +Q_GUI_EXPORT QString qAccessibleLocalizedActionDescription(const QString &actionName); #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface); |