mirror of
https://github.com/feather-wallet/feather.git
synced 2024-11-16 17:27:38 +00:00
Coins: numerical sort for amount column
This commit is contained in:
parent
51a0f86652
commit
9b7849c5be
3 changed files with 16 additions and 9 deletions
|
@ -42,14 +42,14 @@ CoinsWidget::CoinsWidget(QWidget *parent)
|
|||
// context menu
|
||||
ui->coins->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
m_thawOutputAction = new QAction("Thaw output");
|
||||
m_freezeOutputAction = new QAction("Freeze output");
|
||||
m_thawOutputAction = new QAction("Thaw output", this);
|
||||
m_freezeOutputAction = new QAction("Freeze output", this);
|
||||
|
||||
m_freezeAllSelectedAction = new QAction("Freeze selected");
|
||||
m_thawAllSelectedAction = new QAction("Thaw selected");
|
||||
m_freezeAllSelectedAction = new QAction("Freeze selected", this);
|
||||
m_thawAllSelectedAction = new QAction("Thaw selected", this);
|
||||
|
||||
m_viewOutputAction = new QAction(QIcon(":/assets/images/info.png"), "Details");
|
||||
m_sweepOutputAction = new QAction("Sweep output");
|
||||
m_viewOutputAction = new QAction(QIcon(":/assets/images/info.png"), "Details", this);
|
||||
m_sweepOutputAction = new QAction("Sweep output", this);
|
||||
connect(m_freezeOutputAction, &QAction::triggered, this, &CoinsWidget::freezeOutput);
|
||||
connect(m_thawOutputAction, &QAction::triggered, this, &CoinsWidget::thawOutput);
|
||||
connect(m_viewOutputAction, &QAction::triggered, this, &CoinsWidget::viewOutput);
|
||||
|
@ -65,7 +65,7 @@ CoinsWidget::CoinsWidget(QWidget *parent)
|
|||
void CoinsWidget::setModel(CoinsModel * model, Coins * coins) {
|
||||
m_coins = coins;
|
||||
m_model = model;
|
||||
m_proxyModel = new CoinsProxyModel;
|
||||
m_proxyModel = new CoinsProxyModel(this);
|
||||
m_proxyModel->setSourceModel(m_model);
|
||||
ui->coins->setModel(m_proxyModel);
|
||||
ui->coins->setColumnHidden(CoinsModel::Spent, true);
|
||||
|
@ -202,6 +202,7 @@ void CoinsWidget::onSweepOutput() {
|
|||
qCritical() << "key image: " << keyImage;
|
||||
|
||||
emit sweepOutput(keyImage, dialog->address(), dialog->churn(), dialog->outputs());
|
||||
dialog->deleteLater();
|
||||
}
|
||||
|
||||
void CoinsWidget::copy(copyField field) {
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "Coins.h"
|
||||
#include <wallet/api/wallet2_api.h>
|
||||
#include "ModelUtils.h"
|
||||
#include "globals.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QHash>
|
||||
|
@ -190,10 +191,14 @@ QVariant CoinsModel::parseTransactionInfo(const CoinsInfo &cInfo, int column, in
|
|||
case SpentHeight:
|
||||
return cInfo.spentHeight();
|
||||
case Amount:
|
||||
return QString::number(cInfo.amount() / 1e12, 'f', 12);
|
||||
{
|
||||
if (role == Qt::UserRole) {
|
||||
return cInfo.amount() / globals::cdiv;
|
||||
}
|
||||
return QString::number(cInfo.amount() / globals::cdiv, 'f', 12);
|
||||
}
|
||||
case Frozen:
|
||||
return cInfo.frozen();
|
||||
|
||||
default:
|
||||
{
|
||||
qCritical() << "Unimplemented role";
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
CoinsProxyModel::CoinsProxyModel(QObject *parent)
|
||||
: QSortFilterProxyModel(parent)
|
||||
{
|
||||
setSortRole(Qt::UserRole);
|
||||
}
|
||||
|
||||
bool CoinsProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
|
||||
|
|
Loading…
Reference in a new issue