Qml on Android and back button
-
Hi all
I'm new to qml programming. I'm developing an android app using qml and I'm facing the problem to intercept android back button for avoid to have my app closed in some point where should not. Looking into documentation the solution seem easy. Using the Keys.onPressed event into a focused item (focus: true) and manage the pression. This solution work with a simple app but in an qml app having a lot of buttons the focus continuosly change between controls based to the actions of user and the initial focused item with the code for manage the back button key, once lost the focus, doesn't work anymore as obvious. I guess is not a good solution to "clone" the code managin keys to all the items, I'm sure it should be another solution, but which? Is there a way to have a "main" keyboard manager able to get the key event before forwarded to child items in qml? This for have a unique code. I can not make it from C++ side since I need to have an ApplicationWindow than I need to use the QQmlApplicationEngine object. Another solution could be to "force" focus to stay in a specific item, is possible?
Thank you the help -