Skip to content

Commit

Permalink
processing search: also search in group items and fix return value
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Feb 5, 2018
1 parent 058d59b commit 3b17d5a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions python/plugins/processing/gui/ConfigDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def textChanged(self, text=None):
text = str(text.lower())
else:
text = str(self.searchBox.text().lower())
self._filterItem(self.model.invisibleRootItem(), text)
found = self._filterItem(self.model.invisibleRootItem(), text)

self.auto_adjust_columns = False
if text:
Expand All @@ -150,18 +150,17 @@ def textChanged(self, text=None):
self.auto_adjust_columns = True

if text:
return True
return found
else:
self.tree.collapseAll()
return False

def _filterItem(self, item, text):
if item.hasChildren():
show = False
show = isinstance(item, QStandardItem) and bool(text) and (text in item.text().lower())
for i in range(item.rowCount()):
child = item.child(i)
showChild = self._filterItem(child, text)
show = (showChild or show)
show = self._filterItem(child, text) or show
self.tree.setRowHidden(item.row(), item.index().parent(), not show)
return show

Expand Down

0 comments on commit 3b17d5a

Please sign in to comment.