Hellow!
How can i replace big text in the QLegendItem, for example:
I have this text "x^2+12325*x+14124", how can i do that program replace this on the "x^2...124"
In advance many thanks for your help!
Hellow!
How can i replace big text in the QLegendItem, for example:
I have this text "x^2+12325*x+14124", how can i do that program replace this on the "x^2...124"
In advance many thanks for your help!
Well if your question is about this particular text you can simply set the shorter string as curve title.
A more general solution is to overload QwtPlotItem::updateLegend():
Unfortunately there is no support for Qt::TextElideMode in the Qwt layout system yet,Qt Code:
{ if ( legend == NULL ) return; if ( label ) { ... label->setText( ... ); } }To copy to clipboard, switch view to plain text mode
Uwe
It is question not about particular text, there are any text
the solution Uwe suggested is not about particular text as well. Suppose you set your curve a title. That title is what you want to appear in the legend. In updateLegend function, title() gives that title you have set. Now suppose you want only 10 chars max in your title...then take out the first 4 chars of string, append with '...' then take out the last four chars of string and append, etc...
Bookmarks