[Qt-interest] Signals emitted by QSceneView
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Fri Nov 26 17:49:14 CET 2010
On 2010-11-26 Brian Brian McKinnon wrote:
> ... I've been trying to overload the leaveEvent,
> mouseLeaveEvent, ... well pretty much any leave event in either the
> view, scene, or item that I can find with no luck. Is there a notification that gets set out when a mouse leaves a view while dragging an item in the scene?
I am just doing my first steps with QGraphicsScene/View, hence I do not have much experience with that.
In my case I observed that the QGraphicsScene "bounding box" seems to be enlarged once I move an item out "into the invisible". I notice this because scrollbars appear and the scrollable area becomes bigger.
I don't think QGraphicsView/Scene would emit a "mouse leave" event while dragging, because enlarging the area seems to be the intended action.
But maybe you could detect whenever the scene area is to be enlarged, and once this is the case somehow try to interrupt the move operation and start your drag'n'drop event - somehow.
Or overwrite the mouseMoveEvent () events globally on the QGraphicsScene and handle the QGraphicsSceneMouseEvent yourself: e.g. you could forward that event to the item under the mouse, as long as the bounding box of that item does not intersect with the scene bounding box (or visible area bounding box). As soon as you have an intersection you would stop forwarding the QGraphicsSceneMouseEvents to the item and start your desired drag'n'drop operation.
So I think it requires some "custom code" in order to achieve what you want, but it should be doable by intercepting the mouse events before they reach the actual item to be moved.
Cheers,
Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list