aboutsummaryrefslogtreecommitdiffstats
path: root/DemoApplication
diff options
context:
space:
mode:
authorAntti Hölttä <AHoelttae@luxoft.com>2018-12-19 15:14:15 +0100
committerAntti Hölttä <AHoelttae@luxoft.com>2019-03-18 16:37:19 +0100
commitb75bb90ea3ab5babff80ef70f3ae526d7f5cc278 (patch)
treedd78e72e954a152ff389f2a8f9325d9e9a138c31 /DemoApplication
parentd40b79cb1d3304f113df3091662760f585ee389e (diff)
Add dialog window to the demo program
Use 'p' key to open a dialog
Diffstat (limited to 'DemoApplication')
-rw-r--r--DemoApplication/DemoApplication.pro2
-rw-r--r--DemoApplication/controls/MessageDialog.qml39
-rw-r--r--DemoApplication/controls/qmldir1
-rw-r--r--DemoApplication/main.qml17
4 files changed, 58 insertions, 1 deletions
diff --git a/DemoApplication/DemoApplication.pro b/DemoApplication/DemoApplication.pro
index 3088011..7b2fa93 100644
--- a/DemoApplication/DemoApplication.pro
+++ b/DemoApplication/DemoApplication.pro
@@ -30,3 +30,5 @@ OTHER_FILES += $$files($$PWD/*.png, true)
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
+DISTFILES += \
+
diff --git a/DemoApplication/controls/MessageDialog.qml b/DemoApplication/controls/MessageDialog.qml
new file mode 100644
index 0000000..afb9ad7
--- /dev/null
+++ b/DemoApplication/controls/MessageDialog.qml
@@ -0,0 +1,39 @@
+import QtQuick 2.9
+import QtQuick.Controls 2.4
+import QtQuick.Window 2.12
+import QtQuick.Layouts 1.3
+import controls 1.0
+
+Window {
+ id: root
+ width: 300
+ height: 150
+
+ ColumnLayout {
+ anchors.fill: parent
+
+ Text {
+ Layout.alignment: Qt.AlignHCenter
+ text: "This is a dialog!"
+ }
+
+ Row {
+ Layout.alignment: Qt.AlignHCenter
+ CNButton {
+ text: "Yes"
+ focus: true
+ onClicked: root.close()
+ }
+ CNButton {
+ text: "Whatever"
+ onClicked: root.close()
+ }
+ CNButton {
+ text: "No"
+ onClicked: root.close()
+ }
+ }
+ }
+
+
+}
diff --git a/DemoApplication/controls/qmldir b/DemoApplication/controls/qmldir
index 554a44e..736988e 100644
--- a/DemoApplication/controls/qmldir
+++ b/DemoApplication/controls/qmldir
@@ -7,3 +7,4 @@ CNSwitch 1.0 CNSwitch.qml
CNCheckBox 1.0 CNCheckBox.qml
CNListView 1.0 CNListView.qml
CNItemDelegate 1.0 CNItemDelegate.qml
+MessageDialog 1.0 MessageDialog.qml
diff --git a/DemoApplication/main.qml b/DemoApplication/main.qml
index 57e576b..eb1e953 100644
--- a/DemoApplication/main.qml
+++ b/DemoApplication/main.qml
@@ -1,5 +1,5 @@
import QtQuick 2.9
-import QtQuick.Controls 2.2
+import QtQuick.Controls 2.4
import QtQuick.Layouts 1.3
import QtGamepad 1.0
@@ -14,6 +14,21 @@ ApplicationWindow {
visible: true
title: qsTr("Cursor Navigation Demo Application")
+ MessageDialog {
+ id: dialog
+ visible: false
+ x: window.x+window.width/2-dialog.width/2
+ y: window.y+window.height/2-dialog.height/2
+ }
+
+ Shortcut {
+ id: dialogSC
+ sequence: "p"
+ onActivated: {
+ dialog.visible = true
+ }
+ }
+
/* there are alternative ways to implement a tabbar. the traditional tabbar has
* problems with CursorNavigation: when trying to navigate the cursor on it
* right after launching the application, the cursor will not be passed onto