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
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
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
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
Qt Code:
if(curve->symbol()) { // curve has a symbol } else { // curve doesn't have a symbol }To copy to clipboard, switch view to plain text mode
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
but this method only got called when we get a point on a curve with its index.
But it is you who initializes this variable. Maybe you did it incorrectly. Did you use d_selectedCurve->symbol() or something else?
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.
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
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 :
but the text keep showing on (0,0) coordinates. I do not know what is the wrong im doing.Qt Code:
t->setText("Test"); m->setLabel(*t); m->attach(myplot); m->setAxes(4000,1000);To copy to clipboard, switch view to plain text mode
or how i show the marker in the position/coordinates I want to.
Bookmarks