Add new qmlfrontend project template
authorunc0rr
Sat, 16 Dec 2017 23:26:13 +0100
changeset 12854 28cb18c5e712
parent 12853 a9d105dc5c95
child 12855 1b2b84315d27
child 12862 4603b9916ea8
Add new qmlfrontend project template
qmlfrontend/CMakeLists.txt
qmlfrontend/Page1.qml
qmlfrontend/Page1Form.ui.qml
qmlfrontend/main.cpp
qmlfrontend/main.qml
qmlfrontend/qml.qrc
qmlfrontend/qtquickcontrols2.conf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qmlfrontend/CMakeLists.txt	Sat Dec 16 23:26:13 2017 +0100
@@ -0,0 +1,13 @@
+cmake_minimum_required(VERSION 2.8.12)
+
+project(qmlfrontend LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+
+find_package(Qt5 COMPONENTS Core Quick REQUIRED)
+
+add_executable(${PROJECT_NAME} "main.cpp" "qml.qrc")
+
+target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Quick)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qmlfrontend/Page1.qml	Sat Dec 16 23:26:13 2017 +0100
@@ -0,0 +1,7 @@
+import QtQuick 2.7
+
+Page1Form {
+  button1.onClicked: {
+    console.log("Button Pressed. Entered text: " + textField1.text);
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qmlfrontend/Page1Form.ui.qml	Sat Dec 16 23:26:13 2017 +0100
@@ -0,0 +1,24 @@
+import QtQuick 2.7
+import QtQuick.Controls 2.0
+import QtQuick.Layouts 1.3
+
+Item {
+    property alias textField1: textField1
+    property alias button1: button1
+
+    RowLayout {
+        anchors.horizontalCenter: parent.horizontalCenter
+        anchors.topMargin: 20
+        anchors.top: parent.top
+
+        TextField {
+            id: textField1
+            placeholderText: qsTr("Text Field")
+        }
+
+        Button {
+            id: button1
+            text: qsTr("Press Me")
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qmlfrontend/main.cpp	Sat Dec 16 23:26:13 2017 +0100
@@ -0,0 +1,15 @@
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+  QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+  QGuiApplication app(argc, argv);
+
+  QQmlApplicationEngine engine;
+  engine.load(QUrl(QLatin1String("qrc:/main.qml")));
+  if (engine.rootObjects().isEmpty())
+    return -1;
+
+  return app.exec();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qmlfrontend/main.qml	Sat Dec 16 23:26:13 2017 +0100
@@ -0,0 +1,37 @@
+import QtQuick 2.7
+import QtQuick.Controls 2.0
+import QtQuick.Layouts 1.3
+
+ApplicationWindow {
+  visible: true
+  width: 640
+  height: 480
+  title: qsTr("Hello World")
+
+  SwipeView {
+    id: swipeView
+    anchors.fill: parent
+    currentIndex: tabBar.currentIndex
+
+    Page1 {
+    }
+
+    Page {
+      Label {
+        text: qsTr("Second page")
+        anchors.centerIn: parent
+      }
+    }
+  }
+
+  footer: TabBar {
+    id: tabBar
+    currentIndex: swipeView.currentIndex
+    TabButton {
+      text: qsTr("First")
+    }
+    TabButton {
+      text: qsTr("Second")
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qmlfrontend/qml.qrc	Sat Dec 16 23:26:13 2017 +0100
@@ -0,0 +1,9 @@
+<!DOCTYPE RCC>
+<RCC version="1.0">
+    <qresource prefix="/">
+        <file>main.qml</file>
+        <file>Page1.qml</file>
+        <file>Page1Form.ui.qml</file>
+        <file>qtquickcontrols2.conf</file>
+    </qresource>
+</RCC>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qmlfrontend/qtquickcontrols2.conf	Sat Dec 16 23:26:13 2017 +0100
@@ -0,0 +1,15 @@
+; This file can be edited to change the style of the application
+; See Styling Qt Quick Controls 2 in the documentation for details:
+; http://doc.qt.io/qt-5/qtquickcontrols2-styles.html
+
+[Controls]
+Style=Default
+
+[Universal]
+Theme=Light
+;Accent=Steel
+
+[Material]
+Theme=Light
+;Accent=BlueGrey
+;Primary=BlueGray