Results 1 to 2 of 2

Thread: How to get coordinates on an image

  1. #1
    Join Date
    Sep 2012
    Location
    Ankara
    Posts
    15
    Thanks
    3
    Qt products
    Platforms
    Unix/X11

    Question How to get coordinates on an image

    I have a QLabel and I'm displaying an image on it.
    I'll get coordinate when I clicked on Qlabel.
    There is some stars on my picture and I most find those coordinates.
    How can I do it?
    I hold images paths on a QListWidget named listWidgetPhoto. And when I clicked on listWidgetPhoto displayImage() will work.

    Qt Code:
    1. def displayImage(self):
    2.  
    3. imagePath=self.listWidgetPhoto.currentItem()
    4. print(imagePath.text())
    5. self.label.setPixmap(QtGui.QPixmap(_fromUtf8(imagePath.text())))
    To copy to clipboard, switch view to plain text mode 

    1. My sys.version output:
      2.7.3 (default, Aug 1 2012, 05:16:07)
      [GCC 4.6.3]
    2. My OS:
      bq. Ubuntu
      Release 12.04 (precise) 32-bit

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to get coordinates on an image

    You need to handle mousePress/mouseRelease events on your widget. This will give you access to the position where the press/release occured. Then you'll be able to match that against your stored list of coordinates.
    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.


Similar Threads

  1. cut image using coordinates
    By druvraj in forum Qt Programming
    Replies: 1
    Last Post: 13th June 2012, 20:23
  2. QGraphicsItem coordinates, again
    By d_stranz in forum Qt Programming
    Replies: 15
    Last Post: 20th June 2011, 21:10
  3. display image and get coordinates
    By ready in forum Newbie
    Replies: 9
    Last Post: 21st March 2011, 12:46
  4. GPS coordinates via SMS
    By radeknati in forum Qt Programming
    Replies: 0
    Last Post: 20th April 2010, 12:56
  5. Replies: 4
    Last Post: 18th March 2010, 10:11

Tags for this Thread

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.