I'm not sure what you mean in 3).
Are you talking about mouse cursor and restricting it's movement?
I'm not sure if that's a good idea.
In my opinion you should not play with the mouse cursor, instead you can add a marker which could follow the curve.
As to 'how to'.
You can install event filter on the canvas to get mouse move events only when mouse cursor is over the canvas.
Having X screen coordinate you can translate it to X world coordinate using QwtPlot::transform().
Now the difficult part: you can't use QwtPlot facilities to get curve Y value at cetain X (at least I don't know how).
You have to do it yourself and it will depend on data model you have.
In worst case, where your data takes forever to find Y for X you could use canvas cache to find the Y.
Just interogate all pixels in X column (where X comes from mouse move event over the canvas) in the cache and look for first black pixel you find.
This way you get Y position in the canvas which you can map to screen using QwtPlotCanvas::mapToGlobal().
I haven't tested it but I think it should work![]()




Reply With Quote


Bookmarks