MCPcopy Create free account
hub / github.com/LUX-Core/lux / data

Method data

src/qt/recentrequeststablemodel.cpp:50–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

dateTimeStrFunction · 0.85
formatFunction · 0.85
isValidMethod · 0.45
lengthMethod · 0.45
isEmptyMethod · 0.45
getOptionsModelMethod · 0.45

Tested by

no test coverage detected