在MacOS上运行以下PyQt5代码时(Sierra 10.12.6)
self.tray_icon = QtWidgets.QSystemTrayIcon(QtGui.QIcon("icon/path"), self)
self.tray_icon.activated.connect(self.on_systray_activated)
[...]
def on_systray_activated(self, i_reason):
logging.debug("entered on_systray_activated. i_reason = " + str(i_reason))
即使右键单击也会得到activation reasonQSystemTrayIcon::Trigger
在其他系统上(例如XFCE),当用户右键单击时,我们得到QSystemTrayIcon::Context
在MacOS上,如何区分左键和右键单击systray图标?在
QApplication.mouseButtons方法可用于获取当前的state of the mouse buttons:
相关问题 更多 >
编程相关推荐