File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ void BitcoinAmount::setUnit(const Unit unit)
66
66
{
67
67
m_unit = unit;
68
68
Q_EMIT unitChanged ();
69
+ Q_EMIT displayChanged ();
69
70
}
70
71
71
72
QString BitcoinAmount::unitLabel () const
@@ -85,7 +86,7 @@ void BitcoinAmount::flipUnit()
85
86
m_unit = Unit::BTC;
86
87
}
87
88
Q_EMIT unitChanged ();
88
- Q_EMIT amountChanged ();
89
+ Q_EMIT displayChanged ();
89
90
}
90
91
91
92
QString BitcoinAmount::satsToBtcString (qint64 sat)
@@ -151,3 +152,8 @@ void BitcoinAmount::fromDisplay(const QString& text)
151
152
}
152
153
setSatoshi (newSat);
153
154
}
155
+
156
+ void BitcoinAmount::format ()
157
+ {
158
+ Q_EMIT displayChanged ();
159
+ }
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ class BitcoinAmount : public QObject
15
15
Q_OBJECT
16
16
Q_PROPERTY (Unit unit READ unit WRITE setUnit NOTIFY unitChanged)
17
17
Q_PROPERTY (QString unitLabel READ unitLabel NOTIFY unitChanged)
18
- Q_PROPERTY (QString display READ toDisplay WRITE fromDisplay NOTIFY amountChanged )
18
+ Q_PROPERTY (QString display READ toDisplay WRITE fromDisplay NOTIFY displayChanged )
19
19
Q_PROPERTY (qint64 satoshi READ satoshi WRITE setSatoshi NOTIFY amountChanged)
20
20
21
21
public:
@@ -38,6 +38,8 @@ class BitcoinAmount : public QObject
38
38
39
39
bool isSet () const { return m_isSet; }
40
40
41
+ Q_INVOKABLE void format ();
42
+
41
43
static QString satsToBtcString (qint64 sat);
42
44
43
45
public Q_SLOTS:
@@ -47,6 +49,7 @@ public Q_SLOTS:
47
49
Q_SIGNALS:
48
50
void unitChanged ();
49
51
void amountChanged ();
52
+ void displayChanged ();
50
53
51
54
private:
52
55
QString sanitize (const QString& text);
Original file line number Diff line number Diff line change @@ -220,10 +220,11 @@ PageStack {
220
220
placeholderText: " 0.00000000"
221
221
selectByMouse: true
222
222
text: root .recipient .amount .display
223
- onEditingFinished: root .recipient .amount .display = text
223
+ onTextEdited: root .recipient .amount .display = text
224
+ onEditingFinished: root .recipient .amount .format ()
224
225
onActiveFocusChanged: {
225
226
if (! activeFocus) {
226
- root .recipient .amount .display = text
227
+ root .recipient .amount .format ()
227
228
}
228
229
}
229
230
}
You can’t perform that action at this time.
0 commit comments