File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Expand file tree Collapse file tree 3 files changed +15
-3
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:
@@ -36,6 +36,10 @@ class BitcoinAmount : public QObject
36
36
qint64 satoshi () const ;
37
37
void setSatoshi (qint64 new_amount);
38
38
39
+ bool isSet () const { return m_isSet; }
40
+
41
+ Q_INVOKABLE void format ();
42
+
39
43
static QString satsToBtcString (qint64 sat);
40
44
41
45
public Q_SLOTS:
@@ -45,6 +49,7 @@ public Q_SLOTS:
45
49
Q_SIGNALS:
46
50
void unitChanged ();
47
51
void amountChanged ();
52
+ void displayChanged ();
48
53
49
54
private:
50
55
QString sanitize (const QString& text);
Original file line number Diff line number Diff line change @@ -194,7 +194,8 @@ PageStack {
194
194
placeholderText: " 0.00000000"
195
195
selectByMouse: true
196
196
text: root .recipient .amount .display
197
- onEditingFinished: root .recipient .amount .display = text
197
+ onTextEdited: root .recipient .amount .display = text
198
+ onEditingFinished: root .recipient .amount .format ()
198
199
onActiveFocusChanged: {
199
200
if (! activeFocus) {
200
201
root .recipient .amount .display = text
You can’t perform that action at this time.
0 commit comments