Files
pallectrum/electrum/gui/qml/components/controls/FiatField.qml
2022-07-07 18:29:01 +02:00

31 lines
698 B
QML

import QtQuick 2.6
import QtQuick.Controls 2.0
import org.electrum 1.0
TextField {
id: amountFiat
required property TextField btcfield
font.family: FixedFont
placeholderText: qsTr('Amount')
inputMethodHints: Qt.ImhPreferNumbers
onTextChanged: {
if (amountFiat.activeFocus)
btcfield.text = text == ''
? ''
: Config.satsToUnits(Daemon.fx.satoshiValue(amountFiat.text))
}
Connections {
target: Daemon.fx
function onQuotesUpdated() {
amountFiat.text = btcfield.text == ''
? ''
: Daemon.fx.fiatValue(Config.unitsToSats(btcfield.text))
}
}
}