try to use a simple incubator to make loading appear smooter

This commit is contained in:
Marco Martin 2013-02-19 14:40:03 +01:00
parent 0a587eae5e
commit 82930e7226
2 changed files with 10 additions and 4 deletions

View File

@ -23,6 +23,7 @@
#include <QQmlComponent>
#include <QQmlEngine>
#include <QQmlContext>
#include <QQmlIncubator>
#include <QTimer>
#include <kdebug.h>
@ -184,7 +185,14 @@ void QmlObject::completeInitialization()
return;
}
d->root = d->component->create();
QQmlIncubator incubator;
d->component->create(incubator);
while (!incubator.isReady() && incubator.status() != QQmlIncubator::Error) {
QCoreApplication::processEvents(QEventLoop::AllEvents, 50);
}
d->root = incubator.object();
if (!d->root) {
d->errorPrint();

View File

@ -126,9 +126,7 @@ bool DeclarativeAppletScript::init()
Plasma::Applet *a = applet();
Plasma::Containment *cont = qobject_cast<Plasma::Containment *>(a);
if (cont) {
if (pc) {
m_interface = new ContainmentInterface(this);
//fail? so it's a normal Applet
} else {