Trouble with back-button an android
-
@Vega4 said in Trouble with back-button an android:
@J-Hilk
Seems like we want the application to actually close. Like we want the opposite. Minimize or anything or to have control over the process but like described above. for anything we do we are unable to intercept the key_back event.That's what we want - to intercept the key-back event since we need to do some cleaning up before sending the app to the back.
There must be some reason for which the app is completely unaware of the back-keyt presses which is why.. it is not minimized in the first place (which should be by default right?) maybe because it's full-screen? maybe because of some of the flags? we've got no idea but the problem is here.
now I get it :D
maybe because it's full-screen? maybe because of some of the flags
very possible, yes! You could reduce the flags/remove them and add one after the other to see if the event comes through?
Have you checked Shortcuts ? From my experience, they are triggered reliably
Shortcut { sequence: StandardKey.Back onActivated: console.log("back Key") } Shortcut { sequence: StandardKey.Quitt onActivated: console.log("Quit Key") } Shortcut { sequence: StandardKey.Close onActivated: console.log("Close Key") }
@J-Hilk said in Trouble with back-button an android:
very possible, yes! You could reduce the flags/remove them and add one after the other to see if the event comes through?
It's confirmed.. the flags. Now how about it, we like need them :-)
-
@J-Hilk said in Trouble with back-button an android:
very possible, yes! You could reduce the flags/remove them and add one after the other to see if the event comes through?
It's confirmed.. the flags. Now how about it, we like need them :-)
-
@Vega4 I'm out of my depth here, especially as that is probably also all dependent on the window manager you/your OS uses :(
@J-Hilk
We've pretty much closed-in onto the problem. No key-events regarding the bottom navigation bar are dispatched and processed at all once any of the following flags are set (in conjunction or individually):
- Qt.WA_TranslucentBackground
- Qt.WindowTitleHint
- (~Qt.WA_ContentsMarginsRespectsSafeArea)
We need these flags, and it happens when ANY of the above are set.
Setting visibility: Window.FullScreen doesn't seem to affect anything BUT the app looks simply ugly without the above flags. (huge empty black bars on top and bottom.. also yeah due to missing support for smart-borders on android with devices with rounded screens we had to do that by hand).
Time to file a bug-report?
-
@J-Hilk
We've pretty much closed-in onto the problem. No key-events regarding the bottom navigation bar are dispatched and processed at all once any of the following flags are set (in conjunction or individually):
- Qt.WA_TranslucentBackground
- Qt.WindowTitleHint
- (~Qt.WA_ContentsMarginsRespectsSafeArea)
We need these flags, and it happens when ANY of the above are set.
Setting visibility: Window.FullScreen doesn't seem to affect anything BUT the app looks simply ugly without the above flags. (huge empty black bars on top and bottom.. also yeah due to missing support for smart-borders on android with devices with rounded screens we had to do that by hand).
Time to file a bug-report?
@Vega4 said in Trouble with back-button an android:
Time to file a bug-report?
possibly,
you should get at least a "good" answer ;)Don't forget to post a link here, so others can follow the report as well
-
@J-Hilk kindly thank you for your prompt responses. You've been dancing with the Wizards🧙🦹♀️ (https://twitter.com/gridnetproject it's been all recorded LIVE on YouTube).
Will do 🙏
-
@Vega4 said in Trouble with back-button an android:
Time to file a bug-report?
possibly,
you should get at least a "good" answer ;)Don't forget to post a link here, so others can follow the report as well
@J-Hilk Just noticed it's you who were the one who helped us with the custom full-screen support on android back in May https://twitter.com/gridnetproject/status/1389222481874014209... thank you yet again!
-
@J-Hilk Just noticed it's you who were the one who helped us with the custom full-screen support on android back in May https://twitter.com/gridnetproject/status/1389222481874014209... thank you yet again!
@Vega4 said in Trouble with back-button an android:
@J-Hilk Just noticed it's you who were the one who helped us with the custom full-screen support on android back in May https://twitter.com/gridnetproject/status/1389222481874014209... thank you yet again!
You're welcome :D
it helps me too, as I'm currently stuck in my own project, and changing the train of thought can help in those cases. -
Update: Seeing that system-menu related events work in presence of these flags when a QDialog gets opened we hoped that enforcing focus onto the main window once the Main window component gets rendered would help. We've wrapped everything around FocusScope and used forceActiveFocus() within Component.onCompleted(). but this didn't help either. Shortcuts do not get triggered as well.
Link to bug-report:here
It is a pitty I do not have QT's Source available since in assembly I can see that QGuiApplicationPrivate:processKeyEvent DOES process the event when back button is pressed at all times.
Seems like to get around this we would need to make a custom QT build one messing around with QGuiApplicationPrivate:processKeyEvent(), which by the way has lots of customized processing related to android's back_button just from the first looks on it. Can't override it (static method.. and obviously exotic stuff like https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern aren't here at play , by design, of course ;d).