[Interest] How do properly deal with items being disabled in a focus scope in Quick2 (5.2.0)?

Frederik Gladhorn frederik.gladhorn at digia.com
Wed Jan 22 16:03:22 CET 2014


Onsdag 22. januar 2014 13.46.03 skrev Ola Røer Thorsen:
> I've got a custom menu item (ColumnLayout-based), where the items inside
> are some custom button items. Each item is set up with KeyNavigation so
> that active focus is moved up and down using the cursor keys.
> 
> If a button item's "enabled" property is set to false while having active
> focus, it's not possible to move active focus with the keys anymore. The
> item will not have active focus, and will not receive key events. The focus
> scope will not pass active focus to any other item either, so you are
> basically stuck. Using mouse or touch input is not always an option.
> 
> How is this supposed to work? The way this works now, custom javascript
> focus handler code has to be added tailor made for a certain menu, everyone
> will have to invent their own.
> 
> I would have hoped the focus scope could move active focus to the next item
> in the focus chain, if the active item is disabled.

I agree that the current behavior is not very sensible. I'm not sure what the 
desired behavior is though, if you have any good suggestions, it is certainly 
something that could be fixed.

I wouldn't mind a bug report.

What if all items in the scope become disabled? Should the focus be moved left 
or down? Or should there be an exception: when enabled==false all Keys events 
are ignored but the arrow keys? None of these seems very satisfying.

-- 
Best regards,
Frederik Gladhorn
Senior Software Engineer - Digia, Qt
Visit us on: http://qt.digia.com




More information about the Interest mailing list