There is a GraphiscView widget in my dialog, and menu setup is looking:

Qt Code:
  1. m_ui->graphicsView->setContextMenuPolicy(Qt::CustomContextMenu);
  2. connect(m_ui->graphicsView, SIGNAL(customContextMenuRequested(const QPoint&)),
  3. this, SLOT(showContextMenu(const QPoint&)));
To copy to clipboard, switch view to plain text mode 

If I add an object of a class, derived from QGraphicsItem, and having this method overriden:

Qt Code:
  1. void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) Q_DECL_OVERRIDE;
To copy to clipboard, switch view to plain text mode 

, the graphicsView context menu is beig shown, if I right-click on it, not one of the item.
Item's menu is shown only if I comment out set up of graphicsView menu.

How to do it right way, that if I click on an item, its menu is shown, if on an empty field of graphicsView - the graphicsView's menu?