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()。