Create dummy MouseEvent in QML
Unsolved
QML and Qt Quick
-
I have in my application a MouseArea for screensaver functionality:
MouseArea { id: screenSaverTouchArea anchors.fill: parent onPressed: { var consumeEvent = false // Set to true to prevent propagation of touch . . . screen saver functionality . . . if (condition) { . . . // Don't propagate touch here consumeEvent = true } . . . mouse.accepted = consumeEvent // Set to false to propagate this event down } }
mouse.accepted
is set based on whether I want the event to propagate down or not. Now I would also like the screen to be awakened from a different non-touch event in my app. The easiest way would be to callscreenSaverTouchArea.onPressed()
when that event happens:function ssOnEvent() { screenSaverTouchArea.onPressed() }
But that results in
Error: Insufficient arguments
. Is there a way to create a dummy MouseEvent in QML with some off-screen x/y touch coordinates and call the onPressed handler with that as the argument?