summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntti Hölttä <AHoelttae@luxoft.com>2019-08-02 13:40:39 +0200
committerRobert Griebl <robert.griebl@pelagicore.com>2019-08-02 12:03:16 +0000
commit42c0fba64e946181fa7c78f5b8f718d129371a33 (patch)
tree015824e9dd71fb1c2b7f25995fce362202f2697a
parentdce52b3b94b0b6e4c546706aeb57d78af9d52fa2 (diff)
Add currentItem -method
Add currentItem -method to the attached CursorNavigation property. The method returns the QQuickItem that currently has the cursor. Change-Id: I3b43f819d915280bfab58639ccfb429fdcf818a4 Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
-rw-r--r--plugin/cursornavigationattached.cpp8
-rw-r--r--plugin/cursornavigationattached.h4
2 files changed, 11 insertions, 1 deletions
diff --git a/plugin/cursornavigationattached.cpp b/plugin/cursornavigationattached.cpp
index 6e208d5..44bcdb9 100644
--- a/plugin/cursornavigationattached.cpp
+++ b/plugin/cursornavigationattached.cpp
@@ -242,6 +242,14 @@ void CursorNavigationAttached::escape()
}
}
+QQuickItem *CursorNavigationAttached::currentItem()
+{
+ if (m_cursorNavigation && m_cursorNavigation->m_currentItem) {
+ return m_cursorNavigation->m_currentItem->item();
+ }
+ return nullptr;
+}
+
void CursorNavigationAttached::onWindowChanged(QQuickWindow *window)
{
qDebug() << "window changed, window = " << window;
diff --git a/plugin/cursornavigationattached.h b/plugin/cursornavigationattached.h
index a005d7c..ac37de3 100644
--- a/plugin/cursornavigationattached.h
+++ b/plugin/cursornavigationattached.h
@@ -107,7 +107,9 @@ public slots:
void moveForward();
void moveBack();
void escape();
-
+ /* Returns the item that currently has the cursor
+ */
+ QQuickItem *currentItem();
signals:
void acceptsCursorChanged(bool acceptsCursor);