diff --git a/src/abstract_client.cpp b/src/abstract_client.cpp index a94e23af11..0ee0d7251d 100644 --- a/src/abstract_client.cpp +++ b/src/abstract_client.cpp @@ -2612,7 +2612,8 @@ QRect AbstractClient::iconGeometry() const AbstractClient *candidatePanel = nullptr; QRect candidateGeom; - for (auto i = windowManagementInterface()->minimizedGeometries().constBegin(), end = windowManagementInterface()->minimizedGeometries().constEnd(); i != end; ++i) { + const auto minGeometries = windowManagementInterface()->minimizedGeometries(); + for (auto i = minGeometries.constBegin(), end = minGeometries.constEnd(); i != end; ++i) { AbstractClient *client = waylandServer()->findClient(i.key()); if (!client) { continue; diff --git a/src/activation.cpp b/src/activation.cpp index 8335a52ba8..e640344bbe 100644 --- a/src/activation.cpp +++ b/src/activation.cpp @@ -295,7 +295,7 @@ void Workspace::activateClient(AbstractClient* c, bool force) if (!c->isOnCurrentActivity()) { ++block_focus; //DBUS! - Activities::self()->setCurrent(c->activities().first()); //first isn't necessarily best, but it's easiest + Activities::self()->setCurrent(c->activities().constFirst()); //first isn't necessarily best, but it's easiest --block_focus; } #endif diff --git a/src/effects.cpp b/src/effects.cpp index 5b93d2cc45..92dd0d8809 100644 --- a/src/effects.cpp +++ b/src/effects.cpp @@ -2345,7 +2345,7 @@ void EffectFrameImpl::setIcon(const QIcon& icon) m_sceneFrame->crossFadeIcon(); } if (m_iconSize.isEmpty() && !m_icon.availableSizes().isEmpty()) { // Set a size if we don't already have one - setIconSize(m_icon.availableSizes().first()); + setIconSize(m_icon.availableSizes().constFirst()); } m_sceneFrame->freeIconFrame(); } diff --git a/src/effects/presentwindows/presentwindows.cpp b/src/effects/presentwindows/presentwindows.cpp index bb1e5faabb..7fc9177c4e 100644 --- a/src/effects/presentwindows/presentwindows.cpp +++ b/src/effects/presentwindows/presentwindows.cpp @@ -1837,7 +1837,7 @@ void PresentWindowsEffect::closeWindow() EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, int ydiff, bool wrap) const { if (!w) - return m_motionManager.managedWindows().first(); + return m_motionManager.managedWindows().constFirst(); // TODO: Is it possible to select hidden windows? EffectWindow* next; diff --git a/src/kcmkwin/kwindecoration/kwin-applywindowdecoration.cpp b/src/kcmkwin/kwindecoration/kwin-applywindowdecoration.cpp index fb1d83fe8c..987eace05c 100644 --- a/src/kcmkwin/kwindecoration/kwin-applywindowdecoration.cpp +++ b/src/kcmkwin/kwindecoration/kwin-applywindowdecoration.cpp @@ -39,7 +39,7 @@ int main(int argc, char **argv) KWinDecorationSettings *settings = new KWinDecorationSettings(&app); QTextStream ts(stdout); if (!parser->positionalArguments().isEmpty()) { - QString requestedTheme{parser->positionalArguments().first()}; + QString requestedTheme{parser->positionalArguments().constFirst()}; if (requestedTheme.endsWith(QStringLiteral("/*"))) { // Themes installed through KNewStuff will commonly be given an installed files entry // which has the main directory name and an asterix to say the cursors are all in that directory, diff --git a/src/platformsupport/scenes/opengl/abstract_egl_backend.cpp b/src/platformsupport/scenes/opengl/abstract_egl_backend.cpp index 47c4ee2db4..4058a7965f 100644 --- a/src/platformsupport/scenes/opengl/abstract_egl_backend.cpp +++ b/src/platformsupport/scenes/opengl/abstract_egl_backend.cpp @@ -449,7 +449,8 @@ void AbstractEglTexture::updateTexture(WindowPixmap *pixmap, const QRegion ®i auto s = pixmap->surface(); if (EglDmabufBuffer *dmabuf = static_cast(buffer->linuxDmabufBuffer())) { q->bind(); - glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES) dmabuf->images()[0]); //TODO + auto images = dmabuf->images(); + glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES) images[0]); //TODO q->unbind(); if (m_image != EGL_NO_IMAGE_KHR) { eglDestroyImageKHR(m_backend->eglDisplay(), m_image); @@ -589,7 +590,7 @@ bool AbstractEglTexture::loadEglTexture(const QPointer< KWaylandServer::BufferIn bool AbstractEglTexture::loadDmabufTexture(const QPointer< KWaylandServer::BufferInterface > &buffer) { auto *dmabuf = static_cast(buffer->linuxDmabufBuffer()); - if (!dmabuf || dmabuf->images()[0] == EGL_NO_IMAGE_KHR) { + if (!dmabuf || dmabuf->images().isEmpty() || dmabuf->images().constFirst() == EGL_NO_IMAGE_KHR) { qCritical(KWIN_OPENGL) << "Invalid dmabuf-based wl_buffer"; q->discard(); return false; @@ -601,7 +602,7 @@ bool AbstractEglTexture::loadDmabufTexture(const QPointer< KWaylandServer::Buffe q->setWrapMode(GL_CLAMP_TO_EDGE); q->setFilter(GL_NEAREST); q->bind(); - glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES) dmabuf->images()[0]); + glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES) dmabuf->images().constFirst()); q->unbind(); m_size = dmabuf->size(); diff --git a/src/plugins/scenes/xrender/scene_xrender.cpp b/src/plugins/scenes/xrender/scene_xrender.cpp index 4403e7864b..1c8cb6db93 100644 --- a/src/plugins/scenes/xrender/scene_xrender.cpp +++ b/src/plugins/scenes/xrender/scene_xrender.cpp @@ -958,14 +958,14 @@ void SceneXRenderShadow::layoutShadowRects(QRect& top, QRect& topRight, return; } - WindowQuad topQuad = quads.select(WindowQuadShadowTop)[0]; - WindowQuad topRightQuad = quads.select(WindowQuadShadowTopRight)[0]; - WindowQuad topLeftQuad = quads.select(WindowQuadShadowTopLeft)[0]; - WindowQuad leftQuad = quads.select(WindowQuadShadowLeft)[0]; - WindowQuad rightQuad = quads.select(WindowQuadShadowRight)[0]; - WindowQuad bottomQuad = quads.select(WindowQuadShadowBottom)[0]; - WindowQuad bottomRightQuad = quads.select(WindowQuadShadowBottomRight)[0]; - WindowQuad bottomLeftQuad = quads.select(WindowQuadShadowBottomLeft)[0]; + WindowQuad topQuad = quads.select(WindowQuadShadowTop).constFirst(); + WindowQuad topRightQuad = quads.select(WindowQuadShadowTopRight).constFirst(); + WindowQuad topLeftQuad = quads.select(WindowQuadShadowTopLeft).constFirst(); + WindowQuad leftQuad = quads.select(WindowQuadShadowLeft).constFirst(); + WindowQuad rightQuad = quads.select(WindowQuadShadowRight).constFirst(); + WindowQuad bottomQuad = quads.select(WindowQuadShadowBottom).constFirst(); + WindowQuad bottomRightQuad = quads.select(WindowQuadShadowBottomRight).constFirst(); + WindowQuad bottomLeftQuad = quads.select(WindowQuadShadowBottomLeft).constFirst(); top = QRect(topQuad.left(), topQuad.top(), (topQuad.right()-topQuad.left()), (topQuad.bottom()-topQuad.top())); topLeft = QRect(topLeftQuad.left(), topLeftQuad.top(), (topLeftQuad.right()-topLeftQuad.left()), (topLeftQuad.bottom()-topLeftQuad.top())); diff --git a/tests/x11shadowreader.cpp b/tests/x11shadowreader.cpp index f4981bd5d1..2050ad40fd 100644 --- a/tests/x11shadowreader.cpp +++ b/tests/x11shadowreader.cpp @@ -89,7 +89,7 @@ int main(int argc, char **argv) } bool ok = false; - const auto shadow = readShadow(parser.positionalArguments().first().toULongLong(&ok, 16)); + const auto shadow = readShadow(parser.positionalArguments().constFirst().toULongLong(&ok, 16)); if (!ok) { qDebug() << "!!! Failed to read window id"; return 1;