diff --git a/src/sampleplugins/sampleedit/sampleedit.cpp b/src/sampleplugins/sampleedit/sampleedit.cpp index 874c6b3ff..267bdace0 100644 --- a/src/sampleplugins/sampleedit/sampleedit.cpp +++ b/src/sampleplugins/sampleedit/sampleedit.cpp @@ -30,7 +30,8 @@ $Log: meshedit.cpp,v $ #include #include "sampleedit.h" #include -#include +#include +#include using namespace std; using namespace vcg; @@ -55,7 +56,8 @@ const QString SampleEditPlugin::Info() void SampleEditPlugin::mouseReleaseEvent(QMouseEvent * event, MeshModel &/*m*/, GLArea * gla) { gla->update(); - cur = event->pos(); + const Point2f loc = QTLogicalToOpenGL(gla, event->pos()); + curGL = QPoint(int(loc.X()), int(loc.Y())); haveToPick = true; curFacePtr = 0; curVertPtr = 0; @@ -73,7 +75,7 @@ void SampleEditPlugin::Decorate(MeshModel &m, GLArea * gla, QPainter *p) if (pickmode == 0) { NewFaceSel.clear(); - GLPickTri::PickVisibleFace(cur.x(), gla->height() - cur.y(), m.cm, NewFaceSel); + GLPickTri::PickVisibleFace(curGL.x(), curGL.y(), m.cm, NewFaceSel); if (NewFaceSel.size() > 0) { curFacePtr = NewFaceSel[pIndex]; @@ -83,7 +85,7 @@ void SampleEditPlugin::Decorate(MeshModel &m, GLArea * gla, QPainter *p) else if (pickmode == 1) { NewVertSel.clear(); - GLPickTri::PickVert(cur.x(), gla->height() - cur.y(), m.cm, NewVertSel,15,15); + GLPickTri::PickVert(curGL.x(), curGL.y(), m.cm, NewVertSel,15,15); if (NewVertSel.size() > 0) { curVertPtr = NewVertSel[pIndex]; diff --git a/src/sampleplugins/sampleedit/sampleedit.h b/src/sampleplugins/sampleedit/sampleedit.h index a2db68705..1c553a676 100644 --- a/src/sampleplugins/sampleedit/sampleedit.h +++ b/src/sampleplugins/sampleedit/sampleedit.h @@ -51,7 +51,7 @@ public: void drawVert(CMeshO::VertexPointer vp, MeshModel &m, GLArea *gla, QPainter *p); private: - QPoint cur; + QPoint curGL; QFont qFont; bool haveToPick; int pickmode;