From 2f0077a5d1bf4da60874254c0f8edcedf9c23c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Thu, 7 Aug 2025 14:28:08 +0200 Subject: [PATCH] Add compat --- debian-qt6/control | 3 ++- libnymea-core/ruleengine/stateevaluator.cpp | 12 ++++++------ libnymea/integrations/plugin.pri | 17 +++++++++++++++-- libnymea/typeutils.h | 3 +++ 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/debian-qt6/control b/debian-qt6/control index 7f918d9e..0f43d358 100644 --- a/debian-qt6/control +++ b/debian-qt6/control @@ -14,6 +14,7 @@ Build-Depends: debhelper, libnymea-zigbee-dev (>= 0.1.0), libnymea-gpio-dev, libpython3-dev, + qtchooser, qt6-base-dev, qt6-base-dev-tools, qt6-websockets-dev, @@ -21,8 +22,8 @@ Build-Depends: debhelper, qt6-declarative-dev, qt6-serialport-dev, qt6-serialbus-dev, + qt6-5compat-dev, qml6-module-qtquick, - qtchooser, libqt6bluetooth6, libqt6sql6-sqlite, libqt6dbus6 | libqt6dbus6t64, diff --git a/libnymea-core/ruleengine/stateevaluator.cpp b/libnymea-core/ruleengine/stateevaluator.cpp index e2fbe8b3..53f34b02 100644 --- a/libnymea-core/ruleengine/stateevaluator.cpp +++ b/libnymea-core/ruleengine/stateevaluator.cpp @@ -431,17 +431,17 @@ bool StateEvaluator::evaluateDescriptor(const StateDescriptor &descriptor) const switch (descriptor.operatorType()) { case Types::ValueOperatorEquals: - return state.value() == convertedValue; + return state.value() == descriptorValue; case Types::ValueOperatorGreater: - return state.value() > convertedValue; + return state.value() > descriptorValue; case Types::ValueOperatorGreaterOrEqual: - return state.value() >= convertedValue; + return state.value() >= descriptorValue; case Types::ValueOperatorLess: - return state.value() < convertedValue; + return state.value() < descriptorValue; case Types::ValueOperatorLessOrEqual: - return state.value() <= convertedValue; + return state.value() <= descriptorValue; case Types::ValueOperatorNotEquals: - return state.value() != convertedValue; + return state.value() != descriptorValue; } #endif } else if (!descriptor.valueThingId().isNull() && !descriptor.valueStateTypeId().isNull()) { diff --git a/libnymea/integrations/plugin.pri b/libnymea/integrations/plugin.pri index b6f6bbb8..c348a4c8 100644 --- a/libnymea/integrations/plugin.pri +++ b/libnymea/integrations/plugin.pri @@ -31,8 +31,21 @@ CONFIG += plugin link_pkgconfig PKGCONFIG += nymea -QMAKE_CXXFLAGS *= -Werror -std=c++11 -g -Wno-deprecated-declarations -QMAKE_LFLAGS *= -std=c++11 -z defs +greaterThan(QT_MAJOR_VERSION, 5) { + message("Building using Qt6 support") + CONFIG *= c++17 + QMAKE_LFLAGS *= -std=c++17 + QMAKE_CXXFLAGS *= -std=c++17 +} else { + message("Building using Qt5 support") + CONFIG *= c++11 + QMAKE_LFLAGS *= -std=c++11 + QMAKE_CXXFLAGS *= -std=c++11 + DEFINES += QT_DISABLE_DEPRECATED_UP_TO=0x050F00 +} + +QMAKE_CXXFLAGS *= -Werror -g -Wno-deprecated-declarations +QMAKE_LFLAGS *= -z defs JSONFILE=$${_PRO_FILE_PWD_}/integrationplugin"$$TARGET".json diff --git a/libnymea/typeutils.h b/libnymea/typeutils.h index 68db41ff..d535b5ea 100644 --- a/libnymea/typeutils.h +++ b/libnymea/typeutils.h @@ -41,6 +41,9 @@ #include +// Note: do not overload the == operator, we just want a QUuid comparison with QUuid +// ISO C++ says that these are ambiguous, even though the worst conversion for +// the first is better than the worst conversion for the second #define DECLARE_TYPE_ID(type) class type##Id: public QUuid \ { \ public: \