您尚未登录。

楼主 #1 2017-10-17 13:47:35

ttyA
会员
注册时间: 2017-10-17
已发帖子: 1
积分: 1

怎样理解Qt里面控件的 Clicked 和 Pressed 两个信号,有什么差异?

//////

离线

#2 2017-10-17 13:48:10

晕哥
管理员
注册时间: 2017-09-06
已发帖子: 9,348
积分: 9202

Re: 怎样理解Qt里面控件的 Clicked 和 Pressed 两个信号,有什么差异?

https://stackoverflow.com/questions/9451559/what-is-the-difference-between-clicked-and-pressed-in-qt

Pressed: event is generated when you push down the mouse button
Released: event is generated when you release the mouse button (which has been pressed down before)
Clicked: event is generated when a mouse button Pressed & Released.
With these functions you can create a snap-switch for example:

when you press the button, the light will switch off / the music starts / etc, when you release it, light switches back on / the music starts again etc.

按下:当您按下鼠标按钮时会生成事件
发布:当您释放鼠标按钮(以前已被按下)时会生成事件
点击:当鼠标按钮按下并释放时生成事件。
通过这些功能,您可以创建一个快照开关,例如:

当您按下按钮时,指示灯将关闭/音乐启动/ etc,当您释放它,灯开关重新开始/音乐再次启动等。





离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn