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.
501dlg->setAttribute(Qt::WA_DeleteOnClose);502m_opened_dialogs.append(dlg);503connect(dlg, &QObject::destroyed, [this, dlg] {504m_opened_dialogs.removeOne(dlg);505});506dlg->show();507}508}510void TransactionView::openThirdPartyTxUrl(QString url)511{512if(!transactionView || !transactionView->selectionModel())513return;514QModelIndexList selection = transactionView->selectionModel()->selectedRows(0);515if(!selection.isEmpty())516QDesktopServices::openUrl(QUrl::fromUserInput(url.replace("%s", selection.at(0).data(TransactionTableModel::TxHashRole).toString())));517}519QWidget *TransactionView::createDateRangeWidget()520{521dateRangeWidget = new QFrame();522dateRangeWidget->setFrameStyle(static_cast<int>(QFrame::Panel) | static_cast<int>(QFrame::Raised));523dateRangeWidget->setContentsMargins(1,1,1,1);524QHBoxLayout *layout = new QHBoxLayout(dateRangeWidget);525layout->setContentsMargins(0,0,0,0);526layout->addSpacing(23);527layout->addWidget(new QLabel(tr("Range:")));529dateFrom = new QDateTimeEdit(this);530dateFrom->setDisplayFormat("dd/MM/yy");531dateFrom->setCalendarPopup(true);532dateFrom->setMinimumWidth(100);533dateFrom->setDate(QDate::currentDate().addDays(-7));534layout->addWidget(dateFrom);535layout->addWidget(new QLabel(tr("to")));537dateTo = new QDateTimeEdit(this);538dateTo->setDisplayFormat("dd/MM/yy");539dateTo->setCalendarPopup(true);540dateTo->setMinimumWidth(100);541dateTo->setDate(QDate::currentDate());542layout->addWidget(dateTo);543layout->addStretch();545// Hide by default546dateRangeWidget->setVisible(false);548// Notify on change549connect(dateFrom, &QDateTimeEdit::dateChanged, this, &TransactionView::dateRangeChanged);550connect(dateTo, &QDateTimeEdit::dateChanged, this, &TransactionView::dateRangeChanged);552return dateRangeWidget;553}555void TransactionView::dateRangeChanged()556{557if(!transactionProxyModel)558return;559transactionProxyModel->setDateRange(560GUIUtil::StartOfDay(dateFrom->date()),561GUIUtil::StartOfDay(dateTo->date()).addDays(1));562}564void TransactionView::focusTransaction(const QModelIndex &idx)565{566if(!transactionProxyModel)567return;568QModelIndex targetIdx = transactionProxyModel->mapFromSource(idx);569transactionView->scrollTo(targetIdx);570transactionView->setCurrentIndex(targetIdx);571transactionView->setFocus();572}574void TransactionView::focusTransaction(const Txid& txid)575{576if (!transactionProxyModel)577return;579const QModelIndexList results = this->model->getTransactionTableModel()->match(580this->model->getTransactionTableModel()->index(0,0),581TransactionTableModel::TxHashRole,582QString::fromStdString(txid.ToString()), -1);584transactionView->setFocus();585transactionView->selectionModel()->clearSelection();586for (const QModelIndex& index : results) {587const QModelIndex targetIndex = transactionProxyModel->mapFromSource(index);588transactionView->selectionModel()->select(589targetIndex,590QItemSelectionModel::Rows | QItemSelectionModel::Select);591// Called once per destination to ensure all results are in view, unless592// transactions are not ordered by (ascending or descending) date.593transactionView->scrollTo(targetIndex);594// scrollTo() does not scroll far enough the first time when transactions595// are ordered by ascending date.596if (index == results[0]) transactionView->scrollTo(targetIndex);597}598}600// Need to override default Ctrl+C action for amount as default behaviour is just to copy DisplayRole text601bool TransactionView::eventFilter(QObject *obj, QEvent *event)602{603if (event->type() == QEvent::KeyPress)604{605QKeyEvent *ke = static_cast<QKeyEvent *>(event);606if (ke->key() == Qt::Key_C && ke->modifiers().testFlag(Qt::ControlModifier))607{608GUIUtil::copyEntryData(transactionView, 0, TransactionTableModel::TxPlainTextRole);609return true;610}611}612if (event->type() == QEvent::EnabledChange) {613if (!isEnabled()) {614closeOpenedDialogs();615}616}617return QWidget::eventFilter(obj, event);618}620void TransactionView::closeOpenedDialogs()621{622// close all dialogs opened from this view623for (QDialog* dlg : m_opened_dialogs) {624dlg->close();625}626m_opened_dialogs.clear();627}
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.