superwave
3rd July 2011, 03:10
I defined a QGLWidget:
NLDCanvas = new QGLWidget;
NLDCanvas->setMinimumHeight(305);
NLDCanvas->setMinimumWidth(460);
I also defined
QPainter ipainter(this);
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
NLDCanvas = new QGLWidget;
NLDCanvas->setMinimumHeight(305);
NLDCanvas->setMinimumWidth(460);
I also defined
QPainter ipainter(this);
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