C++ (Qt) MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow){ ui->setupUi(this); ui->label->installEventFilter(this);} ...bool MainWindow::eventFilter(QObject *obj, QEvent *event){ if(event->type() == QEvent::MouseButtonPress) { //do something return true; } else { // standard event processing return QObject::eventFilter(obj, event); }}