commit f2f55a2830741b274fc5f844b036f71e31443eeb Author: Denis V. Dedkov Date: Tue Jul 10 20:57:11 2018 +0200 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fab7372 --- /dev/null +++ b/.gitignore @@ -0,0 +1,73 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + diff --git a/HomeForm.qml b/HomeForm.qml new file mode 100644 index 0000000..29d484b --- /dev/null +++ b/HomeForm.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Page { + title: qsTr("Home") + + Label { + text: qsTr("You are on the home page.") + anchors.centerIn: parent + } +} diff --git a/MenuBackButton.qml b/MenuBackButton.qml new file mode 100644 index 0000000..fbce40d --- /dev/null +++ b/MenuBackButton.qml @@ -0,0 +1,69 @@ +import QtQuick 2.0 + +Item { + id: root + signal clicked() + signal back() + + MouseArea { + id: ma + + anchors.fill: parent + anchors.margins: -8 + } + + Rectangle { + id: bar1 + x: 0 + y: root.height / 6 + width: root.height + height: root.height / 9 + antialiasing: true + } + + Rectangle { + id: bar2 + x: 0 + y: root.height / 2 - height / 2 + width: root.height + height: root.height / 9 + antialiasing: true + } + + Rectangle { + id: bar3 + x: 0 + y: root.height / 2 + height * 2 + width: root.height + height: root.height / 9 + antialiasing: true + } + + property int animationDuration: 450 + + state: "menu" + states: [ + State { + name: "menu" + PropertyChanges { target: ma; onClicked: root.clicked() } + }, + + State { + name: "back" + PropertyChanges { target: root; rotation: 180 } + PropertyChanges { target: bar1; rotation: 45; width: root.height / 3 * 2; x: root.height / 2; y: root.height / 4 } + PropertyChanges { target: bar2; width: root.height / 6 * 5 + 1; x: root.height / 9 } + PropertyChanges { target: bar3; rotation: -45; width: root.height / 3 * 2; x: root.height / 2; y: root.height / 3 * 2 } + PropertyChanges { target: ma; onClicked: root.back() } + } + ] + + transitions: [ + Transition { + RotationAnimation { target: root; direction: RotationAnimation.Clockwise; duration: animationDuration; easing.type: Easing.InOutQuad } + PropertyAnimation { target: bar1; properties: "rotation, width, x, y"; duration: animationDuration; easing.type: Easing.InOutQuad } + PropertyAnimation { target: bar2; properties: "rotation, width, x, y"; duration: animationDuration; easing.type: Easing.InOutQuad } + PropertyAnimation { target: bar3; properties: "rotation, width, x, y"; duration: animationDuration; easing.type: Easing.InOutQuad } + } + ] +} diff --git a/SettingsForm.qml b/SettingsForm.qml new file mode 100644 index 0000000..ee384c9 --- /dev/null +++ b/SettingsForm.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.2 + +Page { + title: qsTr("Settings") + + Label { + text: qsTr("You are on Settings Page") + anchors.centerIn: parent + } +} diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..6333b85 --- /dev/null +++ b/main.cpp @@ -0,0 +1,16 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + 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/main.qml b/main.qml new file mode 100644 index 0000000..392db4a --- /dev/null +++ b/main.qml @@ -0,0 +1,69 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.2 + +ApplicationWindow { + id: window + visible: true + width: 640 + height: 480 + title: qsTr("Stack") + + header: ToolBar { + contentHeight: 36 + + MenuBackButton { + id: menuButton + + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 8 + + width: 24 + height: 24 + + state: stackView.depth > 1 ? "back" : "menu" + + onClicked: { + drawer.open() + } + + onBack: { + stackView.pop() + } + } + + 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("Settings") + width: parent.width + onClicked: { + if (stackView.depth > 1) { + stackView.pop() + } + + stackView.push("SettingsForm.qml") + drawer.close() + } + } + } + } + + StackView { + id: stackView + initialItem: "HomeForm.qml" + anchors.fill: parent + } +} diff --git a/nooLight.pro b/nooLight.pro new file mode 100644 index 0000000..e2173bc --- /dev/null +++ b/nooLight.pro @@ -0,0 +1,28 @@ +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 + +# 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 = + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target diff --git a/qml.qrc b/qml.qrc new file mode 100644 index 0000000..fc6eab0 --- /dev/null +++ b/qml.qrc @@ -0,0 +1,9 @@ + + + main.qml + qtquickcontrols2.conf + HomeForm.qml + SettingsForm.qml + MenuBackButton.qml + + diff --git a/qtquickcontrols2.conf b/qtquickcontrols2.conf new file mode 100644 index 0000000..b39affe --- /dev/null +++ b/qtquickcontrols2.conf @@ -0,0 +1,12 @@ +; 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=Universal + +[Universal] +Theme=Dark +;Accent=Steel +;Foreground=Brown +;Background=Steel