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(); m_queryConnection = QMetaObject::Connection();
}, },
Qt::QueuedConnection); Qt::QueuedConnection);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
watcher->setFuture(QtConcurrent::run(this, &ScriptedEffectLoader::findAllEffects)); watcher->setFuture(QtConcurrent::run(this, &ScriptedEffectLoader::findAllEffects));
#else
watcher->setFuture(QtConcurrent::run(&ScriptedEffectLoader::findAllEffects, this));
#endif
} }
QList<KPluginMetaData> ScriptedEffectLoader::findAllEffects() const QList<KPluginMetaData> ScriptedEffectLoader::findAllEffects() const

View file

@ -49,9 +49,15 @@ void ScreenLockerWatcher::initialize()
this, &ScreenLockerWatcher::serviceRegisteredQueried); this, &ScreenLockerWatcher::serviceRegisteredQueried);
connect(watcher, &QFutureWatcher<QDBusReply<bool>>::canceled, connect(watcher, &QFutureWatcher<QDBusReply<bool>>::canceled,
watcher, &QFutureWatcher<QDBusReply<bool>>::deleteLater); watcher, &QFutureWatcher<QDBusReply<bool>>::deleteLater);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
watcher->setFuture(QtConcurrent::run(QDBusConnection::sessionBus().interface(), watcher->setFuture(QtConcurrent::run(QDBusConnection::sessionBus().interface(),
&QDBusConnectionInterface::isServiceRegistered, &QDBusConnectionInterface::isServiceRegistered,
SCREEN_LOCKER_SERVICE_NAME)); 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) void ScreenLockerWatcher::serviceOwnerChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner)
@ -91,9 +97,15 @@ void ScreenLockerWatcher::serviceRegisteredQueried()
this, &ScreenLockerWatcher::serviceOwnerQueried); this, &ScreenLockerWatcher::serviceOwnerQueried);
connect(ownerWatcher, &QFutureWatcher<QDBusReply<QString>>::canceled, connect(ownerWatcher, &QFutureWatcher<QDBusReply<QString>>::canceled,
ownerWatcher, &QFutureWatcher<QDBusReply<QString>>::deleteLater); ownerWatcher, &QFutureWatcher<QDBusReply<QString>>::deleteLater);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
ownerWatcher->setFuture(QtConcurrent::run(QDBusConnection::sessionBus().interface(), ownerWatcher->setFuture(QtConcurrent::run(QDBusConnection::sessionBus().interface(),
&QDBusConnectionInterface::serviceOwner, &QDBusConnectionInterface::serviceOwner,
SCREEN_LOCKER_SERVICE_NAME)); SCREEN_LOCKER_SERVICE_NAME));
#else
ownerWatcher->setFuture(QtConcurrent::run(&QDBusConnectionInterface::serviceOwner,
QDBusConnection::sessionBus().interface(),
SCREEN_LOCKER_SERVICE_NAME));
#endif
} }
watcher->deleteLater(); watcher->deleteLater();
} }

View file

@ -140,7 +140,11 @@ void KWin::Script::run()
m_starting = true; m_starting = true;
QFutureWatcher<QByteArray> *watcher = new QFutureWatcher<QByteArray>(this); QFutureWatcher<QByteArray> *watcher = new QFutureWatcher<QByteArray>(this);
connect(watcher, &QFutureWatcherBase::finished, this, &Script::slotScriptLoadedFromFile); 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())); 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) QByteArray KWin::Script::loadScriptFromFile(const QString &fileName)

View file

@ -129,7 +129,11 @@ Workspace::Workspace()
, m_sessionManager(new SessionManager(this)) , m_sessionManager(new SessionManager(this))
{ {
// If KWin was already running it saved its configuration after loosing the selection -> Reread // 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); QFuture<void> reparseConfigFuture = QtConcurrent::run(options, &Options::reparseConfiguration);
#else
QFuture<void> reparseConfigFuture = QtConcurrent::run(&Options::reparseConfiguration, options);
#endif
ApplicationMenu::create(this); ApplicationMenu::create(this);