我该如何处理⇧ shift(或⌘ command和⌥ option)+ click
on QSystemTrayIcon
?
我已经尝试过的:
app = MyApp(sys.argv)
class MyApp(QApplication):
self.trayIcon = QSystemTrayIcon(self)
self.trayIcon.activated.connect(self.trayIconActivated)
...
def trayIconActivated(self):
print "ACTIVATED", app.keyboardModifiers()
...
始终打印(无论是否按下按钮):
ACTIVATED <KeyboardModifiers object at 0x1002ad498>
def trayIconActivated(self):
print app.keyboardModifiers() & QtCore.Qt.ShiftModifier
print app.keyboardModifiers() & QtCore.Qt.ShiftModifier == QtCore.Qt.ShiftModifier
总是打印:
<KeyboardModifiers object at 0x1002ad4b0>
False
版本:
PySide 1.1.2
Qt 4.8.4