qcompleter: avoid implicit detach

by const method usage

Change-Id: Iade97ee80ed9a89915e89b9f17f12b1842c1baab
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Anton Kudryavtsev 2023-09-07 17:41:13 +03:00
parent a9ffdc59a7
commit e312fbc990

View File

@ -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);
}