diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ded7bc..9e2d68e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,8 @@ endif() set(SRC_DIR "${PROJECT_SOURCE_DIR}/src") include(GNUInstallDirs) -find_package(Qt5 COMPONENTS Core Quick Qml Gui CONFIG REQUIRED) +find_package(QT NAMES Qt6 Qt5 COMPONENTS Core CONFIG REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Quick Qml Gui CONFIG REQUIRED) set(quickflux_PRIVATE_SOURCES ${SRC_DIR}/priv/qfhook.cpp @@ -99,9 +100,9 @@ add_library(QuickFlux::quickflux ALIAS quickflux) target_link_libraries(quickflux PUBLIC - Qt5::Qml - Qt5::Quick - Qt5::Core + Qt${QT_VERSION_MAJOR}::Qml + Qt${QT_VERSION_MAJOR}::Quick + Qt${QT_VERSION_MAJOR}::Core ) target_include_directories(quickflux diff --git a/src/priv/qfsignalproxy.cpp b/src/priv/qfsignalproxy.cpp index 011ad2d..eb97410 100644 --- a/src/priv/qfsignalproxy.cpp +++ b/src/priv/qfsignalproxy.cpp @@ -49,7 +49,11 @@ int QFSignalProxy::qt_metacall(QMetaObject::Call _c, int _id, void **_a) if (type == QMetaType::QVariant) { v = *reinterpret_cast(_a[i + 1]); } else { + #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + v = QVariant(QMetaType{type}, _a[i + 1]); + #else v = QVariant(type, _a[i + 1]); + #endif } message[parameterNames.at(i)] = v; diff --git a/src/qfstore.cpp b/src/qfstore.cpp index 582433c..311d71b 100644 --- a/src/qfstore.cpp +++ b/src/qfstore.cpp @@ -125,7 +125,11 @@ QFStore::QFStore(QObject *parent) : QObject(parent) , m_filterFunctionEnabled(fa QQmlListProperty QFStore::children() { + #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + return QQmlListProperty(qobject_cast(this), &m_children); + #else return QQmlListProperty(qobject_cast(this), m_children); + #endif } void QFStore::dispatch(QString type, QJSValue message) @@ -245,7 +249,11 @@ void QFStore::setup() QQmlListProperty QFStore::redispatchTargets() { + #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + return QQmlListProperty(qobject_cast(this), &m_redispatchTargets); + #else return QQmlListProperty(qobject_cast(this), m_redispatchTargets); + #endif }