try to restore the original parent if possible

setting a null parent to mainitems seems to screw up with their QQmlContext

the problem can be seen with the taskbar, that after fiddling with tooltips a lot, (like switching between pager and a task) it loses thumbnails and it starts to output on stderr
about ids that aren't accessible anymore.

Change-Id: Ibbb6d270fd2e20b5b6745e228f4010b74d3266c9
This commit is contained in:
Marco Martin 2014-10-03 19:55:59 +02:00
parent 7cf9fb93d8
commit ad03d0bb14

View File

@ -122,6 +122,7 @@ public:
Plasma::FrameSvgItem *frameSvgItem;
QPointer<QQuickItem> mainItem;
QPointer<QQuickItem> visualParent;
QPointer<QQuickItem> oldMainItemParent;
QTimer hintsCommitTimer;
QRect cachedGeometry;
@ -634,15 +635,14 @@ void Dialog::setMainItem(QQuickItem *mainItem)
if (d->mainItem != mainItem) {
d->hintsCommitTimer.stop();
if (d->mainItem) {
d->mainItem->setParentItem(0);
d->mainItem->setParent(parent());
d->mainItem->setParentItem(d->oldMainItemParent);
}
d->mainItem = mainItem;
if (mainItem) {
d->oldMainItemParent = mainItem->parentItem();
mainItem->setParentItem(contentItem());
mainItem->setProperty("parent", QVariant::fromValue(contentItem()));
connect(mainItem, SIGNAL(widthChanged()), this, SLOT(slotMainItemSizeChanged()));
connect(mainItem, SIGNAL(heightChanged()), this, SLOT(slotMainItemSizeChanged()));