mypy: Fix new issues in models.completionmodel
This commit is contained in:
parent
87c642d07b
commit
31903163be
|
|
@ -43,7 +43,8 @@ class CompletionModel(QAbstractItemModel):
|
|||
def __init__(self, *, column_widths=(30, 70, 0), parent=None):
|
||||
super().__init__(parent)
|
||||
self.column_widths = column_widths
|
||||
self._categories = [] # type: typing.Sequence[QAbstractItemModel]
|
||||
self._categories = [
|
||||
] # type: typing.MutableSequence[QAbstractItemModel]
|
||||
|
||||
def _cat_from_idx(self, index):
|
||||
"""Return the category pointed to by the given index.
|
||||
|
|
@ -182,10 +183,11 @@ class CompletionModel(QAbstractItemModel):
|
|||
# WORKAROUND:
|
||||
# layoutChanged is broken in PyQt 5.7.1, so we must use metaObject
|
||||
# https://www.riverbankcomputing.com/pipermail/pyqt/2017-January/038483.html
|
||||
self.metaObject().invokeMethod(self, "layoutAboutToBeChanged")
|
||||
self.metaObject().invokeMethod(self, # type: ignore
|
||||
"layoutAboutToBeChanged")
|
||||
for cat in self._categories:
|
||||
cat.set_pattern(pattern)
|
||||
self.metaObject().invokeMethod(self, "layoutChanged")
|
||||
self.metaObject().invokeMethod(self, "layoutChanged") # type: ignore
|
||||
|
||||
def first_item(self):
|
||||
"""Return the index of the first child (non-category) in the model."""
|
||||
|
|
|
|||
Loading…
Reference in New Issue