Properly init rule action param delegates on edit

This commit is contained in:
Michael Zanetti 2022-12-21 15:42:56 +01:00
parent e34155155e
commit 7108fee571

View File

@ -98,7 +98,7 @@ Page {
RadioButton { RadioButton {
id: staticParamRadioButton id: staticParamRadioButton
text: qsTr("Use static value as parameter") text: qsTr("Use static value as parameter")
checked: true checked: root.ruleAction.ruleActionParams.getParam(root.actionType.paramTypes.get(index).id).isValueBased
font.pixelSize: app.smallFont font.pixelSize: app.smallFont
visible: eventParamRadioButton.visible || stateValueRadioButton.visible visible: eventParamRadioButton.visible || stateValueRadioButton.visible
} }
@ -106,6 +106,7 @@ Page {
id: eventParamRadioButton id: eventParamRadioButton
text: qsTr("Use event parameter") text: qsTr("Use event parameter")
visible: eventParamsComboBox.count > 0 visible: eventParamsComboBox.count > 0
checked: root.ruleAction.ruleActionParams.getParam(root.actionType.paramTypes.get(index).id).isEventParamBased
font.pixelSize: app.smallFont font.pixelSize: app.smallFont
} }
RadioButton { RadioButton {
@ -113,6 +114,7 @@ Page {
text: qsTr("Use a thing's state value") text: qsTr("Use a thing's state value")
font.pixelSize: app.smallFont font.pixelSize: app.smallFont
visible: engine.jsonRpcClient.ensureServerVersion("2.0") visible: engine.jsonRpcClient.ensureServerVersion("2.0")
checked: root.ruleAction.ruleActionParams.getParam(root.actionType.paramTypes.get(index).id).isStateValueBased
} }
ThinDivider { ThinDivider {
@ -168,8 +170,8 @@ Page {
: thing.name + " - " + thing.thingClass.stateTypes.getStateType(stateTypeId).displayName : thing.name + " - " + thing.thingClass.stateTypes.getStateType(stateTypeId).displayName
visible: stateValueRadioButton.checked visible: stateValueRadioButton.checked
property var thingId: null property var thingId: root.ruleAction.ruleActionParams.getParam(root.actionType.paramTypes.get(index).id).stateThingId
property var stateTypeId: null property var stateTypeId: root.ruleAction.ruleActionParams.getParam(root.actionType.paramTypes.get(index).id).stateTypeId
readonly property Thing thing: engine.thingManager.things.getThing(thingId) readonly property Thing thing: engine.thingManager.things.getThing(thingId)