#8938 Sub Plot : Fix visibility of legend

Make sure legends are set visible if any items are present in the legend
This commit is contained in:
Magne Sjaastad 2022-05-31 10:22:18 +02:00
parent 787d3ae379
commit fe1acc93a6
2 changed files with 5 additions and 2 deletions

View File

@ -600,7 +600,11 @@ void RiuMultiPlotPage::onLegendUpdated()
//--------------------------------------------------------------------------------------------------
void RiuMultiPlotPage::refreshLegends()
{
// TODO - might need to do something here, but at the moment it looks like alignCanvasTops() is sufficient
QList<QPointer<RiuQwtPlotLegend>> legends = this->legendsForVisiblePlots();
for ( const auto& l : legends )
{
l->setVisible( !l->isEmpty() );
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -108,7 +108,6 @@ QSize RiuQwtPlotLegend::sizeHint() const
void RiuQwtPlotLegend::updateLegend( const QVariant& variant, const QList<QwtLegendData>& legendItems )
{
QwtLegend::updateLegend( variant, legendItems );
setVisible( !legendItems.empty() );
emit legendUpdated();
}