PDA

View Full Version : Normal mouseMoveEvent Behavior?



qtoptus
27th February 2015, 18:13
Hi,

I'm having a problem with QWidget mouseMoveEvent. While moving the mouse if a button is pressed, the handler is not called any more even after the button is released. Any idea?

Thanks.

d_stranz
28th February 2015, 04:51
Did you call QWidget::setMouseTracking() with a "true" argument?

qtoptus
28th February 2015, 06:10
It has nothing to do with setMouseTracking, called or not the mouseMoveEvent gets called on mouse move no problem, but when I press a mouse button while moving it stops.

d_stranz
28th February 2015, 17:24
Then something else is intercepting and handling the mouse move event before it can get to you. If you are doing this in a QGraphicsView, then it could be that the view is intercepting them and turning them into scene events:


You can interact with the items on the scene by using the mouse and keyboard. QGraphicsView translates the mouse and key events into scene events, (events that inherit QGraphicsSceneEvent,), and forward them to the visualized scene. In the end, it's the individual item that handles the events and reacts to them. For example, if you click on a selectable item, the item will typically let the scene know that it has been selected, and it will also redraw itself to display a selection rectangle. Similiarly, if you click and drag the mouse to move a movable item, it's the item that handles the mouse moves and moves itself. Item interaction is enabled by default, and you can toggle it by calling setInteractive().

qtoptus
28th February 2015, 17:52
Thanks you give me some hints...another widget receives the mouse events and handles them at the same time...I will have to filter out or stop the other widget event handling until the first widget is done with move/drag.