Fix roomCategoryDelegate height stuck to 0

This commit is contained in:
miruka
2019-05-06 21:37:34 -04:00
parent a3d0f32dc5
commit a9964ab0f9
2 changed files with 12 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ from .list_model import ListModel
class SortFilterProxy(QSortFilterProxyModel):
sortByRoleChanged = pyqtSignal()
countChanged = pyqtSignal(int)
def __init__(self,
source_model: ListModel,
@@ -24,6 +25,7 @@ class SortFilterProxy(QSortFilterProxyModel):
self.setSourceModel(source_model)
source_model.rolesSet.connect(self._set_sort_role)
source_model.countChanged.connect(self.countChanged.emit)
source_model.changed.connect(self._sort)
self._sort_by_role = sort_by_role
@@ -60,6 +62,11 @@ class SortFilterProxy(QSortFilterProxyModel):
return self.__repr__()
@pyqtProperty(int, notify=countChanged)
def count(self) -> int:
return self.rowCount()
def roleNames(self) -> Dict[int, bytes]:
return self.sourceModel().roleNames()