From 4a89a077dd48cfab92888881e084f9a728718164 Mon Sep 17 00:00:00 2001 From: Marco Bubke <marco.bubke@nokia.com> Date: Mon, 12 Apr 2010 14:12:55 +0200 Subject: [PATCH] Use the notification from the node instances Reviewed-by: kkoehne --- .../stateseditor/stateseditorview.cpp | 27 ++++++++++++------- .../stateseditor/stateseditorview.h | 2 ++ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp index eb98c1c129b..e6e3e1640c2 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp @@ -251,15 +251,6 @@ void StatesEditorView::variantPropertiesChanged(const QList<VariantProperty> &pr m_editorModel->renameState(index, property.value().toString()); } } - foreach (const AbstractProperty &property, propertyList) { - ModelNode node (property.parentModelNode().parentProperty().parentModelNode()); - if (QmlModelState(node).isValid()) { - startUpdateTimer(modelStateIndex(node) + 1, 0); - } else { //a change to the base state update all - for (int i = 0; i < m_modelStates.count(); ++i) - startUpdateTimer(i, 0); - } - } } void StatesEditorView::nodeAboutToBeRemoved(const ModelNode &removedNode) @@ -339,6 +330,18 @@ void StatesEditorView::nodeOrderChanged(const NodeListProperty &listProperty, co } } +void StatesEditorView::nodeInstancePropertyChanged(const ModelNode &node, const QString &propertyName) +{ + if (QmlModelState(node).isValid()) { + startUpdateTimer(modelStateIndex(node) + 1, 0); + } else { //a change to the base state update all + for (int i = 0; i < m_modelStates.count(); ++i) + startUpdateTimer(i, 0); + } + + QmlModelView::nodeInstancePropertyChanged(node, propertyName); +} + void StatesEditorView::stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState) { if (debug) @@ -454,10 +457,14 @@ void StatesEditorView::sceneChanged() } void StatesEditorView::startUpdateTimer(int i, int offset) { + if (i < 0 || i > m_modelStates.count()) + return; + if (i < m_updateTimerIdList.size() && m_updateTimerIdList.at(i) != 0) return; // TODO: Add an offset so not all states are rendered at once - Q_ASSERT(i >= 0 && i < m_modelStates.count()); + + if (i < m_updateTimerIdList.size() && i > 0) if (m_updateTimerIdList.at(i)) killTimer(m_updateTimerIdList.at(i)); diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h index 44bc5b6ac63..26fbb26396d 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h @@ -55,6 +55,8 @@ public: QmlItemNode stateRootNode() { return m_stateRootNode; } bool isAttachedToModel() const { return m_attachedToModel; } + void nodeInstancePropertyChanged(const ModelNode &node, const QString &propertyName); + protected: // AbstractView void modelAttached(Model *model); -- GitLab