diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-10-06 11:44:06 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-10-10 20:28:09 +0200 |
commit | 2303ee38ead0a4eafa9f8af629fd8495c45d1442 (patch) | |
tree | 7452bd4541af302a6749881b7fdef0f1c7283990 /examples | |
parent | 7f0d702f4e568790dfdfd916fa3c2da5ec78c6df (diff) | |
download | qtwayland-2303ee38ead0a4eafa9f8af629fd8495c45d1442.tar.gz |
Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.
Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.
Task-number: QTBUG-99313
Change-Id: Ia64c6615ee81f7ad5d0658449b0ee347c3db8c29
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/wayland/custom-extension/client-common/customextension.cpp | 6 | ||||
-rw-r--r-- | examples/wayland/server-buffer/compositor/sharebufferextension.cpp | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/examples/wayland/custom-extension/client-common/customextension.cpp b/examples/wayland/custom-extension/client-common/customextension.cpp index b07df27f..73fea01b 100644 --- a/examples/wayland/custom-extension/client-common/customextension.cpp +++ b/examples/wayland/custom-extension/client-common/customextension.cpp @@ -25,7 +25,7 @@ static inline struct ::wl_surface *getWlSurface(QWindow *window) QWindow *CustomExtension::windowForSurface(struct ::wl_surface *surface) { - for (QWindow *w : qAsConst(m_windows)) { + for (QWindow *w : std::as_const(m_windows)) { if (getWlSurface(w) == surface) return w; } @@ -79,7 +79,7 @@ void CustomExtension::sendSpin(QWindow *window, uint ms) void CustomExtension::handleExtensionActive() { if (isActive() && !m_activated) { - for (QWindow *w : qAsConst(m_windows)) + for (QWindow *w : std::as_const(m_windows)) sendWindowRegistration(w); } } @@ -99,7 +99,7 @@ void CustomExtension::example_extension_set_font_size(wl_surface *surface, uint3 void CustomExtension::example_extension_set_window_decoration(uint32_t state) { bool shown = state; - for (QWindow *w : qAsConst(m_windows)) { + for (QWindow *w : std::as_const(m_windows)) { Qt::WindowFlags f = w->flags(); if (shown) f &= ~Qt::FramelessWindowHint; diff --git a/examples/wayland/server-buffer/compositor/sharebufferextension.cpp b/examples/wayland/server-buffer/compositor/sharebufferextension.cpp index 9e658767..b1b499ff 100644 --- a/examples/wayland/server-buffer/compositor/sharebufferextension.cpp +++ b/examples/wayland/server-buffer/compositor/sharebufferextension.cpp @@ -77,7 +77,7 @@ void ShareBufferExtension::share_buffer_bind_resource(Resource *resource) if (!m_server_buffers_created) createServerBuffers(); - for (auto *buffer : qAsConst(m_server_buffers)) { + for (auto *buffer : std::as_const(m_server_buffers)) { qDebug() << "sending" << buffer << "to client"; struct ::wl_client *client = wl_resource_get_client(resource->handle); struct ::wl_resource *buffer_resource = buffer->resourceForClient(client); |