Skip to content

Commit

Permalink
reimplemented title matching
Browse files Browse the repository at this point in the history
  • Loading branch information
irgolic committed Jul 4, 2018
1 parent 80ff6a9 commit 6d5f8c3
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Orange/canvas/document/quickmenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,19 +325,17 @@ def filterFunc(self):
def filterAcceptsRow(self, row, parent=QModelIndex()):
flat_model = self.sourceModel()
index = flat_model.index(row, self.filterKeyColumn(), parent)
keywords = flat_model.data(index, role=QtWidgetRegistry.WIDGET_DESC_ROLE).keywords
description = flat_model.data(index, role=QtWidgetRegistry.WIDGET_DESC_ROLE)
name = description.name
keywords = description.keywords

# match keywords
# match name and keywords
accepted = False
for keyword in keywords:
for keyword in [name] + keywords:
if self.filterRegExp().indexIn(keyword) > -1:
accepted = True
break

# if does not match keywords, match title
if not accepted:
accepted = QSortFilterProxyModel.filterAcceptsRow(self, row, parent)

# if matches query, apply filter function (compatibility with paired widget)
if accepted and self.__filterFunc is not None:
model = self.sourceModel()
Expand Down

0 comments on commit 6d5f8c3

Please sign in to comment.