From 0d5379dfbf43c829c52fde279dfdb32a7869031e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20H=C3=B6ltt=C3=A4?= Date: Mon, 18 Mar 2019 14:43:50 +0100 Subject: Add explanation to readme for the redirects-feature --- README.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/README.md b/README.md index 350fc6e..e11511d 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,11 @@ Set a target for moving to cursor to in case of the escape-input. QQuickItem* escapeTarget ``` +Set a list of redirects to override the navigation algorithm on certain angles and redirect the cursor to predefined items. +``` +list redirects +``` + ### Methods Just for passing forward information of intended movement, eg. analog joystick movement. Does not affect the cursor in any way. Changes are received by the item that currently has the cursor. @@ -210,4 +215,42 @@ Gamepad { ``` +### Redirecting + +Use redirects property to define cursor movement manually. + +``` +//A row of buttons, from left to right, where the cursor wraps between last and first buttons +RowLayout { + + CNButton { + id: firstButton + text: "Button 1" + + //moving left will move to the end of the row + CursorNavigation.redirects: [ + Redirect { start: 135; end: 225; target: lastButton } + ] + } + + CNButton { + text: "Button 2" + } + + CNButton { + text: "Button 3" + } + + CNButton { + id: lastButton + text: "Button 4" + + //moving right will move to the beginning of the row + CursorNavigation.redirects: [ + Redirect { start: 315; end: 45; target: firstButton } + ] + } + +} +``` -- cgit v1.2.3