aboutsummaryrefslogtreecommitdiffstats
path: root/DemoApplication/pages/Page4.qml
diff options
context:
space:
mode:
Diffstat (limited to 'DemoApplication/pages/Page4.qml')
-rw-r--r--DemoApplication/pages/Page4.qml107
1 files changed, 14 insertions, 93 deletions
diff --git a/DemoApplication/pages/Page4.qml b/DemoApplication/pages/Page4.qml
index 47828dd..e111745 100644
--- a/DemoApplication/pages/Page4.qml
+++ b/DemoApplication/pages/Page4.qml
@@ -1,108 +1,29 @@
import QtQuick 2.0
import CursorNavigation 1.0
-import QtGamepad 1.0
+import QtQuick.Layouts 1.3
import "../controls"
Item {
- //CursorNavigation.acceptsCursor: true
- Timer {
- id: cooldownTimer
- interval: 500
- repeat: false
- }
+ GridLayout {
+ columns: 4
+ rows: 4
- Rectangle {
- id: pointerRect
- border.color: "orange"
- border.width: 1
- visible: false
- color: "transparent"
- }
+ anchors.fill: parent
+ anchors.centerIn: parent
- Gamepad {
- deviceId: GamepadManager.connectedGamepads.length > 0 ? GamepadManager.connectedGamepads[0] : -1
+ Repeater {
+ CNFlipButton {
+ Layout.minimumWidth: 110
+ Layout.minimumHeight: 110
+ text: "Button " + index
- function handleMove() {
- var v = Qt.vector2d(axisLeftX, axisLeftY)
- if (v.length() >= 0.99 && !cooldownTimer.running) {
- //console.log("handle joystick move, v=" + v)
- parent.CursorNavigation.move(Qt.vector2d(axisLeftX, axisLeftY), 10)
- cooldownTimer.start()
- } else if (v.length() >= 0.1) {
- parent.CursorNavigation.setMagnitude(v)
- var item = parent.CursorNavigation.find(v, 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 {
- parent.CursorNavigation.setMagnitude(0,0)
- pointerRect.visible = false
+ Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
}
- }
-
- onAxisLeftXChanged: handleMove()
- onAxisLeftYChanged: handleMove()
- }
-
- CNButton {
- id: cNButton
- x: 20
- y: 20
- }
-
- CNButton {
- id: cNButton1
- x: 20
- y: 120
- }
-
- CNButton {
- id: cNButton2
- x: 20
- y: 220
- }
- CNButton {
- id: cNButton3
- x: 150
- y: 20
- }
-
- CNButton {
- id: cNButton4
- x: 150
- y: 120
- }
-
- CNButton {
- id: cNButton5
- x: 150
- y: 220
- focus: true
- }
-
- CNButton {
- id: cNButton6
- x: 280
- y: 20
- }
-
- CNButton {
- id: cNButton7
- x: 280
- y: 120
- }
+ model: 16
+ }
- CNButton {
- id: cNButton8
- x: 280
- y: 220
}
}