diff --git a/share/qtcreator/qmldesigner/stateseditor/StateMenu.qml b/share/qtcreator/qmldesigner/stateseditor/StateMenu.qml index d26572ebde6..c30538e31ed 100644 --- a/share/qtcreator/qmldesigner/stateseditor/StateMenu.qml +++ b/share/qtcreator/qmldesigner/stateseditor/StateMenu.qml @@ -44,6 +44,7 @@ StudioControls.Menu { signal remove() signal toggle() signal resetWhenCondition() + signal jumpToCode() signal editAnnotation() signal removeAnnotation() @@ -84,6 +85,14 @@ StudioControls.Menu { StudioControls.MenuSeparator {} + StudioControls.MenuItem { + enabled: !root.isBaseState + text: qsTr("Jump To Code") + onTriggered: root.jumpToCode() + } + + StudioControls.MenuSeparator {} + StudioControls.MenuItem { enabled: !root.isBaseState && root.hasWhenCondition text: qsTr("Reset when Condition") diff --git a/share/qtcreator/qmldesigner/stateseditor/StateThumbnail.qml b/share/qtcreator/qmldesigner/stateseditor/StateThumbnail.qml index 1d8147d0425..781ddc4601f 100644 --- a/share/qtcreator/qmldesigner/stateseditor/StateThumbnail.qml +++ b/share/qtcreator/qmldesigner/stateseditor/StateThumbnail.qml @@ -736,6 +736,9 @@ Item { onRemove: root.remove() onToggle: root.setPropertyChangesVisible(!root.propertyChangesVisible) onResetWhenCondition: statesEditorModel.resetWhenCondition(root.internalNodeId) + + onJumpToCode: StatesEditorBackend.statesEditorModel.jumpToCode() + onEditAnnotation: { StatesEditorBackend.statesEditorModel.setAnnotation(root.internalNodeId) stateMenu.hasAnnotation = root.checkAnnotation() diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp index 0b53af121b8..2ec6f0e6a02 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -246,6 +247,11 @@ bool StatesEditorModel::hasDefaultState() const return m_statesEditorView->hasDefaultState(); } +void StatesEditorModel::jumpToCode() +{ + ModelNodeOperations::jumpToCode(m_statesEditorView->currentState().modelNode()); +} + void StatesEditorModel::setAnnotation(int internalNodeId) { m_statesEditorView->setAnnotation(internalNodeId); diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.h b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.h index 8eff287c869..0e228e46bd8 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.h +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.h @@ -50,6 +50,7 @@ public: Q_INVOKABLE void setStateAsDefault(int internalNodeId); Q_INVOKABLE void resetDefaultState(); Q_INVOKABLE bool hasDefaultState() const; + Q_INVOKABLE void jumpToCode(); Q_INVOKABLE void setAnnotation(int internalNodeId); Q_INVOKABLE void removeAnnotation(int internalNodeId); Q_INVOKABLE bool hasAnnotation(int internalNodeId) const;