From b393641888f18e3accf094c91808e2189c2138cc Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 26 Jan 2016 14:38:54 +0100 Subject: 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 --- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms/xcb/qxcbconnection_xi2.cpp') diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 11577ba1f4..836761c9b9 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -274,7 +274,7 @@ void QXcbConnection::xi2SetupDevices() void QXcbConnection::finalizeXInput2() { - foreach (XInput2TouchDeviceData *dev, m_touchDevices) { + for (XInput2TouchDeviceData *dev : qAsConst(m_touchDevices)) { if (dev->xiDeviceInfo) XIFreeDeviceInfo(dev->xiDeviceInfo); delete dev; @@ -359,7 +359,7 @@ void QXcbConnection::xi2Select(xcb_window_t window) scrollBitMask = XI_MotionMask; scrollBitMask |= XI_ButtonReleaseMask; int i=0; - Q_FOREACH (const ScrollingDevice& scrollingDevice, m_scrollingDevices) { + for (const ScrollingDevice& scrollingDevice : qAsConst(m_scrollingDevices)) { if (tabletDevices.contains(scrollingDevice.deviceId)) continue; // All necessary events are already captured. xiEventMask[i].deviceid = scrollingDevice.deviceId; -- cgit v1.2.3