completion: get rid of model-specific sort method (see #545)

This commit is contained in:
Jakub Klinkovský 2016-07-17 12:46:51 +02:00
parent 49327dfcbb
commit 119f9c0e18
2 changed files with 1 additions and 14 deletions

View File

@ -126,10 +126,3 @@ class BaseCompletionModel(QStandardItemModel):
else:
# category
return Qt.NoItemFlags
def sort(self, column, order=Qt.AscendingOrder):
"""Sort the data in column according to order.
Override QAbstractItemModel::sort.
"""
raise NotImplementedError

View File

@ -63,9 +63,6 @@ class CompletionFilterModel(QSortFilterProxyModel):
Invalidates the filter and re-sorts the model.
If the current completion model overrides sort(), it is used.
If not, the default implementation in QCompletionFilterModel is called.
Args:
val: The value to set.
"""
@ -76,10 +73,7 @@ class CompletionFilterModel(QSortFilterProxyModel):
self.pattern_re = re.compile(val, re.IGNORECASE)
self.invalidateFilter()
sortcol = 0
try:
self.srcmodel.sort(sortcol)
except NotImplementedError:
self.sort(sortcol)
self.sort(sortcol)
self.invalidate()
def count(self):