Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QContextMenuEvent and dual screen monitor
Forum Updated to NodeBB v4.3 + New Features

QContextMenuEvent and dual screen monitor

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 1 Posters 628 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    ddze
    wrote on last edited by raven-worx
    #1

    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

    1 Reply Last reply
    0
    • D Offline
      D Offline
      ddze
      wrote on last edited by ddze
      #2

      solved by

      QPointF scenePos=this->mapToGlobal(QPoint(event->pos().x(),event->pos().y()));
      menu.exec(scenePos.toPoint());
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved