diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-07-18 16:31:13 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-07-23 17:58:46 +0200 |
commit | 91cce1732b73c4457e474c557aaa7f343c0dc8a2 (patch) | |
tree | d1698a0f93194115581ff012a0ce3eae4c63faff /src/qt/bitcoinamountfield.h | |
parent | d5a3fd10e50ea8b2a43e307ed1f52d286663e551 (diff) |
qt: Use fixed-point arithmetic in amount spinbox
Fixes various issues and cleans up code
- Fixes issue #4500: Amount widget +/- has floating point rounding artifacts
- Amount box can now be emptied again, without clearing to 0
Also aligns the amount to the right, as in other places.
Diffstat (limited to 'src/qt/bitcoinamountfield.h')
-rw-r--r-- | src/qt/bitcoinamountfield.h | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/qt/bitcoinamountfield.h b/src/qt/bitcoinamountfield.h index 521a9ed561..c713f5d687 100644 --- a/src/qt/bitcoinamountfield.h +++ b/src/qt/bitcoinamountfield.h @@ -8,17 +8,18 @@ #include <QWidget> QT_BEGIN_NAMESPACE -class QDoubleSpinBox; class QValueComboBox; QT_END_NAMESPACE +class AmountSpinBox; + /** Widget for entering bitcoin amounts. */ class BitcoinAmountField: public QWidget { Q_OBJECT - Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY textChanged USER true) + Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY valueChanged USER true) public: explicit BitcoinAmountField(QWidget *parent = 0); @@ -49,20 +50,15 @@ public: QWidget *setupTabChain(QWidget *prev); signals: - void textChanged(); + void valueChanged(); protected: /** Intercept focus-in event and ',' key presses */ bool eventFilter(QObject *object, QEvent *event); private: - QDoubleSpinBox *amount; + AmountSpinBox *amount; QValueComboBox *unit; - int currentUnit; - qint64 nSingleStep; - - void setText(const QString &text); - QString text() const; private slots: void unitChanged(int idx); |