Raven Core  3.0.0
P2P Digital Currency
assetfilterproxy.cpp
Go to the documentation of this file.
1 // Copyright (c) 2017-2019 The Raven Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 #include "assetfilterproxy.h"
5 #include "assettablemodel.h"
6 
7 
9  QSortFilterProxyModel(parent),
10  assetNamePrefix()
11 {
12 }
13 
14 bool AssetFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
15 {
16  QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
17 
18  QString assetName = index.data(AssetTableModel::AssetNameRole).toString();
19 
20  if(!assetName.contains(assetNamePrefix, Qt::CaseInsensitive))
21  return false;
22 
23  return true;
24 }
25 
26 void AssetFilterProxy::setAssetNamePrefix(const QString &_assetNamePrefix)
27 {
28  this->assetNamePrefix = _assetNamePrefix;
29  invalidateFilter();
30 }
AssetFilterProxy(QObject *parent=0)
void setAssetNamePrefix(const QString &assetNamePrefix)
RVN or name of an asset.
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const