title: PyQt5 SystemTrayIcon's Context Menu doesn't accept key strokes when triggered programmatically
body: <p>I have a python script that uses PyQt5 to place a system Tray Icon, which I can use to run other scripts.</p>
  <p>It's excellent for multiple scripts handling, and since I don't use them often there is no point assigning keyboard shortcuts for all of those scripts.</p>
  <p>As long as I use the right-click to open the context menu, it's fine, but I'd also like to trigger it from keystrokes. The problem I faced is when I don't click at the Icon, even if the menu is shown the focus is not there so any other keystrokes don't reach there.</p>
  <p>The part to trigger the context menu is:</p>
  <pre class="lang-py prettyprint-override"><code>    @QtCore.pyqtSlot(QDBusMessage)
      def dmsg(self, message):
          menu = self.icon.contextMenu()
          if menu.isVisible():
              menu.close()
          else:
              menu.exec(QtCore.QPoint(0,0))
              # menu.show()
  </code></pre>
  <p>I can use the dbus to send a signal which triggers this function and the ContextMenu can be seen without having to click the system tray Icon.</p>
  <p>I use <code>dbus-send --system / gaurav.menu.toggle</code> to send the signal to toggle the context menu visibility, and it works.</p>
  <p>A reproducible example is as follows:</p>
  <pre class="lang-py prettyprint-override"><code>from PyQt5 import QtGui, QtWidgets, QtCore
  from PyQt5.QtDBus import QDBusConnection, QDBusMessage
  import sys
  
  def exe_script(name):
      action = name.text()
      if action == '&amp;Exit':
          sys.exit(0)
      elif action == '&amp;Hello':
          print('hello')
  
  def read_actions():
      return 
  
  def get_menu(all_actions):
      menu = QtWidgets.QMenu()
      actions = []
      for name in ['&amp;Exit', '&amp;Hello']:
          mi = menu.addAction(name)
          actions.append(mi)
      menu.triggered.connect(lambda q:exe_script(q))
      return menu,actions
  
  
  
  class QDBhandler(QtCore.QObject):
      def __init__(self,icon):
          super(QDBhandler,self).__init__()
          bus = QDBusConnection.systemBus()
          bus.registerObject('/', self)
          bus.connect(
              '',
              '/',
              'gaurav.menu',
              'toggle',
              self.dmsg
          )
          self.icon = icon
  
      @QtCore.pyqtSlot(QDBusMessage)
      def dmsg(self, message):
          menu = self.icon.contextMenu()
          if menu.isVisible():
              menu.close()
          else:
              menu.exec(QtCore.QPoint(0,0))
              # menu.show()
          
  
  def main():
      app = QtWidgets.QApplication(sys.argv)
      icon = QtWidgets.QSystemTrayIcon()
      handler = QDBhandler(icon)
      icon.setToolTip('Execute Scripts')
      actions_dict = read_actions()
      menu,actions = get_menu(actions_dict)
      icon.setContextMenu(menu)
      icon.show()
      sys.exit(app.exec())
      
  
  if __name__ == '__main__':
      main()
  
  </code></pre>
  <p>System Information:
  Archlinux, i3-gaps window manager</p>