I want to catch the click on my QMenuBar that is in QMainWindow, so I have subclassed QMenuBar and I have overrided the mousePressEvent function, but now when I click on menu, the submenus doesn't display them.
An idea ?
I want to catch the click on my QMenuBar that is in QMainWindow, so I have subclassed QMenuBar and I have overrided the mousePressEvent function, but now when I click on menu, the submenus doesn't display them.
An idea ?
In the end of your mousePressEvent
function you should pass the event to the base class, which will do its own operations on mouse click:
void MyMenu::mousePressEvent(QMouseEvent *event)
{
// do your stuff
QMenu::mousePressEvent(event);
}
Here you can read about the Qt Event System.