ListModel.clear(): Do nothing if already no data
This commit is contained in:
parent
df088a8daa
commit
17fdaf6bd6
|
@ -357,6 +357,9 @@ class ListModel(QAbstractListModel):
|
|||
|
||||
@pyqtSlot()
|
||||
def clear(self) -> None:
|
||||
if not self._data:
|
||||
return
|
||||
|
||||
# Reimplemented for performance reasons (begin/endRemoveRows)
|
||||
self.beginRemoveRows(QModelIndex(), 0, len(self))
|
||||
self._data.clear()
|
||||
|
|
Loading…
Reference in New Issue
Block a user