From df39627fa33392a71ab79aadaa57e5c5e650e79e Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Tue, 1 Jan 2019 15:18:57 +0100 Subject: Examples: cleanup foreach usage Replace deprecated foreach macro with range-based for loop Change-Id: If919ba1d1d4acddfc1c5460ce7aebf8c49e3ac38 Reviewed-by: Paul Wicking --- examples/embedded/lightmaps/slippymap.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'examples/embedded/lightmaps/slippymap.cpp') diff --git a/examples/embedded/lightmaps/slippymap.cpp b/examples/embedded/lightmaps/slippymap.cpp index ff43261700..da003981ff 100644 --- a/examples/embedded/lightmaps/slippymap.cpp +++ b/examples/embedded/lightmaps/slippymap.cpp @@ -162,7 +162,6 @@ void SlippyMap::handleNetworkData(QNetworkReply *reply) { QImage img; QPoint tp = reply->request().attribute(QNetworkRequest::User).toPoint(); - QUrl url = reply->url(); if (!reply->error()) if (!img.load(reply, 0)) img = QImage(); @@ -173,10 +172,12 @@ void SlippyMap::handleNetworkData(QNetworkReply *reply) emit updated(tileRect(tp)); // purge unused spaces - QRect bound = m_tilesRect.adjusted(-2, -2, 2, 2); - foreach(QPoint tp, m_tilePixmaps.keys()) - if (!bound.contains(tp)) - m_tilePixmaps.remove(tp); + const QRect bound = m_tilesRect.adjusted(-2, -2, 2, 2); + for (auto it = m_tilePixmaps.keyBegin(); it != m_tilePixmaps.keyEnd(); ++it) { + const QPoint &tp = *it; + if (!bound.contains(tp)) + m_tilePixmaps.remove(tp); + } download(); } -- cgit v1.2.3