From 2d45defe15ca9a94f6eba992af3d544fcd5dfb32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20H=C3=B6ltt=C3=A4?= Date: Fri, 30 Nov 2018 14:37:49 +0100 Subject: Add find-function find-function is similar to the move, but instead of moving the cursor, it returns the item that cursor would move to if move was called with the same arguments --- DemoApplication/pages/Page4.qml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'DemoApplication') diff --git a/DemoApplication/pages/Page4.qml b/DemoApplication/pages/Page4.qml index cc74876..a77ce7b 100644 --- a/DemoApplication/pages/Page4.qml +++ b/DemoApplication/pages/Page4.qml @@ -12,6 +12,14 @@ Item { repeat: false } + Rectangle { + id: pointerRect + border.color: "orange" + border.width: 1 + visible: false + color: "transparent" + } + Gamepad { deviceId: GamepadManager.connectedGamepads.length > 0 ? GamepadManager.connectedGamepads[0] : -1 @@ -21,6 +29,18 @@ Item { //console.log("handle joystick move, v=" + v) parent.CursorNavigation.move(Qt.vector2d(axisLeftX, axisLeftY), 10) cooldownTimer.start() + } else if (v.length() >= 0.1) { + var item = parent.CursorNavigation.find(Qt.vector2d(axisLeftX, axisLeftY), 10) + //cooldownTimer.start() + if (item != undefined) { + pointerRect.x = item.x + pointerRect.y = item.y + pointerRect.width = item.width + pointerRect.height = item.height + pointerRect.visible = true + } + } else { + pointerRect.visible = false } } -- cgit v1.2.3