From 0595b127ce4c6d026b3fa0a6e30c7469a0a625c1 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Fri, 15 Jan 2016 10:52:02 +0300 Subject: QtMultimediaQuickTools: replace foreach with range-based for Change-Id: I729375c1de712f1fb7915c95ce9eb7dcd00fe757 Reviewed-by: Yoann Lopes --- src/qtmultimediaquicktools/qdeclarativevideooutput.cpp | 3 ++- src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/qtmultimediaquicktools') diff --git a/src/qtmultimediaquicktools/qdeclarativevideooutput.cpp b/src/qtmultimediaquicktools/qdeclarativevideooutput.cpp index cae6cf002..d3e8c32ee 100644 --- a/src/qtmultimediaquicktools/qdeclarativevideooutput.cpp +++ b/src/qtmultimediaquicktools/qdeclarativevideooutput.cpp @@ -231,7 +231,8 @@ bool QDeclarativeVideoOutput::createBackend(QMediaService *service) { bool backendAvailable = false; - foreach (QObject *instance, videoBackendFactoryLoader()->instances(QLatin1String("declarativevideobackend"))) { + const auto instances = videoBackendFactoryLoader()->instances(QLatin1String("declarativevideobackend")); + for (QObject *instance : instances) { if (QDeclarativeVideoBackendFactoryInterface *plugin = qobject_cast(instance)) { m_backend.reset(plugin->create(this)); if (m_backend && m_backend->init(service)) { diff --git a/src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp b/src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp index 70d48dd97..36572f613 100644 --- a/src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp +++ b/src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp @@ -64,7 +64,8 @@ QDeclarativeVideoRendererBackend::QDeclarativeVideoRendererBackend(QDeclarativeV // Prioritize the plugin requested by the environment QString requestedVideoNode = QString::fromLatin1(qgetenv("QT_VIDEONODE")); - foreach (const QString &key, videoNodeFactoryLoader()->keys()) { + const auto keys = videoNodeFactoryLoader()->keys(); + for (const QString &key : keys) { QObject *instance = videoNodeFactoryLoader()->instance(key); QSGVideoNodeFactoryInterface* plugin = qobject_cast(instance); if (plugin) { @@ -124,7 +125,7 @@ class FilterRunnableDeleter : public QRunnable public: FilterRunnableDeleter(const QList &runnables) : m_runnables(runnables) { } void run() Q_DECL_OVERRIDE { - foreach (QVideoFilterRunnable *runnable, m_runnables) + for (QVideoFilterRunnable *runnable : qAsConst(m_runnables)) delete runnable; } private: @@ -335,7 +336,7 @@ QSGNode *QDeclarativeVideoRendererBackend::updatePaintNode(QSGNode *oldNode, } if (!videoNode) { - foreach (QSGVideoNodeFactoryInterface* factory, m_videoNodeFactories) { + for (QSGVideoNodeFactoryInterface* factory : qAsConst(m_videoNodeFactories)) { // Get a node that supports our frame. The surface is irrelevant, our // QSGVideoItemSurface supports (logically) anything. videoNode = factory->createNode(QVideoSurfaceFormat(m_frame.size(), m_frame.pixelFormat(), m_frame.handleType())); @@ -437,7 +438,7 @@ QList QSGVideoItemSurface::supportedPixelFormats( return formats; } - foreach (QSGVideoNodeFactoryInterface* factory, m_backend->m_videoNodeFactories) + for (QSGVideoNodeFactoryInterface* factory : qAsConst(m_backend->m_videoNodeFactories)) formats.append(factory->supportedPixelFormats(handleType)); return formats; -- cgit v1.2.3