aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickitem.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@digia.com>2013-05-10 11:54:37 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-14 17:27:14 +0200
commite443f6dc7df2e5a0bd2ab890c3b6094500f5b9ab (patch)
treec216dfcbb80c622d10efd6c51411a807c5ac253f /src/quick/items/qquickitem.cpp
parent00556b20067c3a4adf6ff33a17d2a4232fdce6ee (diff)
Mac: respect the system settings in Full Keyboard Access
Iterate all or not in nextPrevItemInTabFocusChain function. Change-Id: I95289b042f3d9924c28ffb9c8c7124c767addf2e Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'src/quick/items/qquickitem.cpp')
-rw-r--r--src/quick/items/qquickitem.cpp41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 5ad53e99b6..1667736d46 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,41 @@ 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;
+
+ if (item->window() && item == item->window()->contentItem())
+ return 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
+ || role == QAccessible::SpinBox)
+ 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 +2095,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 +2159,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;
}