Fetch ZEC Price for display purposes
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "balancestablemodel.h"
|
||||
#include "settings.h"
|
||||
#include "utils.h"
|
||||
|
||||
BalancesTableModel::BalancesTableModel(QObject *parent)
|
||||
@@ -68,12 +69,22 @@ QVariant BalancesTableModel::data(const QModelIndex &index, int role) const
|
||||
return b;
|
||||
}
|
||||
|
||||
if (role == Qt::DisplayRole || role == Qt::ToolTipRole) {
|
||||
if (role == Qt::DisplayRole) {
|
||||
switch (index.column()) {
|
||||
case 0: return std::get<0>(modeldata->at(index.row()));
|
||||
case 1: return QVariant(std::get<1>(modeldata->at(index.row())) % " " % Utils::getTokenName());
|
||||
}
|
||||
}
|
||||
|
||||
if(role == Qt::ToolTipRole) {
|
||||
switch (index.column()) {
|
||||
case 0: return std::get<0>(modeldata->at(index.row()));
|
||||
case 1: {
|
||||
auto bal = std::get<1>(modeldata->at(index.row())).toDouble();
|
||||
return "$ " + QString::number(bal * Settings::getInstance()->getZECPrice(), 'f', 2); // Use 'f' notation to get 2 decimal places
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user