Make WallpaperInterface use the suggested async object loading API
Just asks QmlObject to create an object and waits for QmlObject::finished signal to acquire it. REVIEW: 121148
This commit is contained in:
parent
7c65143e12
commit
fe0d60cfca
@ -124,6 +124,7 @@ void WallpaperInterface::syncWallpaperPackage()
|
||||
m_qmlObject = new KDeclarative::QmlObject(this);
|
||||
s_rootObjects[m_qmlObject->engine()] = this;
|
||||
m_qmlObject->setInitializationDelayed(true);
|
||||
connect(m_qmlObject, &KDeclarative::QmlObject::finished, this, &WallpaperInterface::loadFinished);
|
||||
}
|
||||
|
||||
m_actions->clear();
|
||||
@ -145,7 +146,10 @@ void WallpaperInterface::syncWallpaperPackage()
|
||||
m_qmlObject->setSource(QUrl::fromLocalFile(m_pkg.filePath("mainscript")));
|
||||
m_qmlObject->engine()->rootContext()->setContextProperty("wallpaper", this);
|
||||
m_qmlObject->completeInitialization();
|
||||
}
|
||||
|
||||
void WallpaperInterface::loadFinished()
|
||||
{
|
||||
if (m_qmlObject->mainComponent() &&
|
||||
m_qmlObject->rootObject() &&
|
||||
!m_qmlObject->mainComponent()->isError()) {
|
||||
|
@ -96,6 +96,7 @@ Q_SIGNALS:
|
||||
private Q_SLOTS:
|
||||
void syncWallpaperPackage();
|
||||
void executeAction(const QString &name);
|
||||
void loadFinished();
|
||||
|
||||
private:
|
||||
QString m_wallpaperPlugin;
|
||||
|
Loading…
Reference in New Issue
Block a user