Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Support for QT6 #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/priv/qfsignalproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ int QFSignalProxy::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
if (type == QMetaType::QVariant) {
v = *reinterpret_cast<QVariant *>(_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;
Expand Down
8 changes: 8 additions & 0 deletions src/qfstore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ QFStore::QFStore(QObject *parent) : QObject(parent) , m_filterFunctionEnabled(fa

QQmlListProperty<QObject> QFStore::children()
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return QQmlListProperty<QObject>(qobject_cast<QObject*>(this), &m_children);
#else
return QQmlListProperty<QObject>(qobject_cast<QObject*>(this), m_children);
#endif
}

void QFStore::dispatch(QString type, QJSValue message)
Expand Down Expand Up @@ -245,7 +249,11 @@ void QFStore::setup()

QQmlListProperty<QObject> QFStore::redispatchTargets()
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return QQmlListProperty<QObject>(qobject_cast<QObject*>(this), &m_redispatchTargets);
#else
return QQmlListProperty<QObject>(qobject_cast<QObject*>(this), m_redispatchTargets);
#endif
}


Expand Down