mouseTracking是Qt QWidgets类的属性,bool值。表示窗口的鼠标跟踪属性是否生效。Qt的官方文档描述如下:
This property holds whether mouse tracking is enabled for the widget。
If mouse tracking is disabled (the default), the widget only receives mouse move events when at least one mouse button is pressed while the mouse is being moved.
If mouse tracking is enabled, the widget receives mouse move events even if no buttons are pressed.
即:该属性失效时(默认状态),则只有当鼠标有至少一个按钮按下时移动,窗口才能接收到鼠标移动事件;
该属性生效时,即使没有鼠标按钮按下,窗口也能接收到鼠标移动事件。
该属性可以通过setMouseTracking函数进行设置,通过hasMouseTracking函数进行获取。
相关的事件响应函数是mouseMoveEvent()。
本文详细介绍了Qt中mouseTracking属性的作用及其使用方法。该属性决定窗口是否接收无按键的鼠标移动事件,通过setMouseTracking设置,hasMouseTracking获取。
697

被折叠的 条评论
为什么被折叠?



