]> git.basschouten.com Git - qthomecontrol.git/commitdiff
Update app to Qt 6.5 and update IP.
authorBas Schouten <bas@basschouten.com>
Mon, 14 Aug 2023 21:55:42 +0000 (23:55 +0200)
committerBas Schouten <bas@basschouten.com>
Mon, 14 Aug 2023 21:55:42 +0000 (23:55 +0200)
CMakeLists.txt
Main.qml [new file with mode: 0644]
main.cpp
main.qml [deleted file]
mqttinterface.cpp

index ff02d94715e8d985b04828925d71d27a8459ba8a..11378e0d0dbdbe2127fe15a601f0eb2b256bf58f 100644 (file)
@@ -5,7 +5,9 @@ project(qthomecontrol VERSION 0.1 LANGUAGES CXX)
 set(CMAKE_AUTOMOC ON)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 
-find_package(Qt6 6.2 COMPONENTS Quick REQUIRED)
+find_package(Qt6 6.5 COMPONENTS Quick REQUIRED)
+
+qt_standard_project_setup(REQUIRES 6.5)
 
 if (UNIX)
     add_subdirectory ("paho.mqtt.c")
@@ -20,7 +22,7 @@ qt_add_executable(appqthomecontrol
 qt_add_qml_module(appqthomecontrol
     URI qthomecontrol
     VERSION 1.0
-    QML_FILES main.qml 
+    QML_FILES Main.qml
     SOURCES
       mqttinterface.h mqttinterface.cpp
 )
diff --git a/Main.qml b/Main.qml
new file mode 100644 (file)
index 0000000..7b52a7a
--- /dev/null
+++ b/Main.qml
@@ -0,0 +1,56 @@
+import QtQuick
+import QtQuick.Controls 6.3
+import QtQuick.Layouts 6.3
+import qthomecontrol
+
+Window {
+    width: 720
+    height: 720
+    visible: true
+    color: "#000000"
+    title: qsTr("Home Control")
+
+    MQTTInterface {
+        id: mqttinterface
+    }
+
+    Slider {
+        id: slider
+        x: 13
+        y: 534
+        width: 695
+        height: 178
+        live: true
+        antialiasing: false
+        topPadding: 0
+        orientation: Qt.Horizontal
+        snapMode: RangeSlider.SnapOnRelease
+        stepSize: 1
+        to: 100
+        value: 0
+    }
+
+    Text {
+        id: text1
+        x: 206
+        y: 114
+        width: 309
+        height: 129
+        color: "#ffffff"
+        text: mqttinterface.bedroomTemperature.toFixed(1) + " °C"
+        font.pixelSize: 92
+        horizontalAlignment: Text.AlignHCenter
+    }
+
+    Text {
+        id: text2
+        x: 206
+        y: 285
+        width: 309
+        height: 129
+        color: "#ffffff"
+        text: mqttinterface.bedroomHumidity.toFixed(0) + " %"
+        font.pixelSize: 92
+        horizontalAlignment: Text.AlignHCenter
+    }
+}
index e4ddce2dfc9f8d6e15ec1b62bfcab8523c9fa068..6086143fa16f00a085cc6e2ab7626852203b0222 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -7,13 +7,10 @@ int main(int argc, char *argv[])
     QGuiApplication app(argc, argv);
 
     QQmlApplicationEngine engine;
-    const QUrl url(u"qrc:/qthomecontrol/main.qml"_qs);
-    QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
-                     &app, [url](QObject *obj, const QUrl &objUrl) {
-        if (!obj && url == objUrl)
-            QCoreApplication::exit(-1);
-    }, Qt::QueuedConnection);
-    engine.load(url);
+    QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
+        &app, []() { QCoreApplication::exit(-1); },
+        Qt::QueuedConnection);
+    engine.loadFromModule("qthomecontrol", "Main");
 
     return app.exec();
 }
diff --git a/main.qml b/main.qml
deleted file mode 100644 (file)
index b5b938d..0000000
--- a/main.qml
+++ /dev/null
@@ -1,56 +0,0 @@
-import QtQuick
-import QtQuick.Controls 6.3
-import QtQuick.Layouts 6.3
-import qthomecontrol
-
-Window {
-    width: 720
-    height: 720
-    visible: true
-    color: "#000000"
-    title: qsTr("Hello World")
-
-    MQTTInterface {
-        id: mqttinterface
-    }
-
-    Slider {
-        id: slider
-        x: 13
-        y: 534
-        width: 695
-        height: 178
-        live: true
-        antialiasing: false
-        topPadding: 0
-        orientation: Qt.Horizontal
-        snapMode: RangeSlider.SnapOnRelease
-        stepSize: 1
-        to: 100
-        value: 0
-    }
-
-    Text {
-        id: text1
-        x: 206
-        y: 114
-        width: 309
-        height: 129
-        color: "#ffffff"
-        text: mqttinterface.bedroomTemperature.toFixed(1) + " °C"
-        font.pixelSize: 92
-        horizontalAlignment: Text.AlignHCenter
-    }
-
-    Text {
-        id: text2
-        x: 206
-        y: 285
-        width: 309
-        height: 129
-        color: "#ffffff"
-        text: mqttinterface.bedroomHumidity.toFixed(0) + " %"
-        font.pixelSize: 92
-        horizontalAlignment: Text.AlignHCenter
-    }
-}
index cb8b81d6a7c074ecea5d4359fe15f23d8c981123..29588953d7ea703b6287d576ea8c2d8f16f50b51 100644 (file)
@@ -46,7 +46,7 @@ MQTTInterface::MQTTInterface(QObject *parent)
     MQTTClient_deliveryToken token;
 
     int rc;
-    MQTTClient_create(&mClient, "tcp://10.0.1.213:1883", "bedroom-thermostat-fe",
+    MQTTClient_create(&mClient, "tcp://10.0.1.225:1883", "bedroom-thermostat-fe",
       MQTTCLIENT_PERSISTENCE_NONE, NULL);
 
     if ((rc = MQTTClient_setCallbacks(mClient, this, connlost, msgarrvd, delivered)) != MQTTCLIENT_SUCCESS)