diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/accessible/widgets/simplewidgets.cpp | 56 | ||||
-rw-r--r-- | src/plugins/accessible/widgets/simplewidgets.h | 14 |
2 files changed, 69 insertions, 1 deletions
diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index 89482bb..aa51759 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -209,6 +209,62 @@ QAccessible::State QAccessibleButton::state(int child) const return state; } +int QAccessibleButton::actionCount() +{ + return 1; +} + +void QAccessibleButton::doAction(int actionIndex) +{ + switch (actionIndex) { + case 0: + button()->click(); + break; + } +} + +QString QAccessibleButton::description(int actionIndex) +{ + switch (actionIndex) { + case 0: + return QLatin1String("Clicks the button."); + default: + return QString(); + } +} + +QString QAccessibleButton::name(int actionIndex) +{ + switch (actionIndex) { + case 0: + return QLatin1String("Press"); + default: + return QString(); + } +} + +QString QAccessibleButton::localizedName(int actionIndex) +{ + switch (actionIndex) { + case 0: + return tr("Press"); + default: + return QString(); + } +} + +QStringList QAccessibleButton::keyBindings(int actionIndex) +{ + switch (actionIndex) { +#ifdef QT_NO_SHORTCUT + case 0: + return button()->shortcut().toString(); +#endif + default: + return QStringList(); + } +} + #ifndef QT_NO_TOOLBUTTON /*! \class QAccessibleToolButton diff --git a/src/plugins/accessible/widgets/simplewidgets.h b/src/plugins/accessible/widgets/simplewidgets.h index 8de35ef..0c1cf5e 100644 --- a/src/plugins/accessible/widgets/simplewidgets.h +++ b/src/plugins/accessible/widgets/simplewidgets.h @@ -42,6 +42,7 @@ #ifndef SIMPLEWIDGETS_H #define SIMPLEWIDGETS_H +#include <QtCore/qcoreapplication.h> #include <QtGui/qaccessible2.h> #include <QtGui/qaccessiblewidget.h> @@ -54,8 +55,10 @@ class QLineEdit; class QToolButton; class QProgressBar; -class QAccessibleButton : public QAccessibleWidgetEx +class QAccessibleButton : public QAccessibleWidgetEx, public QAccessibleActionInterface { + Q_ACCESSIBLE_OBJECT + Q_DECLARE_TR_FUNCTIONS(QAccessibleButton) public: QAccessibleButton(QWidget *w, Role r); @@ -65,6 +68,14 @@ public: QString actionText(int action, Text text, int child) const; bool doAction(int action, int child, const QVariantList ¶ms); + // QAccessibleActionInterface + int actionCount(); + void doAction(int actionIndex); + QString description(int actionIndex); + QString name(int actionIndex); + QString localizedName(int actionIndex); + QStringList keyBindings(int actionIndex); + protected: QAbstractButton *button() const; }; @@ -102,6 +113,7 @@ protected: class QAccessibleDisplay : public QAccessibleWidgetEx { + Q_ACCESSIBLE_OBJECT public: explicit QAccessibleDisplay(QWidget *w, Role role = StaticText); |