From cd74345652599acf17d284e24fb738ae00c8e74d Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Wed, 9 Mar 2022 17:41:37 +0100 Subject: [PATCH] Adapt to QQmlListProperty API changes in Qt6 --- src/scripting/workspace_wrapper.cpp | 8 ++++++++ src/scripting/workspace_wrapper.h | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/src/scripting/workspace_wrapper.cpp b/src/scripting/workspace_wrapper.cpp index e54977a6ed..9544fa3981 100644 --- a/src/scripting/workspace_wrapper.cpp +++ b/src/scripting/workspace_wrapper.cpp @@ -397,13 +397,21 @@ QQmlListProperty DeclarativeScriptWorkspaceWrapper::client return QQmlListProperty(this, nullptr, &DeclarativeScriptWorkspaceWrapper::countClientList, &DeclarativeScriptWorkspaceWrapper::atClientList); } +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) int DeclarativeScriptWorkspaceWrapper::countClientList(QQmlListProperty *clients) +#else +qsizetype DeclarativeScriptWorkspaceWrapper::countClientList(QQmlListProperty *clients) +#endif { Q_UNUSED(clients) return workspace()->allClientList().size(); } +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) KWin::AbstractClient *DeclarativeScriptWorkspaceWrapper::atClientList(QQmlListProperty *clients, int index) +#else +KWin::AbstractClient *DeclarativeScriptWorkspaceWrapper::atClientList(QQmlListProperty *clients, qsizetype index) +#endif { Q_UNUSED(clients) return workspace()->allClientList().at(index); diff --git a/src/scripting/workspace_wrapper.h b/src/scripting/workspace_wrapper.h index f85eeffb4f..6b8521cbc6 100644 --- a/src/scripting/workspace_wrapper.h +++ b/src/scripting/workspace_wrapper.h @@ -429,8 +429,13 @@ class DeclarativeScriptWorkspaceWrapper : public WorkspaceWrapper Q_PROPERTY(QQmlListProperty clients READ clients) public: QQmlListProperty clients(); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) static int countClientList(QQmlListProperty *clients); static KWin::AbstractClient *atClientList(QQmlListProperty *clients, int index); +#else + static qsizetype countClientList(QQmlListProperty *clients); + static KWin::AbstractClient *atClientList(QQmlListProperty *clients, qsizetype index); +#endif explicit DeclarativeScriptWorkspaceWrapper(QObject* parent = nullptr); };