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(
|
onStateNameFinished: statesEditorModel.renameState(
|
||||||
delegateRoot.internalNodeId,
|
delegateRoot.internalNodeId,
|
||||||
stateThumbnail.stateName)
|
stateThumbnail.stateName)
|
||||||
|
|
||||||
onWhenConditionFinished: statesEditorModel.setWhenCondition(
|
|
||||||
delegateRoot.internalNodeId,
|
|
||||||
stateThumbnail.whenCondition)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -65,7 +65,6 @@ Item {
|
|||||||
signal extend
|
signal extend
|
||||||
signal remove
|
signal remove
|
||||||
signal stateNameFinished
|
signal stateNameFinished
|
||||||
signal whenConditionFinished
|
|
||||||
|
|
||||||
signal grabbing
|
signal grabbing
|
||||||
signal letGo
|
signal letGo
|
||||||
@@ -608,8 +607,16 @@ Item {
|
|||||||
running: false
|
running: false
|
||||||
interval: 50
|
interval: 50
|
||||||
repeat: false
|
repeat: false
|
||||||
onTriggered: statesEditorModel.setWhenCondition(root.internalNodeId,
|
onTriggered: {
|
||||||
bindingEditor.newWhenCondition)
|
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)
|
stateModelNodeProperty: statesEditorModel.stateModelNode(root.internalNodeId)
|
||||||
@@ -635,6 +642,8 @@ Item {
|
|||||||
indicatorVisible: true
|
indicatorVisible: true
|
||||||
indicator.icon.text: StudioTheme.Constants.edit
|
indicator.icon.text: StudioTheme.Constants.edit
|
||||||
indicator.onClicked: {
|
indicator.onClicked: {
|
||||||
|
whenCondition.previousCondition = whenCondition.text
|
||||||
|
|
||||||
bindingEditor.showWidget()
|
bindingEditor.showWidget()
|
||||||
bindingEditor.text = whenCondition.text
|
bindingEditor.text = whenCondition.text
|
||||||
bindingEditor.prepareBindings()
|
bindingEditor.prepareBindings()
|
||||||
@@ -662,7 +671,7 @@ Item {
|
|||||||
whenCondition.previousCondition = whenCondition.text
|
whenCondition.previousCondition = whenCondition.text
|
||||||
|
|
||||||
if (whenCondition.text !== "")
|
if (whenCondition.text !== "")
|
||||||
root.whenConditionFinished()
|
statesEditorModel.setWhenCondition(root.internalNodeId, root.whenCondition)
|
||||||
else
|
else
|
||||||
statesEditorModel.resetWhenCondition(root.internalNodeId)
|
statesEditorModel.resetWhenCondition(root.internalNodeId)
|
||||||
|
|
||||||
|
@@ -99,7 +99,9 @@ T.TextField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onActiveFocusChanged: {
|
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
|
root.preFocusText = root.text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user