diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp index 6149b248ce9..781bbab1ef1 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp @@ -169,25 +169,35 @@ static void deleteWithoutChildren(const QList &items) } } +static bool isFlowNonItem(const QmlItemNode &itemNode) +{ + return itemNode.isFlowTransition() + || itemNode.isFlowWildcard() + || itemNode.isFlowWildcard(); +} + void FormEditorView::removeNodeFromScene(const QmlItemNode &qmlItemNode) { + QList removedItemList; + if (qmlItemNode.isValid()) { QList nodeList; nodeList.append(qmlItemNode.allSubModelNodes()); nodeList.append(qmlItemNode); - QList removedItemList; - removedItemList.append(scene()->itemsForQmlItemNodes(nodeList)); - 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 (qmlItemNode.isFlowTransition()) { - deleteWithoutChildren(scene()->itemsForQmlItemNodes({qmlItemNode})); + } else if (isFlowNonItem(qmlItemNode)) { + removedItemList.append(scene()->itemsForQmlItemNodes({qmlItemNode})); + deleteWithoutChildren(removedItemList); } + + if (!removedItemList.isEmpty()) + m_currentTool->itemsAboutToRemoved(removedItemList); } void FormEditorView::hideNodeFromScene(const QmlItemNode &qmlItemNode) @@ -308,6 +318,11 @@ void FormEditorView::propertiesAboutToBeRemoved(const QList& p removedItems.append(item); delete item; } + } else if (isFlowNonItem(qmlItemNode)) { + if (FormEditorItem *item = m_scene->itemForQmlItemNode(qmlItemNode)) { + removedItems.append(item); + delete item; + } } } }