[Qt-components] Key navigation

Alan Alpert 416365416c at gmail.com
Mon Jan 7 21:02:26 CET 2013


On Mon, Jan 7, 2013 at 11:49 AM, Alberto Mardegan
<mardy at users.sourceforge.net> wrote:
> On 01/07/2013 08:41 PM, Alan Alpert wrote:
>>
>> The current approach basically has that with FocusScopes. If you have
>> a component which can do something with Keyboard focus, it has a
>> FocusScope around it.
>
>
> Yes.
>
>
>> Now FocusScopes aren't that great, so maybe there's a better way, but
>> given the current keyboard handling in QML where would you add
>> CanFocus where there isn't already a FocusScope (or a root level Item
>> that could easily be turned into a FocusScope)?
>
>
> When I talk about the CanFocus property, I'm actually thinking about child
> items, not about the FocusScope itself.
> Now, suppose that a FocusScope has 10 child items, 5 of which are buttons
> (therefore, focusable) and 5 are labels (unfocusable): if you want to
> automatically build a focus chain, you need to know which children are
> focusable and which are not; and that's where a CanFocus property comes
> handy.

But presumably the root object in a Button component is a FocusScope,
whereas that of a Label would not be. So that's how you automatically
know which ones are focusable and which aren't, by the type of the
root object.

http://qt-project.org/doc/qt-5.0/qtquick/qtquick-input-focus.html
makes it look like any focusable component without a FocusScope is
going to be acting funny anyways.

--
Alan Alpert



More information about the Qt-components mailing list