Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 10-02-2008, 04:17 PM   #1
Registered: Oct 2003
Posts: 34

Rep: Reputation: 15
Qt widget suitable for displaying an image and getting mouse click position


I'm making a small app with Qt (3.1 iirc). So far I've been content to display an image using the QLabel widget, however, I've just remembered that I need to be able to click on the image, and return the location on the image where the mouse click occurred. I haven't seen an appropriate widget for this in the docs - can anyone suggest the best approach? Can I make a widget that inherits from a QLabel that has this functionality In which case, how would the functionality be added?
Old 10-03-2008, 06:08 AM   #2
Registered: Oct 2003
Posts: 34

Original Poster
Rep: Reputation: 15
Ah, sorry. So it really is as simple as inheriting from a QLabel and reimplementing the mousePressedEvent or mouseReleaseEvent.


interactive, qt3

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
background image position RudraB General 1 05-13-2008 11:47 PM
simple example to show an image in Qt 4 without using Widget newbloggy Programming 2 05-12-2006 06:49 AM
Ruby+libglade - howto get an image in a Glade widget? rasat Programming 4 04-12-2006 01:49 AM
mouse: single-click becomes double-click kinzlaw Linux - Hardware 2 08-24-2005 08:55 PM
bsetbg: no suitable image applications slowly Linux - Software 4 04-25-2004 02:47 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:36 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration