You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

ProBoj!

Unregistered

1

Saturday, February 28th 2004, 4:05pm

QGLWidget & mouse

Hello all,

I have a question of the QGLWidget-class: is it possible to get the current position of the mouse (x and y) and even change that position.

For getting the position I might have a solution: I know the QMouseEvent()-function is being called each time the user moves his mouse (if tracking is enabled), so I can update a member variable, like m_x and m_y, each time that function is invoked by QT. However, I suppose QT has a built-in function which gives me the position of the mouse, but I don't see it in the function-list of the class.

For the second I couldn't find something in the docs and this mailinglist, so I hope one of you can help me with this.

Thanks for your time!

e8johan

Professional

  • "e8johan" is male

Posts: 1,195

Location: Sweden

  • Send private message

2

Saturday, February 28th 2004, 4:39pm

RE: QGLWidget & mouse

The position is supplied with the mouse movement event, so you will have to sub-class in order to find it. It is also supplied with the mouse down and mouse up events.

ProBoj!

Unregistered

3

Sunday, February 29th 2004, 8:40am

ok thanks a lot for your reply!

axeljaeger

Professional

  • "axeljaeger" is male

Posts: 730

Location: Frankfurt Germany

Occupation: Student

  • Send private message

4

Sunday, February 29th 2004, 8:56am

QCursor is your friend
It's nice to be important but it's more important to be nice

ProBoj!

Unregistered

5

Sunday, February 29th 2004, 9:45am

jup I managed to do it with QCursor!

thanks