Hi, I'm having some trouble making a robust QtQuick 5.4-based application where I only have 4 cursor keys and a return key available as the input method for the user.
I have various gui buttons that I can move focus between. I've set this up using the KeyNavigation.onXXX etc. For a simple static gui, this is fine. However I get into trouble once some buttons get disabled (enabled-property set to false). This is done based on external events, so it may happen at any time. If a button with active focus is disabled, I'm stuck. The button's focus property is still true, but it will not receive key events, so I cannot move focus to the next using the cursor keys. I'd like focus to move on to some other item automatically anyway. Have any of you got some recommended way of dealing with situations like this? I think I've spent half the development time on this application just making sure keyboard navigation cannot get stuck. I did not have such issues when creating similar applications with Qt Widgets. There the behavior is that focus moves on to another widget automatically if I call setEnabled(false) on a widget with current active focus. I've tried doing something like this in my Button item: Button { id: button activeFocusOnTab: true function transferFocus() { if(!visible || enabled) return; if(nextItemInFocusChain() === button) return; if(focus) nextItemInFocusChain().focus = true; } onEnabledChanged: transferFocus() } This works OK in a smaller test application, but makes the larger application hang when "nextItemInFocusChain" is called for the 20th time or so. Cheers, Ola
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest