I'm using a custom QGraphicsWidget and when I right click on it I want to bring up a menu. I'm starting it like this:
void myQGraphicsWidget::mousePressEvent(QGraphicsSceneMouseEvent *event){
if(event->button() & Qt::RightButton){
const QString test = "test";
QMenu menu;
menu.setTitle(test);
menu.addAction(test);
menu.exec(mapToScene(event->pos()).toPoint());
//menu.exec(mapToScene(QPointF(0,0)).toPoint());
}
}
but the menu shows up way outside of the main application window towards the bottom right of my other monitor. When I use the commented out version then it appears resting on top of my main window. I've tried adjusting the point manually to massage it inside the window but it will just jump to either resting on top of the window or hanging from the bottom, never inside.