Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
5.15.9, 6.5.0
Description
Controls react differently to various focusReason causes. Usually they get more prominent highlight or outline when focusReason is one of those which make the read-only visualFocus property turn on: Qt.TabFocusReason, Qt.BacktabFocusReason, or Qt.ShortcutFocusReason.
KeyNavigation attached type, to my big surprise, sets Tab and Backtab reasons for all of its interactions, be it really Tab/BackTab button or arrow keys. It might not be 100% semantically correct (at least by the name of it), but it works in a way that is supported by the Control::visualFocus property, so I'm happy with it.
ListView, on the other hand, has its own internal arrow keys handling and exposes keyNavigationEnabled property to toggle that. Unfortunately, key presses handled by this mechanism sets a generic Qt.OtherFocusReason status, which is both inconsistent with similarly named KeyNavigation API, and does not deliver nice visuals due to visualFocus being off.
Stack trace
- https://github.com/qt/qtdeclarative/blob/6.5.0/src/quick/items/qquicklistview.cpp#L3484
- https://github.com/qt/qtdeclarative/blob/6.5.0/src/quick/items/qquicklistview.cpp#L3578
- https://github.com/qt/qtdeclarative/blob/6.5.0/src/quick/items/qquickitemview.cpp#L289
- https://github.com/qt/qtdeclarative/blob/6.5.0/src/quick/items/qquickitemview.cpp#L1656
Suggestion
Fix ListView::keyNavigationEnabled to set Qt.TabFocusReason and Qt.BacktabFocusReason on its delegates.
Attachments
Issue Links
- duplicates
-
QTBUG-97006 ListView and GridView keyboard navigation doesn't use FocusReasons
- Reported