[Qt-components] Key navigation

Alberto Mardegan mardy at users.sourceforge.net
Thu Jan 31 06:44:04 CET 2013


On 01/30/2013 09:15 PM, Alan Alpert wrote:
> Actually, I meant something more like
> ============
>    Grid {
>      id: controlContainer
>      ...grid properties...
>      Button { ... }
>      ComboBox { ... }
>     ...other controls...
> }
> ===========
> Where Button and ComboBox both have a KeyContainer as their root items
> (replacing the FocusScope). KeyContainer would be implemented in C++,
> be a focus scope, and have a tabOrder property.

I'm not convinced about this approach; it surely would work, but I'd 
prefer to keep the focus chain logic in the parent container, and have 
the focusable children just declare their "focusability" which a simple 
property.
The FocusChain approach I proposed (even in the second more compact 
form) moves the logic to the parent container, and could be extended in 
the future with more options concerning the "find next child" algorithm:
FocusChain {
     tabOrder: FocusChain.leftToRightAndTopToBottom
     [or childCreationOrder]
}

It would also honour the existing KeyNavigation properties, and be able 
to handle directional keys since it can build a graph of its descendants.

Ciao,
   Alberto



More information about the Qt-components mailing list