diff options
author | Frederik Gladhorn <frederik.gladhorn@nokia.com> | 2011-12-09 11:06:28 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-03 19:27:17 +0100 |
commit | 9ea608cb54569f1e4a68c787fe2f5013a57c9722 (patch) | |
tree | 9af6e5082ba7167fcb24179a454696ba65b2f0cb /src/gui | |
parent | 82f9ad6295fb35e138841810a05075214a2f2690 (diff) |
Use meta object to get string rep of QAccessible::Role.
Change-Id: I69320b69ea13ebc594575277e39d30a066df61fd
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/accessible/qaccessible.cpp | 24 | ||||
-rw-r--r-- | src/gui/accessible/qaccessible.h | 3 |
2 files changed, 22 insertions, 5 deletions
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index 7c23ede6fc..3251e46a96 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -50,10 +50,8 @@ #include <private/qguiapplication_p.h> #include "qplatformaccessibility_qpa.h" -#include <QtCore/QDebug> -#include <QtCore/QHash> -#include <QtCore/QMetaObject> -#include <QtCore/QMutex> +#include <QtCore/qdebug.h> +#include <QtCore/qmetaobject.h> #include <private/qfactoryloader_p.h> QT_BEGIN_NAMESPACE @@ -1209,6 +1207,22 @@ QVariant QAccessibleInterface::virtual_hook(const QVariant &) return QVariant(); } +/*! \internal */ +const char *qAccessibleRoleString(QAccessible::Role role) +{ + if (role >=0x40) + role = QAccessible::UserRole; + static int roleEnum = QAccessible::staticMetaObject.indexOfEnumerator("Role"); + return QAccessible::staticMetaObject.enumerator(roleEnum).valueToKey(role); +} + +/*! \internal */ +const char *qAccessibleEventString(QAccessible::Event event) +{ + static int eventEnum = QAccessible::staticMetaObject.indexOfEnumerator("Event"); + return QAccessible::staticMetaObject.enumerator(eventEnum).valueToKey(event); +} + #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface) { @@ -1220,7 +1234,7 @@ Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface) d << "QAccessibleInterface(" << hex << (void *) iface << dec; if (iface->isValid()) { d << " name=" << iface->text(QAccessible::Name) << " "; - d << "role=" << iface->role() << " "; + d << "role=" << qAccessibleRoleString(iface->role()) << " "; if (iface->childCount()) d << "childc=" << iface->childCount() << " "; if (iface->object()) { diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index 3831b7d8e1..55541810a3 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -439,6 +439,9 @@ inline QAccessibleEvent::QAccessibleEvent(Type atype) #define QAccessibleInterface_iid "com.trolltech.Qt.QAccessibleInterface" Q_DECLARE_INTERFACE(QAccessibleInterface, QAccessibleInterface_iid) +Q_GUI_EXPORT const char *qAccessibleRoleString(QAccessible::Role role); +Q_GUI_EXPORT const char *qAccessibleEventString(QAccessible::Event event); + #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface); #endif |