QMouseEvent::buttons()
它返回的是多个鼠标时间的相与 的 结果
比如,
鼠标左键按下,返回1
鼠标右键按下,返回2
鼠标滚轮按下,返回4
左右键同时按下,返回1|2
三键同时按下,返回1|2|4
QMouseEvent::button()
当多个鼠标按键按下时,只会返回最后一个按键 对应的值
附录
enum MouseButton {
NoButton = 0x00000000,
LeftButton = 0x00000001,
RightButton = 0x00000002,
MidButton = 0x00000004, // ### Qt 5: remove me
MiddleButton = MidButton,
XButton1 = 0x00000008,
XButton2 = 0x00000010,
MouseButtonMask = 0x000000ff
};