#13176 Use guarded pointers for highlighted curves

This commit is contained in:
Magne Sjaastad authored and Kristian Bendiksen committed 2025-11-14 13:06:32 +01:00
1 parent 7c8aadcd60
commit b6f0164de7
3 files changed
+17 -13

No files matched your search

@@ -1018,8 +1018,10 @@ void RiuQwtPlotWidget::selectClosestPlotItem( const QPoint& pos, bool toggleItem
bool wasToggledOff = false;
if ( toggleItemInSelection )
{
for ( auto highlightedCurve : m_hightlightedCurves )
for ( auto highlightedCurve : m_highlightedCurves )
{
if ( highlightedCurve.isNull() ) continue;
if ( highlightedCurve == clickedCurve )
{
wasToggledOff = true;
@@ -1165,7 +1167,7 @@ void RiuQwtPlotWidget::highlightPlotCurves( const std::vector<RimPlotCurve*>& cu
plotCurve->setZ( zValue + 100.0 );
highlightPlotAxes( plotCurve->xAxis(), plotCurve->yAxis() );
m_hightlightedCurves.push_back( currentRimPlotCurve );
m_highlightedCurves.push_back( currentRimPlotCurve );
}
else
{
@@ -1225,9 +1227,9 @@ void RiuQwtPlotWidget::resetPlotItemHighlighting( bool doUpdateCurveOrder )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPlotCurve*> RiuQwtPlotWidget::highlightedCurves() const
std::vector<caf::PdmPointer<RimPlotCurve>> RiuQwtPlotWidget::highlightedCurves() const
{
return m_hightlightedCurves;
return m_highlightedCurves;
}
//--------------------------------------------------------------------------------------------------
@@ -1235,7 +1237,7 @@ std::vector<RimPlotCurve*> RiuQwtPlotWidget::highlightedCurves() const
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotWidget::resetPlotCurveHighlighting()
{
m_hightlightedCurves.clear();
m_highlightedCurves.clear();
if ( !m_plotDefinition || m_originalZValues.empty() )
{
@@ -162,10 +162,10 @@ public:
QwtAxisId toQwtPlotAxis( RiuPlotAxis axis ) const;
void highlightPlotItem( const QwtPlotItem* plotItem );
void highlightCurvesUpdateOrder( const std::vector<RimPlotCurve*>& curves );
void resetPlotItemHighlighting( bool doUpdateCurveOrder = true );
std::vector<RimPlotCurve*> highlightedCurves() const;
void highlightPlotItem( const QwtPlotItem* plotItem );
void highlightCurvesUpdateOrder( const std::vector<RimPlotCurve*>& curves );
void resetPlotItemHighlighting( bool doUpdateCurveOrder = true );
std::vector<caf::PdmPointer<RimPlotCurve>> highlightedCurves() const;
void replot() override;
@@ -231,9 +231,9 @@ private:
int lineWidth;
};
std::map<QwtPlotCurve*, double> m_originalZValues;
std::vector<RimPlotCurve*> m_hightlightedCurves;
std::map<RiuPlotAxis, QwtAxisId> m_axisMapping;
std::map<QwtPlotCurve*, double> m_originalZValues;
std::vector<caf::PdmPointer<RimPlotCurve>> m_highlightedCurves;
std::map<RiuPlotAxis, QwtAxisId> m_axisMapping;
QPointer<QwtPlot> m_plot;