mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Merge #11395: Qt: Enable searching by transaction id
eac2abca0Qt: Enable searching by transaction id (Luke Dashjr)c407c61c5Qt: Avoid invalidating the search filter, when it doesn't really change (Luke Dashjr)b1f634242Qt: Rename confusingly-named "address prefix" to "search string" (Luke Dashjr) Pull request description: Tree-SHA512: 1c67037d19689fbaff21d15ed7848ac86188e5de34728312e1f9758dada759cab50d913a5bc09e413ecaa3e07557cf253809b95b5637ff79f2e3cf24d86dd3ed
This commit is contained in:
@@ -20,7 +20,7 @@ TransactionFilterProxy::TransactionFilterProxy(QObject *parent) :
|
||||
QSortFilterProxyModel(parent),
|
||||
dateFrom(MIN_DATE),
|
||||
dateTo(MAX_DATE),
|
||||
addrPrefix(),
|
||||
m_search_string(),
|
||||
typeFilter(ALL_TYPES),
|
||||
watchOnlyFilter(WatchOnlyFilter_All),
|
||||
minAmount(0),
|
||||
@@ -38,6 +38,7 @@ bool TransactionFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex &
|
||||
bool involvesWatchAddress = index.data(TransactionTableModel::WatchonlyRole).toBool();
|
||||
QString address = index.data(TransactionTableModel::AddressRole).toString();
|
||||
QString label = index.data(TransactionTableModel::LabelRole).toString();
|
||||
QString txid = index.data(TransactionTableModel::TxIDRole).toString();
|
||||
qint64 amount = llabs(index.data(TransactionTableModel::AmountRole).toLongLong());
|
||||
int status = index.data(TransactionTableModel::StatusRole).toInt();
|
||||
|
||||
@@ -51,8 +52,11 @@ bool TransactionFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex &
|
||||
return false;
|
||||
if(datetime < dateFrom || datetime > dateTo)
|
||||
return false;
|
||||
if (!address.contains(addrPrefix, Qt::CaseInsensitive) && !label.contains(addrPrefix, Qt::CaseInsensitive))
|
||||
if (!address.contains(m_search_string, Qt::CaseInsensitive) &&
|
||||
! label.contains(m_search_string, Qt::CaseInsensitive) &&
|
||||
! txid.contains(m_search_string, Qt::CaseInsensitive)) {
|
||||
return false;
|
||||
}
|
||||
if(amount < minAmount)
|
||||
return false;
|
||||
|
||||
@@ -66,9 +70,10 @@ void TransactionFilterProxy::setDateRange(const QDateTime &from, const QDateTime
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
void TransactionFilterProxy::setAddressPrefix(const QString &_addrPrefix)
|
||||
void TransactionFilterProxy::setSearchString(const QString &search_string)
|
||||
{
|
||||
this->addrPrefix = _addrPrefix;
|
||||
if (m_search_string == search_string) return;
|
||||
m_search_string = search_string;
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user