Fix update issues when switching from axis side (#8664)

* #8610 Ensemble import : Set default axis
* Summary Axis : Delete previous axis when switching side
* Janitor: Use auto and empty()
This commit is contained in:
Magne Sjaastad
2022-03-11 13:11:24 +01:00
committed by GitHub
parent 262aed3c8d
commit 0bab8a9834
5 changed files with 71 additions and 42 deletions

View File

@@ -981,6 +981,22 @@ void RiuQtChartsPlotWidget::addAxis( RiuPlotAxis plotAxis, bool isEnabled, bool
m_axesAutoScale[plotAxis] = isAutoScale;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQtChartsPlotWidget::deleteAxis( RiuPlotAxis axis )
{
auto toBeDeleted = plotAxis( axis );
qtChart()->removeAxis( toBeDeleted );
m_axes.erase( axis );
m_axesEnabled.erase( axis );
m_axesAutoScale.erase( axis );
delete toBeDeleted;
toBeDeleted = nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1195,10 +1211,7 @@ void RiuQtChartsPlotWidget::pruneAxes( const std::set<RiuPlotAxis>& usedAxes )
{
if ( usedAxes.count( plotAxis ) == 0 )
{
// This axis is now unused, and can be disabled
qtAxis->setVisible( false );
m_axesEnabled[plotAxis] = false;
m_axesAutoScale[plotAxis] = false;
deleteAxis( plotAxis );
}
}
}