From ce22e95d89fce74eb02cb76d346e5d1ef51db4c9 Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Wed, 9 Mar 2022 17:32:34 +0100 Subject: [PATCH] Adapt to QtConcurrent API changes in Qt6 --- src/effectloader.cpp | 4 ++++ src/screenlockerwatcher.cpp | 12 ++++++++++++ src/scripting/scripting.cpp | 4 ++++ src/workspace.cpp | 4 ++++ 4 files changed, 24 insertions(+) diff --git a/src/effectloader.cpp b/src/effectloader.cpp index af48885cfc..de9ebc8b88 100644 --- a/src/effectloader.cpp +++ b/src/effectloader.cpp @@ -163,7 +163,11 @@ void ScriptedEffectLoader::queryAndLoadAll() m_queryConnection = QMetaObject::Connection(); }, Qt::QueuedConnection); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) watcher->setFuture(QtConcurrent::run(this, &ScriptedEffectLoader::findAllEffects)); +#else + watcher->setFuture(QtConcurrent::run(&ScriptedEffectLoader::findAllEffects, this)); +#endif } QList ScriptedEffectLoader::findAllEffects() const diff --git a/src/screenlockerwatcher.cpp b/src/screenlockerwatcher.cpp index a47f11baa7..214c19ae81 100644 --- a/src/screenlockerwatcher.cpp +++ b/src/screenlockerwatcher.cpp @@ -49,9 +49,15 @@ void ScreenLockerWatcher::initialize() this, &ScreenLockerWatcher::serviceRegisteredQueried); connect(watcher, &QFutureWatcher>::canceled, watcher, &QFutureWatcher>::deleteLater); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) watcher->setFuture(QtConcurrent::run(QDBusConnection::sessionBus().interface(), &QDBusConnectionInterface::isServiceRegistered, SCREEN_LOCKER_SERVICE_NAME)); +#else + watcher->setFuture(QtConcurrent::run(&QDBusConnectionInterface::isServiceRegistered, + QDBusConnection::sessionBus().interface(), + SCREEN_LOCKER_SERVICE_NAME)); +#endif } void ScreenLockerWatcher::serviceOwnerChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner) @@ -91,9 +97,15 @@ void ScreenLockerWatcher::serviceRegisteredQueried() this, &ScreenLockerWatcher::serviceOwnerQueried); connect(ownerWatcher, &QFutureWatcher>::canceled, ownerWatcher, &QFutureWatcher>::deleteLater); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) ownerWatcher->setFuture(QtConcurrent::run(QDBusConnection::sessionBus().interface(), &QDBusConnectionInterface::serviceOwner, SCREEN_LOCKER_SERVICE_NAME)); +#else + ownerWatcher->setFuture(QtConcurrent::run(&QDBusConnectionInterface::serviceOwner, + QDBusConnection::sessionBus().interface(), + SCREEN_LOCKER_SERVICE_NAME)); +#endif } watcher->deleteLater(); } diff --git a/src/scripting/scripting.cpp b/src/scripting/scripting.cpp index 39f3247b49..aa51eb7c6d 100644 --- a/src/scripting/scripting.cpp +++ b/src/scripting/scripting.cpp @@ -140,7 +140,11 @@ void KWin::Script::run() m_starting = true; QFutureWatcher *watcher = new QFutureWatcher(this); connect(watcher, &QFutureWatcherBase::finished, this, &Script::slotScriptLoadedFromFile); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) watcher->setFuture(QtConcurrent::run(this, &KWin::Script::loadScriptFromFile, fileName())); +#else + watcher->setFuture(QtConcurrent::run(&KWin::Script::loadScriptFromFile, this, fileName())); +#endif } QByteArray KWin::Script::loadScriptFromFile(const QString &fileName) diff --git a/src/workspace.cpp b/src/workspace.cpp index 9dba615e27..8d2eeadb5a 100644 --- a/src/workspace.cpp +++ b/src/workspace.cpp @@ -129,7 +129,11 @@ Workspace::Workspace() , m_sessionManager(new SessionManager(this)) { // If KWin was already running it saved its configuration after loosing the selection -> Reread +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) QFuture reparseConfigFuture = QtConcurrent::run(options, &Options::reparseConfiguration); +#else + QFuture reparseConfigFuture = QtConcurrent::run(&Options::reparseConfiguration, options); +#endif ApplicationMenu::create(this);