diff options
author | Antti Hölttä <AHoelttae@luxoft.com> | 2018-07-23 14:53:11 +0200 |
---|---|---|
committer | Antti Hölttä <AHoelttae@luxoft.com> | 2019-03-18 16:29:30 +0100 |
commit | ffd151ecf3971fd8601d8b1d4e2f04fb5793e364 (patch) | |
tree | cd3b947f04781d59bc61306dd34ef15f8c3a24fd /DemoApplication |
Initial commit, demoable poc
Sort of working with 4 dir navigation, check demoapp
Diffstat (limited to 'DemoApplication')
-rw-r--r-- | DemoApplication/CNButton.qml | 17 | ||||
-rw-r--r-- | DemoApplication/DemoApplication.pro | 27 | ||||
-rw-r--r-- | DemoApplication/HomeForm.qml | 14 | ||||
-rw-r--r-- | DemoApplication/Page1Form.qml | 74 | ||||
-rw-r--r-- | DemoApplication/Page2Form.qml | 14 | ||||
-rw-r--r-- | DemoApplication/main.cpp | 17 | ||||
-rw-r--r-- | DemoApplication/main.qml | 66 | ||||
-rw-r--r-- | DemoApplication/qml.qrc | 10 | ||||
-rw-r--r-- | DemoApplication/qtquickcontrols2.conf | 6 |
9 files changed, 245 insertions, 0 deletions
diff --git a/DemoApplication/CNButton.qml b/DemoApplication/CNButton.qml new file mode 100644 index 0000000..edd44cf --- /dev/null +++ b/DemoApplication/CNButton.qml @@ -0,0 +1,17 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.2 +import CursorNavigation 1.0 + +Button { + id: button + CursorNavigation.acceptsCursor: true + property bool hasCursor: CursorNavigation.hasCursor + + Rectangle { + border.width: 2 + border.color: "red" + anchors.fill: parent + visible: button.hasCursor + } + +} diff --git a/DemoApplication/DemoApplication.pro b/DemoApplication/DemoApplication.pro new file mode 100644 index 0000000..6ad5a8e --- /dev/null +++ b/DemoApplication/DemoApplication.pro @@ -0,0 +1,27 @@ +QT += quick +CONFIG += c++11 + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which as been marked deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +TARGET = demo +DESTDIR = .. + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +SOURCES += \ + main.cpp + +RESOURCES += qml.qrc + +# Additional import path used to resolve QML modules in Qt Creator's code model +QML_IMPORT_PATH = + +# Additional import path used to resolve QML modules just for Qt Quick Designer +QML_DESIGNER_IMPORT_PATH = diff --git a/DemoApplication/HomeForm.qml b/DemoApplication/HomeForm.qml new file mode 100644 index 0000000..83412a6 --- /dev/null +++ b/DemoApplication/HomeForm.qml @@ -0,0 +1,14 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.2 + +Page { + width: 600 + height: 400 + + title: qsTr("Home") + + Label { + text: qsTr("You are on the home page.") + anchors.centerIn: parent + } +} diff --git a/DemoApplication/Page1Form.qml b/DemoApplication/Page1Form.qml new file mode 100644 index 0000000..cd2007c --- /dev/null +++ b/DemoApplication/Page1Form.qml @@ -0,0 +1,74 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 + +Page { + width: 600 + height: 400 + + title: qsTr("Page 1") + + Label { + text: qsTr("You are on Page 1.") + anchors.centerIn: parent + } + + CNButton { + id: button + x: 52 + y: 50 + text: qsTr("Button") + } + + CNButton { + id: button1 + x: 110 + y: 138 + text: qsTr("Button") + } + + CNButton { + id: button2 + x: 202 + y: 241 + text: qsTr("Button") + } + + CNButton { + id: button3 + x: 383 + y: 241 + text: qsTr("Button") + } + + CNButton { + id: button4 + x: 383 + y: 322 + text: qsTr("Button") + } + + CNButton { + id: button5 + x: 383 + y: 138 + text: qsTr("Button") + } + + CNButton { + id: button6 + x: 383 + y: 50 + text: qsTr("Button") + } + + CNButton { + id: button7 + x: 62 + y: 241 + text: qsTr("Button") + } + + + +} diff --git a/DemoApplication/Page2Form.qml b/DemoApplication/Page2Form.qml new file mode 100644 index 0000000..34b9dc6 --- /dev/null +++ b/DemoApplication/Page2Form.qml @@ -0,0 +1,14 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.2 + +Page { + width: 600 + height: 400 + + title: qsTr("Page 2") + + Label { + text: qsTr("You are on Page 2.") + anchors.centerIn: parent + } +} diff --git a/DemoApplication/main.cpp b/DemoApplication/main.cpp new file mode 100644 index 0000000..0635536 --- /dev/null +++ b/DemoApplication/main.cpp @@ -0,0 +1,17 @@ +#include <QGuiApplication> +#include <QQmlApplicationEngine> + +int main(int argc, char *argv[]) +{ + QCoreApplication::addLibraryPath(QLatin1String("./plugin")); + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); + if (engine.rootObjects().isEmpty()) + return -1; + + return app.exec(); +} diff --git a/DemoApplication/main.qml b/DemoApplication/main.qml new file mode 100644 index 0000000..685e8dc --- /dev/null +++ b/DemoApplication/main.qml @@ -0,0 +1,66 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.2 +import CursorNavigation 1.0 + +ApplicationWindow { + id: window + visible: true + width: 640 + height: 480 + title: qsTr("Stack") + + header: ToolBar { + contentHeight: toolButton.implicitHeight + + ToolButton { + id: toolButton + text: stackView.depth > 1 ? "\u25C0" : "\u2630" + font.pixelSize: Qt.application.font.pixelSize * 1.6 + onClicked: { + if (stackView.depth > 1) { + stackView.pop() + } else { + drawer.open() + } + } + } + + Label { + text: stackView.currentItem.title + anchors.centerIn: parent + } + } + + Drawer { + id: drawer + width: window.width * 0.66 + height: window.height + + Column { + anchors.fill: parent + + ItemDelegate { + text: qsTr("Page 1") + width: parent.width + onClicked: { + stackView.push("Page1Form.qml") + drawer.close() + } + } + ItemDelegate { + text: qsTr("Page 2") + width: parent.width + onClicked: { + stackView.push("Page2Form.qml") + drawer.close() + } + } + } + } + + StackView { + id: stackView + initialItem: "HomeForm.qml" + anchors.fill: parent + } +} diff --git a/DemoApplication/qml.qrc b/DemoApplication/qml.qrc new file mode 100644 index 0000000..dbc7738 --- /dev/null +++ b/DemoApplication/qml.qrc @@ -0,0 +1,10 @@ +<RCC> + <qresource prefix="/"> + <file>main.qml</file> + <file>HomeForm.qml</file> + <file>Page1Form.qml</file> + <file>Page2Form.qml</file> + <file>qtquickcontrols2.conf</file> + <file>CNButton.qml</file> + </qresource> +</RCC> diff --git a/DemoApplication/qtquickcontrols2.conf b/DemoApplication/qtquickcontrols2.conf new file mode 100644 index 0000000..75b2cb8 --- /dev/null +++ b/DemoApplication/qtquickcontrols2.conf @@ -0,0 +1,6 @@ +; This file can be edited to change the style of the application +; Read "Qt Quick Controls 2 Configuration File" for details: +; http://doc.qt.io/qt-5/qtquickcontrols2-configuration.html + +[Controls] +Style=Default |