From 1436760d3d06c78dd5dd180103d69ce16a5c8741 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Thu, 22 Apr 2021 20:56:00 +0200 Subject: [PATCH] qt coins tab: Ctrl+F now searches the whole prevout string (not just the truncated string that is displayed in the list) --- electrum/gui/qt/util.py | 14 +++++++++++--- electrum/gui/qt/utxo_list.py | 5 +++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/electrum/gui/qt/util.py b/electrum/gui/qt/util.py index c9c4aa062..c6a766257 100644 --- a/electrum/gui/qt/util.py +++ b/electrum/gui/qt/util.py @@ -551,6 +551,7 @@ class MyTreeView(QTreeView): ROLE_CLIPBOARD_DATA = Qt.UserRole + 100 ROLE_CUSTOM_PAINT = Qt.UserRole + 101 ROLE_EDIT_KEY = Qt.UserRole + 102 + ROLE_FILTER_DATA = Qt.UserRole + 103 filter_columns: Iterable[int] @@ -679,6 +680,14 @@ class MyTreeView(QTreeView): # overriding this might allow avoiding storing duplicate data return self.get_role_data_from_coordinate(row, col, role=self.ROLE_EDIT_KEY) + def get_filter_data_from_coordinate(self, row, col) -> str: + filter_data = self.get_role_data_from_coordinate(row, col, role=self.ROLE_FILTER_DATA) + if filter_data: + return filter_data + txt = self.get_text_from_coordinate(row, col) + txt = txt.lower() + return txt + def hide_row(self, row_num): """ row_num is for self.model(). So if there is a proxy, it is the row number @@ -690,9 +699,8 @@ class MyTreeView(QTreeView): self.setRowHidden(row_num, QModelIndex(), False) return for column in self.filter_columns: - txt = self.get_text_from_coordinate(row_num, column) - txt = txt.lower() - if self.current_filter in txt: + filter_data = self.get_filter_data_from_coordinate(row_num, column) + if self.current_filter in filter_data: # the filter matched, but the date filter might apply self.setRowHidden(row_num, QModelIndex(), bool(should_hide)) break diff --git a/electrum/gui/qt/utxo_list.py b/electrum/gui/qt/utxo_list.py index f988f374d..8de591556 100644 --- a/electrum/gui/qt/utxo_list.py +++ b/electrum/gui/qt/utxo_list.py @@ -217,3 +217,8 @@ class UTXOList(MyTreeView): menu.addAction(_("Unfreeze Addresses"), lambda: self.parent.set_frozen_state_of_addresses(addrs, False)) menu.exec_(self.viewport().mapToGlobal(position)) + + def get_filter_data_from_coordinate(self, row, col): + if col == self.Columns.OUTPOINT: + return self.get_role_data_from_coordinate(row, col, role=self.ROLE_PREVOUT_STR) + return super().get_filter_data_from_coordinate(row, col)