forked from qt-creator/qt-creator
QmlDesigner: Fix binding editor empty expression
If the user pressed "Accept" on the binding editor if the text was empty a dialog with a warning popped up. This fix avoids sending empty strings to backend when condition. Task-number: QDS-7729 Change-Id: I77e5e9d34f8566dc4ed215c839b01186d839a2df Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
committed by
Henning Gründl
parent
2f55183557
commit
d920139302
@@ -807,10 +807,6 @@ Rectangle {
|
||||
onStateNameFinished: statesEditorModel.renameState(
|
||||
delegateRoot.internalNodeId,
|
||||
stateThumbnail.stateName)
|
||||
|
||||
onWhenConditionFinished: statesEditorModel.setWhenCondition(
|
||||
delegateRoot.internalNodeId,
|
||||
stateThumbnail.whenCondition)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -65,7 +65,6 @@ Item {
|
||||
signal extend
|
||||
signal remove
|
||||
signal stateNameFinished
|
||||
signal whenConditionFinished
|
||||
|
||||
signal grabbing
|
||||
signal letGo
|
||||
@@ -608,8 +607,16 @@ Item {
|
||||
running: false
|
||||
interval: 50
|
||||
repeat: false
|
||||
onTriggered: statesEditorModel.setWhenCondition(root.internalNodeId,
|
||||
bindingEditor.newWhenCondition)
|
||||
onTriggered: {
|
||||
if (whenCondition.previousCondition === bindingEditor.newWhenCondition)
|
||||
return
|
||||
|
||||
if ( bindingEditor.newWhenCondition !== "")
|
||||
statesEditorModel.setWhenCondition(root.internalNodeId,
|
||||
bindingEditor.newWhenCondition)
|
||||
else
|
||||
statesEditorModel.resetWhenCondition(root.internalNodeId)
|
||||
}
|
||||
}
|
||||
|
||||
stateModelNodeProperty: statesEditorModel.stateModelNode(root.internalNodeId)
|
||||
@@ -635,6 +642,8 @@ Item {
|
||||
indicatorVisible: true
|
||||
indicator.icon.text: StudioTheme.Constants.edit
|
||||
indicator.onClicked: {
|
||||
whenCondition.previousCondition = whenCondition.text
|
||||
|
||||
bindingEditor.showWidget()
|
||||
bindingEditor.text = whenCondition.text
|
||||
bindingEditor.prepareBindings()
|
||||
@@ -662,7 +671,7 @@ Item {
|
||||
whenCondition.previousCondition = whenCondition.text
|
||||
|
||||
if (whenCondition.text !== "")
|
||||
root.whenConditionFinished()
|
||||
statesEditorModel.setWhenCondition(root.internalNodeId, root.whenCondition)
|
||||
else
|
||||
statesEditorModel.resetWhenCondition(root.internalNodeId)
|
||||
|
||||
|
@@ -99,7 +99,9 @@ T.TextField {
|
||||
}
|
||||
|
||||
onActiveFocusChanged: {
|
||||
if (root.activeFocus)
|
||||
// OtherFocusReason in this case means, if the TextField gets focus after the context menu
|
||||
// was closed due to an menu item click.
|
||||
if (root.activeFocus && root.focusReason !== Qt.OtherFocusReason)
|
||||
root.preFocusText = root.text
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user