Details
-
Suggestion
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.3, 6.0.3, 6.1.0
Description
Keyboard handling in Qt Quick is tricky.
One important element (that many people don't completely grasp) are focus scopes.
A focus scope "divides" the tree of Qt Quick elements, so that focus can be remembered within a sub tree. This is for example relevant when the user can navigate between several containers which have a sub-focus or between dialogs that should remember the focus.
I'll use Dialog as example here, assuming the UI is split in two "Dialogs" that each should remember their respective focus internally.
The current way, FocusScope being an explicit item, means that each dialog has to be a FocusScope. This leads to having to forward a lot of properties, since one would often like to have for example a Rectangle as root element of a dialog.
SomeRootElement { FocusScope { id: dialog1 // geometry here forwarded to inner element Rectangle { ... } } FocusScope { id: dialog2 // geometry here forwarded to inner element Rectangle { ... } } }
Is not very elegant, since it means forwarding all of the geometry.
There are no great alternatives. If one could instead set a property "focusScope: true" things would be a lot easier.
(I'm not quite sure about the best component, it's keyboard, not mouse/touch input, but there is no other input component...)