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.
251amount->clear();252unit->setCurrentIndex(0);253}255void BitcoinAmountField::setEnabled(bool fEnabled)256{257amount->setEnabled(fEnabled);258unit->setEnabled(fEnabled);259}261bool BitcoinAmountField::validate()262{263bool valid = false;264value(&valid);265setValid(valid);266return valid;267}269void BitcoinAmountField::setValid(bool valid)270{271if (valid)272amount->setStyleSheet("");273else274amount->setStyleSheet(STYLE_INVALID);275}277bool BitcoinAmountField::eventFilter(QObject *object, QEvent *event)278{279if (event->type() == QEvent::FocusIn)280{281// Clear invalid flag on focus282setValid(true);283}284return QWidget::eventFilter(object, event);285}287QWidget *BitcoinAmountField::setupTabChain(QWidget *prev)288{289QWidget::setTabOrder(prev, amount);290QWidget::setTabOrder(amount, unit);291return unit;292}294CAmount BitcoinAmountField::value(bool *valid_out) const295{296return amount->value(valid_out);297}299void BitcoinAmountField::setValue(const CAmount& value)300{301amount->setValue(value);302}304void BitcoinAmountField::SetAllowEmpty(bool allow)305{306amount->SetAllowEmpty(allow);307}309void BitcoinAmountField::SetMinValue(const CAmount& value)310{311amount->SetMinValue(value);312}314void BitcoinAmountField::SetMaxValue(const CAmount& value)315{316amount->SetMaxValue(value);317}319void BitcoinAmountField::setReadOnly(bool fReadOnly)320{321amount->setReadOnly(fReadOnly);322}324void BitcoinAmountField::unitChanged(int idx)325{326// Use description tooltip for current unit for the combobox327unit->setToolTip(unit->itemData(idx, Qt::ToolTipRole).toString());329// Determine new unit ID330QVariant new_unit = unit->currentData(BitcoinUnits::UnitRole);331assert(new_unit.isValid());332amount->setDisplayUnit(new_unit.value<BitcoinUnit>());333}335void BitcoinAmountField::setDisplayUnit(BitcoinUnit new_unit)336{337unit->setValue(QVariant::fromValue(new_unit));338}340void BitcoinAmountField::setSingleStep(const CAmount& step)341{342amount->setSingleStep(step);343}
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.