Add filter to SeriesSelectionWindow and IssueSelectionWindow fixes #476

This commit is contained in:
Timmy Welch 2023-07-01 18:57:33 -07:00
parent cde980b470
commit 00200334fb
4 changed files with 37 additions and 1 deletions

View File

@ -115,6 +115,17 @@ class IssueSelectionWindow(QtWidgets.QDialog):
self.twList.selectRow(r)
break
self.leFilter.textChanged.connect(self.filter)
def filter(self, text: str) -> None:
rows = set(range(self.twList.rowCount()))
for r in rows:
self.twList.showRow(r)
if text.strip():
shown_rows = {x.row() for x in self.twList.findItems(text, QtCore.Qt.MatchFlag.MatchContains)}
for r in rows - shown_rows:
self.twList.hideRow(r)
def perform_query(self) -> None:
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.CursorShape.WaitCursor))

View File

@ -187,6 +187,17 @@ class SeriesSelectionWindow(QtWidgets.QDialog):
self.update_buttons()
self.twList.selectRow(0)
self.leFilter.textChanged.connect(self.filter)
def filter(self, text: str) -> None:
rows = set(range(self.twList.rowCount()))
for r in rows:
self.twList.showRow(r)
if text.strip():
shown_rows = {x.row() for x in self.twList.findItems(text, QtCore.Qt.MatchFlag.MatchContains)}
for r in rows - shown_rows:
self.twList.hideRow(r)
def update_buttons(self) -> None:
enabled = bool(self.ct_search_results)

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>872</width>
<height>670</height>
<height>673</height>
</rect>
</property>
<property name="windowTitle">
@ -16,6 +16,13 @@
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLineEdit" name="leFilter">
<property name="placeholderText">
<string>Filter</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">

View File

@ -110,6 +110,13 @@
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLineEdit" name="leFilter">
<property name="placeholderText">
<string>Filter</string>
</property>
</widget>
</item>
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">