diff options
Diffstat (limited to 'src')
27 files changed, 72 insertions, 50 deletions
diff --git a/src/client/qwaylanddatasource.cpp b/src/client/qwaylanddatasource.cpp index 0c6ad50e..ea76943a 100644 --- a/src/client/qwaylanddatasource.cpp +++ b/src/client/qwaylanddatasource.cpp @@ -60,7 +60,8 @@ QWaylandDataSource::QWaylandDataSource(QWaylandDataDeviceManager *dataDeviceMana { if (!mimeData) return; - Q_FOREACH (const QString &format, mimeData->formats()) { + const auto formats = mimeData->formats(); + for (const QString &format : formats) { offer(format); } } diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp index d0f98170..41bdf6b0 100644 --- a/src/client/qwaylanddisplay.cpp +++ b/src/client/qwaylanddisplay.cpp @@ -366,7 +366,7 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) } } - foreach (QWaylandScreen *screen, mScreens) { + for (QWaylandScreen *screen : qAsConst(mScreens)) { if (screen->outputId() == id) { mScreens.removeOne(screen); QWindowSystemInterface::handleScreenRemoved(screen); diff --git a/src/client/qwaylandinputcontext.cpp b/src/client/qwaylandinputcontext.cpp index 1d34f06c..068c058e 100644 --- a/src/client/qwaylandinputcontext.cpp +++ b/src/client/qwaylandinputcontext.cpp @@ -221,11 +221,11 @@ void QWaylandTextInput::zwp_text_input_v2_leave(uint32_t serial, ::wl_surface *s void QWaylandTextInput::zwp_text_input_v2_modifiers_map(wl_array *map) { - QList<QByteArray> modifiersMap = QByteArray::fromRawData(static_cast<const char*>(map->data), map->size).split('\0'); + const QList<QByteArray> modifiersMap = QByteArray::fromRawData(static_cast<const char*>(map->data), map->size).split('\0'); m_modifiersMap.clear(); - Q_FOREACH (const QByteArray &modifier, modifiersMap) { + for (const QByteArray &modifier : modifiersMap) { if (modifier == "Shift") m_modifiersMap.append(Qt::ShiftModifier); else if (modifier == "Control") diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index 8a580898..6ebc3bed 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/qwaylandinputdevice.cpp @@ -1349,7 +1349,7 @@ bool QWaylandInputDevice::Touch::allTouchPointsReleased() void QWaylandInputDevice::Touch::releasePoints() { - Q_FOREACH (const QWindowSystemInterface::TouchPoint &previousPoint, mPrevTouchPoints) { + for (const QWindowSystemInterface::TouchPoint &previousPoint : qAsConst(mPrevTouchPoints)) { QWindowSystemInterface::TouchPoint tp = previousPoint; tp.state = Qt::TouchPointReleased; mTouchPoints.append(tp); diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp index ea2b50b4..e75aebd9 100644 --- a/src/client/qwaylandintegration.cpp +++ b/src/client/qwaylandintegration.cpp @@ -421,7 +421,7 @@ void QWaylandIntegration::initializeShellIntegration() preferredShells << QLatin1String("wl-shell") << QLatin1String("ivi-shell"); } - Q_FOREACH (QString preferredShell, preferredShells) { + for (const QString &preferredShell : qAsConst(preferredShells)) { mShellIntegration.reset(createShellIntegration(preferredShell)); if (mShellIntegration) { qCDebug(lcQpaWayland, "Using the '%s' shell integration", qPrintable(preferredShell)); diff --git a/src/client/qwaylandscreen.cpp b/src/client/qwaylandscreen.cpp index d116a807..e7079683 100644 --- a/src/client/qwaylandscreen.cpp +++ b/src/client/qwaylandscreen.cpp @@ -175,7 +175,8 @@ QList<QPlatformScreen *> QWaylandScreen::virtualSiblings() const void QWaylandScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask) { - foreach (QWindow *window, QGuiApplication::allWindows()) { + const auto allWindows = QGuiApplication::allWindows(); + for (QWindow *window : allWindows) { QWaylandWindow *w = static_cast<QWaylandWindow *>(window->handle()); if (w && w->waylandScreen() == this) w->setOrientationMask(mask); diff --git a/src/client/qwaylandshmbackingstore.cpp b/src/client/qwaylandshmbackingstore.cpp index c16d346e..d768e7fc 100644 --- a/src/client/qwaylandshmbackingstore.cpp +++ b/src/client/qwaylandshmbackingstore.cpp @@ -243,7 +243,8 @@ void QWaylandShmBackingStore::resize(const QSize &size, const QRegion &) QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size) { - foreach (QWaylandShmBuffer *b, mBuffers) { + const auto copy = mBuffers; // remove when ported to vector<unique_ptr> + remove_if + for (QWaylandShmBuffer *b : copy) { if (!b->busy()) { if (b->size() == size) { return b; diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index 9bc400f8..c3bfdeaf 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -94,7 +94,8 @@ QWaylandWindow::~QWaylandWindow() reset(false); const QWindow *parent = window(); - foreach (QWindow *w, QGuiApplication::topLevelWindows()) { + const auto tlw = QGuiApplication::topLevelWindows(); + for (QWindow *w : tlw) { if (w->transientParent() == parent) QWindowSystemInterface::handleCloseEvent(w); } @@ -786,7 +787,7 @@ bool QWaylandWindow::createDecoration() } if (hadDecoration != (bool)mWindowDecoration) { - foreach (QWaylandSubSurface *subsurf, mChildren) { + for (QWaylandSubSurface *subsurf : qAsConst(mChildren)) { QPoint pos = subsurf->window()->geometry().topLeft(); QMargins m = frameMargins(); subsurf->set_position(pos.x() + m.left(), pos.y() + m.top()); diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp index 530cf8ed..36c995c3 100644 --- a/src/compositor/compositor_api/qwaylandcompositor.cpp +++ b/src/compositor/compositor_api/qwaylandcompositor.cpp @@ -200,8 +200,8 @@ void QWaylandCompositorPrivate::init() buffer_manager = new QtWayland::BufferManager(q); wl_display_init_shm(display); - QVector<wl_shm_format> formats = QWaylandSharedMemoryFormatHelper::supportedWaylandFormats(); - foreach (wl_shm_format format, formats) + const QVector<wl_shm_format> formats = QWaylandSharedMemoryFormatHelper::supportedWaylandFormats(); + for (wl_shm_format format : formats) wl_display_add_shm_format(display, format); if (!socket_name.isEmpty()) { @@ -706,7 +706,7 @@ QList<QWaylandSurface *> QWaylandCompositor::surfacesForClient(QWaylandClient* c { Q_D(const QWaylandCompositor); QList<QWaylandSurface *> surfs; - foreach (QWaylandSurface *surface, d->all_surfaces) { + for (QWaylandSurface *surface : d->all_surfaces) { if (surface->client() == client) surfs.append(surface); } @@ -728,7 +728,7 @@ QList<QWaylandSurface *> QWaylandCompositor::surfaces() const QWaylandOutput *QWaylandCompositor::outputFor(QWindow *window) const { Q_D(const QWaylandCompositor); - foreach (QWaylandOutput *output, d->outputs) { + for (QWaylandOutput *output : d->outputs) { if (output->window() == window) return output; } diff --git a/src/compositor/compositor_api/qwaylandkeyboard.cpp b/src/compositor/compositor_api/qwaylandkeyboard.cpp index 2302c0b6..452be436 100644 --- a/src/compositor/compositor_api/qwaylandkeyboard.cpp +++ b/src/compositor/compositor_api/qwaylandkeyboard.cpp @@ -256,7 +256,8 @@ void QWaylandKeyboardPrivate::maybeUpdateKeymap() return; createXKBKeymap(); - foreach (Resource *res, resourceMap()) { + const auto resMap = resourceMap(); + for (Resource *res : resMap) { send_keymap(res->handle, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, keymap_fd, keymap_size); } @@ -386,7 +387,8 @@ void QWaylandKeyboardPrivate::createXKBKeymap() void QWaylandKeyboardPrivate::sendRepeatInfo() { - Q_FOREACH (Resource *resource, resourceMap()) { + const auto resMap = resourceMap(); + for (Resource *resource : resMap) { if (resource->version() >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION) send_repeat_info(resource->handle, repeatRate, repeatDelay); } diff --git a/src/compositor/compositor_api/qwaylandoutput.cpp b/src/compositor/compositor_api/qwaylandoutput.cpp index 006edbe6..7a02d4ca 100644 --- a/src/compositor/compositor_api/qwaylandoutput.cpp +++ b/src/compositor/compositor_api/qwaylandoutput.cpp @@ -831,7 +831,8 @@ void QWaylandOutput::setScaleFactor(int scale) d->scaleFactor = scale; - Q_FOREACH (QWaylandOutputPrivate::Resource *resource, d->resourceMap().values()) { + const auto resMap = d->resourceMap(); + for (QWaylandOutputPrivate::Resource *resource : resMap) { if (resource->version() >= 2) { d->send_scale(resource->handle, scale); d->send_done(resource->handle); diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp index c79787e6..add4020d 100644 --- a/src/compositor/compositor_api/qwaylandsurface.cpp +++ b/src/compositor/compositor_api/qwaylandsurface.cpp @@ -136,9 +136,9 @@ QWaylandSurfacePrivate::~QWaylandSurfacePrivate() bufferRef = QWaylandBufferRef(); - foreach (QtWayland::FrameCallback *c, pendingFrameCallbacks) + for (QtWayland::FrameCallback *c : qAsConst(pendingFrameCallbacks)) c->destroy(); - foreach (QtWayland::FrameCallback *c, frameCallbacks) + for (QtWayland::FrameCallback *c : qAsConst(frameCallbacks)) c->destroy(); } @@ -151,7 +151,7 @@ void QWaylandSurfacePrivate::removeFrameCallback(QtWayland::FrameCallback *callb void QWaylandSurfacePrivate::notifyViewsAboutDestruction() { Q_Q(QWaylandSurface); - foreach (QWaylandView *view, views) { + for (QWaylandView *view : qAsConst(views)) { QWaylandViewPrivate::get(view)->markSurfaceAsDestroyed(q); } if (hasContent) { @@ -673,7 +673,7 @@ QWaylandCompositor *QWaylandSurface::compositor() const void QWaylandSurface::frameStarted() { Q_D(QWaylandSurface); - foreach (QtWayland::FrameCallback *c, d->frameCallbacks) + for (QtWayland::FrameCallback *c : qAsConst(d->frameCallbacks)) c->canSend = true; } diff --git a/src/compositor/compositor_api/qwaylandview.cpp b/src/compositor/compositor_api/qwaylandview.cpp index 1a6bf1a6..12889bdf 100644 --- a/src/compositor/compositor_api/qwaylandview.cpp +++ b/src/compositor/compositor_api/qwaylandview.cpp @@ -246,7 +246,8 @@ bool QWaylandView::advance() return false; if (d->surface && d->surface->primaryView() == this) { - Q_FOREACH (QWaylandView *view, d->surface->views()) { + const auto views = d->surface->views(); + for (QWaylandView *view : views) { if (view != this && view->allowDiscardFrontBuffer() && view->d_func()->currentBuffer == d->currentBuffer) view->discardCurrentBuffer(); } diff --git a/src/compositor/extensions/qwaylandqtwindowmanager.cpp b/src/compositor/extensions/qwaylandqtwindowmanager.cpp index 86678b2e..c3cf3488 100644 --- a/src/compositor/extensions/qwaylandqtwindowmanager.cpp +++ b/src/compositor/extensions/qwaylandqtwindowmanager.cpp @@ -109,7 +109,8 @@ void QWaylandQtWindowManager::setShowIsFullScreen(bool value) return; d->showIsFullScreen = value; - Q_FOREACH (QWaylandQtWindowManagerPrivate::Resource *resource, d->resourceMap().values()) { + const auto resMap = d->resourceMap(); + for (QWaylandQtWindowManagerPrivate::Resource *resource : resMap) { d->send_hints(resource->handle, static_cast<int32_t>(d->showIsFullScreen)); } Q_EMIT showIsFullScreenChanged(); diff --git a/src/compositor/extensions/qwaylandtextinput.cpp b/src/compositor/extensions/qwaylandtextinput.cpp index f60a32a1..b46caa64 100644 --- a/src/compositor/extensions/qwaylandtextinput.cpp +++ b/src/compositor/extensions/qwaylandtextinput.cpp @@ -162,7 +162,7 @@ void QWaylandTextInputPrivate::sendInputMethodEvent(QInputMethodEvent *event) afterCommit.cursorPosition += event->commitString().length(); afterCommit.anchorPosition = afterCommit.cursorPosition; - foreach (const QInputMethodEvent::Attribute &attribute, event->attributes()) { + for (const QInputMethodEvent::Attribute &attribute : event->attributes()) { if (attribute.type == QInputMethodEvent::Selection) { afterCommit.cursorPosition = attribute.start; afterCommit.anchorPosition = attribute.length; @@ -174,7 +174,7 @@ void QWaylandTextInputPrivate::sendInputMethodEvent(QInputMethodEvent *event) } } send_commit_string(focusResource->handle, event->commitString()); - foreach (const QInputMethodEvent::Attribute &attribute, event->attributes()) { + for (const QInputMethodEvent::Attribute &attribute : event->attributes()) { if (attribute.type == QInputMethodEvent::Cursor) { int index = QWaylandInputMethodEventBuilder::indexToWayland(event->preeditString(), attribute.start); send_preedit_cursor(focusResource->handle, index); diff --git a/src/compositor/extensions/qwaylandwlshell.cpp b/src/compositor/extensions/qwaylandwlshell.cpp index 9871a8a5..8cd2c731 100644 --- a/src/compositor/extensions/qwaylandwlshell.cpp +++ b/src/compositor/extensions/qwaylandwlshell.cpp @@ -332,7 +332,7 @@ QList<QWaylandWlShellSurface *> QWaylandWlShell::shellSurfacesForClient(QWayland { Q_D(const QWaylandWlShell); QList<QWaylandWlShellSurface *> surfsForClient; - Q_FOREACH (QWaylandWlShellSurface *shellSurface, d->m_shellSurfaces) { + for (QWaylandWlShellSurface *shellSurface : d->m_shellSurfaces) { if (shellSurface->surface() && shellSurface->surface()->client() == client) surfsForClient.append(shellSurface); } @@ -343,7 +343,7 @@ QList<QWaylandWlShellSurface *> QWaylandWlShell::mappedPopups() const { Q_D(const QWaylandWlShell); QList<QWaylandWlShellSurface *> popupSurfaces; - Q_FOREACH (QWaylandWlShellSurface *shellSurface, d->m_shellSurfaces) { + for (QWaylandWlShellSurface *shellSurface : d->m_shellSurfaces) { if (shellSurface->windowType() == Qt::WindowType::Popup && shellSurface->surface() && shellSurface->surface()->hasContent()) { popupSurfaces.append(shellSurface); @@ -355,7 +355,7 @@ QList<QWaylandWlShellSurface *> QWaylandWlShell::mappedPopups() const QWaylandClient *QWaylandWlShell::popupClient() const { Q_D(const QWaylandWlShell); - Q_FOREACH (QWaylandWlShellSurface *shellSurface, d->m_shellSurfaces) { + for (QWaylandWlShellSurface *shellSurface : d->m_shellSurfaces) { if (shellSurface->windowType() == Qt::WindowType::Popup && shellSurface->surface() && shellSurface->surface()->hasContent()) { return shellSurface->surface()->client(); @@ -366,7 +366,8 @@ QWaylandClient *QWaylandWlShell::popupClient() const void QWaylandWlShell::closeAllPopups() { - Q_FOREACH (QWaylandWlShellSurface* shellSurface, mappedPopups()) + const auto mapped = mappedPopups(); + for (QWaylandWlShellSurface *shellSurface : mapped) shellSurface->sendPopupDone(); } diff --git a/src/compositor/extensions/qwaylandwlshellintegration.cpp b/src/compositor/extensions/qwaylandwlshellintegration.cpp index 99a2e765..b732069c 100644 --- a/src/compositor/extensions/qwaylandwlshellintegration.cpp +++ b/src/compositor/extensions/qwaylandwlshellintegration.cpp @@ -198,7 +198,8 @@ void WlShellIntegration::handleSetPopup(QWaylandSeat *seat, QWaylandSurface *par // Find the parent item on the same output QWaylandQuickShellSurfaceItem *parentItem = nullptr; - Q_FOREACH (QWaylandView *view, parent->views()) { + const auto views = parent->views(); + for (QWaylandView *view : views) { if (view->output() == m_item->view()->output()) { QWaylandQuickShellSurfaceItem *item = qobject_cast<QWaylandQuickShellSurfaceItem*>(view->renderObject()); if (item) { diff --git a/src/compositor/extensions/qwaylandxdgshell.cpp b/src/compositor/extensions/qwaylandxdgshell.cpp index f06fd793..eece3f3d 100644 --- a/src/compositor/extensions/qwaylandxdgshell.cpp +++ b/src/compositor/extensions/qwaylandxdgshell.cpp @@ -1279,7 +1279,9 @@ QWaylandXdgToplevel *QWaylandXdgToplevel::fromResource(wl_resource *resource) QList<int> QWaylandXdgToplevel::statesAsInts() const { QList<int> list; - Q_FOREACH (uint state, states()) { + const auto s = states(); + list.reserve(s.size()); + for (auto state : s) { list << static_cast<int>(state); } return list; diff --git a/src/compositor/extensions/qwaylandxdgshellv5.cpp b/src/compositor/extensions/qwaylandxdgshellv5.cpp index a85efbc5..eebfab6d 100644 --- a/src/compositor/extensions/qwaylandxdgshellv5.cpp +++ b/src/compositor/extensions/qwaylandxdgshellv5.cpp @@ -414,7 +414,7 @@ void QWaylandXdgSurfaceV5Private::xdg_surface_ack_configure(Resource *resource, break; } - QVector<uint> changedStates; + std::vector<uint> changedStates; std::set_symmetric_difference( m_lastAckedConfigure.states.begin(), m_lastAckedConfigure.states.end(), config.states.begin(), config.states.end(), @@ -423,7 +423,7 @@ void QWaylandXdgSurfaceV5Private::xdg_surface_ack_configure(Resource *resource, m_lastAckedConfigure = config; if (!changedStates.empty()) { - Q_FOREACH (uint state, changedStates) { + for (uint state : changedStates) { switch (state) { case QWaylandXdgSurfaceV5::State::MaximizedState: emit q->maximizedChanged(); @@ -580,7 +580,7 @@ void QWaylandXdgShellV5::initialize() QWaylandClient *QWaylandXdgShellV5::popupClient() const { Q_D(const QWaylandXdgShellV5); - Q_FOREACH (QWaylandXdgPopupV5 *popup, d->m_xdgPopups) { + for (QWaylandXdgPopupV5 *popup : d->m_xdgPopups) { if (popup->surface()->hasContent()) return popup->surface()->client(); } @@ -987,7 +987,9 @@ void QWaylandXdgSurfaceV5::initialize() QList<int> QWaylandXdgSurfaceV5::statesAsInts() const { QList<int> list; - Q_FOREACH (uint state, states()) { + const auto s = states(); + list.reserve(s.size()); + for (auto state : s) { list << static_cast<int>(state); } return list; @@ -1238,7 +1240,8 @@ uint QWaylandXdgSurfaceV5::sendConfigure(const QSize &size, const QVector<uint> uint QWaylandXdgSurfaceV5::sendConfigure(const QSize &size, const QVector<QWaylandXdgSurfaceV5::State> &states) { QVector<uint> asUints; - Q_FOREACH (QWaylandXdgSurfaceV5::State state, states) { + asUints.reserve(states.size()); + for (QWaylandXdgSurfaceV5::State state : states) { asUints << state; } return sendConfigure(size, asUints); diff --git a/src/compositor/extensions/qwaylandxdgshellv6.cpp b/src/compositor/extensions/qwaylandxdgshellv6.cpp index d1ee45da..96d6f550 100644 --- a/src/compositor/extensions/qwaylandxdgshellv6.cpp +++ b/src/compositor/extensions/qwaylandxdgshellv6.cpp @@ -1214,7 +1214,9 @@ QWaylandSurfaceRole *QWaylandXdgToplevelV6::role() QList<int> QWaylandXdgToplevelV6::statesAsInts() const { QList<int> list; - Q_FOREACH (uint state, states()) { + const auto s = states(); + list.reserve(s.size()); + for (auto state : s) { list << static_cast<int>(state); } return list; diff --git a/src/compositor/global/qwaylandcompositorextension.cpp b/src/compositor/global/qwaylandcompositorextension.cpp index 91298539..36daebce 100644 --- a/src/compositor/global/qwaylandcompositorextension.cpp +++ b/src/compositor/global/qwaylandcompositorextension.cpp @@ -146,7 +146,7 @@ QWaylandObject::QWaylandObject(QObjectPrivate &d, QObject *parent) QWaylandObject::~QWaylandObject() { - foreach (QWaylandCompositorExtension *extension, extension_vector) + for (QWaylandCompositorExtension *extension : qAsConst(extension_vector)) QWaylandCompositorExtensionPrivate::get(extension)->extension_container = nullptr; } diff --git a/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp b/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp index e30bc84f..624a24b0 100644 --- a/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp +++ b/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp @@ -186,12 +186,12 @@ struct wl_display *DataDeviceManager::display() const void DataDeviceManager::overrideSelection(const QMimeData &mimeData) { - QStringList formats = mimeData.formats(); + const QStringList formats = mimeData.formats(); if (formats.isEmpty()) return; m_retainedData.clear(); - foreach (const QString &format, formats) + for (const QString &format : formats) m_retainedData.setData(format, mimeData.data(format)); QWaylandCompositorPrivate::get(m_compositor)->feedRetainedSelectionData(&m_retainedData); @@ -217,7 +217,8 @@ bool DataDeviceManager::offerFromCompositorToClient(wl_resource *clientDataDevic wl_resource_create(client, &wl_data_offer_interface, -1, 0); wl_resource_set_implementation(selectionOffer, &compositor_offer_interface, this, nullptr); wl_data_device_send_data_offer(clientDataDeviceResource, selectionOffer); - foreach (const QString &format, m_retainedData.formats()) { + const auto formats = m_retainedData.formats(); + for (const QString &format : formats) { QByteArray ba = format.toLatin1(); wl_data_offer_send_offer(selectionOffer, ba.constData()); } diff --git a/src/compositor/wayland_wrapper/qwldataoffer.cpp b/src/compositor/wayland_wrapper/qwldataoffer.cpp index 9fea664a..ddc5545e 100644 --- a/src/compositor/wayland_wrapper/qwldataoffer.cpp +++ b/src/compositor/wayland_wrapper/qwldataoffer.cpp @@ -55,7 +55,8 @@ DataOffer::DataOffer(DataSource *dataSource, QtWaylandServer::wl_data_device::Re { // FIXME: connect to dataSource and reset m_dataSource on destroy target->data_device_object->send_data_offer(target->handle, resource()->handle); - Q_FOREACH (const QString &mimeType, dataSource->mimeTypes()) { + const auto mimeTypes = dataSource->mimeTypes(); + for (const QString &mimeType : mimeTypes) { send_offer(mimeType); } } diff --git a/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp b/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp index f396e840..ab809806 100644 --- a/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp +++ b/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp @@ -49,7 +49,8 @@ namespace QtWaylandClient { bool QWaylandWlShellIntegration::initialize(QWaylandDisplay *display) { - Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) { + const auto globals = display->globals(); + for (QWaylandDisplay::RegistryGlobal global : globals) { if (global.interface == QLatin1String("wl_shell")) { m_wlShell = new QtWayland::wl_shell(display->wl_registry(), global.id, 1); break; diff --git a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp index 410f2700..4e25949f 100644 --- a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp +++ b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp @@ -51,7 +51,8 @@ namespace QtWaylandClient { bool QWaylandXdgShellV5Integration::initialize(QWaylandDisplay *display) { - Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) { + const auto globals = display->globals(); + for (QWaylandDisplay::RegistryGlobal global : globals) { if (global.interface == QLatin1String("xdg_shell")) { m_xdgShell.reset(new QWaylandXdgShellV5(display->wl_registry(), global.id)); break; diff --git a/src/qtwaylandscanner/qtwaylandscanner.cpp b/src/qtwaylandscanner/qtwaylandscanner.cpp index 7f3dc5ad..02bb5701 100644 --- a/src/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/qtwaylandscanner/qtwaylandscanner.cpp @@ -542,7 +542,7 @@ bool Scanner::process() if (hasEvents) { printf("\n"); - foreach (const WaylandEvent &e, interface.events) { + for (const WaylandEvent &e : interface.events) { printf(" void send_"); printEvent(e); printf(";\n"); @@ -563,7 +563,7 @@ bool Scanner::process() if (hasRequests) { printf("\n"); - foreach (const WaylandEvent &e, interface.requests) { + for (const WaylandEvent &e : interface.requests) { printf(" virtual void %s_", interfaceNameStripped); printEvent(e); printf(";\n"); @@ -826,7 +826,7 @@ bool Scanner::process() printf("\n"); printf(" };\n"); - foreach (const WaylandEvent &e, interface.requests) { + for (const WaylandEvent &e : interface.requests) { printf("\n"); printf(" void %s::%s_", interfaceName, interfaceNameStripped); printEvent(e, true); @@ -996,7 +996,7 @@ bool Scanner::process() if (!interface.requests.isEmpty()) { printf("\n"); - foreach (const WaylandEvent &e, interface.requests) { + for (const WaylandEvent &e : interface.requests) { const WaylandArgument *new_id = newIdArgument(e.arguments); QByteArray new_id_str = "void "; if (new_id) { @@ -1016,7 +1016,7 @@ bool Scanner::process() if (hasEvents) { printf("\n"); printf(" protected:\n"); - foreach (const WaylandEvent &e, interface.events) { + for (const WaylandEvent &e : interface.events) { printf(" virtual void %s_", interfaceNameStripped); printEvent(e); printf(";\n"); diff --git a/src/shared/qwaylandinputmethodeventbuilder.cpp b/src/shared/qwaylandinputmethodeventbuilder.cpp index 88056637..526d0ef4 100644 --- a/src/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/shared/qwaylandinputmethodeventbuilder.cpp @@ -157,7 +157,7 @@ QInputMethodEvent QWaylandInputMethodEventBuilder::buildPreedit(const QString &t attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, indexFromWayland(text, m_preeditCursor), 1, QVariant())); } - Q_FOREACH (const QInputMethodEvent::Attribute &attr, m_preeditStyles) { + for (const QInputMethodEvent::Attribute &attr : qAsConst(m_preeditStyles)) { int start = indexFromWayland(text, attr.start); int length = indexFromWayland(text, attr.start + attr.length) - start; attributes.append(QInputMethodEvent::Attribute(attr.type, start, length, attr.value)); |