summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouie S <louie@example.com>2024-07-24 15:32:29 -0400
committerLouie S <louie@example.com>2024-07-25 17:11:29 -0400
commit1e02a8b37e2dc74e2d868e818e03e4dda39f4079 (patch)
treed4941679437ed1c786d919f5a3d891dd57397962
parent68ce496b5dd082881dde7536677f295bc40ee055 (diff)
Import values from config.h into qml engine
-rw-r--r--src/frontend/qtquick/main.cpp7
-rw-r--r--src/frontend/qtquick/main.qml2
2 files changed, 8 insertions, 1 deletions
diff --git a/src/frontend/qtquick/main.cpp b/src/frontend/qtquick/main.cpp
index c2c84fc..e1d43f7 100644
--- a/src/frontend/qtquick/main.cpp
+++ b/src/frontend/qtquick/main.cpp
@@ -1,5 +1,8 @@
#include <QGuiApplication>
#include <QQmlApplicationEngine>
+#include <QQmlContext>
+
+#include "../../../config.h"
int main(int argc, char *argv[])
{
@@ -9,6 +12,10 @@ int main(int argc, char *argv[])
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
+
+ // forward values to qml engine
+ engine.rootContext()->setContextProperty("PROJECT_TITLE", PROJECT_TITLE);
+
const QUrl url(QStringLiteral("qrc:/main.qml"));
QObject::connect(
&engine,
diff --git a/src/frontend/qtquick/main.qml b/src/frontend/qtquick/main.qml
index 18936fd..3775f2b 100644
--- a/src/frontend/qtquick/main.qml
+++ b/src/frontend/qtquick/main.qml
@@ -7,7 +7,7 @@ Window {
height: 480
visible: true
// TODO grab this from config.h
- title: qsTr("Assignment List")
+ title: PROJECT_TITLE
// DropDown for groups (including an "all" option)
Item {