diff options
author | Antti Hölttä <AHoelttae@luxoft.com> | 2018-11-30 14:37:49 +0100 |
---|---|---|
committer | Antti Hölttä <AHoelttae@luxoft.com> | 2019-03-18 16:33:53 +0100 |
commit | 2d45defe15ca9a94f6eba992af3d544fcd5dfb32 (patch) | |
tree | 175f11f7710f2fa01122202f85e56937b8f51f87 /DemoApplication | |
parent | 0bef07a8183c387a10620a7a1a62a065ba62148a (diff) |
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
Diffstat (limited to 'DemoApplication')
-rw-r--r-- | DemoApplication/pages/Page4.qml | 20 |
1 files changed, 20 insertions, 0 deletions
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 } } |