Unsolved QContextMenuEvent and dual screen monitor
-
Here is piece of code :
void ViewItems::contextMenuEvent(QContextMenuEvent *event){ //QPointF scenePos=this->mapToScene(QPoint(event->pos().x(),event->pos().y())); QMenu menu(this); menu.addAction("Delete item"); menu.exec(event->pos()); // menu.exec(scenePos.toPoint()); }
and generates a menu button. Problem is that creates the menu item on the not intended monitor screen. (regardless of the mapping from the scene to the view ) Is there a way to select a monitor on which the context menu appears ?
raven-worx: restored deleted post
-
solved by
QPointF scenePos=this->mapToGlobal(QPoint(event->pos().x(),event->pos().y())); menu.exec(scenePos.toPoint());