PDA

View Full Version : How to get a QwtLegendLabel from a QwtPlotItem(such as QwtPlotCurve)?



momo
15th April 2015, 12:34
Hello everyone, In Qwt6.0, I can use QwtLegend::find(const* QwtPlotItem) to get a pointer of QwtLegendItem, but in 6.1, QwtLegendItem is replaced with QwtLegendLabel, and QwtLegend::find() is removed. What should I do when I want to get a pointer of QwtLegendLabel which is related to a QwtPlotItem? And how can I get all QwtLegendLabels from a QwtLegend?

Uwe
16th April 2015, 07:00
F.e in the cpuplot example ( CpuPlot::showCurve ) you can find the sequence how to get the label.
The complete list can be found by iterating over the plot items - or maybe easier by plot->legend()->findChildren<QwtLegendLabel>();

This odd API is somehow the price, that needs to paid for being able to replace QwtLegend by any other type of widget.

Uwe