View Full Version : QwtPlot: knowing the closest marker after the user clicks on the plot

9th May 2006, 12:25
Hello all,

I have recently upgraded Qwt on my PC, from 0.4.1 to 0.5.0.

In my project I:
1) retrieve the coordinates where the user clicked
2) get the closest marker of that point

On 0.4.1, I am using a QwtPlot with Markers. I used to catch the signal emitted by QwtPlot which was "plotMousePressed" and then using "closestMarker" in the slot to retrieve the marker on which the user had clicked.

There has been some changes and these both commands are no more available. Do you know a way to get the same behavior on a marker with the version 0.5.0 of Qwt?

I had a look at these:
For the mouse event: there are signals emitted by the legend widget and by the picker widget. The picker widget serves to select a QWidget*, but the problem is that the marker does not inherit from QWidget.
For the closestMarker function: there is a "ClosestPoint" for the curve, but I found nothing similar for the marker.

Any hint, any help welcome,



11th September 2012, 19:55
I do not have closestMarker method as well. Does anyone know what/if there is a replacement for it? I am trtying to play with the transforms, and appears that if I inverse transform the cursor positin it is within 5 units of my Marker positins, put this gap is to large for me to use. Any input will be appreciated. thanks.

12th September 2012, 07:43
In your case it is better to transform the marker position into widget coordinates - otherwise your algo depends on the zoom width. But how many pixels off ( maybe the rectangle around the position in symbol size ) your application accepts as a match is completely up to you.