don't double create root objects
This commit is contained in:
parent
c533153978
commit
0fdc1a71f0
@ -183,7 +183,7 @@ QObject *AppletQuickItemPrivate::createFullRepresentationItem()
|
|||||||
return fullRepresentationItem.data();
|
return fullRepresentationItem.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fullRepresentation) {
|
if (fullRepresentation && fullRepresentation.data() != qmlObject->mainComponent()) {
|
||||||
fullRepresentationItem = qmlObject->createObjectFromComponent(fullRepresentation.data(), QtQml::qmlContext(qmlObject->rootObject()));
|
fullRepresentationItem = qmlObject->createObjectFromComponent(fullRepresentation.data(), QtQml::qmlContext(qmlObject->rootObject()));
|
||||||
} else {
|
} else {
|
||||||
fullRepresentation = qmlObject->mainComponent();
|
fullRepresentation = qmlObject->mainComponent();
|
||||||
@ -191,6 +191,11 @@ QObject *AppletQuickItemPrivate::createFullRepresentationItem()
|
|||||||
emit q->fullRepresentationChanged(fullRepresentation.data());
|
emit q->fullRepresentationChanged(fullRepresentation.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!fullRepresentationItem) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
QQuickItem *graphicsObj = qobject_cast<QQuickItem *>(fullRepresentationItem.data());
|
QQuickItem *graphicsObj = qobject_cast<QQuickItem *>(fullRepresentationItem.data());
|
||||||
QObject::connect (graphicsObj, &QQuickItem::widthChanged, [=]() {
|
QObject::connect (graphicsObj, &QQuickItem::widthChanged, [=]() {
|
||||||
fullRepresentationResizeTimer.start();
|
fullRepresentationResizeTimer.start();
|
||||||
@ -435,7 +440,7 @@ Plasma::Applet *AppletQuickItem::applet() const
|
|||||||
|
|
||||||
void AppletQuickItem::init()
|
void AppletQuickItem::init()
|
||||||
{
|
{
|
||||||
if (AppletQuickItemPrivate::s_rootObjects.contains(this)) {
|
if (AppletQuickItemPrivate::s_rootObjects.contains(d->qmlObject->engine())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user