I have a custom subclass of QGraphicsScene that executes a context menu. The context menu works, but I can't seem to receive any keyboard shortcuts for it. Here's a simplified example of my code.
Qt Code:
  1. MyScene::MyScene(QObject *parent) :
  2. {
  3. m_contextMenu = new QMenu();
  4. QAction *action = m_contextMenu->addAction(tr("Duplicate"), this);
  5. action->setShortcut(tr("Ctrl+D"));
  6. connect(action, SIGNAL(triggered(), this, SLOT(duplicateSelectedItem()));
  7. }
To copy to clipboard, switch view to plain text mode 

The duplicateSelectedItem() slot never gets called. How do I ensure the keyboard shortcut events get propagated to this action? I got the impression this would happen when the QGraphicsView gets focus, but clearly it can't figure out that the actions I've created in the scene are in focus. If it makes any difference, I'm testing this on OSX. Thanks.