PDA

View Full Version : mouseMoveEvent during drag is not fired



gruszczy
24th February 2009, 16:34
If I start a drag action, then mouseMoveEvent method of the widget that I am currently dragging something over is not called anymore. I would like it to be called, because I want to know, where is the cursor. It's a widget drawn completely during paintEvent and I would like to redraw it, when drag is in certain areas (that represent objects onto which drop can be done). How can I turn it on or emulate this?

talk2amulya
24th February 2009, 16:45
if that doesnt work maybe u can try events like enterEvent or hoverEvent..do they work for u?

gruszczy
24th February 2009, 17:00
Nope, neither of them works.

talk2amulya
24th February 2009, 17:05
void QWidget::dragEnterEvent ( QDragEnterEvent * event ) [virtual protected]

This event handler is called when a drag is in progress and the mouse enters this widget. The event is passed in the event parameter.

this should be your solution

gruszczy
24th February 2009, 17:15
:-)

I'll try to explain it again. I am dragging an object inside a one widget, that is painted using some information stored inside this widget. There are no subwidgets, so there are no dragEnterEvents inside (unless I drag an object outside this widget, but that really isn't the case). I am doing everything based on mouse moves - if I drag mouse in a certain region of the widget, drag starts. If I drop the widget in a certain region - proper drop is done. And this works. But I would like to be able to control this move and repaint widget accordingly. But it seems, that everything is frozen during drag.

talk2amulya
24th February 2009, 17:29
alright dude, now ur requirement is a bit clear..but i havent done anth like that before..but i wanna shoot in the dark for last time..how about using dragMove?

aamer4yu
24th February 2009, 17:51
Why do u want to draw during drag ?
If I am getting your problem right,y ou could better set pixmap in the mimedata of the drag.

You can see the draggable icons examples in Qt Demos.

gruszczy
24th February 2009, 22:04
Ahhh, why haven't I noticed that dragMoveEvent! That's it! Thanks :-)