Results 1 to 4 of 4

Thread: Tooltip in qwt

  1. #1
    Join Date
    Oct 2015
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Tooltip in qwt

    Hello. I have to do the following: when I point to the value (big dot - qwtSymbol) a coordinate of this value will be appeared . I found on the internet the method realization and I change it a little:

    Qt Code:
    1. void Monitoring::showToolTip(QMouseEvent* ev){
    2.  
    3. if(ev == QEvent::MouseMove) {
    4.  
    5. double distance = 1e99;
    6. int point_index = first_c->closestPoint(QPoint(ev->x(), ev->y()), &distance); // for my one of my curves
    7.  
    8. QwtPlotMarker* tooltip = new QwtPlotMarker();
    9. tooltip->setLabel(QString("hello")); //for debugging
    10. tooltip->attach(funPlot);
    11. funPlot->replot();
    12. }
    To copy to clipboard, switch view to plain text mode 

    But I don't understand how to call this function. I thought I could call it through the signal-slot construction, but I can't pick up appropriate signal.

  2. #2
    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: Tooltip in qwt

    I would advice against using this code as it results in heavy replots, while moving the mouse.

    Something like tooltips can be done in a much better way using QwtPlotPicker. Have a look the bode or spectrogram example - moving the mouse over the plot canvas and you will see.
    To display a specific informationfor a position you would have to overload QwtPlotPicker::trackerText or QwtPlotPicker::trackerTextF. At positions, where you don't want display any information simply return QString::null.

    Uwe

  3. #3
    Join Date
    Oct 2015
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Tooltip in qwt

    Thanks for you answer. But how can I find the coordinates qwtSymbols on my plot?

  4. #4
    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: Tooltip in qwt

    Usually symbols are related to some points in plot coordinates. You can translate between plot and widget coordinates using the canvas maps ( see QwtPlot::canvasMap() ).
    Maybe the code the code from curvetracker example helps.

    Uwe

  5. The following user says thank you to Uwe for this useful post:

    Cat (19th October 2016)

Similar Threads

  1. Tooltip
    By ich in forum Qt Programming
    Replies: 1
    Last Post: 19th November 2014, 18:52
  2. tooltip of slider........
    By vani.pv in forum Newbie
    Replies: 9
    Last Post: 25th September 2012, 11:47
  3. Regarding tooltip
    By ashishsaryar in forum Qt Programming
    Replies: 1
    Last Post: 24th December 2011, 09:32
  4. Tooltip in Qwt
    By Ankitha Varsha in forum Qwt
    Replies: 5
    Last Post: 8th December 2009, 13:07
  5. ToolTip....
    By merry in forum Qt Programming
    Replies: 27
    Last Post: 3rd August 2007, 11:42

Tags for this Thread

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.