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

Ola Røer Thorsen ola at silentwings.no
Thu Jan 23 13:33:48 CET 2014


Hi Frederik,

thanks for the reply!

I've created a bug report here:
https://bugreports.qt-project.org/browse/QTBUG-35051
It includes some example code to play with. It got assigned to Alan Alpert,
so maybe you could change that if necessary.

I know it's tricky once all items are disabled. In the bug report I've
suggested this:

Plan A: move focus to the next child item with activeFocusOnTab and enabled
set to true
Plan B: if no such items were found, try moving active focus to the next
item in the "tab chain".

Best regards,
Ola






2014/1/22 Frederik Gladhorn <frederik.gladhorn at digia.com>

> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140123/d2a32764/attachment.html>


More information about the Interest mailing list