Commit f096d16e authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner: Fixing crash if FormEditorItems have custom children

If any FormEditor item has non FormEditor item children the current
code will crash. While currently FormEditor items do not have such children,
we might add such children in the future.

Change-Id: I894324a4b247e91eb3fd0db30eb4d9f198f7474a
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
parent 631d960c
...@@ -379,15 +379,16 @@ void FormEditorScene::clearFormEditorItems() ...@@ -379,15 +379,16 @@ void FormEditorScene::clearFormEditorItems()
{ {
const QList<QGraphicsItem*> itemList(items()); const QList<QGraphicsItem*> itemList(items());
foreach (QGraphicsItem *item, itemList) { const QList<FormEditorItem*> formEditorItemsTransformed =
if (qgraphicsitem_cast<FormEditorItem* >(item)) Utils::transform(itemList, [](QGraphicsItem *item) { return qgraphicsitem_cast<FormEditorItem* >(item); });
const QList<FormEditorItem*> formEditorItems = Utils::filtered(formEditorItemsTransformed,
[](FormEditorItem *item) { return item; });
foreach (FormEditorItem *item, formEditorItems)
item->setParentItem(0); item->setParentItem(0);
}
foreach (QGraphicsItem *item, itemList) { foreach (FormEditorItem *item, formEditorItems)
if (qgraphicsitem_cast<FormEditorItem* >(item))
delete item; delete item;
}
} }
void FormEditorScene::highlightBoundingRect(FormEditorItem *highlighItem) void FormEditorScene::highlightBoundingRect(FormEditorItem *highlighItem)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment