}
}
-void StatesEditorModel::updateState(int updateIndex)
+void StatesEditorModel::updateState(int beginIndex, int endIndex)
{
- if (updateIndex >= 0) {
- QModelIndex modelIndex = index(updateIndex, 0);
- emit dataChanged(modelIndex, modelIndex);
- }
+ if (beginIndex >= 0 && endIndex >= 0)
+ emit dataChanged(index(beginIndex, 0), index(endIndex, 0));
}
void StatesEditorModel::removeState(int stateIndex)
void insertState(int stateIndex);
void removeState(int stateIndex);
- void updateState(int stateIndex);
+ void updateState(int beginIndex, int endIndex);
Q_INVOKABLE void renameState(int nodeId, const QString &newName);
void emitChangedToState(int n);
void StatesEditorView::variantPropertiesChanged(const QList<VariantProperty> &propertyList, PropertyChangeFlags /*propertyChange*/)
{
- foreach (const VariantProperty &property, propertyList) {
- if (property.name() == "name" && property.parentModelNode().hasParentProperty()) {
- NodeAbstractProperty parentProperty = property.parentModelNode().parentProperty();
- if (parentProperty.name() == "states" && parentProperty.parentModelNode().isRootNode()) {
- m_statesEditorModel->updateState(parentProperty.indexOf(property.parentModelNode()) + 1);
- }
- }
- }
}
{
if (identifier == "__instance preview image changed__") {
+ int minimumIndex = 10000;
+ int maximumIndex = -1;
foreach(const ModelNode &node, nodeList) {
if (node.isRootNode()) {
- m_statesEditorModel->updateState(0);
+ minimumIndex = qMin(minimumIndex, 0);
+ maximumIndex = qMax(maximumIndex, 0);
} else {
int index = rootStateGroup().allStates().indexOf(QmlModelState(node)) + 1;
- if (index > 0)
- m_statesEditorModel->updateState(index);
+ if (index > 0) {
+ minimumIndex = qMin(minimumIndex, index);
+ maximumIndex = qMax(maximumIndex, index);
+ }
}
}
+
+ if (maximumIndex >= 0)
+ m_statesEditorModel->updateState(minimumIndex, maximumIndex);
+
} else {
QmlModelView::customNotification(view, identifier, nodeList, imageList);
}