PDA

View Full Version : QwtLegend orientation on QwtPlot



bday1223
26th September 2011, 20:45
I've created a multi-curve QwtPlot with a legend as a child of the canvas at the top, but the legend items are all strung out on a single line across the top of the plot.

// add a legend
QwtLegend* legend = new QwtLegend();
legend->setParent( canvas() );
insertLegend( legend, QwtPlot::ExternalLegend );

I'd like to see each item on its own line; i.e. arranged vertically down the left side of the plot.
Can this be done?

Thanks,
bd

Uwe
27th September 2011, 06:26
QwtDynGridLayout *layout = qobject_cast<QwtDynGridLayout *>( legend->contentsWidget()->layout() );
if ( layout )
layout->setMaxCols( 1 );
Uwe