2020-10-07 10:36:04 +00:00
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
// Copyright (c) 2020, The Monero Project.
|
|
|
|
|
|
|
|
#include "CoinsProxyModel.h"
|
|
|
|
#include "CoinsModel.h"
|
|
|
|
|
|
|
|
CoinsProxyModel::CoinsProxyModel(QObject *parent)
|
|
|
|
: QSortFilterProxyModel(parent)
|
|
|
|
{
|
2020-10-21 14:53:17 +00:00
|
|
|
setSortRole(Qt::UserRole);
|
2020-10-07 10:36:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CoinsProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
|
|
|
|
{
|
|
|
|
QModelIndex spentIndex = sourceModel()->index(sourceRow, CoinsModel::Spent, sourceParent);
|
|
|
|
bool isSpent = sourceModel()->data(spentIndex).toBool();
|
|
|
|
|
|
|
|
return !(!m_showSpent && isSpent);
|
|
|
|
}
|