ListModel.clear(): Do nothing if already no data

This commit is contained in:
miruka 2019-05-09 16:11:15 -04:00
parent df088a8daa
commit 17fdaf6bd6

View File

@ -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()