QMenu as widget right click context menu blocks mouse events
I have implemented a QMenu for a Widget as follows:
void MyWidget::mousePressEvent( QGraphicsSceneMouseEvent* event )
if( event->button() == Qt::RightButton )
QMenu* myMenu = new QMenu();
myMenu->addAction("Send Blend To Projector", this, SLOT( sendBlendToSelectedProj() ) );
myMenu->popup( QCursor::pos() );
The popup menu still grabs the mouse event; when I click on another widget I want to popup it own menu after the first one closes; this doesn't happen while the first popup menu is displayed. Based on what I read in the documentation, the popup is nonModal and should not capture mouse events.
i believe when you use Qmenu::popup() to show the menu it's window flags are also set to "Popup". Meaning that the mouse event is just to be used for closing.
You can try just to use move() and show(). But then you would have to take care that your you close your menu by yourself.
I tried using myMenu->exec and myMenu ->show and they all block the mouse; I tried installing an event filter on the widget to make myMenu ignore the right click; this works partially, as myMenu now ignores the mouse right click , but the event is not being picked up by the second widget.
Basically what I am trying to implement is behavior similar with a right click in MS Excel: when the user right clicks on a cell, the cell gets selected and the context menu shows up; right clicking on another cell selects that cell and shows it's context menu. Can anybody point me in the right direction? Thanks