From 259ecb356eb789678497db6b655cc3e377a67cce Mon Sep 17 00:00:00 2001 From: mpa Date: Tue, 21 Apr 2015 16:20:59 +0300 Subject: [PATCH] 0052660: Plot2D Viewer: Plot2d_Curve can't be selected --- src/SPlot2d/SPlot2d_ViewModel.cxx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/SPlot2d/SPlot2d_ViewModel.cxx b/src/SPlot2d/SPlot2d_ViewModel.cxx index 02b8e4009..896ad5aed 100644 --- a/src/SPlot2d/SPlot2d_ViewModel.cxx +++ b/src/SPlot2d/SPlot2d_ViewModel.cxx @@ -407,24 +407,31 @@ void SPlot2d_Viewer::onClicked( const QVariant& itemInfo, int index ) QwtPlotItem* plotItem = aViewFrame->getPlot()->infoToItem( itemInfo ); + bool isCurveSelected = false; CurveDict aCurves = aViewFrame->getCurves(); for( CurveDict::Iterator it = aCurves.begin(); it != aCurves.end(); ++it ) { - it.value()->setSelected( plotItem == it.key() ); - aViewFrame->updateCurve( it.value(), true ); + if(plotItem == it.key()) { + isCurveSelected = true; + it.value()->setSelected(true); + } else { + it.value()->setSelected(false); + } } - bool isAnalytical = false; AnalyticalCurveList curves = aViewFrame->getAnalyticalCurves(); foreach ( Plot2d_AnalyticalCurve* curve, curves ) { if(plotItem == curve->plotItem()) { - isAnalytical = true; + isCurveSelected = true; curve->setSelected(true); } else { curve->setSelected(false); } } - if(isAnalytical) { + if(isCurveSelected) { + for( CurveDict::Iterator it = aCurves.begin(); it != aCurves.end(); ++it ) + aViewFrame->updateCurve( it.value() ); + myDeselectAnalytical = false; emit clearSelected(); aViewFrame->updateAnalyticalCurves(); -- 2.39.2