[Completer] Stop line edit rewrite on popup highlight (#7447)
Some checks failed
CodeQL / Analyze (cpp) (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
Build Desktop / Configure (push) Has been cancelled
Build Desktop / Debian 13 (push) Has been cancelled
Build Desktop / Debian 12 (push) Has been cancelled
Build Desktop / Fedora 44 (push) Has been cancelled
Build Desktop / Fedora 43 (push) Has been cancelled
Build Desktop / Servatrice_Debian 12 (push) Has been cancelled
Build Desktop / Ubuntu 26.04 (push) Has been cancelled
Build Desktop / Ubuntu 24.04 (push) Has been cancelled
Build Desktop / Arch (push) Has been cancelled
Build Desktop / macOS 13 Intel (push) Has been cancelled
Build Desktop / macOS 14 (push) Has been cancelled
Build Desktop / macOS 15 (push) Has been cancelled
Build Desktop / macOS 26 Debug (push) Has been cancelled
Build Desktop / Windows 10 (push) Has been cancelled
Build Docker / Servatrice (arm) (push) Has been cancelled
Build Docker / Servatrice (x86) (push) Has been cancelled
Build Docker / Publish multi-platform Servatrice image (push) Has been cancelled

* [Completer] Stop line edit rewrite on popup highlight

* [Completer] Extract the completion index into a variable

Make the popup selection update readable at a glance.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL
2026-10-08 14:38:11 +02:00
committed by GitHub
parent 870ab23608
commit 514014dc00

View File

@@ -149,7 +149,8 @@ bool CardCompleterStyler::handlePopupKeyPress(QKeyEvent *event)
const int newRow = qBound(0, currentRow + step, rowCount - 1);
if (newRow != currentRow) {
popup->setCurrentIndex(completer->completionModel()->index(newRow, completer->completionColumn()));
const QModelIndex newIndex = completer->completionModel()->index(newRow, completer->completionColumn());
popup->selectionModel()->setCurrentIndex(newIndex, QItemSelectionModel::NoUpdate);
}
return true;
@@ -178,7 +179,8 @@ void CardCompleterStyler::ensureClosestSelected()
const int closestRow = rowCount - 1;
if (currentRow != closestRow) {
popup->setCurrentIndex(completionModel->index(closestRow, completer->completionColumn()));
popup->selectionModel()->setCurrentIndex(completionModel->index(closestRow, completer->completionColumn()),
QItemSelectionModel::NoUpdate);
}
}