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_RECENTREQUESTSTABLEMODEL_H6#define BITCOIN_QT_RECENTREQUESTSTABLEMODEL_H8#include <qt/sendcoinsrecipient.h>10#include <string>12#include <QAbstractTableModel>13#include <QStringList>14#include <QDateTime>16class WalletModel;18class RecentRequestEntry19{20public:21RecentRequestEntry() = default;23static constexpr int CURRENT_VERSION{1};24int nVersion{RecentRequestEntry::CURRENT_VERSION};25int64_t id{0};26QDateTime date;27SendCoinsRecipient recipient;29SERIALIZE_METHODS(RecentRequestEntry, obj) {30unsigned int date_timet;31SER_WRITE(obj, date_timet = obj.date.toSecsSinceEpoch());32READWRITE(obj.nVersion, obj.id, date_timet, obj.recipient);33SER_READ(obj, obj.date = QDateTime::fromSecsSinceEpoch(date_timet));34}35};37class RecentRequestEntryLessThan38{39public:40RecentRequestEntryLessThan(int nColumn, Qt::SortOrder fOrder):41column(nColumn), order(fOrder) {}42bool operator()(const RecentRequestEntry& left, const RecentRequestEntry& right) const;44private:45int column;46Qt::SortOrder order;47};49/** Model for list of recently generated payment requests / bitcoin: URIs.50* Part of wallet model.51*/52class RecentRequestsTableModel: public QAbstractTableModel53{54Q_OBJECT56public:57explicit RecentRequestsTableModel(WalletModel *parent);58~RecentRequestsTableModel();60enum ColumnIndex {61Date = 0,62Label = 1,63Message = 2,64Amount = 3,65NUMBER_OF_COLUMNS66};68/** @name Methods overridden from QAbstractTableModel69@{*/70int rowCount(const QModelIndex &parent) const override;71int columnCount(const QModelIndex &parent) const override;72QVariant data(const QModelIndex &index, int role) const override;73bool setData(const QModelIndex &index, const QVariant &value, int role) override;74QVariant headerData(int section, Qt::Orientation orientation, int role) const override;75QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;76bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;77Qt::ItemFlags flags(const QModelIndex &index) const override;78void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;79/*@}*/81const RecentRequestEntry &entry(int row) const { return list[row]; }82void addNewRequest(const SendCoinsRecipient &recipient);83void addNewRequest(const std::string &recipient);84void addNewRequest(RecentRequestEntry &recipient);86public Q_SLOTS:87void updateDisplayUnit();89private:90WalletModel *walletModel;91QStringList columns;92QList<RecentRequestEntry> list;93int64_t nReceiveRequestsMaxId{0};95/** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */96void updateAmountColumnTitle();97/** Gets title for amount column including current display unit if optionsModel reference available. */98QString getAmountTitle();99};101#endif // BITCOIN_QT_RECENTREQUESTSTABLEMODEL_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.