<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); "><div style="font-size: 14px; font-family: Calibri, sans-serif; ">Hi All,</div><div style="font-size: 14px; font-family: Calibri, sans-serif; "><br></div><div style="font-size: 14px; font-family: Calibri, sans-serif; ">I'm trying to use QShortcut to set a global shortcut for my application, however if I set the context to anything other than Qt.WidgetContext (I.e. Qt.ApplicationContext in my case) the application crashes. This behaviour is true for Mac OSX 10.8 and Windows 7. I'm using Python 2.7.2, Qt4.8 and PyQt4.10. The following little program is a demo and crashes for me:</div><div style="font-size: 14px; font-family: Calibri, sans-serif; "><br></div><div><div><font face="Consolas" style="font-size: 10px;">import sip</font></div><div><font face="Consolas" style="font-size: 10px;">sip.setapi('QString',2)</font></div><div><font face="Consolas" style="font-size: 10px;">sip.setapi('QVariant',2)</font></div><div><font face="Consolas" style="font-size: 10px;"><br></font></div><div><font face="Consolas" style="font-size: 10px;">from PyQt4.QtCore import *</font></div><div><font face="Consolas" style="font-size: 10px;">from PyQt4.QtGui import *</font></div><div><font face="Consolas" style="font-size: 10px;"><br></font></div><div><font face="Consolas" style="font-size: 10px;">class Widget(QWidget):</font></div><div><font face="Consolas" style="font-size: 10px;"> def __init__(self, parent=None, **kwargs):</font></div><div><font face="Consolas" style="font-size: 10px;"> QWidget.__init__(self, parent, **kwargs)</font></div><div><font face="Consolas" style="font-size: 10px;"><br></font></div><div><font face="Consolas" style="font-size: 10px;"> self.shortcut=QShortcut(</font></div><div><font face="Consolas" style="font-size: 10px;"> "Ctrl+P",</font></div><div><font face="Consolas" style="font-size: 10px;"> self,</font></div><div><font face="Consolas" style="font-size: 10px;"> context=Qt.ApplicationShortcut,</font></div><div><font face="Consolas" style="font-size: 10px;"> activated=self._sca</font></div><div><font face="Consolas" style="font-size: 10px;"> )</font></div><div><font face="Consolas" style="font-size: 10px;"><br></font></div><div><font face="Consolas" style="font-size: 10px;"> @pyqtSlot()</font></div><div><font face="Consolas" style="font-size: 10px;"> def _sca(self): print "SCA"</font></div><div><font face="Consolas" style="font-size: 10px;"><br></font></div><div><font face="Consolas" style="font-size: 10px;">if __name__=="__main__":</font></div><div><font face="Consolas" style="font-size: 10px;"> from sys import argv, exit</font></div><div><font face="Consolas" style="font-size: 10px;"><br></font></div><div><font face="Consolas" style="font-size: 10px;"> a=QApplication(argv)</font></div><div><font face="Consolas" style="font-size: 10px;"> w=Widget()</font></div><div><font face="Consolas" style="font-size: 10px;"> w.show()</font></div><div><font face="Consolas" style="font-size: 10px;"> w.raise_()</font></div><div><font face="Consolas" style="font-size: 10px;"> exit(a.exec_())</font></div></div><div style="font-size: 14px; font-family: Calibri, sans-serif; "><br></div><div style="font-size: 14px; font-family: Calibri, sans-serif; ">Just wondering if anybody has had this issue and can tell me what I'm doing wrong or if this is a genuine bug.</div><div style="font-size: 14px; font-family: Calibri, sans-serif; "><br></div><div style="font-size: 14px; font-family: Calibri, sans-serif; ">Thanks very much, Rob</div></body></html>