Qt: Enable searching by transaction id

This commit is contained in:
Luke Dashjr 2017-09-25 04:18:35 +00:00
parent c407c61c5b
commit eac2abca02
2 changed files with 6 additions and 2 deletions

View file

@ -38,6 +38,7 @@ bool TransactionFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex &
bool involvesWatchAddress = index.data(TransactionTableModel::WatchonlyRole).toBool(); bool involvesWatchAddress = index.data(TransactionTableModel::WatchonlyRole).toBool();
QString address = index.data(TransactionTableModel::AddressRole).toString(); QString address = index.data(TransactionTableModel::AddressRole).toString();
QString label = index.data(TransactionTableModel::LabelRole).toString(); QString label = index.data(TransactionTableModel::LabelRole).toString();
QString txid = index.data(TransactionTableModel::TxIDRole).toString();
qint64 amount = llabs(index.data(TransactionTableModel::AmountRole).toLongLong()); qint64 amount = llabs(index.data(TransactionTableModel::AmountRole).toLongLong());
int status = index.data(TransactionTableModel::StatusRole).toInt(); int status = index.data(TransactionTableModel::StatusRole).toInt();
@ -51,8 +52,11 @@ bool TransactionFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex &
return false; return false;
if(datetime < dateFrom || datetime > dateTo) if(datetime < dateFrom || datetime > dateTo)
return false; return false;
if (!address.contains(m_search_string, Qt::CaseInsensitive) && !label.contains(m_search_string, 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; return false;
}
if(amount < minAmount) if(amount < minAmount)
return false; return false;

View file

@ -97,7 +97,7 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
search_widget = new QLineEdit(this); search_widget = new QLineEdit(this);
#if QT_VERSION >= 0x040700 #if QT_VERSION >= 0x040700
search_widget->setPlaceholderText(tr("Enter address or label to search")); search_widget->setPlaceholderText(tr("Enter address, transaction id, or label to search"));
#endif #endif
hlayout->addWidget(search_widget); hlayout->addWidget(search_widget);