Results 1 to 5 of 5

Thread: Displaying tooltip for points in the graph

  1. #1
    Join Date
    Oct 2006
    Location
    Bangalore
    Posts
    32
    Qt products
    Qt4
    Platforms
    Windows

    Red face Displaying tooltip for points in the graph

    Hi,

    I have been working on Qt3 all this time just started working on Qt4.

    in Qt4, I have graphs in my application using Qwt.
    I need to display the point values (x and y ) when user keeps the mouse on the points of the curves in the graph as a tooltip.

    Qt3 offered QTooltip class which has maybeTip function. I used subclass QToolTip class and re-implement maybeTip function. Then compared the point values captured in maybeTip function and with my curve point values with some tolerence and decided whether I should display tooltip at that position of not.

    In Qt4, maybeTip function is removed!
    How can I implement tool tips now in Qt4?

    I tried to search this in Qt Assistant, but did not get solid idea

    Pls help

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Displaying tooltip for points in the graph

    Doesn't Qwt offer something like that? It should, because this is basic functionality in chart controls.

    You could try subclassing the graph widget and carefully override its event() function and handle all events with the type QEvent::ToolTip.

  3. #3
    Join Date
    Jan 2008
    Location
    Silicon valley
    Posts
    15
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Displaying tooltip for points in the graph

    It is done through QwtPlotZoomer::trackerText(). Take a look on the qwt-5.0.2/examples/spectrogram example.

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

    Default Re: Displaying tooltip for points in the graph

    You need to derive from QwtPlotPicker reimplementing YourPicker::trackerText. Here you have to identify if the current position qualifies as being "over" a point and return the type of information you like.

    I already answered this question several times, but unfortunately I couldn't find in which forum it was. So please search on your own, you will find a more detailed discussion and AFAIR some code snippets there.

    Uwe

  5. #5
    Join Date
    Oct 2006
    Location
    Bangalore
    Posts
    32
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Displaying tooltip for points in the graph

    Hi,
    Thank you so much.
    I will try it

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.