Fix bug in QwtPlotWidget highlight reset

QwtPlotShapeItem objects were not reset
This commit is contained in:
Jørgen Herje
2023-01-26 14:42:00 +01:00
committed by Magne Sjaastad
parent c916459a55
commit 3c296202c2

View File

@@ -1055,7 +1055,7 @@ void RiuQwtPlotWidget::resetPlotItemHighlighting( bool doUpdateCurveOrder )
{ {
if ( !m_originalZValues.empty() ) if ( !m_originalZValues.empty() )
{ {
auto plotItemList = m_plot->itemList(); const auto& plotItemList = m_plot->itemList();
for ( QwtPlotItem* plotItem : plotItemList ) for ( QwtPlotItem* plotItem : plotItemList )
{ {
if ( auto* plotCurve = dynamic_cast<QwtPlotCurve*>( plotItem ) ) if ( auto* plotCurve = dynamic_cast<QwtPlotCurve*>( plotItem ) )
@@ -1071,7 +1071,13 @@ void RiuQwtPlotWidget::resetPlotItemHighlighting( bool doUpdateCurveOrder )
continue; continue;
} }
} }
}
m_originalZValues.clear();
}
const auto& plotItemList = m_plot->itemList();
for ( QwtPlotItem* plotItem : plotItemList )
{
auto* plotShapeItem = dynamic_cast<QwtPlotShapeItem*>( plotItem ); auto* plotShapeItem = dynamic_cast<QwtPlotShapeItem*>( plotItem );
if ( plotShapeItem ) if ( plotShapeItem )
{ {
@@ -1085,8 +1091,6 @@ void RiuQwtPlotWidget::resetPlotItemHighlighting( bool doUpdateCurveOrder )
plotShapeItem->setZ( plotShapeItem->z() - 100.0 ); plotShapeItem->setZ( plotShapeItem->z() - 100.0 );
} }
} }
m_originalZValues.clear();
}
resetPlotAxisHighlighting(); resetPlotAxisHighlighting();