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

* [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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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