[Qt-interest] How can I get the current cursor's position in dragMoveEvent ?

Benjamin Lau blwy10v at gmail.com
Sun Aug 2 17:46:46 CEST 2009


On Sun, Aug 2, 2009 at 5:26 PM, Kermit Mei<kermit.mei at gmail.com> wrote:
> Hello, I want to drag something, and I need to get the cursor's position
> in the dragMoveEvent(event). I can't use event->pos(), because is
> returns the position where the drag was make. But what I want is the
> current moved position, how can I get it?
>
> Thanks.
> Kermit Mei
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>

dragMoveEvent is only called once when the drag starts. If you want
the position of the mouse as the mouse is moving, use the
mouseMoveEvent event handler.

For more information, see here:
http://doc.qtsoftware.com/4.5/qwidget.html#mouseMoveEvent

Hope this is what you're looking for!
Benjamin



More information about the Qt-interest-old mailing list