From db6cd708db9345a0948dfe7c51f6640896a48ef7 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 25 Jul 2019 16:04:34 +0200 Subject: [PATCH] QmlDesigner: Remove one use of Java-style iterator Also take advantage of the fact that filtering a list can be done more straightforward than creating a full copy and removing non-matching items. Change-Id: I95e983873d4273b2302c4b3bbaeddb4390310d99 Reviewed-by: Christian Kandeler --- src/plugins/qmldesigner/designercore/model/model.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/plugins/qmldesigner/designercore/model/model.cpp b/src/plugins/qmldesigner/designercore/model/model.cpp index f8cb347ba61..d53b8cfc1d5 100644 --- a/src/plugins/qmldesigner/designercore/model/model.cpp +++ b/src/plugins/qmldesigner/designercore/model/model.cpp @@ -1393,14 +1393,8 @@ void ModelPrivate::notifyNodeOrderChanged(const InternalNodeListPropertyPointer void ModelPrivate::setSelectedNodes(const QList &selectedNodeList) { - - QList sortedSelectedList(selectedNodeList); - QMutableListIterator iterator(sortedSelectedList); - while (iterator.hasNext()) { - InternalNode::Pointer node(iterator.next()); - if (!node->isValid()) - iterator.remove(); - } + QList sortedSelectedList + = Utils::filtered(selectedNodeList, &InternalNode::isValid); sortedSelectedList = sortedSelectedList.toSet().toList(); Utils::sort(sortedSelectedList);