Browse Source

Add icons for memo

recurring
Aditya Kulkarni 6 years ago
parent
commit
cde3581b53
  1. 20
      src/txtablemodel.cpp

20
src/txtablemodel.cpp

@ -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())
@ -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();
}

Loading…
Cancel
Save