mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-09 19:43:26 -08:00
[Completer] Highlight popup rows without rewriting the line edit (#7502)
* [Completer] Highlight popup rows without rewriting the line edit Selecting a popup row with ClearAndSelect emits selectionChanged, which QCompleter turns into highlighted() and QLineEdit turns into setText(). Sincebe2c16eca5(#7466) that rewrites the typed text on every completion reset / arrow-key press (e.g. typing "A" becomes "Axe" and cannot be edited), regressing the514014dc00(#7447) fix that used NoUpdate. Add selectWithoutRewrite(), which blocks the selection-model signals while applying ClearAndSelect so the highlight stays visible without touching the line edit, then syncs the preview manually. Route both the above-popup auto-select and Up/Down navigation through it, and handle Up/Down for below-popups too instead of falling through to Qt's rewriting default. Enter/click acceptance via activated() is unchanged. * [Completer] Repaint popup highlight after silent selection change Blocking the selection model's signals also suppresses the view's own selectionChanged/currentChanged repaints, so force a viewport update after restoring signals. Use EnsureVisible to match Qt's normal scroll behaviour. --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
456d9d9e70
commit
bbe438b09a
2 changed files with 48 additions and 14 deletions
|
|
@ -55,6 +55,7 @@ private:
|
|||
void applyPopupWidth();
|
||||
void updateOrientation();
|
||||
void ensureClosestSelected();
|
||||
void selectWithoutRewrite(const QModelIndex &index);
|
||||
|
||||
bool handlePopupKeyPress(QKeyEvent *event);
|
||||
bool isPopupAboveWidget() const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue