account: fix balance order

This commit is contained in:
tobtoht 2023-06-13 12:39:23 +02:00
parent 744c892ba0
commit f8a3df1489
No known key found for this signature in database
GPG key ID: E45B10DD027D2472

View file

@ -7,6 +7,8 @@
#include <QFont> #include <QFont>
#include "utils/Utils.h" #include "utils/Utils.h"
#include "libwalletqt/WalletManager.h"
SubaddressAccountModel::SubaddressAccountModel(QObject *parent, SubaddressAccount *subaddressAccount) SubaddressAccountModel::SubaddressAccountModel(QObject *parent, SubaddressAccount *subaddressAccount)
: QAbstractTableModel(parent) : QAbstractTableModel(parent)
, m_subaddressAccount(subaddressAccount) , m_subaddressAccount(subaddressAccount)
@ -84,8 +86,14 @@ QVariant SubaddressAccountModel::parseSubaddressAccountRow(const Monero::Subaddr
case Label: case Label:
return QString::fromStdString(row.getLabel()); return QString::fromStdString(row.getLabel());
case Balance: case Balance:
if (role == Qt::UserRole) {
return WalletManager::amountFromString(QString::fromStdString(row.getBalance()));
}
return QString::fromStdString(row.getBalance()); return QString::fromStdString(row.getBalance());
case UnlockedBalance: case UnlockedBalance:
if (role == Qt::UserRole) {
return WalletManager::amountFromString(QString::fromStdString(row.getUnlockedBalance()));
}
return QString::fromStdString(row.getUnlockedBalance()); return QString::fromStdString(row.getUnlockedBalance());
default: default:
return QVariant(); return QVariant();