Fetch ZEC Price for display purposes

This commit is contained in:
Aditya Kulkarni
2018-10-18 11:15:49 -07:00
parent 6f79abcc14
commit 1b2335c0d4
9 changed files with 108 additions and 9 deletions

View File

@@ -1,4 +1,5 @@
#include "txtablemodel.h"
#include "settings.h"
#include "utils.h"
TxTableModel::TxTableModel(QObject *parent)
@@ -53,7 +54,13 @@ void TxTableModel::setNewData(QList<TransactionItem>* data) {
case 0: return modeldata->at(index.row()).type;
case 1: return modeldata->at(index.row()).address;
case 2: return modeldata->at(index.row()).datetime;
case 3: return QVariant(QString::number(modeldata->at(index.row()).amount, 'g', 8) % " " % Utils::getTokenName());
case 3: {
if (role == Qt::DisplayRole)
return QVariant(QString::number(modeldata->at(index.row()).amount, 'g', 8) % " " % Utils::getTokenName());
else {
return "$ " + QString::number(Settings::getInstance()->getZECPrice() * modeldata->at(index.row()).amount, 'f', 2);
}
}
}
}