title: Qt shortcut for custom context menu
body: <p>I have been reading though a couple of examples and post but I just cannot figure out how to add a shortcut to my custom context menu. My GUI has several elements. One of them is a treeView. For the elements in my treeView I would like to have a custom context menu.</p>
  <p>My first approach was according to this tutorial <a href="http://www.setnode.com/blog/right-click-context-menus-with-qt/" rel="nofollow noreferrer">here</a>. The context menu itself worked but the shortcuts cannot work if you create the actin within the show function.
  So my second approach was according to <a href="http://doc.qt.io/qt-5/qtwidgets-mainwindows-application-example.html" rel="nofollow noreferrer">this</a> tutorial. But still my shortcuts do not work and if I use the context menu all actions are called twice...</p>
  <p>Since I did not find a tutorial or code example, which matches my case, I hope that someone here can explain to me how this is correctly done in theory. Adding a shortcut to an action for a custom context menu.</p>
  <ol>
  <li>Where do I have to declare my action?</li>
  <li>What needs to be the parent of the action?</li>
  <li>On which widget do I need to call addAction?</li>
  </ol>
  <p>Thanks for any hints.</p>