Tools: Fix recursive filtering (#4597)

* check for 'filterRegExp' first

* use recursive filtering option if is available
This commit is contained in:
Jakub Trllo 2023-03-13 11:20:59 +01:00 committed by GitHub
parent a7f0d57638
commit 86184a8ee0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 23 deletions

View file

@ -27,10 +27,10 @@ class RecursiveSortFilterProxyModel(QtCore.QSortFilterProxyModel):
if not parent.isValid():
return False
if hasattr(self, "filterRegularExpression"):
regex = self.filterRegularExpression()
else:
if hasattr(self, "filterRegExp"):
regex = self.filterRegExp()
else:
regex = self.filterRegularExpression()
pattern = regex.pattern()
if pattern and regex.isValid():
@ -111,10 +111,10 @@ class SearchEntitiesDialog(QtWidgets.QDialog):
def _on_filter_timer(self):
text = self._filter_edit.text()
if hasattr(self._proxy, "setFilterRegularExpression"):
self._proxy.setFilterRegularExpression(text)
else:
if hasattr(self._proxy, "setFilterRegExp"):
self._proxy.setFilterRegExp(text)
else:
self._proxy.setFilterRegularExpression(text)
# WARNING This expanding and resizing is relatively slow.
self._view.expandAll()