1
0

qt coins tab: Ctrl+F now searches the whole prevout string

(not just the truncated string that is displayed in the list)
This commit is contained in:
SomberNight
2021-04-22 20:56:00 +02:00
parent 3b77340671
commit 1436760d3d
2 changed files with 16 additions and 3 deletions

View File

@@ -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

View File

@@ -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)