Feathercoin  0.5.0
P2P Digital Currency
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
bitcoinamountfield.h
Go to the documentation of this file.
1 #ifndef BITCOINAMOUNTFIELD_H
2 #define BITCOINAMOUNTFIELD_H
3 
4 #include <QWidget>
5 
6 QT_BEGIN_NAMESPACE
7 class QDoubleSpinBox;
8 class QValueComboBox;
9 QT_END_NAMESPACE
10 
13 class BitcoinAmountField: public QWidget
14 {
15  Q_OBJECT
16 
17  Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY textChanged USER true)
18 
19 public:
20  explicit BitcoinAmountField(QWidget *parent = 0);
21 
22  qint64 value(bool *valid=0) const;
23  void setValue(qint64 value);
24 
26  void setValid(bool valid);
28  bool validate();
29 
31  void setDisplayUnit(int unit);
32 
34  void clear();
35 
39  QWidget *setupTabChain(QWidget *prev);
40 
41 signals:
42  void textChanged();
43 
44 protected:
46  bool eventFilter(QObject *object, QEvent *event);
47 
48 private:
49  QDoubleSpinBox *amount;
52 
53  void setText(const QString &text);
54  QString text() const;
55 
56 private slots:
57  void unitChanged(int idx);
58 
59 };
60 
61 #endif // BITCOINAMOUNTFIELD_H
Widget for entering bitcoin amounts.
LRUHandle * prev
Definition: cache.cc:30
bool validate()
Perform input validation, mark field as invalid if entered value is not valid.
QDoubleSpinBox * amount
QWidget * setupTabChain(QWidget *prev)
Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project.org/browse/QTBUG-10907), in these cases we have to set it up manually.
bool eventFilter(QObject *object, QEvent *event)
Intercept focus-in event and ',' key presses.
QString text() const
BitcoinAmountField(QWidget *parent=0)
QValueComboBox * unit
void clear()
Make field empty and ready for new input.
void setValid(bool valid)
Mark current value as invalid in UI.
void setText(const QString &text)
void setDisplayUnit(int unit)
Change unit used to display amount.
void setValue(qint64 value)