How can I detect which mouse button was clicked (right or left) in the slot for QtCore.SIGNAL('cellClicked(int,开发者_开发知识库int)')?
You would probably pass the event to your cellClicked
function. I'm assuming you emit your signal from a place that has access to a QMouseEvent.
Check out this thread.
Excerpt:
def mousePressEvent(self, event):
if event.button() == QtCore.Qt.RightButton:
event.accept()
self.rightClickMenu(event)
else:
event.ignore()
Also, this mailing list thread looks like a more complete example.
精彩评论