don't double create root objects

This commit is contained in:
Marco Martin 2014-02-25 13:52:19 +01:00
parent c533153978
commit 0fdc1a71f0

View File

@ -183,7 +183,7 @@ QObject *AppletQuickItemPrivate::createFullRepresentationItem()
return fullRepresentationItem.data();
}
if (fullRepresentation) {
if (fullRepresentation && fullRepresentation.data() != qmlObject->mainComponent()) {
fullRepresentationItem = qmlObject->createObjectFromComponent(fullRepresentation.data(), QtQml::qmlContext(qmlObject->rootObject()));
} else {
fullRepresentation = qmlObject->mainComponent();
@ -191,6 +191,11 @@ QObject *AppletQuickItemPrivate::createFullRepresentationItem()
emit q->fullRepresentationChanged(fullRepresentation.data());
}
if (!fullRepresentationItem) {
return 0;
}
QQuickItem *graphicsObj = qobject_cast<QQuickItem *>(fullRepresentationItem.data());
QObject::connect (graphicsObj, &QQuickItem::widthChanged, [=]() {
fullRepresentationResizeTimer.start();
@ -435,7 +440,7 @@ Plasma::Applet *AppletQuickItem::applet() const
void AppletQuickItem::init()
{
if (AppletQuickItemPrivate::s_rootObjects.contains(this)) {
if (AppletQuickItemPrivate::s_rootObjects.contains(d->qmlObject->engine())) {
return;
}