QmlDesigner: Fix dynamic properties on material library init

Nodes with dynamic properties cannot be reparented under a newly
created node in the same transaction without breaking said properties.

To work around this issue, ensureMaterialLibraryNode() was split into
two transactions. This also meant removing ensureMaterialLibraryNode()
call from materialLibraryNode(), so now material library will only be
created in response to model attach or qtquick3d import addition.
This should still cover all cases where user doesn't manually remove
the material library node.

Fixes: QDS-8095
Change-Id: Icff449b2bee0da2b43b02bbf5e0d28189aa2b3a9
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2022-10-27 13:34:58 +03:00
parent 596529651b
commit d72f5674b5
2 changed files with 29 additions and 30 deletions

View File

@@ -80,9 +80,7 @@ MaterialEditorView::MaterialEditorView(QWidget *parent)
m_ensureMatLibTimer.callOnTimeout([this] {
if (model() && model()->rewriterView() && !model()->rewriterView()->hasIncompleteTypeInformation()
&& model()->rewriterView()->errors().isEmpty()) {
executeInTransaction("MaterialEditorView::MaterialEditorView", [this] {
ensureMaterialLibraryNode();
});
ensureMaterialLibraryNode();
m_ensureMatLibTimer.stop();
}
});