How to tell the mouse button using QApplication::mouseButtons() in a “click” slot?

后端 未结 3 1868
忘掉有多难
忘掉有多难 2021-01-26 01:21

I have a QMainWindow, and want to handle the \"clicked\" signal from a smaller widget (such as tableview) inside it.

Originally I connect the signal to a slot of this QM

3条回答
  •  佛祖请我去吃肉
    2021-01-26 01:51

    You get 0 becouse clicked is emited after mouse release, not at mouse press. What do you want to achieve ? Maybe try settings on you widget contextMenuPolicy to custom, and than connect to signal contextMenuRequested (for the right click) and clicked for the left click ?

提交回复
热议问题