From d1a40c47cf520f7a8b284150ef58aa9560f985a8 Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Thu, 9 Feb 2023 12:42:09 +0100 Subject: [PATCH] qml: fix max toggle in InvoiceDialog --- electrum/gui/qml/components/InvoiceDialog.qml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/electrum/gui/qml/components/InvoiceDialog.qml b/electrum/gui/qml/components/InvoiceDialog.qml index f089f2e4c..bcef5a0c2 100644 --- a/electrum/gui/qml/components/InvoiceDialog.qml +++ b/electrum/gui/qml/components/InvoiceDialog.qml @@ -313,21 +313,22 @@ ElDialog { } Label { - text: Config.baseUnit - color: Material.accentColor Layout.fillWidth: amountMax.visible ? false : true Layout.columnSpan: amountMax.visible ? 1 : 2 + + text: Config.baseUnit + color: Material.accentColor } Switch { id: amountMax + Layout.fillWidth: true + text: qsTr('Max') visible: _canMax - Layout.fillWidth: true - checked: invoice.amount.isMax + checked: false onCheckedChanged: { - if (activeFocus) { + if (activeFocus) invoice.amount.isMax = checked - } } } @@ -419,7 +420,10 @@ ElDialog { if (invoice_key != '') { invoice.initFromKey(invoice_key) } - if (invoice.amount.isEmpty) + if (invoice.amount.isEmpty) { amountContainer.editmode = true + } else if (invoice.amount.isMax) { + amountMax.checked = true + } } }