Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
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 <consensus/amount.h>
9
10#include <QWidget>
11
12class AmountSpinBox;
13
15class QValueComboBox;
17
20class BitcoinAmountField : public QWidget {
22
25
26public:
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
73
74protected:
76 bool eventFilter(QObject *object, QEvent *event) override;
77
78private:
81
82private Q_SLOTS:
83 void unitChanged(int idx);
84};
85
86#endif // BITCOIN_QT_BITCOINAMOUNTFIELD_H
QSpinBox that uses fixed-point numbers internally and uses our own formatting/parsing functions.
Widget for entering bitcoin amounts.
AmountSpinBox * amount
void setEnabled(bool fEnabled)
Enable/Disable.
void SetMaxValue(const Amount &value)
Set the maximum value in satoshis.
QValueComboBox * unit
bool eventFilter(QObject *object, QEvent *event) override
Intercept focus-in event and ',' key presses.
void setReadOnly(bool fReadOnly)
Make read-only.
void setDisplayUnit(int unit)
Change unit used to display amount.
void clear()
Make field empty and ready for new input.
bool validate()
Perform input validation, mark field as invalid if entered value is not valid.
QWidget * setupTabChain(QWidget *prev)
Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project....
void setValue(const Amount value)
void setValid(bool valid)
Mark current value as invalid in UI.
void SetAllowEmpty(bool allow)
If allow empty is set to false the field will be set to the minimum allowed value if left empty.
void setSingleStep(const Amount step)
Set single step in satoshis.
void SetMinValue(const Amount &value)
Set the minimum value in satoshis.
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition random.h:85