diff options
author | Frank Meerkoetter <frank.meerkoetter@basyskom.com> | 2016-04-02 19:33:56 +0200 |
---|---|---|
committer | Frank Meerkoetter <frank.meerkoetter@basyskom.com> | 2016-04-06 14:38:30 +0000 |
commit | 789555ac175dcd18a910bebb457400c07692a074 (patch) | |
tree | a289b17694dc305e7b64ca1e105f887bf3e777a2 /src/qml/types/qqmllistmodel.cpp | |
parent | 2faf3081e87e01173b375338807ec80bdae30e21 (diff) |
replace handwritten loop with qDeleteAll
Also mark variable as const
Change-Id: I50bae920785619b1baecfe4ee07978dc886c974d
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/types/qqmllistmodel.cpp')
-rw-r--r-- | src/qml/types/qqmllistmodel.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index 91eef2d982..613b6681d0 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -2002,13 +2002,12 @@ int QQmlListModel::count() const */ void QQmlListModel::clear() { - int cleared = count(); + const int cleared = count(); emitItemsAboutToBeRemoved(0, cleared); if (m_dynamicRoles) { - for (int i=0 ; i < m_modelObjects.count() ; ++i) - delete m_modelObjects[i]; + qDeleteAll(m_modelObjects); m_modelObjects.clear(); } else { m_listModel->clear(); |