From: nds Date: Fri, 18 Sep 2009 08:36:12 +0000 (+0000) Subject: This is a fix for bug 0030235: Fit area doesn't work for particle number density... X-Git-Tag: V2_2_0~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4d3c5fe9bc516537953173b2f10430b3cd54503c;p=modules%2Fgui.git This is a fix for bug 0030235: Fit area doesn't work for particle number density curves. It corrects fir area functionality. --- diff --git a/src/Plot2d/Plot2d_ViewFrame.cxx b/src/Plot2d/Plot2d_ViewFrame.cxx index b9ee9a259..a0fe2ff9e 100755 --- a/src/Plot2d/Plot2d_ViewFrame.cxx +++ b/src/Plot2d/Plot2d_ViewFrame.cxx @@ -334,6 +334,26 @@ bool Plot2d_ViewFrame::eventFilter( QObject* watched, QEvent* e ) } } } + if ( myOperation != FitAreaId ) { + // this is a fix for zoomer's work. It has the base value, which by default + // is equal to original range of viewer: QRectF(0, 0, 1000, 100). When user + // wish to make fitRange for any region which lays outside this rect, + // the result is empty area, because zoomer make operation '&' between + // base and current rect. So we need to update base of zommer rect by content + // of QwtPlot in order to have valid intersection. It's right to change it by + // listening signal of changing scale of QwtPlot. But unfortunately it has no + // such a signal and we have to perform such a correction in this place. + QwtPlotZoomer* aZoomer = myPlot->getZoomer(); + if ( aZoomer ) { + QwtDoubleRect aBase = aZoomer->zoomBase(); + double xMin,xMax,yMin,yMax,y2Min,y2Max; + getFitRanges( xMin,xMax,yMin,yMax,y2Min,y2Max ); + QwtDoubleRect aFitRect = QwtDoubleRect( xMin, yMin, + fabs( xMax-xMin ), fabs( yMax-yMin ) ); + if ( aBase != aFitRect ) + aZoomer->setZoomBase( aFitRect ); + } + } return QWidget::eventFilter( watched, e ); } diff --git a/src/Plot2d/Plot2d_ViewFrame.h b/src/Plot2d/Plot2d_ViewFrame.h index ced090ea8..c76e7a570 100755 --- a/src/Plot2d/Plot2d_ViewFrame.h +++ b/src/Plot2d/Plot2d_ViewFrame.h @@ -246,6 +246,8 @@ public: bool polished() const { return myIsPolished; } QwtPlotGrid* grid() { return myGrid; }; + QwtPlotZoomer* getZoomer() { return myPlotZoomer; } + public slots: virtual void polish();