Adapt to QtConcurrent API changes in Qt6

This commit is contained in:
Volker Krause 2022-03-09 17:32:34 +01:00
parent 0143b63527
commit ce22e95d89
4 changed files with 24 additions and 0 deletions

View file

@ -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<KPluginMetaData> ScriptedEffectLoader::findAllEffects() const

View file

@ -49,9 +49,15 @@ void ScreenLockerWatcher::initialize()
this, &ScreenLockerWatcher::serviceRegisteredQueried);
connect(watcher, &QFutureWatcher<QDBusReply<bool>>::canceled,
watcher, &QFutureWatcher<QDBusReply<bool>>::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<QDBusReply<QString>>::canceled,
ownerWatcher, &QFutureWatcher<QDBusReply<QString>>::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();
}

View file

@ -140,7 +140,11 @@ void KWin::Script::run()
m_starting = true;
QFutureWatcher<QByteArray> *watcher = new QFutureWatcher<QByteArray>(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)

View file

@ -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<void> reparseConfigFuture = QtConcurrent::run(options, &Options::reparseConfiguration);
#else
QFuture<void> reparseConfigFuture = QtConcurrent::run(&Options::reparseConfiguration, options);
#endif
ApplicationMenu::create(this);