Results 1 to 3 of 3

Thread: mouse position

  1. #1
    Join Date
    Sep 2016
    Posts
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default mouse position

    Hello
    how can i get mouse position over the window ?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: mouse position

    Depends on what you want to do.

    Generally the global position can be retrieved with QCursor::pos(), but maybe you need to track mouse movement which would require to implement the QWidget::mouseMoveEvent() handler.

    Cheers,
    _

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,348
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    318
    Thanked 872 Times in 859 Posts

    Default Re: mouse position

    and call QWidget::setMouseTracking() with "true".
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Getting Mouse position
    By williamjamir in forum Qwt
    Replies: 3
    Last Post: 8th October 2015, 21:05
  2. Mouse position
    By nomad.007 in forum Newbie
    Replies: 2
    Last Post: 8th September 2015, 17:11
  3. view position of mouse position in GraphicsScene
    By Raghaw in forum Qt Programming
    Replies: 2
    Last Post: 23rd August 2012, 05:46
  4. How to get the mouse's position
    By sophister in forum Qt Programming
    Replies: 2
    Last Post: 30th April 2009, 07:07
  5. How to get mouse's position?
    By coralbird in forum Newbie
    Replies: 4
    Last Post: 23rd July 2006, 04:52

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
  •  
Qt is a trademark of The Qt Company.