[Qt-components] Key navigation

Alan Alpert 416365416c at gmail.com
Thu Jan 31 21:43:52 CET 2013


On Wed, Jan 30, 2013 at 9:44 PM, Alberto Mardegan
<mardy at users.sourceforge.net> wrote:
> 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.

The only "problem" I have with the FocusChain approach is that we're
diverging from the Widgets style focus handling. Which is probably
fine, I just thought that copying widgets was what we were aiming for.
I agree that it's nicer to split out a possibly complex focus chain
order.

In terms of implementing it, would you still make Button and ComboBox
based off KeyContainer? Or would you need to hook directly into the
Item key handling?

--
Alan Alpert



More information about the Qt-components mailing list