aboutsummaryrefslogtreecommitdiffstats
path: root/plugin/cursornavigation.h
diff options
context:
space:
mode:
authorAntti Hölttä <AHoelttae@luxoft.com>2018-12-05 15:41:52 +0100
committerAntti Hölttä <AHoelttae@luxoft.com>2019-03-18 16:34:23 +0100
commit726f0bca0d50a86ff30a367cbdd2f31190fcd30c (patch)
treefd04bf5d92f2f25d317a12af5f29a47d986f6062 /plugin/cursornavigation.h
parentff7c7152388889da7d603b207e575e366873186d (diff)
Add callbacks for magnitude, moves and actions
When cursor is moved, the current item is informed of the actions via callbacks. Eg. when cursor is moved up, the item that had the cursor will have its movedUp signal fired. It is now also possible to inform navigable items over incomplete movement, or the magnitude of the movement. This may be used eg. to make buttons or elements to flip/rotate to indicate that the cursor is about to be moved.
Diffstat (limited to 'plugin/cursornavigation.h')
-rw-r--r--plugin/cursornavigation.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/plugin/cursornavigation.h b/plugin/cursornavigation.h
index f3a6f91..a32a357 100644
--- a/plugin/cursornavigation.h
+++ b/plugin/cursornavigation.h
@@ -20,13 +20,16 @@ class CursorNavigation : public QObject
public:
CursorNavigation(QQuickWindow *parent);
+ //pass input events forward to the current item
+ //void setMagnitude(qreal angle, qreal magnitude);
+ //void setMagnitude(const QVector2D& vector);
//move the cursor
- void move(qreal angle, qreal tolerance, bool discrete);
- void move(const QVector2D& vector, qreal tolerance, bool discrete);
+ bool move(qreal angle, qreal tolerance, bool discrete);
+ bool move(const QVector2D& vector, qreal tolerance, bool discrete);
//find the next item without moving the cursor
CursorNavigationAttached *find(qreal angle, qreal tolerance, bool discrete);
CursorNavigationAttached *find(const QVector2D& vector, qreal tolerance, bool discrete);
- void action(Action action);
+ bool action(Action action);
static CursorNavigationAttached *qmlAttachedProperties(QObject *object);
@@ -40,8 +43,6 @@ private:
void registerItem(CursorNavigationAttached* item);
void unregisterItem(CursorNavigationAttached* item);
- void _move(qreal angle, qreal tolerance, bool discrete);
- CursorNavigationAttached *_find(qreal angle, qreal tolerance, bool discrete);
CursorNavigationAttached *defaultItem();
private:
@@ -55,6 +56,7 @@ private:
CursorNavigationAttached *m_rootItem;
friend class CursorNavigationAttached;
+ friend class InputAdapter;
};
QML_DECLARE_TYPEINFO(CursorNavigation, QML_HAS_ATTACHED_PROPERTIES)