diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-01-26 14:38:54 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-04-28 05:09:36 +0000 |
commit | b393641888f18e3accf094c91808e2189c2138cc (patch) | |
tree | 54eefb7a5b8a0a022373487dfdb392e23634a333 /src/plugins/platforms/xcb/qxcbconnection.cpp | |
parent | e91abaa48eb3c6269a0f34301b58d2c194cb6141 (diff) |
xcb: eradicate Q_FOREACH loops [needing qAsConst()]
... by replacing them with C++11 range-for loops.
To avoid detaches of these mutable Qt containers,
wrap the container in qAsConst().
Saves more than 2KiB in text size on optimized GCC 6.0
Linux AMD64 builds.
Change-Id: I9610e711edc01d2a1ba19fef65d6b000ffc77255
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbconnection.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 001500ba1b..2126c271f9 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -522,7 +522,7 @@ void QXcbConnection::initializeScreens() ++xcbScreenNumber; } // for each xcb screen - foreach (QXcbVirtualDesktop *virtualDesktop, m_virtualDesktops) + for (QXcbVirtualDesktop *virtualDesktop : qAsConst(m_virtualDesktops)) virtualDesktop->subscribeToXFixesSelectionNotify(); if (m_virtualDesktops.isEmpty()) { @@ -537,7 +537,7 @@ void QXcbConnection::initializeScreens() } // Push the screens to QGuiApplication - foreach (QXcbScreen *screen, m_screens) { + for (QXcbScreen *screen : qAsConst(m_screens)) { qCDebug(lcQpaScreen) << "adding" << screen << "(Primary:" << screen->isPrimary() << ")"; QXcbIntegration::instance()->screenAdded(screen, screen->isPrimary()); } @@ -1236,7 +1236,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) #ifndef QT_NO_CLIPBOARD m_clipboard->handleXFixesSelectionRequest(notify_event); #endif - foreach (QXcbVirtualDesktop *virtualDesktop, m_virtualDesktops) + for (QXcbVirtualDesktop *virtualDesktop : qAsConst(m_virtualDesktops)) virtualDesktop->handleXFixesSelectionNotify(notify_event); handled = true; @@ -1245,7 +1245,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) handled = true; } else if (has_randr_extension && response_type == xrandr_first_event + XCB_RANDR_SCREEN_CHANGE_NOTIFY) { xcb_randr_screen_change_notify_event_t *change_event = (xcb_randr_screen_change_notify_event_t *)event; - foreach (QXcbScreen *s, m_screens) { + for (QXcbScreen *s : qAsConst(m_screens)) { if (s->root() == change_event->root ) s->handleScreenChange(change_event); } @@ -1736,7 +1736,7 @@ void QXcbConnection::processXcbEvents() // Indicate with a null event that the event the callbacks are waiting for // is not in the queue currently. - Q_FOREACH (PeekFunc f, m_peekFuncs) + for (PeekFunc f : qAsConst(m_peekFuncs)) f(this, 0); m_peekFuncs.clear(); |