From eb1e9d222db9b6df1bf66af4b6c287d4e89ca13a Mon Sep 17 00:00:00 2001 From: ouv Date: Tue, 22 Mar 2011 10:47:50 +0000 Subject: [PATCH] setTraceBoundingRectEnabled( bool ) method is added. --- src/GraphicsView/GraphicsView_ViewPort.cxx | 17 +++++++++++++++-- src/GraphicsView/GraphicsView_ViewPort.h | 2 ++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/GraphicsView/GraphicsView_ViewPort.cxx b/src/GraphicsView/GraphicsView_ViewPort.cxx index d066402c3..442fc9281 100644 --- a/src/GraphicsView/GraphicsView_ViewPort.cxx +++ b/src/GraphicsView/GraphicsView_ViewPort.cxx @@ -143,6 +143,7 @@ GraphicsView_ViewPort::GraphicsView_ViewPort( QWidget* theParent ) mySceneGap = 20; myFitAllGap = 40; + myIsTraceBoundingRectEnabled = true; // background setBackgroundBrush( QBrush( Qt::white ) ); @@ -348,6 +349,15 @@ void GraphicsView_ViewPort::setFitAllGap( double theFitAllGap ) myFitAllGap = theFitAllGap; } +//================================================================ +// Function : setTraceBoundingRectEnabled +// Purpose : +//================================================================ +void GraphicsView_ViewPort::setTraceBoundingRectEnabled( bool theState ) +{ + myIsTraceBoundingRectEnabled = theState; +} + //================================================================ // Function : setViewNameEnabled // Purpose : @@ -1247,8 +1257,11 @@ void GraphicsView_ViewPort::finishPulling() //================================================================ void GraphicsView_ViewPort::onBoundingRectChanged() { - QRectF aRect = objectsBoundingRect(); - myScene->setSceneRect( aRect.adjusted( -mySceneGap, -mySceneGap, mySceneGap, mySceneGap ) ); + if( myIsTraceBoundingRectEnabled ) + { + QRectF aRect = objectsBoundingRect(); + myScene->setSceneRect( aRect.adjusted( -mySceneGap, -mySceneGap, mySceneGap, mySceneGap ) ); + } } //================================================================ diff --git a/src/GraphicsView/GraphicsView_ViewPort.h b/src/GraphicsView/GraphicsView_ViewPort.h index 2d95dfacc..0b97494f0 100644 --- a/src/GraphicsView/GraphicsView_ViewPort.h +++ b/src/GraphicsView/GraphicsView_ViewPort.h @@ -82,6 +82,7 @@ public: // scene void setSceneGap( double theSceneGap ); void setFitAllGap( double theFitAllGap ); + void setTraceBoundingRectEnabled( bool theState ); // view name void setViewNamePosition( NamePosition thePosition, @@ -216,6 +217,7 @@ private: GraphicsView_Scene* myScene; double mySceneGap; double myFitAllGap; + bool myIsTraceBoundingRectEnabled; // view name NameLabel* myNameLabel; -- 2.39.2