Add icons for memo
This commit is contained in:
@@ -90,12 +90,7 @@ void TxTableModel::updateAllData() {
|
|||||||
auto dat = modeldata->at(index.row());
|
auto dat = modeldata->at(index.row());
|
||||||
if (role == Qt::DisplayRole) {
|
if (role == Qt::DisplayRole) {
|
||||||
switch (index.column()) {
|
switch (index.column()) {
|
||||||
case 0: {
|
case 0: return dat.type;
|
||||||
QString labels = (dat.type == "send" ? "S" : "R");
|
|
||||||
if (!dat.memo.isEmpty())
|
|
||||||
labels = labels + " M";
|
|
||||||
return labels;
|
|
||||||
}
|
|
||||||
case 1: {
|
case 1: {
|
||||||
auto addr = modeldata->at(index.row()).address;
|
auto addr = modeldata->at(index.row()).address;
|
||||||
if (addr.trimmed().isEmpty())
|
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();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user