diff --git a/electrum/gui/qml/components/InvoiceDialog.qml b/electrum/gui/qml/components/InvoiceDialog.qml index 59590c622..51f41de5a 100644 --- a/electrum/gui/qml/components/InvoiceDialog.qml +++ b/electrum/gui/qml/components/InvoiceDialog.qml @@ -181,7 +181,9 @@ ElDialog { font.pixelSize: constants.fontSizeXLarge font.family: FixedFont font.bold: true - text: Config.formatSats(invoice.amount, false) + text: invoice.invoiceType == Invoice.LightningInvoice + ? Config.formatMilliSats(invoice.amount, false) + : Config.formatSats(invoice.amount, false) } Label { @@ -223,12 +225,13 @@ ElDialog { Layout.preferredWidth: amountFontMetrics.advanceWidth('0') * 14 + leftPadding + rightPadding fiatfield: amountFiat readOnly: amountMax.checked + msatPrecision: invoice.invoiceType == Invoice.LightningInvoice color: readOnly ? Material.accentColor : Material.foreground onTextAsSatsChanged: { if (!amountMax.checked) - invoice.amountOverride.satsInt = textAsSats.satsInt + invoice.amountOverride.copyFrom(textAsSats) } Connections { target: invoice.amountOverride diff --git a/electrum/gui/qml/components/controls/BtcField.qml b/electrum/gui/qml/components/controls/BtcField.qml index fca0455fd..a42624356 100644 --- a/electrum/gui/qml/components/controls/BtcField.qml +++ b/electrum/gui/qml/components/controls/BtcField.qml @@ -7,12 +7,13 @@ TextField { id: amount required property TextField fiatfield + property bool msatPrecision: false font.family: FixedFont placeholderText: qsTr('Amount') inputMethodHints: Qt.ImhDigitsOnly validator: RegularExpressionValidator { - regularExpression: Config.btcAmountRegex + regularExpression: msatPrecision ? Config.btcAmountRegexMsat : Config.btcAmountRegex } property Amount textAsSats diff --git a/electrum/gui/qml/qeinvoice.py b/electrum/gui/qml/qeinvoice.py index bedc1c659..8e3ce2023 100644 --- a/electrum/gui/qml/qeinvoice.py +++ b/electrum/gui/qml/qeinvoice.py @@ -383,7 +383,7 @@ class QEInvoice(QObject, QtEventListener): if self.amount.isEmpty: if self.amountOverride.isEmpty: raise Exception('can not pay 0 amount') - amount_msat = self.amountOverride.satsInt * 1000 + amount_msat = self.amountOverride.msatsInt self._wallet.pay_lightning_invoice(self._effectiveInvoice, amount_msat) diff --git a/electrum/gui/qml/qetypes.py b/electrum/gui/qml/qetypes.py index 090dae9a6..abcb445df 100644 --- a/electrum/gui/qml/qetypes.py +++ b/electrum/gui/qml/qetypes.py @@ -90,6 +90,7 @@ class QEAmount(QObject): self._is_max = False self.valueChanged.emit() + @pyqtSlot('QVariant') def copyFrom(self, amount): if not amount: self._logger.warning('copyFrom with None argument. assuming 0') # TODO