diff options
Diffstat (limited to 'src/plugins/platforms/offscreen')
-rw-r--r-- | src/plugins/platforms/offscreen/offscreen.pro | 2 | ||||
-rw-r--r-- | src/plugins/platforms/offscreen/qoffscreencommon.cpp | 17 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/plugins/platforms/offscreen/offscreen.pro b/src/plugins/platforms/offscreen/offscreen.pro index cc65449b04..fbaa853c41 100644 --- a/src/plugins/platforms/offscreen/offscreen.pro +++ b/src/plugins/platforms/offscreen/offscreen.pro @@ -2,6 +2,8 @@ TARGET = qoffscreen QT += core-private gui-private platformsupport-private +DEFINES += QT_NO_FOREACH + SOURCES = main.cpp \ qoffscreenintegration.cpp \ qoffscreenwindow.cpp \ diff --git a/src/plugins/platforms/offscreen/qoffscreencommon.cpp b/src/plugins/platforms/offscreen/qoffscreencommon.cpp index a63aacdbfe..85422071aa 100644 --- a/src/plugins/platforms/offscreen/qoffscreencommon.cpp +++ b/src/plugins/platforms/offscreen/qoffscreencommon.cpp @@ -59,9 +59,9 @@ public: void setPos(const QPoint &pos) Q_DECL_OVERRIDE { m_pos = pos; - QWindowList wl = QGuiApplication::topLevelWindows(); + const QWindowList wl = QGuiApplication::topLevelWindows(); QWindow *containing = 0; - foreach (QWindow *w, wl) { + for (QWindow *w : wl) { if (w->type() != Qt::Desktop && w->isExposed() && w->geometry().contains(pos)) { containing = w; break; @@ -104,9 +104,9 @@ QPixmap QOffscreenScreen::grabWindow(WId id, int x, int y, int width, int height QOffscreenWindow *window = QOffscreenWindow::windowForWinId(id); if (!window || window->window()->type() == Qt::Desktop) { - QWindowList wl = QGuiApplication::topLevelWindows(); + const QWindowList wl = QGuiApplication::topLevelWindows(); QWindow *containing = 0; - foreach (QWindow *w, wl) { + for (QWindow *w : wl) { if (w->type() != Qt::Desktop && w->isExposed() && w->geometry().contains(rect)) { containing = w; break; @@ -212,11 +212,10 @@ QOffscreenBackingStore *QOffscreenBackingStore::backingStoreForWinId(WId id) void QOffscreenBackingStore::clearHash() { - QList<WId> ids = m_windowAreaHash.keys(); - foreach (WId id, ids) { - QHash<WId, QOffscreenBackingStore *>::iterator it = m_backingStoreForWinIdHash.find(id); - if (it.value() == this) - m_backingStoreForWinIdHash.remove(id); + for (auto it = m_windowAreaHash.cbegin(), end = m_windowAreaHash.cend(); it != end; ++it) { + const auto it2 = qAsConst(m_backingStoreForWinIdHash).find(it.key()); + if (it2.value() == this) + m_backingStoreForWinIdHash.erase(it2); } m_windowAreaHash.clear(); } |