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#include <qt/receiverequestdialog.h>6#include <qt/forms/ui_receiverequestdialog.h>8#include <qt/bitcoinunits.h>9#include <qt/guiutil.h>10#include <qt/optionsmodel.h>11#include <qt/qrimagewidget.h>12#include <qt/walletmodel.h>14#include <QDialog>15#include <QString>17#include <bitcoin-build-config.h> // IWYU pragma: keep19ReceiveRequestDialog::ReceiveRequestDialog(QWidget* parent)20: QDialog(parent, GUIUtil::dialog_flags),21ui(new Ui::ReceiveRequestDialog)22{23ui->setupUi(this);24GUIUtil::handleCloseWindowShortcut(this);25}27ReceiveRequestDialog::~ReceiveRequestDialog()28{29delete ui;30}32void ReceiveRequestDialog::setModel(WalletModel *_model)33{34this->model = _model;36if (_model)37connect(_model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &ReceiveRequestDialog::updateDisplayUnit);39// update the display unit if necessary40update();41}43void ReceiveRequestDialog::setInfo(const SendCoinsRecipient &_info)44{45this->info = _info;46setWindowTitle(tr("Request payment to %1").arg(info.label.isEmpty() ? info.address : info.label));47QString uri = GUIUtil::formatBitcoinURI(info);49#ifdef USE_QRCODE50if (ui->qr_code->setQR(uri, info.address)) {51connect(ui->btnSaveAs, &QPushButton::clicked, ui->qr_code, &QRImageWidget::saveImage);52} else {53ui->btnSaveAs->setEnabled(false);54}55#else56ui->btnSaveAs->hide();57ui->qr_code->hide();58#endif60ui->uri_content->setText("<a href=\"" + uri + "\">" + GUIUtil::HtmlEscape(uri) + "</a>");61ui->address_content->setText(info.address);63if (!info.amount) {64ui->amount_tag->hide();65ui->amount_content->hide();66} // Amount is set in updateDisplayUnit() slot.67updateDisplayUnit();69if (!info.label.isEmpty()) {70ui->label_content->setText(info.label);71} else {72ui->label_tag->hide();73ui->label_content->hide();74}76if (!info.message.isEmpty()) {77ui->message_content->setText(info.message);78} else {79ui->message_tag->hide();80ui->message_content->hide();81}83if (!model->getWalletName().isEmpty()) {84ui->wallet_content->setText(model->getWalletName());85} else {86ui->wallet_tag->hide();87ui->wallet_content->hide();88}90ui->btnVerify->setVisible(model->wallet().hasExternalSigner());92connect(ui->btnVerify, &QPushButton::clicked, [this] {93model->displayAddress(info.address.toStdString());94});95}97void ReceiveRequestDialog::updateDisplayUnit()98{99if (!model) return;100ui->amount_content->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), info.amount));101}103void ReceiveRequestDialog::on_btnCopyURI_clicked()104{105GUIUtil::setClipboard(GUIUtil::formatBitcoinURI(info));106}108void ReceiveRequestDialog::on_btnCopyAddress_clicked()109{110GUIUtil::setClipboard(info.address);111}
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.