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_TRANSACTIONTABLEMODEL_H6#define BITCOIN_QT_TRANSACTIONTABLEMODEL_H8#include <qt/bitcoinunits.h>10#include <QAbstractTableModel>11#include <QStringList>13#include <memory>15namespace interfaces {16class Handler;17}19class PlatformStyle;20class TransactionRecord;21class TransactionTablePriv;22class WalletModel;24/** UI model for the transaction table of a wallet.25*/26class TransactionTableModel : public QAbstractTableModel27{28Q_OBJECT30public:31explicit TransactionTableModel(const PlatformStyle *platformStyle, WalletModel *parent = nullptr);32~TransactionTableModel();34enum ColumnIndex {35Status = 0,36Date = 1,37Type = 2,38ToAddress = 3,39Amount = 440};42/** Roles to get specific information from a transaction row.43These are independent of column.44*/45enum RoleIndex {46/** Type of transaction */47TypeRole = Qt::UserRole,48/** Date and time this transaction was created */49DateRole,50/** Long description (HTML format) */51LongDescriptionRole,52/** Address of transaction */53AddressRole,54/** Label of address related to transaction */55LabelRole,56/** Net amount of transaction */57AmountRole,58/** Transaction hash */59TxHashRole,60/** Transaction data, hex-encoded */61TxHexRole,62/** Whole transaction as plain text */63TxPlainTextRole,64/** Is transaction confirmed? */65ConfirmedRole,66/** Formatted amount, without brackets when unconfirmed */67FormattedAmountRole,68/** Transaction status (TransactionRecord::Status) */69StatusRole,70/** Unprocessed icon */71RawDecorationRole,72};74int rowCount(const QModelIndex &parent) const override;75int columnCount(const QModelIndex &parent) const override;76QVariant data(const QModelIndex &index, int role) const override;77QVariant headerData(int section, Qt::Orientation orientation, int role) const override;78QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const override;79bool processingQueuedTransactions() const { return fProcessingQueuedTransactions; }81private:82WalletModel *walletModel;83std::unique_ptr<interfaces::Handler> m_handler_transaction_changed;84std::unique_ptr<interfaces::Handler> m_handler_show_progress;85QStringList columns;86TransactionTablePriv *priv;87bool fProcessingQueuedTransactions{false};88const PlatformStyle *platformStyle;90void subscribeToCoreSignals();91void unsubscribeFromCoreSignals();93QString lookupAddress(const std::string &address, bool tooltip) const;94QVariant addressColor(const TransactionRecord *wtx) const;95QString formatTxStatus(const TransactionRecord *wtx) const;96QString formatTxDate(const TransactionRecord *wtx) const;97QString formatTxType(const TransactionRecord *wtx) const;98QString formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const;99QString formatTxAmount(const TransactionRecord *wtx, bool showUnconfirmed=true, BitcoinUnits::SeparatorStyle separators=BitcoinUnits::SeparatorStyle::STANDARD) const;100QString formatTooltip(const TransactionRecord *rec) const;101QVariant txStatusDecoration(const TransactionRecord *wtx) const;102QVariant txAddressDecoration(const TransactionRecord *wtx) const;104public Q_SLOTS:105/* New transaction, or transaction changed status */106void updateTransaction(const QString &hash, int status, bool showTransaction);107void updateConfirmations();108void updateDisplayUnit();109/** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */110void updateAmountColumnTitle();111/* Needed to update fProcessingQueuedTransactions through a QueuedConnection */112void setProcessingQueuedTransactions(bool value) { fProcessingQueuedTransactions = value; }114friend class TransactionTablePriv;115};117#endif // BITCOIN_QT_TRANSACTIONTABLEMODEL_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.