Increase legend icon size?
Hello,
I'm using Qwt 6 (svn). I'd like to increase the size of the lines and symbols in the legend. I know that the symbol size there depends on the symbol size of a curve, but I just need to have the legend items drawn on larger rectangles, without increasing symbol sizes on the curves. I also need to change the sizes of NoSymbol-style items (where only the lines are drawn).
The reason why I want this is that the current resulting images are not that good. I tried calling QwtPlotCurve::drawLegendIdentifier() with my own painter and 16x16 rectangle, and the results are way better. So I'd like to use a rectangle of the same size when drawing the legend items.
Thanks in advance!
Re: Increase legend icon size?
You have to do something like this:
Code:
void YourCurve
::updateLegend( QwtLegend *legend
) const {
dynamic_cast<QwtLegendItem*>(legend->find( this ));
if ( lgdItem )
lgdItem->setIdentifierSize( ... );
}
I know this is not very comfortable ( worse than in Qwt 5.x ), but it needed to be changed for the new type of plot items, that also need to be displayed on the legend and I didn't want to lose too much time on this less important topic.
Hope I will have something better in future Qwt versions,
Uwe
Re: Increase legend icon size?
Thanks a lot!
I had to insert an extra call to QwtPlotItem::updateLegend(legend); at the end of YourCurve::updateLegend(), otherwise it wouldn't use the specified size for symbol-style legend items (lines were ok).