Results 1 to 3 of 3

Thread: QwtPlot: knowing the closest marker after the user clicks on the plot

  1. #1
    Join Date
    May 2006
    Posts
    1
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Question QwtPlot: knowing the closest marker after the user clicks on the plot

    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,

    Thanks,

    Guilhem.

  2. #2
    Join Date
    Dec 2008
    Posts
    23
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QwtPlot: knowing the closest marker after the user clicks on the plot

    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.

  3. #3
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QwtPlot: knowing the closest marker after the user clicks on the plot

    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.

    Uwe

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.