aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types/qqmllistmodel.cpp
diff options
context:
space:
mode:
authorAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-04-25 17:40:19 +0300
committerAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-04-27 13:39:22 +0000
commit485a381cabc730622dbe1b150260ea417d2bbcfd (patch)
tree56ac2b422a0d2db44eb2babbe82e639a880dab57 /src/qml/types/qqmllistmodel.cpp
parent1ee7efac496d893cea9e5310d249275fe1532f2a (diff)
Qml: use qDeleteAll more
qDeleteAll uses iterator-based loop, that produce less code than index-based. Saves ~0.1 KB text size. Config: release build, Ubuntu 14.04 x64, gcc 4.9 Change-Id: Ib6c01f3b6a73367e33aecd34223edde15262d33c Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/types/qqmllistmodel.cpp')
-rw-r--r--src/qml/types/qqmllistmodel.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index 91eef2d982..44a4ff03e9 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -169,9 +169,7 @@ ListLayout::ListLayout(const ListLayout *other) : currentBlock(0), currentBlockO
ListLayout::~ListLayout()
{
- for (int i=0 ; i < roles.count() ; ++i) {
- delete roles[i];
- }
+ qDeleteAll(roles);
}
void ListLayout::sync(ListLayout *src, ListLayout *target)
@@ -1662,8 +1660,7 @@ QQmlListModel::QQmlListModel(QQmlListModel *orig, QQmlListModelWorkerAgent *agen
QQmlListModel::~QQmlListModel()
{
- for (int i=0 ; i < m_modelObjects.count() ; ++i)
- delete m_modelObjects[i];
+ qDeleteAll(m_modelObjects);
if (m_primary) {
m_listModel->destroy();
@@ -2007,8 +2004,7 @@ void QQmlListModel::clear()
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();