In Qt to capture the mouse movement events need to rewrite mousemoveevent, but mousemoveevent in order to not consume resources, by default, only the mouse press move to capture. Setmousetracking (TRUE) is required to capture movement when the mouse is not pressed.
Note: If the control you want to respond to a mouse event is contained by a parent control, the control and its parent control or container also need setmousetracking (true); As the standard qlable in my program is promoted to MyLabel by my custom class, in the main interface I first set up a widget1 of container container qwidget, then put some mylable, and now need to be prompted when the mouse moves over the label. The following work needs to be done: First call setmousetracking (true) in the custom class. You need to call Ui.widget1->setmousetracking (TRUE) in the main interface afterwards.
Reference: http://blog.csdn.net/hcj116/article/details/17334473
The use of mousemoveevent in QT