From 55eae851b6f4f1cfd69673da5fb37189213106de Mon Sep 17 00:00:00 2001 From: Tal Lancaster Date: Tue, 17 Jan 2017 13:03:45 -0700 Subject: [PATCH] Intial commit for files --- CMakeLists.txt | 22 ++++++++++++++++++++++ main.cpp | 19 +++++++++++++++++++ qml/hw.qml | 16 ++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 main.cpp create mode 100644 qml/hw.qml diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..55719af --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,22 @@ +# sets the PROJECT_NAME variable +project(qmlApp) + +cmake_minimum_required(VERSION 3.0) + +set(CMAKE_AUTOMOC ON) + +find_package(Qt5 COMPONENTS Widgets Qml Quick REQUIRED) + +set(SRC_LIST main.cpp) + +# add an executable based on the project name and source list +add_executable(${PROJECT_NAME} ${SRC_LIST}) + +# links Qt5Core to the project executable +target_link_libraries(${PROJECT_NAME} Qt5::Widgets Qt5::Qml Qt5::Quick) + +add_custom_target(copyQmlFiles ALL + DEPENDS ${PROJECT} ${CMAKE_SOURCE_DIR}/qml + COMMAND cmake -E copy_directory ${CMAKE_SOURCE_DIR}/qml ${CMAKE_BINARY_DIR}/qml +) + diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..34d4d3c --- /dev/null +++ b/main.cpp @@ -0,0 +1,19 @@ + +#include +#include +#include + + +int main (int argc, char* argv[]) +{ + + QGuiApplication q_app (argc, argv); + + // Using QQuickView + QQuickView view; + view.setSource(QUrl::fromLocalFile("qml/hw.qml")); + view.show(); + + return q_app.exec (); +} + diff --git a/qml/hw.qml b/qml/hw.qml new file mode 100644 index 0000000..695810e --- /dev/null +++ b/qml/hw.qml @@ -0,0 +1,16 @@ +import QtQuick 2.0 + +Rectangle { + id: page + width: 320; height: 480 + color: "lightgray" + + Text { + id: helloText + text: "Hello world!" + y: 30 + anchors.horizontalCenter: page.horizontalCenter + font.pointSize: 24; font.bold: true + } +} +