From 6173e1d6f82b3bc205c1bebdc8481c1dbff4572f Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 19 Jun 2018 15:09:33 +0200 Subject: Build the Windows platform plugin with QT_NO_FOREACH ...for consistency with the other platform plugins. Change-Id: I85946d610a62c19140618c83f80c4aa63fce4bc3 Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowsscreen.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/plugins/platforms/windows/qwindowsscreen.cpp') diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index f2d32bc9b4..bf7f359aac 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -274,9 +274,12 @@ QList QWindowsScreen::virtualSiblings() const { QList result; if (m_data.flags & QWindowsScreenData::VirtualDesktop) { - foreach (QWindowsScreen *screen, QWindowsContext::instance()->screenManager().screens()) + const QWindowsScreenManager::WindowsScreenList screens + = QWindowsContext::instance()->screenManager().screens(); + for (QWindowsScreen *screen : screens) { if (screen->data().flags & QWindowsScreenData::VirtualDesktop) result.push_back(screen); + } } else { result.push_back(const_cast(this)); } @@ -505,7 +508,8 @@ void QWindowsScreenManager::removeScreen(int index) // move those manually. if (screen != primaryScreen) { unsigned movedWindowCount = 0; - foreach (QWindow *w, QGuiApplication::topLevelWindows()) { + const QWindowList tlws = QGuiApplication::topLevelWindows(); + for (QWindow *w : tlws) { if (w->screen() == screen && w->handle() && w->type() != Qt::Desktop) { if (w->isVisible() && w->windowState() != Qt::WindowMinimized && (QWindowsWindow::baseWindowOf(w)->exStyle() & WS_EX_TOOLWINDOW)) { @@ -530,9 +534,9 @@ void QWindowsScreenManager::removeScreen(int index) bool QWindowsScreenManager::handleScreenChanges() { // Look for changed monitors, add new ones - WindowsScreenDataList newDataList = monitorData(); + const WindowsScreenDataList newDataList = monitorData(); const bool lockScreen = newDataList.size() == 1 && (newDataList.front().flags & QWindowsScreenData::LockScreen); - foreach (const QWindowsScreenData &newData, newDataList) { + for (const QWindowsScreenData &newData : newDataList) { const int existingIndex = indexOfMonitor(m_screens, newData.name); if (existingIndex != -1) { m_screens.at(existingIndex)->handleChanges(newData); @@ -564,7 +568,7 @@ void QWindowsScreenManager::clearScreens() const QWindowsScreen *QWindowsScreenManager::screenAtDp(const QPoint &p) const { - foreach (QWindowsScreen *scr, m_screens) { + for (QWindowsScreen *scr : m_screens) { if (scr->geometry().contains(p)) return scr; } -- cgit v1.2.3