Master Core  v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
bitcoinamountfield.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2013 The Bitcoin developers
2 // Distributed under the MIT/X11 software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOINAMOUNTFIELD_H
6 #define BITCOINAMOUNTFIELD_H
7 
8 #include <QWidget>
9 
10 QT_BEGIN_NAMESPACE
11 class QDoubleSpinBox;
12 class QValueComboBox;
13 QT_END_NAMESPACE
14 
18 {
19  Q_OBJECT
20 
21  Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY textChanged USER true)
22 
23 public:
24  explicit BitcoinAmountField(QWidget *parent = 0);
25 
26  qint64 value(bool *valid=0) const;
27  void setValue(qint64 value);
28 
30  void setSingleStep(qint64 step);
31 
33  void setReadOnly(bool fReadOnly);
34 
36  void setValid(bool valid);
38  bool validate();
39 
41  void setDisplayUnit(int unit);
42 
44  void clear();
45 
50 
51 signals:
52  void textChanged();
53 
54 protected:
56  bool eventFilter(QObject *object, QEvent *event);
57 
58 private:
59  QDoubleSpinBox *amount;
62  qint64 nSingleStep;
63 
64  void setText(const QString &text);
65  QString text() const;
66 
67 private slots:
68  void unitChanged(int idx);
69 
70 };
71 
72 #endif // BITCOINAMOUNTFIELD_H
Widget for entering bitcoin amounts.
bool validate()
Perform input validation, mark field as invalid if entered value is not valid.
void setReadOnly(bool fReadOnly)
Make read-only.
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 setSingleStep(qint64 step)
Set single step in satoshis.
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)