[Interest] QGraphicsItem does not become a mouse grabber
Dmitrii Volosnykh
dmitrii.volosnykh at gmail.com
Tue Mar 11 10:36:24 CET 2014
I'd like my custom item to become an explicit mouse grabber on mouse press
event. I call grabMouse() inside mousePressEvent() handler, but it does not
receive any consecutive mouse move and release events (imagine, I try to
drag this item).
As far as I can see from QGraphicsScene's sources
QGraphicsScenePrivate::mousePressEventHandler() forwards mouse press event
to the item under cursor, making it implicit mouse grabber a priori. After
this mouse event was handled by the target item, the former one releases
mouse grabber state. While in general this seems to be okay, I expect this
custom item to keep mouse grabber state when it was set explicitly. Indeed,
what actually grabMouse() does, being called from mousePressEvent(), is
updates lastMouseGrabberItemHasImplicitMouseGrab flag to false. So, I
guess, ungrabMouse() should be called only in case item is still an
implicit mouse grabber.
Does this suggestion make sense? Should the current behaviour be considered
as a false one?
Regards,
Dmitrii.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140311/5d4c2542/attachment.html>
More information about the Interest
mailing list