From 2cb45cbb6b12048a1e7e02877a56d63a09e708ed Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 22 Jun 2022 14:43:43 +0300 Subject: [PATCH] QmlDesigner: Reduce number of preview requests from material editor Removed preview request call from setValue, as it is called in long loops during initial project load and added the calls outside those loops where they already weren't there. Fixes: QDS-7175 Change-Id: Ia83814a0de6fe801d954373dc8ce0e4920e8a6a6 Reviewed-by: Mahmoud Badri Reviewed-by: Thomas Hartmann --- .../components/materialeditor/materialeditorview.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/components/materialeditor/materialeditorview.cpp b/src/plugins/qmldesigner/components/materialeditor/materialeditorview.cpp index 10cd12a7c7b..49cebb3dd4b 100644 --- a/src/plugins/qmldesigner/components/materialeditor/materialeditorview.cpp +++ b/src/plugins/qmldesigner/components/materialeditor/materialeditorview.cpp @@ -556,6 +556,7 @@ void MaterialEditorView::propertiesRemoved(const QList &proper if (noValidSelection()) return; + bool changed = false; for (const AbstractProperty &property : propertyList) { ModelNode node(property.parentModelNode()); @@ -564,8 +565,11 @@ void MaterialEditorView::propertiesRemoved(const QList &proper if (node == m_selectedMaterial || QmlObjectNode(m_selectedMaterial).propertyChangeForCurrentState() == node) { setValue(m_selectedMaterial, property.name(), QmlObjectNode(m_selectedMaterial).instanceValue(property.name())); + changed = true; } } + if (changed) + requestPreviewRender(); } void MaterialEditorView::variantPropertiesChanged(const QList &propertyList, PropertyChangeFlags /*propertyChange*/) @@ -670,6 +674,7 @@ void MaterialEditorView::instancePropertyChanged(const QList &propertyPair : propertyList) { const ModelNode modelNode = propertyPair.first; const QmlObjectNode qmlObjectNode(modelNode); @@ -681,8 +686,11 @@ void MaterialEditorView::instancePropertyChanged(const QListsetValue(qmlObjectNode, name, value); - requestPreviewRender(); m_locked = false; }