Bitcoin ABC  0.24.7
P2P Digital Currency
bitcoinamountfield.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2015 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_QT_BITCOINAMOUNTFIELD_H
6 #define BITCOIN_QT_BITCOINAMOUNTFIELD_H
7 
8 #include <amount.h>
9 
10 #include <QWidget>
11 
12 class AmountSpinBox;
13 
14 QT_BEGIN_NAMESPACE
15 class QValueComboBox;
16 QT_END_NAMESPACE
17 
20 class BitcoinAmountField : public QWidget {
21  Q_OBJECT
22 
23  Q_PROPERTY(
24  Amount value READ value WRITE setValue NOTIFY valueChanged USER true)
25 
26 public:
27  explicit BitcoinAmountField(QWidget *parent = nullptr);
28 
29  Amount value(bool *value = nullptr) const;
30  void setValue(const Amount value);
31 
36  void SetAllowEmpty(bool allow);
37 
39  void SetMinValue(const Amount &value);
40 
42  void SetMaxValue(const Amount &value);
43 
45  void setSingleStep(const Amount step);
46 
48  void setReadOnly(bool fReadOnly);
49 
51  void setValid(bool valid);
54  bool validate();
55 
57  void setDisplayUnit(int unit);
58 
60  void clear();
61 
63  void setEnabled(bool fEnabled);
64 
69  QWidget *setupTabChain(QWidget *prev);
70 
71 Q_SIGNALS:
72  void valueChanged();
73 
74 protected:
76  bool eventFilter(QObject *object, QEvent *event) override;
77 
78 private:
81 
82 private Q_SLOTS:
83  void unitChanged(int idx);
84 };
85 
86 #endif // BITCOIN_QT_BITCOINAMOUNTFIELD_H
BitcoinAmountField::SetAllowEmpty
void SetAllowEmpty(bool allow)
If allow empty is set to false the field will be set to the minimum allowed value if left empty.
Definition: bitcoinamountfield.cpp:299
BitcoinAmountField::unitChanged
void unitChanged(int idx)
Definition: bitcoinamountfield.cpp:314
BitcoinAmountField::valueChanged
void valueChanged()
BitcoinAmountField::setReadOnly
void setReadOnly(bool fReadOnly)
Make read-only.
Definition: bitcoinamountfield.cpp:310
BitcoinAmountField::unit
QValueComboBox * unit
Definition: bitcoinamountfield.h:80
BitcoinAmountField::setDisplayUnit
void setDisplayUnit(int unit)
Change unit used to display amount.
Definition: bitcoinamountfield.cpp:324
QValueComboBox
Definition: qvaluecombobox.h:13
BitcoinAmountField::SetMaxValue
void SetMaxValue(const Amount &value)
Set the maximum value in satoshis.
Definition: bitcoinamountfield.cpp:307
BitcoinAmountField::value
Amount value
Definition: bitcoinamountfield.h:24
BitcoinAmountField::SetMinValue
void SetMinValue(const Amount &value)
Set the minimum value in satoshis.
Definition: bitcoinamountfield.cpp:303
BitcoinAmountField::setupTabChain
QWidget * setupTabChain(QWidget *prev)
Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project....
Definition: bitcoinamountfield.cpp:285
BitcoinAmountField::eventFilter
bool eventFilter(QObject *object, QEvent *event) override
Intercept focus-in event and ',' key presses.
Definition: bitcoinamountfield.cpp:277
AmountSpinBox
QSpinBox that uses fixed-point numbers internally and uses our own formatting/parsing functions.
Definition: bitcoinamountfield.cpp:22
Amount
Definition: amount.h:19
BitcoinAmountField::clear
void clear()
Make field empty and ready for new input.
Definition: bitcoinamountfield.cpp:252
BitcoinAmountField::amount
AmountSpinBox * amount
Definition: bitcoinamountfield.h:79
BitcoinAmountField::setValid
void setValid(bool valid)
Mark current value as invalid in UI.
Definition: bitcoinamountfield.cpp:269
BitcoinAmountField
Widget for entering bitcoin amounts.
Definition: bitcoinamountfield.h:20
BitcoinAmountField::BitcoinAmountField
BitcoinAmountField(QWidget *parent=nullptr)
Definition: bitcoinamountfield.cpp:220
BitcoinAmountField::setSingleStep
void setSingleStep(const Amount step)
Set single step in satoshis.
Definition: bitcoinamountfield.cpp:328
amount.h
BitcoinAmountField::setValue
void setValue(const Amount value)
Definition: bitcoinamountfield.cpp:295
BitcoinAmountField::validate
bool validate()
Perform input validation, mark field as invalid if entered value is not valid.
Definition: bitcoinamountfield.cpp:262
BitcoinAmountField::setEnabled
void setEnabled(bool fEnabled)
Enable/Disable.
Definition: bitcoinamountfield.cpp:257