diff options
author | Antti Hölttä <AHoelttae@luxoft.com> | 2019-01-28 14:01:49 +0100 |
---|---|---|
committer | Antti Hölttä <AHoelttae@luxoft.com> | 2019-03-18 16:42:14 +0100 |
commit | 90bac9f6ea2aea664e934116074c4db4887416f8 (patch) | |
tree | 74699e38be4ce0cc37ea707f4a029d3aade2e777 | |
parent | 9d97581eb2051dc0a038cd6f4d53fbec0f318175 (diff) |
Fixed a caption in the demo, rename files and remove unused files
-rw-r--r-- | DemoApplication/main.qml | 8 | ||||
-rw-r--r-- | DemoApplication/pages/Basics.qml (renamed from DemoApplication/pages/Page1.qml) | 2 | ||||
-rw-r--r-- | DemoApplication/pages/FlipButtons.qml (renamed from DemoApplication/pages/Page4.qml) | 0 | ||||
-rw-r--r-- | DemoApplication/pages/Lists.qml (renamed from DemoApplication/pages/Page2.qml) | 0 | ||||
-rw-r--r-- | DemoApplication/pages/MapView.qml (renamed from DemoApplication/pages/Page6.qml) | 0 | ||||
-rw-r--r-- | DemoApplication/pages/Page3.qml | 105 | ||||
-rw-r--r-- | DemoApplication/pages/Page5.qml | 178 |
7 files changed, 5 insertions, 288 deletions
diff --git a/DemoApplication/main.qml b/DemoApplication/main.qml index 7fcdf67..f149a69 100644 --- a/DemoApplication/main.qml +++ b/DemoApplication/main.qml @@ -108,10 +108,10 @@ ApplicationWindow { StackLayout { anchors.fill: parent currentIndex: tabBar.currentIndex - Page1 { } - Page2 { } - Page4 { } - Page6 { } + Basics { } + FlipButtons { } + Lists { } + MapView { } } CursorNavigation.acceptsCursor: false diff --git a/DemoApplication/pages/Page1.qml b/DemoApplication/pages/Basics.qml index 244c1a3..f43ca1b 100644 --- a/DemoApplication/pages/Page1.qml +++ b/DemoApplication/pages/Basics.qml @@ -9,7 +9,7 @@ Item { Text { id: text - text: "Welcome to the CursorNavigation demo!\nUse the arrow keys, keys a,w,s,d or a game controller to move the cursor between the UI elements." + text: "Welcome to the CursorNavigation demo!\nUse the arrow keys or a game controller to move the cursor between the UI elements." anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right diff --git a/DemoApplication/pages/Page4.qml b/DemoApplication/pages/FlipButtons.qml index c73c3d9..c73c3d9 100644 --- a/DemoApplication/pages/Page4.qml +++ b/DemoApplication/pages/FlipButtons.qml diff --git a/DemoApplication/pages/Page2.qml b/DemoApplication/pages/Lists.qml index aedbbd2..aedbbd2 100644 --- a/DemoApplication/pages/Page2.qml +++ b/DemoApplication/pages/Lists.qml diff --git a/DemoApplication/pages/Page6.qml b/DemoApplication/pages/MapView.qml index 61d09bb..61d09bb 100644 --- a/DemoApplication/pages/Page6.qml +++ b/DemoApplication/pages/MapView.qml diff --git a/DemoApplication/pages/Page3.qml b/DemoApplication/pages/Page3.qml deleted file mode 100644 index 2444f11..0000000 --- a/DemoApplication/pages/Page3.qml +++ /dev/null @@ -1,105 +0,0 @@ -import QtQuick 2.0 - -import CursorNavigation 1.0 -import controls 1.0 - -Item { - width: parent.width - height: parent.height - - FocusScope { - id: rootScope - anchors.fill: parent - Row { - anchors.centerIn: parent - spacing: 10 - CNButton { - width: 100 - height: 100 - text: "alone!" - - CursorNavigation.onMovedUp: { text = "moved up"; } - CursorNavigation.onMovedDown: { text = "moved down"; } - CursorNavigation.onMovedRight: { text = "moved right"; } - CursorNavigation.onMovedLeft: { text = "moved left"; } - CursorNavigation.onActivated: { text = "Activated"; } - } - - Grid { - columns: 2 - rows: 2 - spacing: 5 - - CNButton { - text: "b1" - } - - CNButton { - text: "b2 (default focus)" - focus: true - } - - CNButton { - id: defaultButton - text: "b3 (escape target)" - } - - CNButton { - text: "b4" - } - } - - Rectangle { - width: 250 - height: 200 - - border.width: 2 - border.color: "grey" - - FocusScope { - anchors.fill: parent - CursorNavigation.acceptsCursor: true - CursorNavigation.escapeTarget: defaultButton - CursorNavigation.trapsCursor: trapCheckBox.checked - - //redefine the controls for this scope - //(default arrow keys will still work as well, unless reassigned here) - Keys.onDigit5Pressed: { CursorNavigation.moveUp(); } - Keys.onDigit2Pressed: { CursorNavigation.moveDown(); } - Keys.onDigit3Pressed: { CursorNavigation.moveRight(); } - Keys.onDigit1Pressed: { CursorNavigation.moveLeft(); } - - Grid { - spacing: 5 - columns: 2 - rows: 3 - - CNButton { - text: "sb1" - } - - CNButton { - text: "sb2" - } - - CNButton { - text: "sb3" - } - - CNButton { - text: "sb4 (default focus)" - focus: true - } - - CNCheckBox { - id: trapCheckBox - text: "trap cursor" - } - } - } - } - } - //this seems to be the way to force focus on a newly opened dialog? - Component.onCompleted: { forceActiveFocus(); } - } -} diff --git a/DemoApplication/pages/Page5.qml b/DemoApplication/pages/Page5.qml deleted file mode 100644 index 80fba90..0000000 --- a/DemoApplication/pages/Page5.qml +++ /dev/null @@ -1,178 +0,0 @@ -import QtQuick 2.11 -import QtQuick.Controls 2.4 -import QtQuick.Layouts 1.3 - -import CursorNavigation 1.0 -import controls 1.0 - -Item { - width: parent.width - height: parent.height - - Component { - id: delegate - Text { - id: nameText - width: contentWidth - text: index - font.pixelSize: 24 - color: index%2 == 0 ? "green" : "black" - } - } - - FocusScope { - id: leftMenu - width: 199 - height: (parent.height - toolBar.height) - property string bgColor: "#800080" - Rectangle { - id: rect - anchors.fill: parent - color: leftMenu.bgColor - opacity: 0.6 - } - Column { - width: parent.width - height: 300 - anchors.verticalCenter: parent.verticalCenter - CNSwitch { - width: 180 - anchors.horizontalCenter: parent.horizontalCenter - text: "Enable 2nd player" - } - CNRadioButton { - width: 120 - anchors.horizontalCenter: parent.horizontalCenter - text: "Purple" - checked: (leftMenu.bgColor === "#800080") - onClicked: { leftMenu.bgColor = "#800080"; } - } - CNRadioButton { - width: 120 - anchors.horizontalCenter: parent.horizontalCenter - text: "Orange" - checked: (leftMenu.bgColor === "#ffa500") - onClicked: { leftMenu.bgColor = "#ffa500"; } - } - } - } - FocusScope { - width: 400 - height: parent.height - anchors.centerIn: parent - CursorNavigation.acceptsCursor: true - //TODO should this work? it didn't either this way or - //by setting just listView - CursorNavigation.escapeTarget: listViewFocusScope - //TODO it would be handy to have a way of implementing - //the moveUp/Down/Right/Left functions of the cursor manager - //as many times addtional view-specific actions need to - //be done when those are triggered - Keys.onDigit1Pressed: { pathView.decrementCurrentIndex(); } - Keys.onDigit2Pressed: { pathView.incrementCurrentIndex(); } - Rectangle { - anchors.fill: parent - border.width: 1 - border.color: pathView.CursorNavigation.hasCursor ? "red" : "transparent" - color: "transparent" - } - PathView { - id: pathView - anchors.fill: parent - model: 20 - delegate: delegate - focus: true - path: Path { - startX: 50; startY: 200 - PathArc { - x: (pathView.width - 50); y: 200 - radiusX: 100; radiusY: 90 - useLargeArc: true - } - PathArc { - x: 50; y: 200 - radiusX: 100; radiusY: 90 - useLargeArc: true - } - } - } - } - - FocusScope { - id: listViewFocusScope - width: 200 - height: ((listView.count*40)+40) - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.verticalCenterOffset: -toolBar.height - - CNListView { - id: listView - anchors.fill: parent - spacing: 4 - - delegate: CNItemDelegate { - width: listView.width - height: 40 - - contentItem: Item { - width: listView.width - height: 40 - - Row { - width: (parent.width - x) - height: 35 - x: 5 - anchors.verticalCenter: parent.verticalCenter - spacing: 10 - - Rectangle { - width: parent.height - height: parent.height - radius: width/2 - color: colorCode - } - - Text { - height: parent.height - font.bold: true - verticalAlignment: Text.AlignVCenter - text: name - } - } - } - } - - model: ListModel { - ListElement { name: "Joe"; colorCode: "grey" } - ListElement { name: "Hillary"; colorCode: "red" } - ListElement { name: "Norton"; colorCode: "blue" } - ListElement { name: "Hans"; colorCode: "green" } - ListElement { name: "Ivan"; colorCode: "green" } - ListElement { name: "Alex"; colorCode: "blue" } - ListElement { name: "Erika"; colorCode: "red" } - } - } - } - FocusScope { - width: parent.width - height: 50 - anchors.bottom: parent.bottom - ToolBar { - id: toolBar - anchors.fill: parent - RowLayout { - anchors.fill: parent - CNToolButton { text: "Menu" } - CNToolButton { text: "Undo Table" } - CNToolButton { text: "Rise Bet" } - CNToolButton { text: "Start" } - Item { Layout.fillWidth: true } - CNCheckBox { - text: "Outside bet" - Layout.alignment: Qt.AlignRight - } - } - } - } -} |