Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
transactiontablemodel.h
Go to the documentation of this file.
1// Copyright (c) 2011-2016 The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#ifndef BITCOIN_QT_TRANSACTIONTABLEMODEL_H
6#define BITCOIN_QT_TRANSACTIONTABLEMODEL_H
7
8#include <qt/bitcoinunits.h>
9
10#include <QAbstractTableModel>
11#include <QStringList>
12
13#include <memory>
14
15namespace interfaces {
16class Handler;
17}
18
19class PlatformStyle;
22class WalletModel;
23
27class TransactionTableModel : public QAbstractTableModel {
29
30public:
32 WalletModel *parent = nullptr);
34
36 Status = 0,
38 Date = 2,
39 Type = 3,
41 Amount = 5
42 };
43
82
83 int rowCount(const QModelIndex &parent) const override;
84 int columnCount(const QModelIndex &parent) const override;
85 QVariant data(const QModelIndex &index, int role) const override;
86 QVariant headerData(int section, Qt::Orientation orientation,
87 int role) const override;
88 QModelIndex index(int row, int column,
89 const QModelIndex &parent = QModelIndex()) const override;
93
94private:
96 std::unique_ptr<interfaces::Handler> m_handler_transaction_changed;
97 std::unique_ptr<interfaces::Handler> m_handler_show_progress;
102
105
106 QString lookupAddress(const std::string &address, bool tooltip) const;
107 QVariant addressColor(const TransactionRecord *wtx) const;
108 QString formatTxStatus(const TransactionRecord *wtx) const;
109 QString formatTxDate(const TransactionRecord *wtx) const;
110 QString formatTxType(const TransactionRecord *wtx) const;
111 QString formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const;
113 bool showUnconfirmed = true,
120
121public Q_SLOTS:
125 void updateTransaction(const QString &hash, int status,
126 bool showTransaction);
127 void updateConfirmations();
128 void updateDisplayUnit();
141
143};
144
145#endif // BITCOIN_QT_TRANSACTIONTABLEMODEL_H
UI model for a transaction.
UI model for the transaction table of a wallet.
QVariant txStatusDecoration(const TransactionRecord *wtx) const
TransactionTablePriv * priv
QVariant addressColor(const TransactionRecord *wtx) const
RoleIndex
Roles to get specific information from a transaction row.
@ TxPlainTextRole
Whole transaction as plain text.
@ LabelRole
Label of address related to transaction.
@ LongDescriptionRole
Long description (HTML format)
@ TypeRole
Type of transaction.
@ StatusRole
Transaction status (TransactionRecord::Status)
@ DateRole
Date and time this transaction was created.
@ TxHashRole
Transaction hash.
@ TxHexRole
Transaction data, hex-encoded.
@ RawDecorationRole
Unprocessed icon.
@ TxIDRole
Unique identifier.
@ AddressRole
Address of transaction.
@ WatchonlyDecorationRole
Watch-only icon.
@ WatchonlyRole
Watch-only boolean.
@ AmountRole
Net amount of transaction.
@ ConfirmedRole
Is transaction confirmed?
@ FormattedAmountRole
Formatted amount, without brackets when unconfirmed.
QString formatTooltip(const TransactionRecord *rec) const
QString formatTxAmount(const TransactionRecord *wtx, bool showUnconfirmed=true, BitcoinUnits::SeparatorStyle separators=BitcoinUnits::SeparatorStyle::STANDARD) const
QVariant data(const QModelIndex &index, int role) const override
bool processingQueuedTransactions() const
QVariant txWatchonlyDecoration(const TransactionRecord *wtx) const
void updateTransaction(const QString &hash, int status, bool showTransaction)
New transaction, or transaction changed status.
QString formatTxStatus(const TransactionRecord *wtx) const
void setProcessingQueuedTransactions(bool value)
Needed to update fProcessingQueuedTransactions through a QueuedConnection.
std::unique_ptr< interfaces::Handler > m_handler_transaction_changed
int columnCount(const QModelIndex &parent) const override
std::unique_ptr< interfaces::Handler > m_handler_show_progress
int rowCount(const QModelIndex &parent) const override
void updateAmountColumnTitle()
Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table hea...
QString formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
const PlatformStyle * platformStyle
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
QString formatTxType(const TransactionRecord *wtx) const
QString lookupAddress(const std::string &address, bool tooltip) const
Look up address in address book, if found return label (address) otherwise just return (address)
QVariant txAddressDecoration(const TransactionRecord *wtx) const
QString formatTxDate(const TransactionRecord *wtx) const
Interface to Bitcoin wallet from Qt view code.
Definition walletmodel.h:47
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition random.h:85