qt-interest@trolltech.com
[Top] [All Lists]

Re: [Qt-interest] How can I get the current cursor's position in dragMov

Subject: Re: [Qt-interest] How can I get the current cursor's position in dragMoveEvent ?
From: Benjamin Lau
Date: Mon, 10 Aug 2009 13:15:38 +0800
On Mon, Aug 10, 2009 at 12:59 PM, Kermit Mei<kermit.mei@xxxxxxxxx> wrote:
> On Sun, 2009-08-02 at 23:52 +0800, Benjamin Lau wrote:
>> On Sun, Aug 2, 2009 at 11:46 PM, Benjamin Lau<blwy10v@xxxxxxxxx> wrote:
>> > On Sun, Aug 2, 2009 at 5:26 PM, Kermit Mei<kermit.mei@xxxxxxxxx> 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@xxxxxxxxxxxxx
>> >> 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
>> >
>>
>> Ok, sorry, I was a bit inaccurate in my explanation of dragMoveEvent.
>> dragMoveEvent is called when the drag is in progress AND when the
>> cursor enters/leaves the widget OR a modifier key is pressed while the
>> widget has focused. See here for more information:
>> http://doc.qtsoftware.com/4.5/qwidget.html#dragMoveEvent
>>
>> Sorry for the inaccurate bit.
>> Benjamin
>
> Thank you, Benjamin. But what you told me I had seen in assistant. I
> can't find the position when I draging something,yet.  Maybe I shoul use
> the cursor's position.
>
> Regards.
> Kermit
>
>

So mouseMoveEvent does not work for you as well? As far as I know,
that's the only way to get the cursor's position anyway while the
mouse is moving.

_______________________________________________
Qt-interest mailing list
Qt-interest@xxxxxxxxxxxxx
http://lists.trolltech.com/mailman/listinfo/qt-interest

<Prev in Thread] Current Thread [Next in Thread>