LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Qt widget suitable for displaying an image and getting mouse click position (https://www.linuxquestions.org/questions/programming-9/qt-widget-suitable-for-displaying-an-image-and-getting-mouse-click-position-673808/)

greenmuzz 10-02-2008 03:17 PM

Qt widget suitable for displaying an image and getting mouse click position
 
Hello,

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?

greenmuzz 10-03-2008 05:08 AM

Ah, sorry. So it really is as simple as inheriting from a QLabel and reimplementing the mousePressedEvent or mouseReleaseEvent.


All times are GMT -5. The time now is 03:04 PM.