diff options
author | Liang Qi <liang.qi@digia.com> | 2013-05-07 08:41:50 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-05-08 12:49:57 +0200 |
commit | 305616a60462b668c4d0b3d19302fa90469aceb5 (patch) | |
tree | 6a58741f6fefbafcfc15d834fd24e99238726075 /src/quick/items/qquickitem.cpp | |
parent | cec16f1e67aeec0e8a82a06cda6aaca5d95f4d94 (diff) |
Mac: respect the system settings in Full Keyboard Access
Iterate all or not in nextPrevItemInTabFocusChain function.
Change-Id: I14d40dbeda01ca470efe23886789383ff1d30c0f
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/quick/items/qquickitem.cpp')
-rw-r--r-- | src/quick/items/qquickitem.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 733e26a3b6..b4732c3975 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -58,6 +58,7 @@ #include <QtCore/qdebug.h> #include <QtCore/qcoreevent.h> #include <QtCore/qnumeric.h> +#include <QtGui/qpa/qplatformtheme.h> #include <private/qqmlglobal_p.h> #include <private/qqmlengine_p.h> @@ -2034,6 +2035,35 @@ QQuickItem::~QQuickItem() /*! \internal +*/ +bool QQuickItemPrivate::qt_tab_all_widgets() +{ + if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) + return theme->themeHint(QPlatformTheme::TabAllWidgets).toBool(); + return true; +} + +/*! + \internal +*/ +bool QQuickItemPrivate::canAcceptTabFocus(QQuickItem *item) +{ + bool result = true; + +#ifndef QT_NO_ACCESSIBILITY + result = false; + if (QObject *acc = qmlAttachedPropertiesObject<QQuickAccessibleAttached>(item, false)) { + int role = acc->property("role").toInt(); + if (role == QAccessible::EditableText || role == QAccessible::Table || role == QAccessible::List) + result = true; + } +#endif + + return result; +} + +/*! + \internal \brief QQuickItemPrivate::focusNextPrev focuses the next/prev item in the tab-focus-chain \param item The item that currently has the focus \param forward The direction @@ -2059,6 +2089,8 @@ QQuickItem* QQuickItemPrivate::nextPrevItemInTabFocusChain(QQuickItem *item, boo Q_ASSERT(item); Q_ASSERT(item->activeFocusOnTab()); + bool all = QQuickItemPrivate::qt_tab_all_widgets(); + QQuickItem *from = 0; if (forward) { from = item->parentItem(); @@ -2121,7 +2153,8 @@ QQuickItem* QQuickItemPrivate::nextPrevItemInTabFocusChain(QQuickItem *item, boo } from = last; - } while (skip || !current->activeFocusOnTab() || !current->isEnabled() || !current->isVisible()); + } while (skip || !current->activeFocusOnTab() || !current->isEnabled() || !current->isVisible() + || !(all || QQuickItemPrivate::canAcceptTabFocus(current))); return current; } |