summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOrangerot <purple@orangerot.dev>2024-07-26 17:49:18 +0200
committerOrangerot <purple@orangerot.dev>2024-07-26 17:49:18 +0200
commita5ba031c9dfc830d3fe44e868c5fd26af2fbb225 (patch)
tree7142f49c4cbfaa607a42530e67918c120bc071c8
parentf039734dddd1262909219ed14d9bf07e4d35ff81 (diff)
feat(qt): simple qt qml application
-rw-r--r--.gitignore1
-rw-r--r--CMakeLists.txt4
-rw-r--r--application.qml13
-rw-r--r--main.cpp21
4 files changed, 35 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..567609b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+build/
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b592c39..08e7297 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,3 +4,7 @@ project(itat_challange_olympics)
set(CMAKE_CXX_STANDARD 17)
add_executable(itat_challange_olympics main.cpp)
+
+find_package(Qt6 REQUIRED COMPONENTS Quick)
+target_link_libraries(itat_challange_olympics PRIVATE Qt6::Quick)
+
diff --git a/application.qml b/application.qml
new file mode 100644
index 0000000..38da5d6
--- /dev/null
+++ b/application.qml
@@ -0,0 +1,13 @@
+import QtQuick
+import QtQuick.Controls
+
+ApplicationWindow {
+ width: 400
+ height: 400
+ visible: true
+
+ Button {
+ id: button
+ text: "A Special Button"
+ }
+}
diff --git a/main.cpp b/main.cpp
index bc8f460..4796716 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,6 +1,19 @@
-#include <iostream>
+#include <QGuiApplication>
+#include <QQmlEngine>
+#include <QQmlContext>
+#include <QQmlComponent>
-int main() {
- std::cout << "Hello, World!" << std::endl;
- return 0;
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QQmlEngine engine;
+ QQmlContext *objectContext = new QQmlContext(engine.rootContext());
+
+ QQmlComponent component(&engine, "application.qml");
+ QObject *object = component.create(objectContext);
+
+ // ... delete object and objectContext when necessary
+
+ return app.exec();
}