Use the notification from the node instances

Reviewed-by: kkoehne
This commit is contained in:
Marco Bubke
2010-04-12 14:12:55 +02:00
committed by Kai Koehne
parent 02f297be26
commit 4a89a077dd
2 changed files with 19 additions and 10 deletions

View File

@@ -251,15 +251,6 @@ void StatesEditorView::variantPropertiesChanged(const QList<VariantProperty> &pr
m_editorModel->renameState(index, property.value().toString()); 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) 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) void StatesEditorView::stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState)
{ {
if (debug) if (debug)
@@ -454,10 +457,14 @@ void StatesEditorView::sceneChanged()
} }
void StatesEditorView::startUpdateTimer(int i, int offset) { 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) if (i < m_updateTimerIdList.size() && m_updateTimerIdList.at(i) != 0)
return; return;
// TODO: Add an offset so not all states are rendered at once // 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 (i < m_updateTimerIdList.size() && i > 0)
if (m_updateTimerIdList.at(i)) if (m_updateTimerIdList.at(i))
killTimer(m_updateTimerIdList.at(i)); killTimer(m_updateTimerIdList.at(i));

View File

@@ -55,6 +55,8 @@ public:
QmlItemNode stateRootNode() { return m_stateRootNode; } QmlItemNode stateRootNode() { return m_stateRootNode; }
bool isAttachedToModel() const { return m_attachedToModel; } bool isAttachedToModel() const { return m_attachedToModel; }
void nodeInstancePropertyChanged(const ModelNode &node, const QString &propertyName);
protected: protected:
// AbstractView // AbstractView
void modelAttached(Model *model); void modelAttached(Model *model);