#9233 Fix regression in correlation plot

Introduced in be236cb.
This commit is contained in:
Kristian Bendiksen 2022-08-29 10:11:14 +02:00
parent 3ff5d238b1
commit 5ed12b17cd

View File

@ -173,12 +173,13 @@ void RiuMultiPlotPage::insertPlot( RiuPlotWidget* plotWidget, size_t index )
RiuQwtPlotWidget* qwtPlotWidget = dynamic_cast<RiuQwtPlotWidget*>( plotWidget ); RiuQwtPlotWidget* qwtPlotWidget = dynamic_cast<RiuQwtPlotWidget*>( plotWidget );
RiuQwtPlotLegend* legend = new RiuQwtPlotLegend( this ); RiuQwtPlotLegend* legend = nullptr;
RiuDraggableOverlayFrame* legendFrame = RiuDraggableOverlayFrame* legendFrame =
new RiuDraggableOverlayFrame( plotWidget->getParentForOverlay(), plotWidget->overlayMargins() ); new RiuDraggableOverlayFrame( plotWidget->getParentForOverlay(), plotWidget->overlayMargins() );
if ( m_plotDefinition->legendsVisible() && plotWidget->plotDefinition()->legendsVisible() ) if ( m_plotDefinition->legendsVisible() && plotWidget->plotDefinition()->legendsVisible() )
{ {
legend = new RiuQwtPlotLegend( this );
int legendColumns = 1; int legendColumns = 1;
if ( m_plotDefinition->legendsHorizontal() ) if ( m_plotDefinition->legendsHorizontal() )
{ {
@ -715,6 +716,8 @@ void RiuMultiPlotPage::addLegendWidget( RiuPlotWidget* plotWidget,
int column, int column,
int colSpan ) int colSpan )
{ {
if ( !legend ) return;
if ( m_plotDefinition->legendPosition() == RimPlotWindow::LegendPosition::ABOVE ) if ( m_plotDefinition->legendPosition() == RimPlotWindow::LegendPosition::ABOVE )
{ {
m_gridLayout->addWidget( legend, row, column, 1, colSpan, Qt::AlignHCenter | Qt::AlignBottom ); m_gridLayout->addWidget( legend, row, column, 1, colSpan, Qt::AlignHCenter | Qt::AlignBottom );
@ -738,6 +741,8 @@ void RiuMultiPlotPage::updateLegendVisibility( RiuPlotWidget* plotWid
RiuQwtPlotLegend* legend, RiuQwtPlotLegend* legend,
RiuDraggableOverlayFrame* legendFrame ) RiuDraggableOverlayFrame* legendFrame )
{ {
if ( !legend ) return;
if ( m_plotDefinition->legendsVisible() && !legend->isEmpty() ) if ( m_plotDefinition->legendsVisible() && !legend->isEmpty() )
{ {
updateLegendColumns( legend ); updateLegendColumns( legend );