[UI] Auto-select first completion match in popup

This commit is contained in:
Lukas Brübach 2026-10-09 13:51:18 +02:00
parent 4607b7d3ad
commit ae0dfb8622
2 changed files with 3 additions and 4 deletions

View file

@ -176,11 +176,11 @@ void CardCompleterStyler::ensureClosestSelected()
}
const int currentRow = popup->currentIndex().row();
const int closestRow = rowCount - 1;
const int closestRow = 0;
if (currentRow != closestRow) {
popup->selectionModel()->setCurrentIndex(completionModel->index(closestRow, completer->completionColumn()),
QItemSelectionModel::NoUpdate);
QItemSelectionModel::SelectCurrent);
}
}

View file

@ -71,8 +71,7 @@ void LineEditCompleter::focusOutEvent(QFocusEvent *e)
if (popupWasVisible && e->reason() == Qt::TabFocusReason) {
// Refocus the edit so Tab doesn't move focus away
// Use a queued connection to ensure focus is restored after the focus change completes
QMetaObject::invokeMethod(this, "setFocus", Qt::QueuedConnection);
setFocus();
e->accept();
return;
}