View Full Version : How to get mouse's position?
coralbird
20th July 2006, 08:47
I want to get mouse's position in a widget not through QMouseEvent,How can I do this?
thanks!
high_flyer
20th July 2006, 10:52
then you will have to work directly with X.
(Why can't you use QMouseEvent?)
QPoint p = widget->mapFromGlobal(QCursor::pos());
coralbird
23rd July 2006, 04:52
then you will have to work directly with X.
(Why can't you use QMouseEvent?)
sure,I am building a GUI program, but mouseMove event just can be captured when left
or right button is pressed, which is different with windows ,and grap mouse input is
dangerous,so I have to get mouse position in timerEvent().
coralbird
23rd July 2006, 04:52
QPoint p = widget->mapFromGlobal(QCursor::pos());
Thanks a lot! I will test it.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.