Maybe you need move events?
Cheers,
_
Maybe you need move events?
Cheers,
_
Thanks for the suggestion. I tried adding move events after each press and release event – to no avail.
But somehow you could be right. I examined the mouse.x and mouse.y properties for the MouseArea:nPressed(). They are relative to the receiving item. For the synthetic events they also seem to be relative to the first item that was clicked(?). For example:
qml: PRESSED MouseArea RIGHT: 20::20 <-- simulated press event in the right MouseArea
qml: PRESSED MouseArea RIGHT: -180::20 <-- simulated press event in the left MouseArea
In this case all events are received by the right MouseArea as if there is some kind of active focus for mouse events. Subsequently, I examined the MouseArea::entered() and exited() signals which seemed to be send correctly (press event --> onEntered triggered, release event --> onExited triggered).
Thanks for any clue,
Thomas
Last edited by yurumi; 21st August 2015 at 13:23.
You can install an event filter on the application object, it will "see" all events that happen in the application.
Cheers,
_
Thanks for the quick reply! In fact you were so fast that you overtook me while I was editing my previous post (please have a look above).
In the meantime I installed a custom event filter and compared the real mouse movement events with my generated events. The only differences for the real input are quite alot of MouseMove events and some CursorChange events when the mouse passes the MouseAreas/Rects. I recreated the MouseMove events more sophisticated, so that there is a trail of events from/to the origin before/after each press/release event. I even created CursorChange events everytime the origin is reached. Still doesn't work :-(
When comparing the real mouse movement with the simulated one, there is another difference: When the simulated move events enter/exit the MouseArea which was previously clicked, onEntered() / onExited() are triggered (not so for the other MouseArea). This also suggests that there is some kind of unreleased focus. I stumbled upon grabMouse() and releaseMouse() for QWidget. The pendant for QQuickItems seems to be ungrabMouse(). I tried creating QEvent::UngrabMouse events which somehow sounds promising. Also no luck
Maybe it would be better to create QTouchEvent, but this seems to be quite difficult: https://forum.qt.io/topic/46140/gene...ate-touches/12
...just to close this topic: Although not fully satisfying, I figured out a workaround for the above mentioned problem.
For every MouseArea add:
so the mouse event somehow gets "reset"...Qt Code:
... onReleased: { ... parent.visible = false parent.visible = true }To copy to clipboard, switch view to plain text mode
I've found that you can get the item that grabbed the mouse via QQuickWindow::mouseGrabberItem(). Then you have to do the bound checking and call QQuickItem::ungrabMouse() when needed.
It's probably somehow related to the implementation of dragging.
anda_skoa (30th December 2015)
Bookmarks