Convert canvas coordinates to parent widget
Hello everyone!
Currently, I am facing a problem that I have a certain point on my canvas and I also have a parent widget that incorporates the whole plot. What I need to do is to convert a point from a curve in my canvas to coordinates relative to my parent widget.
Does anybody know how I can do it?
I tried doing the following example, but was not successful:
auto points1 = plot_->canvas()->mapFromParent(pointsToConvert);
auto points2= plot_->mapFromParent(points1 );
auto points3 = mapFromParent(points2);
Thank you!
Re: Convert canvas coordinates to parent widget
First you need to translate the curve points into widget coordinates of the canvas. This can be done using the maps you get with QwtPlot::canvasMap().
Uwe