I'm not sure how to use insertLegend to fix the problem.

In the constructor for my child of QwtPlot, I added

Qt Code:
  1. insertLegend(new QwtLegend(canvas()), QwtPlot::TopLegend);
  2. plotLayout()->setLegendPosition(QwtPlot::TopLegend);
To copy to clipboard, switch view to plain text mode 

but that didn't change anything. I tried adding widgets directly to the legend:

Qt Code:
  1. QwtPlotCurve* curve = new QwtPlotCurve(var->get_name());
  2. plotLayout()->setLegendPosition(QwtPlot::TopLegend);
  3. legend()->insert(curve, new QLabel("hello", legend()));
  4. curve->attach(this);
To copy to clipboard, switch view to plain text mode 

but the QLabels are still stacking up on top of each other, without using different columns.

Note: Despite setting the QwtLegend to the top position in the constructor, if I don't use setLegendPosition each time I add a curve, the legend appears on the right side of the plot.

I've tried playing with different ratio parameters, but those did not do anything.

What am I missing?

Thanks,
Tom