Re: Symbols in custom legend
Brought to you by:
rathmann
From: Vedran F. <ved...@gm...> - 2010-05-23 15:26:29
|
Thanks for your reply. On 21.05.2010 11:06, Uwe Rathmann wrote: > The legend items are updated by the curves in replot - killing your local > changes. When updating a curve uses the identifierMode from the legend. The > font of the plot items should be inherited from the legend. So simply assign > mode and font to the legend instead to the legend items. Works! > If you want to have different symbols for curve and legend item you have to > overload YourCurve:.legendItem(). In Qwt 6.x you would could also reimplement > QwtPlotCurve::drawLegendIdentifier(). I use Qwt 5 and have now overloaded legendItem in my QwtPlotCurve subclass as suggested: QwtLegendItem* legendItem() const { QwtLegendItem* legendItem = new QwtLegendItem; legendItem->setSymbol(QwtSymbol(QwtSymbol::Rect, QBrush(Qt::blue), QPen(QBrush(Qt::blue),1), QSize(6,6))); return legendItem; } But now I don't get any symbol in the legend, only text is displayed. Thanks, Vedran -- http://vedranf.net | a8e7a7783ca0d460fee090cc584adc12 |