aboutsummaryrefslogtreecommitdiffstats
path: root/plugin/cursornavigationattached.h
diff options
context:
space:
mode:
authorAntti Hölttä <AHoelttae@luxoft.com>2018-10-30 15:40:04 +0100
committerAntti Hölttä <AHoelttae@luxoft.com>2019-03-18 16:30:59 +0100
commit00fa5d9215d32124292fe3e45372acebac7b9d31 (patch)
tree021b35b301ae990ac9842f5ebf21d8c51db718a5 /plugin/cursornavigationattached.h
parent2f4ec044ee4c7cf14481e1e0b86fecf804fcd770 (diff)
Refactor item registration with scopes in mind
ItemRegister class removed and items now keep track of their own cursor navigable child items. Navigation happens now only between siblings.
Diffstat (limited to 'plugin/cursornavigationattached.h')
-rw-r--r--plugin/cursornavigationattached.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/plugin/cursornavigationattached.h b/plugin/cursornavigationattached.h
index 2be0f72..1a8314c 100644
--- a/plugin/cursornavigationattached.h
+++ b/plugin/cursornavigationattached.h
@@ -3,6 +3,7 @@
//#include <qqml.h>
#include <QObject>
+#include <QList>
class CursorNavigation;
class QQuickItem;
@@ -13,15 +14,17 @@ class CursorNavigationAttached : public QObject
Q_OBJECT
//is available for cursor navigation
Q_PROPERTY(bool acceptsCursor READ acceptsCursor WRITE setAcceptsCursor NOTIFY acceptsCursorChanged)
- //is available for cursor navigation
+ //indicates if item is currently selected, indicated also by activeFocus property
Q_PROPERTY(bool hasCursor READ hasCursor NOTIFY hasCursorChanged)
- //traps cursor. a trapped cursor can not be traversed outside of the item that traps it
+ //indicates if one of children is currently selected
+ Q_PROPERTY(bool childHasCursor READ hasCursor NOTIFY hasCursorChanged)
+ //traps cursor. a trapped cursor can not be traversed outside of the item that traps it until the escape input is given
Q_PROPERTY(bool trapsCursor READ trapsCursor WRITE setTrapsCursor NOTIFY trapsCursorChanged)
- //proxy cursor to other items
- //Q_PROPERTY(QQmlListProperty<QQuickItem> preferredCursorTargets READ preferredCursorTargetsQML)
+
public:
CursorNavigationAttached(QQuickItem *parent);
+ ~CursorNavigationAttached();
bool acceptsCursor() const;
void setAcceptsCursor(bool acceptsCursor);
@@ -31,6 +34,8 @@ public:
bool trapsCursor() const;
void setTrapsCursor(bool trapsCursor);
+ QQuickItem *item() const;
+
signals:
void acceptsCursorChanged(bool acceptsCursor);
void hasCursorChanged(bool hasCursor);
@@ -40,10 +45,13 @@ private slots:
void onWindowChanged(QQuickWindow *window);
private:
- QQuickItem *item() const;
void setHasCursor(bool hasCursor);
+ QList<CursorNavigationAttached*> &siblings();
CursorNavigation *m_cursorNavigation;
+ CursorNavigationAttached *m_parentNavigable;
+ QList<CursorNavigationAttached*> m_children;
+
bool m_acceptsCursor;
bool m_hasCursor;
bool m_trapsCursor;