From: rnv Date: Mon, 21 Jul 2014 08:43:39 +0000 (+0400) Subject: Fix for the "22651: [CEA 1224] suppressed code in Plot 2D" issue. X-Git-Tag: V7_5_0a1~32 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=31a58a213c79458927328f1c2745154340a54eb8;p=modules%2Fgui.git Fix for the "22651: [CEA 1224] suppressed code in Plot 2D" issue. --- diff --git a/src/Plot2d/Plot2d_PlotItems.cxx b/src/Plot2d/Plot2d_PlotItems.cxx index a2222caa5..73fd3b40c 100644 --- a/src/Plot2d/Plot2d_PlotItems.cxx +++ b/src/Plot2d/Plot2d_PlotItems.cxx @@ -349,26 +349,28 @@ void Plot2d_QwtPlotCurve::updateLegend( const QwtPlotItem* thePlotItem, QwtPlotCurve::updateLegend( thePlotItem, theLegendData ); - const QVariant itemInfo = thePlotItem->plot()->itemToInfo( const_cast< QwtPlotItem *>( thePlotItem ) ); - QwtLegend* legend = dynamic_cast( thePlotItem->plot()->legend() ); - QWidget* widget = legend->legendWidget( itemInfo ); - QwtLegendLabel* label = dynamic_cast( widget ); - if( Plot2d_QwtLegendLabel* anItem = (Plot2d_QwtLegendLabel*)label ) { - int aMode = Plot2d_QwtLegendLabel::IM_None; - if( myYAxisIdentifierEnabled ) - aMode = myYAxis == QwtPlot::yRight ? - Plot2d_QwtLegendLabel::IM_Right : - Plot2d_QwtLegendLabel::IM_Left; - anItem->setYAxisIdentifierMode( aMode ); - - anItem->setSymbol( legendSymbol() ); - if( Plot2d_Plot2d* plot = dynamic_cast( thePlotItem->plot() ) ) - anItem->setSymbolType( plot->getLegendSymbolType() ); - anItem->setPen( legendPen() ); - - anItem->setSelected( isSelected() ); - anItem->updateHighlit(); - anItem->repaint(); + const QVariant itemInfo = thePlotItem->plot()->itemToInfo( const_cast< QwtPlotItem *>( thePlotItem ) ); + if( QwtLegend* legend = dynamic_cast( thePlotItem->plot()->legend() ) ) { + if( QWidget* widget = legend->legendWidget( itemInfo ) ) { + QwtLegendLabel* label = dynamic_cast( widget ); + if( Plot2d_QwtLegendLabel* anItem = (Plot2d_QwtLegendLabel*)label ) { + int aMode = Plot2d_QwtLegendLabel::IM_None; + if( myYAxisIdentifierEnabled ) + aMode = myYAxis == QwtPlot::yRight ? + Plot2d_QwtLegendLabel::IM_Right : + Plot2d_QwtLegendLabel::IM_Left; + anItem->setYAxisIdentifierMode( aMode ); + + anItem->setSymbol( legendSymbol() ); + if( Plot2d_Plot2d* plot = dynamic_cast( thePlotItem->plot() ) ) + anItem->setSymbolType( plot->getLegendSymbolType() ); + anItem->setPen( legendPen() ); + + anItem->setSelected( isSelected() ); + anItem->updateHighlit(); + anItem->repaint(); + } + } } }