QmlDesigner: Fix expressions in DynamicPropertyRow and states

* States are now taken into account.
* If name is empty in expressionChanged(), then this
  is just a notifier for the QML frontend and has to be ignored.
* When exposing the expression to QML we also have to take into
  account states.
* Implementing resetting dynamic properties. We have to hardcode
  the default values for the base state
* I also implemented the callbacks in the views for PropertyChanges.

Change-Id: I08247a3c1783a52853db7bf0f7f249520f7edc1c
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Thomas Hartmann
2022-09-09 16:33:23 +02:00
parent 26e5b3787c
commit 39f44cf57c
8 changed files with 218 additions and 49 deletions

View File

@@ -804,6 +804,8 @@ void MaterialEditorView::propertiesRemoved(const QList<AbstractProperty> &proper
setValue(m_selectedMaterial, property.name(), QmlObjectNode(m_selectedMaterial).instanceValue(property.name()));
changed = true;
}
dynamicPropertiesModel()->dispatchPropertyChanges(property);
}
if (changed)
requestPreviewRender();
@@ -827,6 +829,8 @@ void MaterialEditorView::variantPropertiesChanged(const QList<VariantProperty> &
changed = true;
}
dynamicPropertiesModel()->dispatchPropertyChanges(property);
}
if (changed)
requestPreviewRender();
@@ -854,6 +858,8 @@ void MaterialEditorView::bindingPropertiesChanged(const QList<BindingProperty> &
changed = true;
}
dynamicPropertiesModel()->dispatchPropertyChanges(property);
}
if (changed)
requestPreviewRender();