# HG changeset patch # User unc0rr # Date 1513463173 -3600 # Node ID 28cb18c5e7120d7afdc1530749a948aa114c1982 # Parent a9d105dc5c957fafc52cb02e364bb4fbfb5018fd Add new qmlfrontend project template diff -r a9d105dc5c95 -r 28cb18c5e712 qmlfrontend/CMakeLists.txt --- /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) diff -r a9d105dc5c95 -r 28cb18c5e712 qmlfrontend/Page1.qml --- /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); + } +} diff -r a9d105dc5c95 -r 28cb18c5e712 qmlfrontend/Page1Form.ui.qml --- /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") + } + } +} diff -r a9d105dc5c95 -r 28cb18c5e712 qmlfrontend/main.cpp --- /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 +#include + +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(); +} diff -r a9d105dc5c95 -r 28cb18c5e712 qmlfrontend/main.qml --- /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") + } + } +} diff -r a9d105dc5c95 -r 28cb18c5e712 qmlfrontend/qml.qrc --- /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 @@ + + + + main.qml + Page1.qml + Page1Form.ui.qml + qtquickcontrols2.conf + + diff -r a9d105dc5c95 -r 28cb18c5e712 qmlfrontend/qtquickcontrols2.conf --- /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