void StatesEditorView::nodeAboutToBeRemoved(const ModelNode &removedNode) { if (removedNode.hasParentProperty()) { const NodeAbstractProperty propertyParent = removedNode.parentProperty(); if (propertyParent.parentModelNode().isRootNode() && propertyParent.name() == "states") m_lastIndex = propertyParent.indexOf(removedNode); } if (currentState().isValid() && removedNode == currentState()) setCurrentState(baseState()); }
void StatesEditorView::nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags /*propertyChange*/) { if (oldPropertyParent.isValid() && oldPropertyParent.parentModelNode().isRootNode() && oldPropertyParent.name() == "states") m_statesEditorModel->removeState(m_lastIndex); m_lastIndex = -1; if (newPropertyParent.isValid() && newPropertyParent.parentModelNode().isRootNode() && newPropertyParent.name() == "states") { int index = newPropertyParent.indexOf(node); m_statesEditorModel->insertState(index); } }
void StatesEditorView::nodeAboutToBeReparented(const ModelNode &node, const NodeAbstractProperty &/*newPropertyParent*/, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags /*propertyChange*/) { if (oldPropertyParent.isValid() && oldPropertyParent.parentModelNode().isRootNode() && oldPropertyParent.name() == "states") m_lastIndex = oldPropertyParent.indexOf(node); }