mirror of
https://github.com/feather-wallet/feather.git
synced 2025-01-09 20:39:58 +00:00
133700160a
Co-Authored-By: tobtoht <thotbot@protonmail.com>
24 lines
No EOL
975 B
C++
24 lines
No EOL
975 B
C++
// SPDX-License-Identifier: BSD-3-Clause
|
|
// Copyright (c) 2020, The Monero Project.
|
|
|
|
#include "AddressBookProxyModel.h"
|
|
#include "AddressBookModel.h"
|
|
|
|
AddressBookProxyModel::AddressBookProxyModel(QObject *parent)
|
|
: QSortFilterProxyModel(parent),
|
|
m_searchRegExp("")
|
|
{
|
|
m_searchRegExp.setCaseSensitivity(Qt::CaseInsensitive);
|
|
m_searchRegExp.setPatternSyntax(QRegExp::RegExp);
|
|
}
|
|
|
|
bool AddressBookProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
|
|
{
|
|
QModelIndex addressIndex = sourceModel()->index(sourceRow, AddressBookModel::Address, sourceParent);
|
|
QModelIndex descriptionIndex = sourceModel()->index(sourceRow, AddressBookModel::Description, sourceParent);
|
|
|
|
QString addressData = sourceModel()->data(addressIndex, Qt::UserRole).toString();
|
|
QString descriptionData = sourceModel()->data(descriptionIndex).toString();
|
|
|
|
return (addressData.contains(m_searchRegExp) || descriptionData.contains(m_searchRegExp));
|
|
} |