Something like this?
MWin inherits QMainWindow
if(event
->type
() == QEvent::ContextMenu) { qDebug("I have blocked the context menu.");
return true;
} else return QObject::eventFilter(object, event
);
}
else return QObject::eventFilter(object, event
);
}
bool MWin::eventFilter(QObject* object, QEvent* event) {
if(event->type() == QEvent::ContextMenu) {
QContextMenuEvent* mevent = static_cast<QContextMenuEvent *>(event);
if(mevent->reason() == QContextMenuEvent::Mouse) {
qDebug("I have blocked the context menu.");
return true;
} else return QObject::eventFilter(object, event);
}
else return QObject::eventFilter(object, event);
}
To copy to clipboard, switch view to plain text mode
and installation:
...
fileToolBar->installEventFilter(this);
...
modeToolBar->installEventFilter(this);
...
actionToolBar->installEventFilter(this);
...
...
fileToolBar->installEventFilter(this);
...
modeToolBar->installEventFilter(this);
...
actionToolBar->installEventFilter(this);
...
To copy to clipboard, switch view to plain text mode
Bookmarks