]> Git Repo - VerusCoin.git/blame - src/qt/bitcoinamountfield.h
Merge branch 'master' of https://github.com/bitcoin/bitcoin
[VerusCoin.git] / src / qt / bitcoinamountfield.h
CommitLineData
f193c57a
WL
1#ifndef BITCOINFIELD_H
2#define BITCOINFIELD_H
3
4#include <QWidget>
5
6QT_BEGIN_NAMESPACE
a5e6d723 7class QValidatedLineEdit;
587e5285 8class QComboBox;
f193c57a
WL
9QT_END_NAMESPACE
10
84114e34
WL
11// Coin amount entry widget with separate parts for whole
12// coins and decimals.
f193c57a
WL
13class BitcoinAmountField: public QWidget
14{
15 Q_OBJECT
587e5285
WL
16 //Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged USER true);
17 Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY textChanged USER true);
f193c57a
WL
18public:
19 explicit BitcoinAmountField(QWidget *parent = 0);
20
587e5285
WL
21 qint64 value(bool *valid=0) const;
22 void setValue(qint64 value);
73cd5e52 23
587e5285
WL
24 // Mark current valid as invalid in UI
25 void setValid(bool valid);
a5e6d723 26 bool validate();
587e5285
WL
27
28 // Make field empty and ready for new input
29 void clear();
30
a5e6d723
WL
31 // Qt messes up the tab chain by default in some cases (issue http://bugreports.qt.nokia.com/browse/QTBUG-10907)
32 // Hence we have to set it up manually
33 QWidget *setupTabChain(QWidget *prev);
f193c57a
WL
34
35signals:
36 void textChanged();
37
38protected:
39 // Intercept '.' and ',' keys, if pressed focus a specified widget
40 bool eventFilter(QObject *object, QEvent *event);
41
42private:
a5e6d723
WL
43 QValidatedLineEdit *amount;
44 QValidatedLineEdit *decimals;
587e5285
WL
45 QComboBox *unit;
46 int currentUnit;
47
48 void setText(const QString &text);
49 QString text() const;
50
51private slots:
52 void unitChanged(int idx);
53
f193c57a
WL
54};
55
56
57#endif // BITCOINFIELD_H
This page took 0.028113 seconds and 4 git commands to generate.