diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp index 3a5d5ea63f7..08e63291d53 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp @@ -651,9 +651,11 @@ bool FormEditorView::isMoveToolAvailable() const return true; } -void FormEditorView::stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState) +void FormEditorView::actualStateChanged(const ModelNode &node) { - QmlModelView::stateChanged(newQmlModelState, oldQmlModelState); + QmlModelView::actualStateChanged(node); + + QmlModelState newQmlModelState(node); m_formEditorWidget->anchorToolAction()->setEnabled(newQmlModelState.isBaseState()); diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorview.h b/src/plugins/qmldesigner/components/formeditor/formeditorview.h index 7b6bebdc649..f08ad2c2f68 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorview.h +++ b/src/plugins/qmldesigner/components/formeditor/formeditorview.h @@ -118,6 +118,8 @@ public: double spacing() const; void deActivateItemCreator(); + void actualStateChanged(const ModelNode &node); + public slots: void activateItemCreator(const QString &name); @@ -125,7 +127,6 @@ signals: void ItemCreatorDeActivated(); protected: - void stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState); void reset(); protected slots: diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp index d494e908780..7e7fad921c9 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp @@ -933,9 +933,11 @@ QWidget *PropertyEditor::widget() return m_stackedWidget; } -void PropertyEditor::stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState) + +void PropertyEditor::actualStateChanged(const ModelNode &node) { - QmlModelView::stateChanged(newQmlModelState, oldQmlModelState); + QmlModelView::actualStateChanged(node); + QmlModelState newQmlModelState(node); Q_ASSERT(newQmlModelState.isValid()); if (debug) qDebug() << Q_FUNC_INFO << newQmlModelState.name(); diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.h index d626b212463..02a97954d23 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.h +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.h @@ -111,12 +111,12 @@ public: void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList); void resetView(); + void actualStateChanged(const ModelNode &node); protected: void timerEvent(QTimerEvent *event); void otherPropertyChanged(const QmlObjectNode &, const QString &propertyName); void transformChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName); - void stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState); void setupPane(const QString &typeName); void setValue(const QmlObjectNode &fxObjectNode, const QString &name, const QVariant &value); diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp index e4cde531587..277eb33189c 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp @@ -308,14 +308,16 @@ void StatesEditorView::nodeInstancePropertyChanged(const ModelNode &node, const QmlModelView::nodeInstancePropertyChanged(node, propertyName); } -void StatesEditorView::stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState) +void StatesEditorView::actualStateChanged(const ModelNode &node) { + QmlModelState newQmlModelState(node); + if (newQmlModelState.isBaseState()) { m_statesEditorWidget->setCurrentStateInternalId(0); } else { m_statesEditorWidget->setCurrentStateInternalId(newQmlModelState.modelNode().internalId()); } - QmlModelView::stateChanged(newQmlModelState, oldQmlModelState); + QmlModelView::actualStateChanged(node); } void StatesEditorView::transformChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName) diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h index 3bfc7bb75cd..89cd210752c 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h @@ -67,7 +67,7 @@ public: // QmlModelView - void stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState); + void actualStateChanged(const ModelNode &node); void transformChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName); void parentChanged(const QmlObjectNode &qmlObjectNode); void otherPropertyChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName); diff --git a/src/plugins/qmldesigner/designercore/include/qmlmodelview.h b/src/plugins/qmldesigner/designercore/include/qmlmodelview.h index d77bfbb6cb3..ab36aa72111 100644 --- a/src/plugins/qmldesigner/designercore/include/qmlmodelview.h +++ b/src/plugins/qmldesigner/designercore/include/qmlmodelview.h @@ -131,7 +131,6 @@ protected: virtual void transformChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName) ; virtual void parentChanged(const QmlObjectNode &qmlObjectNode); virtual void otherPropertyChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName); - virtual void stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState); void activateState(const QmlModelState &state); diff --git a/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp b/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp index 97f1047615f..01b52159055 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp @@ -440,16 +440,8 @@ void QmlModelView::rewriterEndTransaction() } -void QmlModelView::actualStateChanged(const ModelNode &node) +void QmlModelView::actualStateChanged(const ModelNode & /*node*/) { - QmlModelState newState(node); - QmlModelState oldState = currentState(); - - if (!newState.isValid()) - newState = baseState(); - - if (newState != oldState) - stateChanged(newState, oldState); } @@ -480,8 +472,5 @@ void QmlModelView::otherPropertyChanged(const QmlObjectNode &/*qmlObjectNode*/, { } -void QmlModelView::stateChanged(const QmlModelState &/*newQmlModelState*/, const QmlModelState &/*oldQmlModelState*/) -{ -} } //QmlDesigner