4 changed files with 54 additions and 53 deletions
@ -0,0 +1,28 @@ |
|||||||
|
import QtQuick 2.6 |
||||||
|
import QtQuick.Controls 2.0 |
||||||
|
|
||||||
|
import org.electrum 1.0 |
||||||
|
|
||||||
|
TextField { |
||||||
|
id: amount |
||||||
|
|
||||||
|
required property TextField fiatfield |
||||||
|
|
||||||
|
font.family: FixedFont |
||||||
|
placeholderText: qsTr('Amount') |
||||||
|
inputMethodHints: Qt.ImhPreferNumbers |
||||||
|
property Amount textAsSats |
||||||
|
onTextChanged: { |
||||||
|
textAsSats = Config.unitsToSats(amount.text) |
||||||
|
if (fiatfield.activeFocus) |
||||||
|
return |
||||||
|
fiatfield.text = text == '' ? '' : Daemon.fx.fiatValue(amount.textAsSats) |
||||||
|
} |
||||||
|
|
||||||
|
Connections { |
||||||
|
target: Config |
||||||
|
function onBaseUnitChanged() { |
||||||
|
amount.text = amount.textAsSats != 0 ? Config.satsToUnits(amount.textAsSats) : '' |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,18 @@ |
|||||||
|
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)) |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue