Results 1 to 4 of 4

Thread: How to know mouse release event in mouse move event

  1. #1

    Default How to know mouse release event in mouse move event


    I want to collect all the mouse points along the mouse when I drag the mouse(left button press and move). So I wrote "mouseMoveEvent" in a Widget and getting the x, y coordinates.

    If I move the mouse very slowly then only I am getting all points along the mouse.

    If I move a little bit fast then I am not able to collect all the points along the mouse. It is missing some points along the path. And if the mouse move speed is over then missing many points.

    So I am planing to put a while loop in "mouseMoveEvent" and then get mouse co ordinates with "Cursor:os()". Now I want to break while loop when I release mouse button.

    How to know in "mouseMoveEvent" thet I release mouse button?

    Is there any alternative method to do this other than putting while in "mouseMoveEvent" ?

    Can you please help me what to do?

    Thanks & Regards

  2. #2
    Join Date
    Jan 2006
    Warsaw, Poland
    Thanked 5,014 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits

    Default Re: How to know mouse release event in mouse move event

    You are getting all the points. The operating system reports mouse moves with some granularity, otherwise it would be overwhelmed with events. Any while loop inside mouseMoveEvent is bound to block your application and you will not get any events because you will block when receiving the first one before the next one is sent to your app. If you want better precision then you just have to mouse your mouse slowly or somehow configure your operating system to generate more events although it will significantly slow down your system and worsen your user experience.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.

  3. #3

    Default Re: How to know mouse release event in mouse pressdown event

    No, I am not getting all points. I am drawing all co-ordinates which are getting in mouseMove to screen by update() (calling paintEvent). It is setting only few points.

    Is there any call to get event like postEvent.

    Or is there any way to get event object from the QObject event system.

    Thanks and regards

  4. #4
    Join Date
    Jan 2006
    Thanked 1,005 Times in 913 Posts
    Qt products
    Unix/X11 Windows Symbian S60
    Wiki edits

    Default Re: How to know mouse release event in mouse pressdown event

    You are getting all events, there are simply not more emitted. You could write your own methods with a timer querying QPointer::pos() and start them via mousePress and mouseReleaseEvent. But that - as said - slows your system down...

Similar Threads

  1. Getting mouse release event system-wide
    By rittchat in forum Newbie
    Replies: 4
    Last Post: 9th February 2012, 08:08
  2. Mouse Event - source of event?
    By PowerPlate in forum Qt Programming
    Replies: 1
    Last Post: 27th October 2011, 09:46
  3. QAbstractItemView not calling mouse move event function
    By sagirahmed in forum Qt Programming
    Replies: 0
    Last Post: 5th July 2010, 10:26
  4. mouse move event filtering in PyQt4
    By lucaf in forum Qt Programming
    Replies: 1
    Last Post: 4th April 2009, 14:53
  5. Mouse Move Event
    By merry in forum Newbie
    Replies: 5
    Last Post: 3rd June 2007, 06:26


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.