reparent items when they go in a dialog
This commit is contained in:
parent
a5636902e6
commit
650e518c2e
@ -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()));
|
||||
|
Loading…
Reference in New Issue
Block a user