Results 1 to 3 of 3

Thread: Get mouse position on click?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2009
    Location
    United States
    Posts
    45
    Thanks
    20
    Qt products
    Qt4
    Platforms
    Windows

    Default Get mouse position on click?

    I am drawing an image in my QMainWindow and I need to get the position of the mouse when it's clicked, so that I can tell where on the image the user clicked. Is there an easy way to do this?

    Thanks a lot for your help

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Get mouse position on click?


  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Get mouse position on click?

    If you have a mouse event use that, otherwise you can also see QCursor::pos().

Similar Threads

  1. how to get the position of mouse click on a label
    By qt_user in forum Qt Programming
    Replies: 1
    Last Post: 9th August 2010, 09:14
  2. Replies: 1
    Last Post: 10th July 2009, 09:54
  3. Right-click menu position
    By thuswa in forum Qt Programming
    Replies: 2
    Last Post: 15th April 2009, 22:00
  4. Word at mouse click position in QGraphicsTextItem
    By pherthyl in forum Qt Programming
    Replies: 2
    Last Post: 3rd November 2008, 04:56
  5. [GraphicsScene] retrieving click-position
    By Wirloff in forum Qt Programming
    Replies: 10
    Last Post: 12th April 2007, 10:26

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.