1
0

qml: fix max toggle in InvoiceDialog

This commit is contained in:
Sander van Grieken
2023-02-09 12:42:09 +01:00
parent 31523449b3
commit d1a40c47cf

View File

@@ -313,21 +313,22 @@ ElDialog {
} }
Label { Label {
text: Config.baseUnit
color: Material.accentColor
Layout.fillWidth: amountMax.visible ? false : true Layout.fillWidth: amountMax.visible ? false : true
Layout.columnSpan: amountMax.visible ? 1 : 2 Layout.columnSpan: amountMax.visible ? 1 : 2
text: Config.baseUnit
color: Material.accentColor
} }
Switch { Switch {
id: amountMax id: amountMax
Layout.fillWidth: true
text: qsTr('Max') text: qsTr('Max')
visible: _canMax visible: _canMax
Layout.fillWidth: true checked: false
checked: invoice.amount.isMax
onCheckedChanged: { onCheckedChanged: {
if (activeFocus) { if (activeFocus)
invoice.amount.isMax = checked invoice.amount.isMax = checked
}
} }
} }
@@ -419,7 +420,10 @@ ElDialog {
if (invoice_key != '') { if (invoice_key != '') {
invoice.initFromKey(invoice_key) invoice.initFromKey(invoice_key)
} }
if (invoice.amount.isEmpty) if (invoice.amount.isEmpty) {
amountContainer.editmode = true amountContainer.editmode = true
} else if (invoice.amount.isMax) {
amountMax.checked = true
}
} }
} }