[Qt-components] Key navigation

Bache-Wiig Jens Jens.Bache-Wiig at digia.com
Mon Jan 7 18:23:19 CET 2013


It is not realistic to assume that the majority of controls will be placed inside these optional layouts. At least not to rely on them for all things regarding keyboard navigation. You are likely also using a mix of Row, Column, Grid or just plain old anchoring. What if we just assign a default key navigation chain based on the declared order of items (which is what widgets do by default I believe)  and special case the tabbing through layouts to allow RTL/LTR behaviour specifically for them.

At the moment I think tabbing into and out of FocusScopes are a bit broken. See this for instance: https://bugreports.qt-project.org/browse/QTCOMPONENTS-1266

I think Liang is interested in researching improved key navigation for 5.1 after we have a basic test framework in place for components.

Jens



On Jan 7, 2013, at 6:12 PM, Alan Alpert <416365416c at gmail.com<http://gmail.com>> wrote:

On Sun, Jan 6, 2013 at 7:54 AM, Alberto Mardegan
<mardy at users.sourceforge.net<mailto:mardy at users.sourceforge.net>> wrote:
On 01/02/2013 11:37 AM, Alberto Mardegan wrote:
It would be nice if there was a default key navigation flow, implicitly
built according to the placement of the components inside a window; then
the keyNavigation properties could be used to override this when needed.
The QtWidgets library also provides a default key navigation, so it
seems sensible if the QML components have the same.

Here is a possible implementation:

  https://codereview.qt-project.org/#change,44029

It introduces a FocusChain object which can be used like this:

==================
FocusChain {
  id: focusChain
  rootItem: widgetContainer
}

Grid {
  id: widgetContainer
  ...grid properties...

  Keys.onTabPressed: focusChain.focusNext(Qt.Key_Tab)
  Keys.onBacktabPressed: focusChain.focusNext(Qt.Key_Backtab)

  Button { ... }
  ComboBox { ... }
  ...other widgets...
}
==================

Since this is based around layouting behavior, why not build it into
the Qt Components layouts? Surely they're a more realistic usecase for
components than using the positioners. GridLayout could automatically
have a FocusChain, leading to no further code required for the user
(int the common case).

--
Alan Alpert
_______________________________________________
Qt-components mailing list
Qt-components at qt-project.org<mailto:Qt-components at qt-project.org>
http://lists.qt-project.org/mailman/listinfo/qt-components

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-components/attachments/20130107/3967f66a/attachment.html 


More information about the Qt-components mailing list