QmlDesigner: Ensure material lib node exists on project launch

In this commit material library node is created on model attach.
A timer keeps monitoring until it is suitable to create the node.

This will properly move materials into material library for
projects created with previous QDS versions.

Also removed unnecessary handling on new material dragging, as
rewriter now works properly with material library creation.

Fixes: QDS-7178
Change-Id: Idf6f41906e02bc064961d8de9841ba1644bd3552
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Mahmoud Badri
2022-06-22 14:46:27 +03:00
committed by Miikka Heikkinen
parent 9caa28754c
commit cc1bf95dc2
4 changed files with 33 additions and 31 deletions

View File

@@ -74,8 +74,11 @@ MaterialEditorView::MaterialEditorView(QWidget *parent)
connect(m_updateShortcut, &QShortcut::activated, this, &MaterialEditorView::reloadQml);
m_ensureMatLibTimer.callOnTimeout([this] {
if (model() && model()->rewriterView() && !model()->rewriterView()->hasIncompleteTypeInformation()) {
materialLibraryNode(); // create the material library node
if (model() && model()->rewriterView() && !model()->rewriterView()->hasIncompleteTypeInformation()
&& model()->rewriterView()->errors().isEmpty()) {
executeInTransaction("MaterialEditorView::MaterialEditorView", [this] {
ensureMaterialLibraryNode();
});
m_ensureMatLibTimer.stop();
}
});