From 96482edf6a358d7fc70505dbd804bf46999b4dca Mon Sep 17 00:00:00 2001 From: asv Date: Tue, 23 Aug 2005 12:23:30 +0000 Subject: [PATCH] new function initView() is added in order to easily customize creation of a new view window in SOCC. --- src/OCCViewer/OCCViewer_ViewModel.cxx | 21 ++++++++++++++------- src/OCCViewer/OCCViewer_ViewModel.h | 4 ++++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/OCCViewer/OCCViewer_ViewModel.cxx b/src/OCCViewer/OCCViewer_ViewModel.cxx index acfb8cf2e..bf90792a5 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.cxx +++ b/src/OCCViewer/OCCViewer_ViewModel.cxx @@ -88,16 +88,23 @@ void OCCViewer_Viewer::setBackgroundColor( const QColor& c ) myBgColor = c; } -SUIT_ViewWindow* OCCViewer_Viewer::createView( SUIT_Desktop* theDesktop ) +void OCCViewer_Viewer::initView( OCCViewer_ViewWindow* view ) { - OCCViewer_ViewWindow* res = new OCCViewer_ViewWindow(theDesktop, this); - res->initLayout(); + if ( view ) { + view->initLayout(); + + OCCViewer_ViewPort3d* vp3d = view->getViewPort(); + if ( vp3d ) + vp3d->setBackgroundColor( myBgColor ); + } +} - OCCViewer_ViewPort3d* vp3d = res->getViewPort(); - if ( vp3d ) - vp3d->setBackgroundColor( myBgColor ); - return res; +SUIT_ViewWindow* OCCViewer_Viewer::createView( SUIT_Desktop* theDesktop ) +{ + OCCViewer_ViewWindow* view = new OCCViewer_ViewWindow(theDesktop, this); + initView( view ); + return view; } //********************************************************************* diff --git a/src/OCCViewer/OCCViewer_ViewModel.h b/src/OCCViewer/OCCViewer_ViewModel.h index d42be6a25..64e153ad3 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.h +++ b/src/OCCViewer/OCCViewer_ViewModel.h @@ -15,6 +15,7 @@ class SUIT_ViewWindow; class SUIT_Desktop; +class OCCViewer_ViewWindow; struct viewAspect { @@ -121,6 +122,9 @@ public: signals: void selectionChanged(); +protected: + void initView( OCCViewer_ViewWindow* view ); + protected slots: void onMousePress(SUIT_ViewWindow*, QMouseEvent*); void onMouseMove(SUIT_ViewWindow*, QMouseEvent*); -- 2.39.2