Set Qt.ItemNeverHasChildren for leaf model items.
This allows Qt to do some optimizations.
This commit is contained in:
parent
dd292b0781
commit
8eb483d66b
@ -1038,7 +1038,7 @@ class DownloadManager(QAbstractListModel):
|
|||||||
"""Override flags so items aren't selectable.
|
"""Override flags so items aren't selectable.
|
||||||
|
|
||||||
The default would be Qt.ItemIsEnabled | Qt.ItemIsSelectable."""
|
The default would be Qt.ItemIsEnabled | Qt.ItemIsSelectable."""
|
||||||
return Qt.ItemIsEnabled
|
return Qt.ItemIsEnabled | Qt.ItemNeverHasChildren
|
||||||
|
|
||||||
def rowCount(self, parent=QModelIndex()):
|
def rowCount(self, parent=QModelIndex()):
|
||||||
"""Get count of active downloads."""
|
"""Get count of active downloads."""
|
||||||
|
@ -109,7 +109,8 @@ class BaseCompletionModel(QStandardItemModel):
|
|||||||
qtutils.ensure_valid(index)
|
qtutils.ensure_valid(index)
|
||||||
if index.parent().isValid():
|
if index.parent().isValid():
|
||||||
# item
|
# item
|
||||||
return Qt.ItemIsEnabled | Qt.ItemIsSelectable
|
return (Qt.ItemIsEnabled | Qt.ItemIsSelectable |
|
||||||
|
Qt.ItemNeverHasChildren)
|
||||||
else:
|
else:
|
||||||
# category
|
# category
|
||||||
return Qt.NoItemFlags
|
return Qt.NoItemFlags
|
||||||
|
Loading…
Reference in New Issue
Block a user