Anoncoin  0.9.4
P2P Digital Currency
anoncoinamountfield.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2013 The Bitcoin developers
2 // Copyright (c) 2013-2014 The Anoncoin Core developers
3 // Distributed under the MIT/X11 software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef ANONCOINAMOUNTFIELD_H
7 #define ANONCOINAMOUNTFIELD_H
8 
9 #include <QWidget>
10 
11 QT_BEGIN_NAMESPACE
12 class QDoubleSpinBox;
13 class QValueComboBox;
14 QT_END_NAMESPACE
15 
18 class AnoncoinAmountField: public QWidget
19 {
20  Q_OBJECT
21 
22  Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY textChanged USER true)
23 
24 public:
25  explicit AnoncoinAmountField(QWidget *parent = 0);
26 
27  qint64 value(bool *valid=0) const;
28  void setValue(qint64 value);
29 
31  void setSingleStep(qint64 step);
32 
34  void setReadOnly(bool fReadOnly);
35 
37  void setValid(bool valid);
39  bool validate();
40 
42  void setDisplayUnit(int unit);
43 
45  void clear();
46 
50  QWidget *setupTabChain(QWidget *prev);
51 
52 signals:
53  void textChanged();
54 
55 protected:
57  bool eventFilter(QObject *object, QEvent *event);
58 
59 private:
60  QDoubleSpinBox *amount;
63  qint64 nSingleStep;
64 
65  void setText(const QString &text);
66  QString text() const;
67 
68 private slots:
69  void unitChanged(int idx);
70 
71 };
72 
73 #endif // ANONCOINAMOUNTFIELD_H
void setText(const QString &text)
void setDisplayUnit(int unit)
Change unit used to display amount.
void setValue(qint64 value)
void setValid(bool valid)
Mark current value as invalid in UI.
bool validate()
Perform input validation, mark field as invalid if entered value is not valid.
QValueComboBox * unit
QDoubleSpinBox * amount
Widget for entering anoncoin amounts.
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.
void clear()
Make field empty and ready for new input.
bool eventFilter(QObject *object, QEvent *event)
Intercept focus-in event and ',' key presses.
void setSingleStep(qint64 step)
Set single step in satoshis.
void setReadOnly(bool fReadOnly)
Make read-only.
AnoncoinAmountField(QWidget *parent=0)