I'm not sure how to use insertLegend to fix the problem.
In the constructor for my child of QwtPlot, I added
plotLayout
()->setLegendPosition
(QwtPlot::TopLegend);
insertLegend(new QwtLegend(canvas()), QwtPlot::TopLegend);
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:
plotLayout
()->setLegendPosition
(QwtPlot::TopLegend);
legend
()->insert
(curve,
new QLabel("hello", legend
()));
curve->attach(this);
QwtPlotCurve* curve = new QwtPlotCurve(var->get_name());
plotLayout()->setLegendPosition(QwtPlot::TopLegend);
legend()->insert(curve, new QLabel("hello", legend()));
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
Bookmarks