diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 48331c5a4d0..ca5669ad7b4 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -455,7 +455,7 @@ void QWaylandDisplay::checkTextInputProtocol() QWaylandScreen *QWaylandDisplay::screenForOutput(struct wl_output *output) const { - for (auto screen : qAsConst(mScreens)) { + for (auto screen : std::as_const(mScreens)) { if (screen->output() == output) return screen; } @@ -519,12 +519,12 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin #if QT_WAYLAND_TEXT_INPUT_V4_WIP mTextInputManagerv4.reset(); #endif // QT_WAYLAND_TEXT_INPUT_V4_WIP - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(nullptr); } mTextInputMethodManager.reset(new QtWayland::qt_text_input_method_manager_v1(registry, id, 1)); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInputMethod(new QWaylandTextInputMethod(this, mTextInputMethodManager->get_text_input_method(inputDevice->wl_seat()))); mWaylandIntegration->reconfigureInputContext(); mTextInputManagerIndex = mTextInputManagerList.indexOf(interface); @@ -537,12 +537,12 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin #if QT_WAYLAND_TEXT_INPUT_V4_WIP mTextInputManagerv4.reset(); #endif // QT_WAYLAND_TEXT_INPUT_V4_WIP - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInputMethod(nullptr); } mTextInputManagerv1.reset(new QtWayland::zwp_text_input_manager_v1(registry, id, 1)); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) { + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) { auto textInput = new QWaylandTextInputv1(this, mTextInputManagerv1->create_text_input()); textInput->setSeat(inputDevice->wl_seat()); inputDevice->setTextInput(textInput); @@ -559,12 +559,12 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin #if QT_WAYLAND_TEXT_INPUT_V4_WIP mTextInputManagerv4.reset(); #endif // QT_WAYLAND_TEXT_INPUT_V4_WIP - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInputMethod(nullptr); } mTextInputManagerv2.reset(new QtWayland::zwp_text_input_manager_v2(registry, id, 1)); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(new QWaylandTextInputv2(this, mTextInputManagerv2->get_text_input(inputDevice->wl_seat()))); mWaylandIntegration->reconfigureInputContext(); mTextInputManagerIndex = mTextInputManagerList.indexOf(interface); @@ -575,12 +575,12 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin if (mTextInputManagerIndex < INT_MAX) { mTextInputMethodManager.reset(); mTextInputManagerv2.reset(); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInputMethod(nullptr); } mTextInputManagerv4.reset(new QtWayland::zwp_text_input_manager_v4(registry, id, 1)); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(new QWaylandTextInputv4(this, mTextInputManagerv4->get_text_input(inputDevice->wl_seat()))); mWaylandIntegration->reconfigureInputContext(); mTextInputManagerIndex = mTextInputManagerList.indexOf(interface); @@ -595,7 +595,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } } else if (interface == QLatin1String(QWaylandXdgOutputManagerV1::interface()->name)) { mXdgOutputManager.reset(new QWaylandXdgOutputManagerV1(this, id, version)); - for (auto *screen : qAsConst(mWaitingScreens)) + for (auto *screen : std::as_const(mWaitingScreens)) screen->initXdgOutput(xdgOutputManager()); forceRoundTrip(); } @@ -622,7 +622,7 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) } } - for (QWaylandScreen *screen : qAsConst(mScreens)) { + for (QWaylandScreen *screen : std::as_const(mScreens)) { if (screen->outputId() == id) { mScreens.removeOne(screen); // If this is the last screen, we have to add a fake screen, or Qt will break. @@ -634,27 +634,27 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) } if (global.interface == QLatin1String(QtWayland::zwp_text_input_manager_v1::interface()->name)) { mTextInputManagerv1.reset(); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(nullptr); mWaylandIntegration->reconfigureInputContext(); } if (global.interface == QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name)) { mTextInputManagerv2.reset(); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(nullptr); mWaylandIntegration->reconfigureInputContext(); } #if QT_WAYLAND_TEXT_INPUT_V4_WIP if (global.interface == QLatin1String(QtWayland::zwp_text_input_manager_v4::interface()->name)) { mTextInputManagerv4.reset(); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(nullptr); mWaylandIntegration->reconfigureInputContext(); } #endif // QT_WAYLAND_TEXT_INPUT_V4_WIP if (global.interface == QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name)) { mTextInputMethodManager.reset(); - for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInputMethod(nullptr); mWaylandIntegration->reconfigureInputContext(); } diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 9ff63b3b56a..56c89688677 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -1465,7 +1465,7 @@ void QWaylandInputDevice::handleTouchPoint(int id, QEventPoint::State state, con bool QWaylandInputDevice::Touch::allTouchPointsReleased() { - for (const auto &tp : qAsConst(mPendingTouchPoints)) { + for (const auto &tp : std::as_const(mPendingTouchPoints)) { if (tp.state != QEventPoint::Released) return false; } diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 6d74de13b5c..9ee3811806f 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -422,7 +422,7 @@ void QWaylandIntegration::initializeShellIntegration() preferredShells << QLatin1String("qt-shell"); } - for (const QString &preferredShell : qAsConst(preferredShells)) { + for (const QString &preferredShell : std::as_const(preferredShells)) { mShellIntegration.reset(createShellIntegration(preferredShell)); if (mShellIntegration) { qCDebug(lcQpaWayland, "Using the '%s' shell integration", qPrintable(preferredShell)); diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index fd56a252b93..4f75d205ab1 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -150,7 +150,7 @@ QList QWaylandScreen::virtualSiblings() const list.reserve(screens.size() + (placeholder ? 1 : 0)); - for (QWaylandScreen *screen : qAsConst(screens)) { + for (QWaylandScreen *screen : std::as_const(screens)) { if (screen->screen()) list << screen; } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 73a14b89766..4fd012de211 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -559,7 +559,7 @@ void QWaylandWindow::sendRecursiveExposeEvent() return; sendExposeEvent(QRect(QPoint(), geometry().size())); - for (QWaylandSubSurface *subSurface : qAsConst(mChildren)) { + for (QWaylandSubSurface *subSurface : std::as_const(mChildren)) { auto subWindow = subSurface->window(); subWindow->sendRecursiveExposeEvent(); } @@ -924,7 +924,7 @@ bool QWaylandWindow::createDecoration() } if (hadDecoration != mWindowDecorationEnabled) { - for (QWaylandSubSurface *subsurf : qAsConst(mChildren)) { + for (QWaylandSubSurface *subsurf : std::as_const(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/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp index cfde26c76df..f0758bf7037 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp @@ -132,7 +132,7 @@ QInputMethodEvent *QWaylandInputMethodEventBuilder::buildPreedit(const QString & attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, indexFromWayland(text, m_preeditCursor), 1, QVariant())); } - for (const QInputMethodEvent::Attribute &attr : qAsConst(m_preeditStyles)) { + for (const QInputMethodEvent::Attribute &attr : std::as_const(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)); diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 0e9eb0e5c62..f80795099f5 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -437,7 +437,7 @@ bool Scanner::process() printf("// This file was generated by qtwaylandscanner\n"); printf("// source file is %s\n\n", qPrintable(m_protocolFilePath)); - for (auto b : qAsConst(m_includes)) + for (auto b : std::as_const(m_includes)) printf("#include %s\n", b.constData()); auto printExportMacro = [this](const char *prefix, const QByteArray &preProcessorProtocolName) { @@ -695,7 +695,7 @@ bool Scanner::process() printf(" %s::~%s()\n", interfaceName, interfaceName); printf(" {\n"); - printf(" for (auto resource : qAsConst(m_resource_map))\n"); + printf(" for (auto resource : std::as_const(m_resource_map))\n"); printf(" resource->%s_object = nullptr;\n", interfaceNameStripped); printf("\n"); printf(" if (m_resource)\n"); diff --git a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp index 5ec046d1757..558e4676b3e 100644 --- a/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp +++ b/tests/auto/wayland/primaryselectionv1/tst_primaryselectionv1.cpp @@ -147,7 +147,7 @@ public: {} bool isClean() override { - for (auto *device : qAsConst(m_devices)) { + for (auto *device : std::as_const(m_devices)) { // The client should not leak selection offers, i.e. if this fails, there is a missing // zwp_primary_selection_offer_v1.destroy request if (!device->m_sentSelectionOffers.empty()) diff --git a/tests/auto/wayland/shared/corecompositor.cpp b/tests/auto/wayland/shared/corecompositor.cpp index 38930c540c9..dd7311e41ce 100644 --- a/tests/auto/wayland/shared/corecompositor.cpp +++ b/tests/auto/wayland/shared/corecompositor.cpp @@ -35,7 +35,7 @@ CoreCompositor::~CoreCompositor() bool CoreCompositor::isClean() { Lock lock(this); - for (auto *global : qAsConst(m_globals)) { + for (auto *global : std::as_const(m_globals)) { if (!global->isClean()) return false; } @@ -46,7 +46,7 @@ QString CoreCompositor::dirtyMessage() { Lock lock(this); QStringList messages; - for (auto *global : qAsConst(m_globals)) { + for (auto *global : std::as_const(m_globals)) { if (!global->isClean()) messages << (global->metaObject()->className() % QLatin1String(": ") % global->dirtyMessage()); } diff --git a/tests/auto/wayland/shared/corecompositor.h b/tests/auto/wayland/shared/corecompositor.h index 2edb7f3fc8e..b7d1de78d79 100644 --- a/tests/auto/wayland/shared/corecompositor.h +++ b/tests/auto/wayland/shared/corecompositor.h @@ -98,7 +98,7 @@ public: global_type *get() { warnIfNotLockedByThread(Q_FUNC_INFO); - for (auto *global : qAsConst(m_globals)) { + for (auto *global : std::as_const(m_globals)) { if (auto *casted = qobject_cast(global)) return casted; } @@ -112,7 +112,7 @@ public: global_type *get(int index) { warnIfNotLockedByThread(Q_FUNC_INFO); - for (auto *global : qAsConst(m_globals)) { + for (auto *global : std::as_const(m_globals)) { if (auto *casted = qobject_cast(global)) { if (index--) continue; @@ -130,7 +130,7 @@ public: { warnIfNotLockedByThread(Q_FUNC_INFO); QList matching; - for (auto *global : qAsConst(m_globals)) { + for (auto *global : std::as_const(m_globals)) { if (auto *casted = qobject_cast(global)) matching.append(casted); } diff --git a/tests/auto/wayland/shared/coreprotocol.cpp b/tests/auto/wayland/shared/coreprotocol.cpp index 559ddbd7dca..005151f74f6 100644 --- a/tests/auto/wayland/shared/coreprotocol.cpp +++ b/tests/auto/wayland/shared/coreprotocol.cpp @@ -144,7 +144,7 @@ void Surface::surface_frame(Resource *resource, uint32_t callback) } bool WlCompositor::isClean() { - for (auto *surface : qAsConst(m_surfaces)) { + for (auto *surface : std::as_const(m_surfaces)) { if (!CursorRole::fromSurface(surface)) { if (m_compositor->m_type != CoreCompositor::CompositorType::Legacy) return false; @@ -160,7 +160,7 @@ QString WlCompositor::dirtyMessage() if (isClean()) return "clean"; QStringList messages; - for (auto *s : qAsConst(m_surfaces)) { + for (auto *s : std::as_const(m_surfaces)) { QString role = s->m_role ? s->m_role->staticMetaObject.className(): "none/unknown"; messages << "Surface with role: " + role; } @@ -547,7 +547,7 @@ Shm::Shm(CoreCompositor *compositor, QList formats, int version) bool Shm::isClean() { -// for (ShmPool *pool : qAsConst(m_pools)) { +// for (ShmPool *pool : std::as_const(m_pools)) { // //TODO: return false if not cursor buffer // if (pool->m_buffers.isEmpty()) { // return false; diff --git a/tests/auto/wayland/shared/coreprotocol.h b/tests/auto/wayland/shared/coreprotocol.h index 77ef3cd465f..370b8cd84bb 100644 --- a/tests/auto/wayland/shared/coreprotocol.h +++ b/tests/auto/wayland/shared/coreprotocol.h @@ -411,7 +411,7 @@ protected: void shm_create_pool(Resource *resource, uint32_t id, int32_t fd, int32_t size) override; void shm_bind_resource(Resource *resource) override { - for (auto format : qAsConst(m_formats)) + for (auto format : std::as_const(m_formats)) send_format(resource->handle, format); } }; diff --git a/tests/auto/wayland/shared/datadevice.cpp b/tests/auto/wayland/shared/datadevice.cpp index 100f937d355..26ebec6bd2e 100644 --- a/tests/auto/wayland/shared/datadevice.cpp +++ b/tests/auto/wayland/shared/datadevice.cpp @@ -7,7 +7,7 @@ namespace MockCompositor { bool DataDeviceManager::isClean() { - for (auto *device : qAsConst(m_dataDevices)) { + for (auto *device : std::as_const(m_dataDevices)) { // The client should not leak selection offers, i.e. if this fails, there is a missing // data_offer.destroy request if (!device->m_sentSelectionOffers.empty()) diff --git a/tests/auto/wayland/shared/xdgshell.cpp b/tests/auto/wayland/shared/xdgshell.cpp index b50f36e7d05..eb9a1e87afd 100644 --- a/tests/auto/wayland/shared/xdgshell.cpp +++ b/tests/auto/wayland/shared/xdgshell.cpp @@ -14,7 +14,7 @@ XdgWmBase::XdgWmBase(CoreCompositor *compositor, int version) XdgToplevel *XdgWmBase::toplevel(int i) { int j = 0; - for (auto *xdgSurface : qAsConst(m_xdgSurfaces)) { + for (auto *xdgSurface : std::as_const(m_xdgSurfaces)) { if (auto *toplevel = xdgSurface->m_toplevel) { if (j == i) return toplevel; @@ -27,7 +27,7 @@ XdgToplevel *XdgWmBase::toplevel(int i) XdgPopup *XdgWmBase::popup(int i) { int j = 0; - for (auto *xdgSurface : qAsConst(m_xdgSurfaces)) { + for (auto *xdgSurface : std::as_const(m_xdgSurfaces)) { if (auto *popup = xdgSurface->m_popup) { if (j == i) return popup;