reparent items when they go in a dialog

This commit is contained in:
Marco Martin 2011-02-25 22:38:03 +01:00
parent a5636902e6
commit 650e518c2e

View File

@ -83,7 +83,12 @@ QGraphicsObject *DialogProxy::mainItem() const
void DialogProxy::setMainItem(QGraphicsObject *mainItem)
{
if (m_mainItem.data() != mainItem) {
if (m_mainItem) {
m_mainItem.data()->setParent(mainItem->parent());
}
m_mainItem = mainItem;
mainItem->setParentItem(0);
mainItem->setParent(this);
//if this is called in Compenent.onCompleted we have to wait a loop the item is added to a scene
QTimer::singleShot(0, this, SLOT(syncMainItem()));