How to transform the phisical cooridinate of QMouseEvent to logical coordinate?
I defined a QGLWidget:
Code:
NLDCanvas->setMinimumHeight(305);
NLDCanvas->setMinimumWidth(460);
I also defined
Code:
ipainter.
setWindow(QRect(50,
50,
100,
100);
Moreover,In the QGLWidget, I reimplemented the mouseMoveEvent(QMouseEvent *e) function.
And I need to pick the items under the position of the cursor.
However, since the e->posF() is according to the physical coordinate, the result does not has the same value of the item's logical coordinate.
How can I get the logical coordinate of the mouse position of the QGLWidget?
Thanks a lot
Re: How to transform the phisical cooridinate of QMouseEvent to logical coordinate?
Quote:
Originally Posted by
superwave
I defined a QGLWidget:
Code:
NLDCanvas->setMinimumHeight(305);
NLDCanvas->setMinimumWidth(460);
I also defined
Code:
ipainter.
setWindow(QRect(50,
50,
100,
100);
Moreover,In the QGLWidget, I reimplemented the mouseMoveEvent(QMouseEvent *e) function.
And I need to pick the items under the position of the cursor.
However, since the e->posF() is according to the physical coordinate, the result does not has the same value of the item's logical coordinate.
How can I get the logical coordinate of the mouse position of the QGLWidget?
Thanks a lot
Are you talking about coordinate conversion between OpenGL space coordinate and Qt screen coordinate?
Regards,
Dong Back Kim