Results 1 to 6 of 6

Thread: chase mouse x,y values

  1. #1
    Join Date
    Feb 2012
    Location
    Armenia/Yerevan
    Posts
    400
    Thanks
    15
    Thanked 16 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default chase mouse x,y values

    As mouse moves on my widget, I want to show mouse x n y values aside the mouse pointer, preferably in a small pop-up.
    any tips for this please?

  2. #2
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: chase mouse x,y values

    first set mouseTracking to true then implement mouseMoveEvent(qmouseEvent *e). from argument you can get x and y coordinate of mouse

  3. #3
    Join Date
    Feb 2012
    Location
    Armenia/Yerevan
    Posts
    400
    Thanks
    15
    Thanked 16 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: chase mouse x,y values

    Yeap, got it.
    I also want to know how to show x and y values right aside the mouse pointer in a pop-up window or whatever.

  4. #4
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: chase mouse x,y values

    it's property of widget(dialog). setMouseTracking(true) in constructor

  5. #5
    Join Date
    Feb 2012
    Location
    Armenia/Yerevan
    Posts
    400
    Thanks
    15
    Thanked 16 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: chase mouse x,y values

    Quote Originally Posted by alizadeh91 View Post
    it's property of widget(dialog). setMouseTracking(true) in constructor
    I also want to know how to show x and y values right aside the mouse pointer in a pop-up window or whatever.

  6. #6
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: chase mouse x,y values

    Quote Originally Posted by saman_artorious View Post
    I also want to know how to show x and y values right aside the mouse pointer in a pop-up window or whatever.
    use toolTip to show the value of x() and y() after u reimplement the mousePressEvent event->pos() .
    "Behind every great fortune lies a crime" - Balzac

Similar Threads

  1. Replies: 3
    Last Post: 22nd February 2013, 19:56
  2. Ogre+qt mouse event (add object with mouse problem)
    By rimie23 in forum Qt Programming
    Replies: 7
    Last Post: 24th April 2012, 10:49
  3. How to convert string hex values to its real binary values?
    By AttilaPethe in forum Qt Programming
    Replies: 1
    Last Post: 20th February 2012, 22:47
  4. Replies: 0
    Last Post: 28th June 2011, 07:41
  5. Printing Values of the mouse position in a graph
    By soumyadeep_pan in forum Qwt
    Replies: 4
    Last Post: 22nd May 2009, 13:17

Bookmarks

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.