PDA

View Full Version : Changing the brush in QwtPlotLegendItem



Momergil
15th July 2014, 21:57
Hello!

In one of my QwtPlots I have a couple of QwtPlotCurves with different styles (one is a normal line while the other is a dot line). In the same plot I have a QwtPlotLegendItem that serves as legends for these curves.

Now as far as I can see, the line style doesn't appear in the legend: both legends show a normal filled rectangle with the colors of the respective curves.

How can I customize the legend's rectangles appearence? I tried to customize all "draw" methods from QwtPlotLegendItem saying something like
painter->setBrush(Qt::Dense3Pattern);, but nothing happens :T


Thanks,

Momergil

Uwe
16th July 2014, 07:43
There are a couple of options how a curve is represented on the legend ( see QwtPlotCurve::LegendAttributes ). If none of them matches what you need you have to overload QwtPlotCurve::legendIcon().

Uwe