diff options
author | Aleksei German <aleksei.german@qt.io> | 2020-07-28 17:03:35 +0200 |
---|---|---|
committer | Thomas Hartmann <thomas.hartmann@qt.io> | 2020-08-27 10:05:44 +0000 |
commit | f642c02eb651b8146c57f735e03e4db29078abca (patch) | |
tree | 561ed8450b1a4ee8eb7526999e9a556109edec49 /share | |
parent | ac5d35a53d81212b8ca99af792f312d336e2f087 (diff) |
QmlDesigner: Annotations for States
- Added Annotations support for States
Task: QDS-2312
Change-Id: I204ec958f85bd0f05eae0abbb3848d6d59e7e397
Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
Diffstat (limited to 'share')
-rw-r--r-- | share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml b/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml index ef624574ac..6b01f322f8 100644 --- a/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml +++ b/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml @@ -41,6 +41,8 @@ Rectangle { property int delegateStateImageSize property bool delegateHasWhenCondition property string delegateWhenConditionString + property bool hasAnnotation: checkAnnotation() + readonly property bool isDefaultState: isDefault signal delegateInteraction @@ -53,6 +55,10 @@ Rectangle { return stringList } + function checkAnnotation() { + return statesEditorModel.hasAnnotation(internalNodeId) + } + MouseArea { id: mouseArea anchors.fill: parent @@ -120,11 +126,31 @@ Rectangle { } } + StudioControls.MenuItem { + enabled: !isBaseState + text: (hasAnnotation ? qsTr("Edit Annotation") + : qsTr("Add Annotation")) + onTriggered: { + statesEditorModel.setAnnotation(internalNodeId) + hasAnnotation = checkAnnotation() + } + } + + StudioControls.MenuItem { + enabled: !isBaseState && hasAnnotation + text: qsTr("Remove Annotation") + onTriggered: { + statesEditorModel.removeAnnotation(internalNodeId) + hasAnnotation = checkAnnotation() + } + } + onClosed: { stateNameField.actionIndicator.forceVisible = false } onOpened: { + hasAnnotation = checkAnnotation() myRoot.delegateInteraction() } } |