MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / data

Method data

src/qt/recentrequeststablemodel.cpp:51–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51QVariant RecentRequestsTableModel::data(const QModelIndex &index, int role) const
52{
53 if(!index.isValid() || index.row() >= list.length())
54 return QVariant();
55
56 if(role == Qt::DisplayRole || role == Qt::EditRole)
57 {
58 const RecentRequestEntry *rec = &list[index.row()];
59 switch(index.column())
60 {
61 case Date:
62 return GUIUtil::dateTimeStr(rec->date);
63 case Label:
64 if(rec->recipient.label.isEmpty() && role == Qt::DisplayRole)
65 {
66 return tr("(no label)");
67 }
68 else
69 {
70 return rec->recipient.label;
71 }
72 case Message:
73 if(rec->recipient.message.isEmpty() && role == Qt::DisplayRole)
74 {
75 return tr("(no message)");
76 }
77 else
78 {
79 return rec->recipient.message;
80 }
81 case Amount:
82 if (rec->recipient.amount == 0 && role == Qt::DisplayRole)
83 return tr("(no amount requested)");
84 else if (role == Qt::EditRole)
85 return BitcoinUnits::format(walletModel->getOptionsModel()->getDisplayUnit(), rec->recipient.amount, false, BitcoinUnits::separatorNever);
86 else
87 return BitcoinUnits::format(walletModel->getOptionsModel()->getDisplayUnit(), rec->recipient.amount);
88 }
89 }
90 else if (role == Qt::TextAlignmentRole)
91 {
92 if (index.column() == Amount)
93 return (int)(Qt::AlignRight|Qt::AlignVCenter);
94 }
95 return QVariant();
96}
97
98bool RecentRequestsTableModel::setData(const QModelIndex &index, const QVariant &value, int role)
99{

Callers

nothing calls this directly

Calls 5

dateTimeStrFunction · 0.85
formatFunction · 0.85
getDisplayUnitMethod · 0.80
isValidMethod · 0.45
getOptionsModelMethod · 0.45

Tested by

no test coverage detected