diff options
author | Jens Bache-Wiig <jens.bache-wiig@digia.com> | 2012-11-01 11:47:37 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-11-01 20:17:57 +0100 |
commit | 70dea61670d0f66482442b41549de8ee19474fa6 (patch) | |
tree | 042c35790dd59ee7d5986594c0c4b41baafba9ed /src/widgets/styles/qstylehelper.cpp | |
parent | 8c15be7bb2488a17b2c2f62e2d2a7ed01dd331d6 (diff) |
Make ToolButton work with Macstyle for components
We needed a new helper function for this. The widget cast was
breaking desktop components. By using accessible role, we can make
it work for both use cases without depending on the widget.
Change-Id: Ic854dc45a4e5b7a50c5be701e903d58a4a914ee5
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'src/widgets/styles/qstylehelper.cpp')
-rw-r--r-- | src/widgets/styles/qstylehelper.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp index e23db2b637..8d67683eae 100644 --- a/src/widgets/styles/qstylehelper.cpp +++ b/src/widgets/styles/qstylehelper.cpp @@ -86,6 +86,23 @@ qreal dpiScaled(qreal value) #endif } +// Searches for an ancestor of a particular accessible role +bool hasAncestor(QObject *obj, QAccessible::Role role) +{ + bool found = false; +#ifndef QT_NO_ACCESSIBILITY + QObject *parent = obj ? obj->parent() : 0; + while (parent && !found) { + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(parent); + if (iface && iface->role() == role) + found = true; + delete iface; + parent = parent->parent(); + } +#endif // QT_NO_ACCESSIBILITY + return found; +} + #ifndef QT_NO_DIAL |