With the QwtLegend i manage the visibility of curves, markers etc. that are attached to to plot.
I can't use the attribute QwtPlotItem::Legend, because if i set it to false it disapears from QwtLegend.
Yes of course: setting QwtPlotItem::Legend to false has the meaning of not being relevant for the legend.
The QwtPlotLegendItem inside of plot should show ONLY the visible items of the plot. How can i do this?
Overload QwtPlotLegendItem::updateLegend(), something like this:
virtual void YourLegendItem
::updateLegend( const QwtPlotItem *plotItem,
const QList<QwtLegendData> &data )
{
if ( !plotItem->isVisible() )
QwtPlotLegendItem::updateLegend( plotItem, QList<QwtLegendData>() );
else
QwtPlotLegendItem::updateLegend( plotItem, data );
}
virtual void YourLegendItem::updateLegend( const QwtPlotItem *plotItem,
const QList<QwtLegendData> &data )
{
if ( !plotItem->isVisible() )
QwtPlotLegendItem::updateLegend( plotItem, QList<QwtLegendData>() );
else
QwtPlotLegendItem::updateLegend( plotItem, data );
}
To copy to clipboard, switch view to plain text mode
Bookmarks