From e312fbc990bf6e59dab5eb2818e9cd1c5a7c9c60 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Thu, 7 Sep 2023 17:41:13 +0300 Subject: [PATCH] qcompleter: avoid implicit detach MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit by const method usage Change-Id: Iade97ee80ed9a89915e89b9f17f12b1842c1baab Reviewed-by: MÃ¥rten Nordheim --- src/widgets/util/qcompleter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index 9664004455..394a968aad 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -840,8 +840,8 @@ void QCompleterPrivate::setCurrentIndex(QModelIndex index, bool select) void QCompleterPrivate::_q_completionSelected(const QItemSelection& selection) { QModelIndex index; - if (!selection.indexes().isEmpty()) - index = selection.indexes().first(); + if (const auto indexes = selection.indexes(); !indexes.isEmpty()) + index = indexes.first(); _q_complete(index, true); }