Update Bugreport Links
[bitcoinplatinum.git] / src / qt / bitcoinamountfield.h
blob66792e00a9ede10bfad00f89a7f80f5e7d70b1a2
1 #ifndef BITCOINFIELD_H
2 #define BITCOINFIELD_H
4 #include <QWidget>
6 QT_BEGIN_NAMESPACE
7 class QDoubleSpinBox;
8 class QValueComboBox;
9 QT_END_NAMESPACE
11 /** Widget for entering bitcoin amounts.
13 class BitcoinAmountField: public QWidget
15 Q_OBJECT
16 Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY textChanged USER true)
17 public:
18 explicit BitcoinAmountField(QWidget *parent = 0);
20 qint64 value(bool *valid=0) const;
21 void setValue(qint64 value);
23 /** Mark current value as invalid in UI. */
24 void setValid(bool valid);
25 /** Perform input validation, mark field as invalid if entered value is not valid. */
26 bool validate();
28 /** Change unit used to display amount. */
29 void setDisplayUnit(int unit);
31 /** Make field empty and ready for new input. */
32 void clear();
34 /** Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project.org/browse/QTBUG-10907),
35 in these cases we have to set it up manually.
37 QWidget *setupTabChain(QWidget *prev);
39 signals:
40 void textChanged();
42 protected:
43 /** Intercept focus-in event and ',' key presses */
44 bool eventFilter(QObject *object, QEvent *event);
46 private:
47 QDoubleSpinBox *amount;
48 QValueComboBox *unit;
49 int currentUnit;
51 void setText(const QString &text);
52 QString text() const;
54 private slots:
55 void unitChanged(int idx);
60 #endif // BITCOINFIELD_H