Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何检测在 QtCore.SIGNAL('cellClicked(int,int)') 的插槽中单击了哪个鼠标按钮(向右或向左)?
您可能会将事件传递给您的cellClicked函数。我假设您从可以访问 QMouseEvent 的地方发出信号。
cellClicked
看看这个线程。
摘抄:
def mousePressEvent(self, event): if event.button() == QtCore.Qt.RightButton: event.accept() self.rightClickMenu(event) else: event.ignore()
此外,这个邮件列表线程看起来像一个更完整的示例。