Skip to content

Commit

Permalink
Fix hang in options search widget
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson authored and 3nids committed Feb 5, 2018
1 parent 8d55cad commit c8d1d2d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion python/plugins/processing/gui/ConfigDialog.py
Expand Up @@ -87,6 +87,7 @@ def helpKey(self):


class ProcessingTreeHighlight(QgsOptionsDialogHighlightWidget):

def __init__(self, config_dialog):
super(ProcessingTreeHighlight, self).__init__(config_dialog.tree)
self.config_dialog = config_dialog
Expand Down Expand Up @@ -130,15 +131,25 @@ def __init__(self, showSearch=True):

self.saveMenus = False
self.tree.expanded.connect(self.itemExpanded)
self.auto_adjust_columns = True

def textChanged(self, text=None):
if text is not None:
text = str(text.lower())
else:
text = str(self.searchBox.text().lower())
self._filterItem(self.model.invisibleRootItem(), text)

self.auto_adjust_columns = False
if text:
self.tree.expandAll()
else:
self.tree.collapseAll()

self.adjustColumns()
self.auto_adjust_columns = True

if text:
return True
else:
self.tree.collapseAll()
Expand Down Expand Up @@ -329,7 +340,8 @@ def accept(self):
def itemExpanded(self, idx):
if idx == self.menusItem.index():
self.saveMenus = True
self.adjustColumns()
if self.auto_adjust_columns:
self.adjustColumns()

def adjustColumns(self):
self.tree.resizeColumnToContents(0)
Expand Down

0 comments on commit c8d1d2d

Please sign in to comment.