From ffd151ecf3971fd8601d8b1d4e2f04fb5793e364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20H=C3=B6ltt=C3=A4?= Date: Mon, 23 Jul 2018 14:53:11 +0200 Subject: Initial commit, demoable poc Sort of working with 4 dir navigation, check demoapp --- DemoApplication/CNButton.qml | 17 ++++++++ DemoApplication/DemoApplication.pro | 27 +++++++++++++ DemoApplication/HomeForm.qml | 14 +++++++ DemoApplication/Page1Form.qml | 74 +++++++++++++++++++++++++++++++++++ DemoApplication/Page2Form.qml | 14 +++++++ DemoApplication/main.cpp | 17 ++++++++ DemoApplication/main.qml | 66 +++++++++++++++++++++++++++++++ DemoApplication/qml.qrc | 10 +++++ DemoApplication/qtquickcontrols2.conf | 6 +++ 9 files changed, 245 insertions(+) create mode 100644 DemoApplication/CNButton.qml create mode 100644 DemoApplication/DemoApplication.pro create mode 100644 DemoApplication/HomeForm.qml create mode 100644 DemoApplication/Page1Form.qml create mode 100644 DemoApplication/Page2Form.qml create mode 100644 DemoApplication/main.cpp create mode 100644 DemoApplication/main.qml create mode 100644 DemoApplication/qml.qrc create mode 100644 DemoApplication/qtquickcontrols2.conf (limited to 'DemoApplication') 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 +#include + +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 @@ + + + main.qml + HomeForm.qml + Page1Form.qml + Page2Form.qml + qtquickcontrols2.conf + CNButton.qml + + 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 -- cgit v1.2.3