Results 1 to 2 of 2

Thread: how to get the position of mouse click on a label

  1. #1
    Join Date
    Jul 2010
    Posts
    50
    Thanks
    7
    Platforms
    Windows

    Default how to get the position of mouse click on a label

    I have a label which displays an image. I want to perform two tasks:
    1. that when a point is clicked on the image, the point is clicked as 1......and the succeding clicks are accordingly labelled 2,3 and 4 respectively...........
    (This should get enabled on a button click). DOUBT:How to retrieve those positions on a mouse click event?
    2. When another button is clicked, I am able to draw a rectangle using a brush and save its 4 coordinates.....how to do this?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,734
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: how to get the position of mouse click on a label

    Have you looked at QLabel::mousePressEvent() or any of the related event handlers?

Similar Threads

  1. Detect click on QTableWidget label
    By Darthspawn in forum Qt Programming
    Replies: 1
    Last Post: 12th March 2010, 10:50
  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. close window when click on a label
    By sabeesh in forum Qt Programming
    Replies: 3
    Last Post: 29th October 2007, 07:35

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.