forked from qt-creator/qt-creator
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 <christian.kandeler@qt.io>
This commit is contained in:
@@ -1393,14 +1393,8 @@ void ModelPrivate::notifyNodeOrderChanged(const InternalNodeListPropertyPointer
|
|||||||
|
|
||||||
void ModelPrivate::setSelectedNodes(const QList<InternalNode::Pointer> &selectedNodeList)
|
void ModelPrivate::setSelectedNodes(const QList<InternalNode::Pointer> &selectedNodeList)
|
||||||
{
|
{
|
||||||
|
QList<InternalNode::Pointer> sortedSelectedList
|
||||||
QList<InternalNode::Pointer> sortedSelectedList(selectedNodeList);
|
= Utils::filtered(selectedNodeList, &InternalNode::isValid);
|
||||||
QMutableListIterator<InternalNode::Pointer> iterator(sortedSelectedList);
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
InternalNode::Pointer node(iterator.next());
|
|
||||||
if (!node->isValid())
|
|
||||||
iterator.remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
sortedSelectedList = sortedSelectedList.toSet().toList();
|
sortedSelectedList = sortedSelectedList.toSet().toList();
|
||||||
Utils::sort(sortedSelectedList);
|
Utils::sort(sortedSelectedList);
|
||||||
|
Reference in New Issue
Block a user