开发者

Which button was clicked?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜