diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2016-10-26 10:25:20 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2016-10-31 12:52:36 +0000 |
commit | 8829f0044cd54f0a0357f5022a63969d37aa2648 (patch) | |
tree | dcf62e8e008fba003b7eaa7a8da262c8ade07074 /src/designer/src/components/formeditor/qdesigner_resource.cpp | |
parent | 9a43344df6ff3a3b68f983395dadfce94007b891 (diff) |
Qt Designer: Remove use of Java-style list/vector iterators
Replace by range-for or algorithms.
Change-Id: I16e1f883bf1a774f46cb0c51fb16ce6d7d80b04e
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'src/designer/src/components/formeditor/qdesigner_resource.cpp')
-rw-r--r-- | src/designer/src/components/formeditor/qdesigner_resource.cpp | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/designer/src/components/formeditor/qdesigner_resource.cpp b/src/designer/src/components/formeditor/qdesigner_resource.cpp index d37d565a5..c412637d5 100644 --- a/src/designer/src/components/formeditor/qdesigner_resource.cpp +++ b/src/designer/src/components/formeditor/qdesigner_resource.cpp @@ -100,6 +100,9 @@ #include <QtCore/qdebug.h> #include <QtCore/QXmlStreamWriter> +#include <algorithm> +#include <iterator> + Q_DECLARE_METATYPE(QWidgetList) QT_BEGIN_NAMESPACE @@ -2001,13 +2004,10 @@ QStringList QDesignerResource::mergeWithLoadedPaths(const QStringList &paths) co { QStringList newPaths = paths; #ifdef OLD_RESOURCE_FORMAT - QStringList loadedPaths = m_resourceBuilder->loadedQrcFiles(); - QStringListIterator it(loadedPaths); - while (it.hasNext()) { - const QString path = it.next(); - if (!newPaths.contains(path)) - newPaths << path; - } + const QStringList loadedPaths = m_resourceBuilder->loadedQrcFiles(); + std::remove_copy_if(loadedPaths.cbegin(), loadedPaths.cend(), + std::back_inserter(newPaths), + [&newPaths] (const QString &path) { return newPaths.contains(path); }); #endif return newPaths; } @@ -2052,14 +2052,10 @@ void QDesignerResource::createResources(DomResources *resources) QtResourceSet *resourceSet = m_formWindow->resourceSet(); if (resourceSet) { - QStringList oldPaths = resourceSet->activeResourceFilePaths(); - QStringList newPaths = oldPaths; - QStringListIterator it(paths); - while (it.hasNext()) { - const QString path = it.next(); - if (!newPaths.contains(path)) - newPaths << path; - } + QStringList newPaths = resourceSet->activeResourceFilePaths(); + std::remove_copy_if(paths.cbegin(), paths.cend(), + std::back_inserter(newPaths), + [&newPaths] (const QString &path) { return newPaths.contains(path); }); resourceSet->activateResourceFilePaths(newPaths); } else { resourceSet = m_formWindow->core()->resourceModel()->addResourceSet(paths); |