diff options
-rw-r--r-- | share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml | 7 | ||||
-rw-r--r-- | share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/TextField.qml | 30 |
2 files changed, 21 insertions, 16 deletions
diff --git a/share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml b/share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml index 642ebd972d1..4b004708c2d 100644 --- a/share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml +++ b/share/qtcreator/qmldesigner/newstateseditor/StateThumbnail.qml @@ -650,7 +650,12 @@ Item { } onEditingFinished: { - if (whenCondition.previousCondition === whenCondition.text) + // The check for contenxtMenuAboutToShow is necessary in order to make a the + // popup stay open if the when condition was changed. Otherwise editingFinished + // will be called and the model will be reset. The popup will trigger a focus + // change and editingFinished is triggered. + if (whenCondition.previousCondition === whenCondition.text + || whenCondition.contextMenuAboutToShow) return whenCondition.previousCondition = whenCondition.text diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/TextField.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/TextField.qml index 702d80ab8a1..531a5b0ff35 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/TextField.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/TextField.qml @@ -50,6 +50,8 @@ T.TextField { property string preFocusText: "" + property bool contextMenuAboutToShow: false + horizontalAlignment: Qt.AlignLeft verticalAlignment: Qt.AlignVCenter @@ -62,7 +64,7 @@ T.TextField { readOnly: false selectByMouse: true - persistentSelection: focus // QTBUG-73807 + persistentSelection: contextMenu.visible || root.focus clip: true width: StudioTheme.Values.defaultControlWidth @@ -78,24 +80,22 @@ T.TextField { enabled: true hoverEnabled: true propagateComposedEvents: true - acceptedButtons: Qt.LeftButton | Qt.RightButton + acceptedButtons: Qt.NoButton cursorShape: Qt.PointingHandCursor - onPressed: function(mouse) { - if (mouse.button === Qt.RightButton) - contextMenu.popup(root) - - mouse.accepted = false - } } - onPersistentSelectionChanged: { - if (!persistentSelection) - root.deselect() + onPressed: function(event) { + if (event.button === Qt.RightButton) + contextMenu.popup(root) } ContextMenu { id: contextMenu myTextEdit: root + + onClosed: root.forceActiveFocus() + onAboutToShow: root.contextMenuAboutToShow = true + onAboutToHide: root.contextMenuAboutToShow = false } onActiveFocusChanged: { @@ -165,7 +165,7 @@ T.TextField { states: [ State { name: "default" - when: root.enabled && !root.hover && !root.edit + when: root.enabled && !root.hover && !root.edit && !contextMenu.visible PropertyChanges { target: textFieldBackground color: StudioTheme.Values.themeControlBackground @@ -184,7 +184,7 @@ T.TextField { State { name: "globalHover" when: (actionIndicator.hover || translationIndicator.hover || indicator.hover) - && !root.edit && root.enabled + && !root.edit && root.enabled && !contextMenu.visible PropertyChanges { target: textFieldBackground color: StudioTheme.Values.themeControlBackgroundGlobalHover @@ -199,7 +199,7 @@ T.TextField { State { name: "hover" when: mouseArea.containsMouse && !actionIndicator.hover && !translationIndicator.hover - && !indicator.hover && !root.edit && root.enabled + && !indicator.hover && !root.edit && root.enabled && !contextMenu.visible PropertyChanges { target: textFieldBackground color: StudioTheme.Values.themeControlBackgroundHover @@ -213,7 +213,7 @@ T.TextField { }, State { name: "edit" - when: root.edit + when: root.edit || contextMenu.visible PropertyChanges { target: textFieldBackground color: StudioTheme.Values.themeControlBackgroundInteraction |