Adapt to QQmlListProperty API changes in Qt6

This commit is contained in:
Volker Krause 2022-03-09 17:41:37 +01:00
parent 9253c06105
commit cd74345652
2 changed files with 13 additions and 0 deletions

View file

@ -397,13 +397,21 @@ QQmlListProperty<KWin::AbstractClient> DeclarativeScriptWorkspaceWrapper::client
return QQmlListProperty<KWin::AbstractClient>(this, nullptr, &DeclarativeScriptWorkspaceWrapper::countClientList, &DeclarativeScriptWorkspaceWrapper::atClientList);
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
int DeclarativeScriptWorkspaceWrapper::countClientList(QQmlListProperty<KWin::AbstractClient> *clients)
#else
qsizetype DeclarativeScriptWorkspaceWrapper::countClientList(QQmlListProperty<KWin::AbstractClient> *clients)
#endif
{
Q_UNUSED(clients)
return workspace()->allClientList().size();
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
KWin::AbstractClient *DeclarativeScriptWorkspaceWrapper::atClientList(QQmlListProperty<KWin::AbstractClient> *clients, int index)
#else
KWin::AbstractClient *DeclarativeScriptWorkspaceWrapper::atClientList(QQmlListProperty<KWin::AbstractClient> *clients, qsizetype index)
#endif
{
Q_UNUSED(clients)
return workspace()->allClientList().at(index);

View file

@ -429,8 +429,13 @@ class DeclarativeScriptWorkspaceWrapper : public WorkspaceWrapper
Q_PROPERTY(QQmlListProperty<KWin::AbstractClient> clients READ clients)
public:
QQmlListProperty<KWin::AbstractClient> clients();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
static int countClientList(QQmlListProperty<KWin::AbstractClient> *clients);
static KWin::AbstractClient *atClientList(QQmlListProperty<KWin::AbstractClient> *clients, int index);
#else
static qsizetype countClientList(QQmlListProperty<KWin::AbstractClient> *clients);
static KWin::AbstractClient *atClientList(QQmlListProperty<KWin::AbstractClient> *clients, qsizetype index);
#endif
explicit DeclarativeScriptWorkspaceWrapper(QObject* parent = nullptr);
};