completion: get rid of custom_filter (see #545)
This commit is contained in:
parent
d079caafa8
commit
caf5937585
@ -133,13 +133,3 @@ class BaseCompletionModel(QStandardItemModel):
|
||||
Override QAbstractItemModel::sort.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def custom_filter(self, pattern, row, parent):
|
||||
"""Custom filter.
|
||||
|
||||
Args:
|
||||
pattern: The current filter pattern.
|
||||
row: The row to accept or reject in the filter.
|
||||
parent: The parent item QModelIndex.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
@ -140,20 +140,17 @@ class CompletionFilterModel(QSortFilterProxyModel):
|
||||
if parent == QModelIndex() or not self.pattern:
|
||||
return True
|
||||
|
||||
try:
|
||||
return self.srcmodel.custom_filter(self.pattern, row, parent)
|
||||
except NotImplementedError:
|
||||
for col in self.srcmodel.columns_to_filter:
|
||||
idx = self.srcmodel.index(row, col, parent)
|
||||
if not idx.isValid():
|
||||
# No entries in parent model
|
||||
continue
|
||||
data = self.srcmodel.data(idx)
|
||||
if not data:
|
||||
continue
|
||||
elif self.pattern_re.search(data):
|
||||
return True
|
||||
return False
|
||||
for col in self.srcmodel.columns_to_filter:
|
||||
idx = self.srcmodel.index(row, col, parent)
|
||||
if not idx.isValid():
|
||||
# No entries in parent model
|
||||
continue
|
||||
data = self.srcmodel.data(idx)
|
||||
if not data:
|
||||
continue
|
||||
elif self.pattern_re.search(data):
|
||||
return True
|
||||
return False
|
||||
|
||||
def intelligentLessThan(self, lindex, rindex):
|
||||
"""Custom sorting implementation.
|
||||
|
Loading…
Reference in New Issue
Block a user