I have a MainWindow. On MainWindow I have multiple Qlabel’s. Now, i need to find the QLabel clicked.
Using MousePressEvent, i can get the X() and Y() position of the mouse clicked.
How can i use this Co-ordinate to identify the QLabel??
Is there any function in QT to find the Object clicked using X() and Y() co-ordinate??
Since QLabel is a subclass of QWidget, you can handle mouse press events in QLabel::mousePressEvent
But in QMainWindow, you can use childAt to get the child widgets at x,y
Read more at:
http://doc.qt.io/qt-5/qwidget.html#childAt