tags:

views:

92

answers:

2

Hello, I'm new to Qt. I'd like a window to follow the mouse around the screen. (It's a useful aid to reading)

The best I can come up with is a timer that uses QPoint QCursor::pos() to move the window every .1 seconds.

Rather than spinning this timer constantly, is there an event system I can tap into? This would look smoother, and use less computer.

Is there a better way?

Thanks,

Mike

+2  A: 

You can override QWidget::mouseMoveEvent() and update your window position there.

Georg Fritzsche
Be sure you enable tracking as well, if it isn't already for your widget.
Caleb Huitt - cjhuitt
A: 

Try QTimer and its timeout() signal. The event system you're looking for is probably the main event loop, provided by the QCoreApplication or the QApplication classes.

Jurily