I can't get keyboard shortcuts to work with Qt.WidgetShortcut or Qt.WidgetWithChildrenShortcut context. It seems that nothing I do will trigger the action. Below is a sample class which is giving the problem. Can anyone point out where I am going wrong?<div>
<br></div><div><div>class Widget(QtGui.QWidget):</div><div> def __init__(self):</div><div> super().__init__()</div><div> self.act = QtGui.QAction('test', self)</div><div> self.act.setShortcut(QtGui.QKeySequence(QtGui.QKeySequence.Copy))</div>
<div> self.act.setShortcutContext(Qt.WidgetWithChildrenShortcut)</div><div> self.addAction(self.act)</div><div> self.act.triggered.connect(self.slot)</div><div><br></div><div> def slot(self):</div>
<div> print('triggered')</div></div><div><br></div><div>David</div>