From 4d97cffeebd10ec257c2dcec704f30e65bcc3bf8 Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 10 Nov 2010 12:25:06 +0000 Subject: [PATCH] 0021702: [CEA 436] Problem with YACS schema --- src/Plot2d/Plot2d_ViewFrame.cxx | 48 ++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/src/Plot2d/Plot2d_ViewFrame.cxx b/src/Plot2d/Plot2d_ViewFrame.cxx index 7dcafc445..51c2639d2 100755 --- a/src/Plot2d/Plot2d_ViewFrame.cxx +++ b/src/Plot2d/Plot2d_ViewFrame.cxx @@ -647,7 +647,7 @@ void Plot2d_ViewFrame::displayCurves( const curveList& curves, bool update ) } fitAll(); //myPlot->setUpdatesEnabled( true ); -// update legend + // update legend if ( update ) myPlot->replot(); } @@ -1159,19 +1159,21 @@ void Plot2d_ViewFrame::setLegendPos( int pos ) { myLegendPos = pos; QwtLegend* legend = myPlot->legend(); - switch( pos ) { - case 0: - myPlot->insertLegend( legend, QwtPlot::LeftLegend ); - break; - case 1: - myPlot->insertLegend( legend, QwtPlot::RightLegend ); - break; - case 2: - myPlot->insertLegend( legend, QwtPlot::TopLegend ); - break; - case 3: - myPlot->insertLegend( legend, QwtPlot::BottomLegend ); - break; + if ( legend ) { + switch( pos ) { + case 0: + myPlot->insertLegend( legend, QwtPlot::LeftLegend ); + break; + case 1: + myPlot->insertLegend( legend, QwtPlot::RightLegend ); + break; + case 2: + myPlot->insertLegend( legend, QwtPlot::TopLegend ); + break; + case 3: + myPlot->insertLegend( legend, QwtPlot::BottomLegend ); + break; + } } } @@ -2461,14 +2463,16 @@ void Plot2d_QwtPlotCurve::updateLegend( QwtLegend* legend ) const { QwtPlotCurve::updateLegend( legend ); - QWidget* widget = legend->find( this ); - if( Plot2d_QwtLegendItem* anItem = dynamic_cast( widget ) ) { - int aMode = Plot2d_QwtLegendItem::IM_None; - if( myYAxisIdentifierEnabled ) - aMode = myYAxis == QwtPlot::yRight ? - Plot2d_QwtLegendItem::IM_Right : - Plot2d_QwtLegendItem::IM_Left; - anItem->setYAxisIdentifierMode( aMode ); + if ( legend ) { + QWidget* widget = legend->find( this ); + if( Plot2d_QwtLegendItem* anItem = dynamic_cast( widget ) ) { + int aMode = Plot2d_QwtLegendItem::IM_None; + if( myYAxisIdentifierEnabled ) + aMode = myYAxis == QwtPlot::yRight ? + Plot2d_QwtLegendItem::IM_Right : + Plot2d_QwtLegendItem::IM_Left; + anItem->setYAxisIdentifierMode( aMode ); + } } } -- 2.39.2