How to overwrite system gestures for a native app?
I'm working on a nataive app, that overwrites partly a system edge swipe from the bottom edges. I was told, that I can implement this feature by using QWindow::setFlags()
with the value Qt.WindowOverridesSystemGestures
.
Sailfish Apps are using the Silica AppplicationWindow as their root UI element. I expected, that this class inherits the QtQuick ApplicationWindow that again inherits the properties and methods of the QtQuick Window with the property flags
. This seems to be wrong, because the SDK and the log output report an error:
Cannot assign to non-existent property "flags"
flags: Qt.WindowOverridesSystemGestures
Do I have to implement an app without Silica? With this approach I would loose the Sailfish look and feel. I think, it is somehow possible to implement the said requirement with a Sailfish Silica app, because the Sailfish tutorial app overwrites system gestures either.
The next challange would be to implement additional system gestures. I'm quite new at Qt development and I'm missign the clear MVC paradigm I used to implement for Java apps for Android or Objective-C and Swift apps for macOS and iOS. UWP Windows app are using a different MVVM paradigm.
However I would expect to implement window controller (Objective-C, Swift) or event listener (Java) by overwriting methods for event handlung for the said use case and hand over further use cases by calling somethink like super.swipeEvent(event)
. I can't find methods for swipe or gesture events in any QML type that I could use.
I'll checkout the IRC client project. The uses a swipe geture to call drawers form the left and right side. Maybe I can use this approach. Suggestions, recommendations or links to open source projects, which have implemented a similar requirement, are welcome.
Have you already looked into the Backup thingy in Settings? All gestures are disables during the Backup. If you take a look at the QML files of the app you will find some QML code that blocks all gestures. They use the same flags you mentioned I think. The internals of the component that's responsible for disabling the gestures can be found on Coderus Github page (better sailfish qml components)
Dylan Van Assche ( 2018-12-29 22:48:49 +0200 )editSounds like a good idea. Do you know the system path for this settings? Are these settings located, where other apps are installed?
Do you also have an idea to capture swipe or gesture events in QML?
jsommer ( 2018-12-30 13:37:07 +0200 )editI think it's very bad practice to override system gestures unless there's a good reason to do this, such as blocking them for security issues (e. g. ask for confirmation before closing a critical app).
Giacomo Di Giacomo ( 2019-01-01 19:28:17 +0200 )edit@Giacomo. Indeed, but in my case, it is a prototype app, that demostrated additional system gestures for a fork or patch of the Sailfish lipstick implementation we will implement in collaboration with Jolla.
jsommer ( 2019-01-02 10:28:50 +0200 )edit