aboutsummaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
authorAntti Hölttä <AHoelttae@luxoft.com>2018-12-17 15:08:17 +0100
committerAntti Hölttä <AHoelttae@luxoft.com>2019-03-18 16:34:23 +0100
commit593b6cd83f1bb991358564d030c08abd8b0ab3d8 (patch)
tree5627cf2f221c90a9a6cd743f3f75105b2066403c /plugin
parent726f0bca0d50a86ff30a367cbdd2f31190fcd30c (diff)
Fix definition of CursorNavigation.hasCursor
An item may now have the cursor on it also if the active focus is last set on one of its non-navigable children.
Diffstat (limited to 'plugin')
-rw-r--r--plugin/cursornavigation.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/plugin/cursornavigation.cpp b/plugin/cursornavigation.cpp
index 0a09ade..418844c 100644
--- a/plugin/cursornavigation.cpp
+++ b/plugin/cursornavigation.cpp
@@ -166,9 +166,8 @@ void CursorNavigation::setCursorOnItem(CursorNavigationAttached *item)
if (item && item->acceptsCursor()) {
item->setHasCursor(true);
m_currentItem = item;
- m_currentItem->item()->forceActiveFocus();
- //m_currentItem->item()->setFocus(true);
qWarning() << "Set cursor to " << item->item();
+ m_currentItem->item()->forceActiveFocus();
} else {
qWarning() << "Set cursor to NULL";
m_currentItem = nullptr;
@@ -179,7 +178,17 @@ void CursorNavigation::setCursorOnItem(CursorNavigationAttached *item)
void CursorNavigation::onActiveFocusItemChanged()
{
qWarning() << "onActiveFocusItemChanged, item:" << m_window->activeFocusItem();
- setCursorOnItem(cursorNavigationAttachment(m_window->activeFocusItem()));
+
+ QQuickItem *item = m_window->activeFocusItem();
+ while (item) {
+ CursorNavigationAttached *cursorNavigable = cursorNavigationAttachment(item);
+ if (cursorNavigable && cursorNavigable->available()) {
+ setCursorOnItem(cursorNavigable);
+ return;
+ }
+ item = item->parentItem();
+ }
+ setCursorOnItem(nullptr);
}
void CursorNavigation::registerItem(CursorNavigationAttached* item)