Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2011-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#ifndef BITCOIN_QT_BITCOINAMOUNTFIELD_H6#define BITCOIN_QT_BITCOINAMOUNTFIELD_H8#include <consensus/amount.h>9#include <qt/bitcoinunits.h>11#include <QWidget>13class AmountSpinBox;15QT_BEGIN_NAMESPACE16class QValueComboBox;17QT_END_NAMESPACE19/** Widget for entering bitcoin amounts.20*/21class BitcoinAmountField: public QWidget22{23Q_OBJECT25// ugly hack: for some unknown reason CAmount (instead of qint64) does not work here as expected26// discussion: https://github.com/bitcoin/bitcoin/pull/511727Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY valueChanged USER true)29public:30explicit BitcoinAmountField(QWidget *parent = nullptr);32CAmount value(bool *value=nullptr) const;33void setValue(const CAmount& value);35/** If allow empty is set to false the field will be set to the minimum allowed value if left empty. **/36void SetAllowEmpty(bool allow);38/** Set the minimum value in satoshis **/39void SetMinValue(const CAmount& value);41/** Set the maximum value in satoshis **/42void SetMaxValue(const CAmount& value);44/** Set single step in satoshis **/45void setSingleStep(const CAmount& step);47/** Make read-only **/48void setReadOnly(bool fReadOnly);50/** Mark current value as invalid in UI. */51void setValid(bool valid);52/** Perform input validation, mark field as invalid if entered value is not valid. */53bool validate();55/** Change unit used to display amount. */56void setDisplayUnit(BitcoinUnit new_unit);58/** Make field empty and ready for new input. */59void clear();61/** Enable/Disable. */62void setEnabled(bool fEnabled);64/** Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project.org/browse/QTBUG-10907),65in these cases we have to set it up manually.66*/67QWidget *setupTabChain(QWidget *prev);69Q_SIGNALS:70void valueChanged();72protected:73/** Intercept focus-in event and ',' key presses */74bool eventFilter(QObject *object, QEvent *event) override;76private:77AmountSpinBox* amount{nullptr};78QValueComboBox *unit;80private Q_SLOTS:81void unitChanged(int idx);83};85#endif // BITCOIN_QT_BITCOINAMOUNTFIELD_H
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.