fix(NetworkSelector): Fix broken bindings when the item is toggled
This commit is contained in:
parent
44d511fd6a
commit
2454b5f69a
|
@ -25,11 +25,6 @@ StatusListItem {
|
||||||
Disabled
|
Disabled
|
||||||
}
|
}
|
||||||
|
|
||||||
QtObject {
|
|
||||||
id: d
|
|
||||||
property SingleSelectionInfo tmpObject: SingleSelectionInfo { enabled: true }
|
|
||||||
}
|
|
||||||
|
|
||||||
objectName: model.chainName
|
objectName: model.chainName
|
||||||
title: model.chainName
|
title: model.chainName
|
||||||
asset.height: 24
|
asset.height: 24
|
||||||
|
@ -40,7 +35,7 @@ StatusListItem {
|
||||||
if(!root.singleSelection.enabled) {
|
if(!root.singleSelection.enabled) {
|
||||||
checkBox.nextCheckState()
|
checkBox.nextCheckState()
|
||||||
} else if(!radioButton.checked) { // Don't allow uncheck
|
} else if(!radioButton.checked) { // Don't allow uncheck
|
||||||
radioButton.toggle()
|
root.toggleNetwork(({chainId: model.chainId, chainName: model.chainName, iconUrl: model.iconUrl}), root.networkModel, model.index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,19 +72,8 @@ StatusListItem {
|
||||||
ButtonGroup.group: root.radioButtonGroup
|
ButtonGroup.group: root.radioButtonGroup
|
||||||
checked: root.singleSelection.currentModel === root.networkModel && root.singleSelection.currentIndex === model.index
|
checked: root.singleSelection.currentModel === root.networkModel && root.singleSelection.currentIndex === model.index
|
||||||
|
|
||||||
property SingleSelectionInfo exchangeObject: null
|
onToggled: {
|
||||||
function setNewInfo(networkModel, index) {
|
if(checked) {
|
||||||
d.tmpObject.currentModel = networkModel
|
|
||||||
d.tmpObject.currentIndex = index
|
|
||||||
exchangeObject = d.tmpObject
|
|
||||||
d.tmpObject = root.singleSelection
|
|
||||||
root.singleSelection = exchangeObject
|
|
||||||
exchangeObject = null
|
|
||||||
}
|
|
||||||
|
|
||||||
onCheckedChanged: {
|
|
||||||
if(checked && (root.singleSelection.currentModel !== root.networkModel || root.singleSelection.currentIndex !== model.index)) {
|
|
||||||
setNewInfo(root.networkModel, model.index)
|
|
||||||
root.toggleNetwork(({chainId: model.chainId, chainName: model.chainName, iconUrl: model.iconUrl}), root.networkModel, model.index)
|
root.toggleNetwork(({chainId: model.chainId, chainName: model.chainName, iconUrl: model.iconUrl}), root.networkModel, model.index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue