Getting click coordinates from plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting click coordinates from plugin

jportemer
Hello everybody. I am a student and for a project I have to write a plugin on LibreCAD for positionning points in terms of others. I am working on the sample.h and sample.cpp.
I have adapted the form so that I can place and draw a point by three distances to three point already drawn.
Now I absolutely need to compute a method on this plugin that lets the user to click on the draw space and place a point where he clicked.
How can I do that ? How can I get the (x,y) click coordinates of the click so that I could create a QPointF(x,y) and call the AddPoint method of the document_interface doc object ?

I have to find a solution quick so if you have any clue to solve this problem, that would be very nice !

Thanks a lot for your help.
Reply | Threaded
Open this post in threaded view
|

Re: Getting click coordinates from plugin

Rallaz
Continue with align.h and align.cpp in plugins folder.

QPointF point;
bool yes = doc->getPoint(&point, QString("first base point:"));
if (!yes)
    return; //cancelled, the user do no select any point
Reply | Threaded
Open this post in threaded view
|

Re: Getting click coordinates from plugin

Rallaz
In reply to this post by jportemer