Results 1 to 16 of 16

Thread: Tooltip to QwtSymbol ???

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Tooltip to QwtSymbol ???

    Hello everyone,

    I have a QwtSymbol on plot and i want to display like a tool-tip for each symbol i have on the curve, when i click on the symbol.
    so how can i attache like a tool-tip to display the info i need ??

    Thanks

  2. #2
    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: Tooltip to QwtSymbol ???

    You can use QwtPlotPicker overloading trackerText(). How to identify which click is a match of which symbol and how to connect a match to the information you want to display is up the the application code.

    Maybe the ( slow ! ) implementation of CanvasPicker::select in the event_filter example is something you can use. When the symbols are from curves with an ordered set of points you might want to use qwtUpperSampleIndex you can find in qwt_series_data.h in SVN trunk.

    Uwe

  3. #3
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Tooltip to QwtSymbol ???

    Thanks,

    Regarding how i identify the symbols, i used the event_filter example.
    but there is an issue i faced which, when i have other curve that does NOT have symbols, and i click close to one of its points the application crashes. i know because it expects a symbol and didn't find it, but how can i fix this issue, so what would be my if statements to check if the curve has a symbol or not ?? hope you got what i am trying to explain.

    how i connect the information to the symbol, I save the information i want to display with each symbol in the same order i draw the symbol an with that the symbol index is my index for the information.
    thanks

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Tooltip to QwtSymbol ???

    Quote Originally Posted by jesse_mark View Post
    so what would be my if statements to check if the curve has a symbol or not ?? hope you got what i am trying to explain.
    Qt Code:
    1. if(curve->symbol()) {
    2. // curve has a symbol
    3. } else {
    4. // curve doesn't have a symbol
    5. }
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Tooltip to QwtSymbol ???

    Yeah i tried this and its crashed as well,

    so what i did is if (d_selectedCurve->style()== QwtPlotCurve::Lines) as in my case the curves that has symbols are a noline style. this worked for me.

    Thank you so much Wysota

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Tooltip to QwtSymbol ???

    Quote Originally Posted by jesse_mark View Post
    Yeah i tried this and its crashed as well,
    If it did then "curve" was pointing to an invalid object.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Tooltip to QwtSymbol ???

    but this method only got called when we get a point on a curve with its index.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Tooltip to QwtSymbol ???

    But it is you who initializes this variable. Maybe you did it incorrectly. Did you use d_selectedCurve->symbol() or something else?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Tooltip to QwtSymbol ???

    yes i did used it. i almost used the same code in the example i only added thing i need. but the method and detecting the symbol is same as the example.
    so maybe u can just add a curve with no symbols in the example and see that.

  10. #10
    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: Tooltip to QwtSymbol ???

    I can only repeat myself: use a combination of QwtPlotPicker and QwtPlotCurve::closestPoint() ( or something faster depending on the characteristics of your curve ).

    Copying code from an unrelated example instead of trying to understand what needs to be done is nothing but a waste of time.

    Uwe

  11. #11
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Tooltip to QwtSymbol ???

    My main problem was not detection the symbols on the curve or how to related the information to the selected symbol, and this is clear from my question which is tooltip for symbols.
    you suggested this example too, in "CanvasPicker::select in the event_filter example is something you can use".

    I do have the information displayed in a fixed label when i click the symbol. but I was wording if there a way to display a kinda tool-tip to symbols.
    you suggested overloading trackerText(),

    I was thinking of using QwtPlotMarker
    i tired something like :


    Qt Code:
    1. QwtText *t = new QwtText;
    2.  
    3. t->setText("Test");
    4. m->setLabel(*t);
    5. m->attach(myplot);
    6. m->setAxes(4000,1000);
    To copy to clipboard, switch view to plain text mode 
    but the text keep showing on (0,0) coordinates. I do not know what is the wrong im doing.
    or how i show the marker in the position/coordinates I want to.

Similar Threads

  1. Replies: 4
    Last Post: 29th March 2011, 20:33
  2. Replies: 1
    Last Post: 27th January 2011, 10:06
  3. Alignment of QwtSymbol
    By FelixB in forum Qwt
    Replies: 2
    Last Post: 11th January 2011, 08:40
  4. Tooltip in Qwt
    By Ankitha Varsha in forum Qwt
    Replies: 5
    Last Post: 8th December 2009, 12:07
  5. QwtSymbol highlighting?
    By shud in forum Qwt
    Replies: 1
    Last Post: 2nd October 2009, 21: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.