diff options
author | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-01-15 10:52:02 +0300 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@theqtcompany.com> | 2016-01-15 13:59:16 +0000 |
commit | 0595b127ce4c6d026b3fa0a6e30c7469a0a625c1 (patch) | |
tree | fd36d27093cf65a41cfa0e5c8965ed1bddc95a18 /src | |
parent | 64fbbdd7385b83073e97aca9a020c51be2875060 (diff) | |
download | qtmultimedia-0595b127ce4c6d026b3fa0a6e30c7469a0a625c1.tar.gz |
QtMultimediaQuickTools: replace foreach with range-based for
Change-Id: I729375c1de712f1fb7915c95ce9eb7dcd00fe757
Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/qtmultimediaquicktools/qdeclarativevideooutput.cpp | 3 | ||||
-rw-r--r-- | src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp | 9 |
2 files changed, 7 insertions, 5 deletions
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<QDeclarativeVideoBackendFactoryInterface*>(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<QSGVideoNodeFactoryInterface*>(instance); if (plugin) { @@ -124,7 +125,7 @@ class FilterRunnableDeleter : public QRunnable public: FilterRunnableDeleter(const QList<QVideoFilterRunnable *> &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<QVideoFrame::PixelFormat> 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; |