From 3ee6c0914d5dd5e16c398b5148028c40d8daffe3 Mon Sep 17 00:00:00 2001 From: Vladimir Belyavsky Date: Sun, 21 Apr 2024 20:39:15 +0300 Subject: QQuickItem: Avoid unnecessary detach on passiveGrabbers list Avoid unnecessary detach on passiveGrabbers list in QQuickItemPrivate::localizedTouchEvent by using QList::constFirst() instead of non-const QList::first(). Change-Id: I01e30f95d662d1e9c9335f2be800624670e1a53a Reviewed-by: Richard Moe Gustavsen --- src/quick/items/qquickitem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 4c26708168..a9a5c4c4a2 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -9289,12 +9289,12 @@ void QQuickItemPrivate::localizedTouchEvent(const QTouchEvent *event, bool isFil bool hasAnotherGrabber = pointGrabber && pointGrabber != q; // if there's no exclusive grabber, look for passive grabbers during filtering if (isFiltering && !pointGrabber) { - auto pg = event->passiveGrabbers(p); + const auto pg = event->passiveGrabbers(p); if (!pg.isEmpty()) { // It seems unlikely to have multiple passive grabbers of one eventpoint with different grandparents. // So hopefully if we start from one passive grabber and go up the parent chain from there, // we will find any filtering parent items that exist. - auto handler = qmlobject_cast(pg.first()); + auto handler = qmlobject_cast(pg.constFirst()); if (handler) pointGrabber = handler->parentItem(); } -- cgit v1.2.3