16 QAbstractTableModel(parent), walletModel(parent)
21 std::vector<std::string> vReceiveRequests;
23 for (
const std::string& request : vReceiveRequests)
56 if(role == Qt::DisplayRole || role == Qt::EditRole)
59 switch(
index.column())
66 return tr(
"(no label)");
75 return tr(
"(no message)");
83 return tr(
"(no amount requested)");
84 else if (role == Qt::EditRole)
90 else if (role == Qt::TextAlignmentRole)
93 return (
int)(Qt::AlignRight|Qt::AlignVCenter);
105 if(orientation == Qt::Horizontal)
107 if(role == Qt::DisplayRole && section <
columns.size())
132 return createIndex(row, column);
139 if(count > 0 && row >= 0 && (row+count) <=
list.size())
141 for (
int i = 0; i < count; ++i)
148 beginRemoveRows(parent, row, row + count - 1);
149 list.erase(
list.begin() + row,
list.begin() + row + count);
159 return Qt::ItemIsSelectable | Qt::ItemIsEnabled;
167 newEntry.
date = QDateTime::currentDateTime();
182 std::vector<char>
data(recipient.begin(), recipient.end());
200 beginInsertRows(QModelIndex(), 0, 0);
201 list.prepend(recipient);
220 if (
order == Qt::DescendingOrder)
221 std::swap(pLeft, pRight);
226 return pLeft->
date.toTime_t() < pRight->
date.toTime_t();
234 return pLeft->
id < pRight->
id;
void loadReceiveRequests(std::vector< std::string > &vReceiveRequests)
bool setData(const QModelIndex &index, const QVariant &value, int role)
void addNewRequest(const SendCoinsRecipient &recipient)
void sort(int column, Qt::SortOrder order=Qt::AscendingOrder)
int64_t nReceiveRequestsMaxId
~RecentRequestsTableModel()
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
QString dateTimeStr(const QDateTime &date)
Double ended buffer combining vector and stream-like interfaces.
int getDisplayUnit() const
QList< RecentRequestEntry > list
QVariant headerData(int section, Qt::Orientation orientation, int role) const
int rowCount(const QModelIndex &parent) const
static QString shortName(int unit)
Short name.
QModelIndex index(int row, int column, const QModelIndex &parent) const
SendCoinsRecipient recipient
const RecentRequestEntry & entry(int row) const
bool operator()(RecentRequestEntry &left, RecentRequestEntry &right) const
void displayUnitChanged(int unit)
QVariant data(const QModelIndex &index, int role) const
WalletModel * walletModel
Interface to Bitcoin wallet from Qt view code.
void updateAmountColumnTitle()
Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table hea...
int columnCount(const QModelIndex &parent) const
bool saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest)
RecentRequestsTableModel(WalletModel *parent)
QString getAmountTitle()
Gets title for amount column including current display unit if optionsModel reference available...
static QString format(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
Format as string.
OptionsModel * getOptionsModel()
Qt::ItemFlags flags(const QModelIndex &index) const