Skip to content

Commit

Permalink
Add icons for memo
Browse files Browse the repository at this point in the history
  • Loading branch information
adityapk00 committed Oct 26, 2018
1 parent e2a61d6 commit cde3581
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/txtablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,7 @@ void TxTableModel::updateAllData() {
auto dat = modeldata->at(index.row());
if (role == Qt::DisplayRole) {
switch (index.column()) {
case 0: {
QString labels = (dat.type == "send" ? "S" : "R");
if (!dat.memo.isEmpty())
labels = labels + " M";
return labels;
}
case 0: return dat.type;
case 1: {
auto addr = modeldata->at(index.row()).address;
if (addr.trimmed().isEmpty())
Expand Down Expand Up @@ -124,6 +119,19 @@ void TxTableModel::updateAllData() {
}
}

if (role == Qt::DecorationRole && index.column() == 0) {
if (!dat.memo.isEmpty()) {
// Return the info pixmap to indicate memo
QIcon icon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation);
return QVariant(icon.pixmap(16, 16));
} else {
// Empty pixmap to make it align
QPixmap p(16, 16);
p.fill(Qt::white);
return QVariant(p);
}
}

return QVariant();
}

Expand Down

0 comments on commit cde3581

Please sign in to comment.