Look, after proper code formatting the problem is obvious:
{
if (obj == imageLabel) {
if (event
->type
() == QEvent::MouseButtonPress) { qDebug("Mouse has been pressed\n");
// return true here, because ...
}
return true; // ... this will filter out ALL events for label ! including paint events;)
} else {
// pass the event on to the parent class
return false;
//return QMainWindow::eventFilter(obj, event);
}
}
bool MyAppName::eventFilter(QObject *obj, QEvent *event)
{
if (obj == imageLabel) {
if (event->type() == QEvent::MouseButtonPress) {
qDebug("Mouse has been pressed\n");
// return true here, because ...
}
return true; // ... this will filter out ALL events for label ! including paint events;)
} else {
// pass the event on to the parent class
return false;
//return QMainWindow::eventFilter(obj, event);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks