diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp index 1267def60bd..42ebab0f46b 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp @@ -194,23 +194,21 @@ void FormEditorView::removeNodeFromScene(const QmlItemNode &qmlItemNode) QList removedItemList; if (qmlItemNode.isValid()) { - QList nodeList; - nodeList.append(qmlItemNode.allSubModelNodes()); + QList nodeList = qmlItemNode.allSubModelNodes(); nodeList.append(qmlItemNode); - removedItemList.append(scene()->itemsForQmlItemNodes(nodeList)); + } else if (isFlowNonItem(qmlItemNode)) { + removedItemList.append(scene()->itemsForQmlItemNodes({qmlItemNode})); + } + + if (!removedItemList.isEmpty()) { + m_currentTool->itemsAboutToRemoved(removedItemList); //The destructor of QGraphicsItem does delete all its children. //We have to keep the children if they are not children in the model anymore. //Otherwise we delete the children explicitly anyway. deleteWithoutChildren(removedItemList); - } else if (isFlowNonItem(qmlItemNode)) { - removedItemList.append(scene()->itemsForQmlItemNodes({qmlItemNode})); - deleteWithoutChildren(removedItemList); } - - if (!removedItemList.isEmpty()) - m_currentTool->itemsAboutToRemoved(removedItemList); } void FormEditorView::createFormEditorWidget()