PDA

View Full Version : how can I get the handle of the window when the mouse is move



duduqq
26th June 2008, 07:45
how can I get the handle of the window when the mouse is move,
I want to get the handle of the window and get the window's coordinateof the upper left corner and coordinate of the downer right corner .

mcosta
26th June 2008, 09:40
You can use QWidget::geometry() or QWidget::frameGeometry() to get the Coordinate of Widget and QWidget::mapToGlobal() to convert them in Global Coordinates.

What means
how can I get the handle of the window when the mouse is move?

You can reimplement QWidget::mouseMoveEvent() to catch mouse movement and use QWidget::setMouseTracking() to set ON mouse tracking properties

duduqq
27th June 2008, 07:22
You can use QWidget::geometry() or QWidget::frameGeometry() to get the Coordinate of Widget and QWidget::mapToGlobal() to convert them in Global Coordinates.

What means ?

You can reimplement QWidget::mouseMoveEvent() to catch mouse movement and use QWidget::setMouseTracking() to set ON mouse tracking properties
thanks
but the mouse is out side the widget ,and the mouseMoveEvent() can track where is the mouse

mcosta
27th June 2008, 08:58
You are right.
But if you press a mouse button when pointer is on the widget and you move the pointer outside the widget you receive mouseMoveEvent.

You can grab the mouse with QWidget::grabMouse()

duduqq
10th July 2008, 14:10
But I want get the handle when the mouse clicked out side the window
Or I just move the mouse out side the window not press the mouse and move

Sandip
10th July 2008, 15:17
Hi,

Can you explain your problem in details? I would like to know what are you trying to achieve so that I can help you in better way.

If that window is created by your application then you can get it easily with QApplication::allWidgets () but before that you have to grab the mouse and check whether mouse position lies within geometry of any window.

If you want to obtain the mouse press event and the window for which it is intended then you have to hook the mouse events with the help of other api's. For that you may have to depend on platform specific api's.

duduqq
13th July 2008, 03:42
Hi,

Can you explain your problem in details? I would like to know what are you trying to achieve so that I can help you in better way.

If that window is created by your application then you can get it easily with QApplication::allWidgets () but before that you have to grab the mouse and check whether mouse position lies within geometry of any window.

If you want to obtain the mouse press event and the window for which it is intended then you have to hook the mouse events with the help of other api's. For that you may have to depend on platform specific api's.
yes ,i want to obtain the mouse press event when the mouse move or press at the desktop or other window,how can i get the handle with the help of the api,can you get me some code,thank you very much.

jpn
17th July 2008, 21:47
See QxtWindowSystem::windowAt() (http://doc.libqxt.org/latest/classQxtWindowSystem.html)