From: sln Date: Tue, 20 May 2008 09:03:26 +0000 (+0000) Subject: NPAL19051: X-Git-Tag: TG_ELNO_visualization_28May2008~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=17cc9a19e5ab3f344690fb03e6274be05259cd40;p=modules%2Fgui.git NPAL19051: 1) New signal viewCloned() is added to notify other objects about finishing ?Clone? operation from onCloneView slot 2)Part of code is moved from Splot2d_Viewer::onCloneView() slot to Pplot2d_Viewer::onCloneView() slot --- diff --git a/src/Plot2d/Plot2d_ViewModel.cxx b/src/Plot2d/Plot2d_ViewModel.cxx index e689f6ef5..514d04b73 100755 --- a/src/Plot2d/Plot2d_ViewModel.cxx +++ b/src/Plot2d/Plot2d_ViewModel.cxx @@ -171,8 +171,37 @@ void Plot2d_Viewer::onDumpView() /*! SLOT: called when action "Clone view" is activated */ -void Plot2d_Viewer::onCloneView( Plot2d_ViewFrame*, Plot2d_ViewFrame* ) +void Plot2d_Viewer::onCloneView( Plot2d_ViewFrame* clonedVF, Plot2d_ViewFrame* newVF ) { + if( !clonedVF || !newVF ) + return; + + // 1) Copy all properties of view + + newVF->copyPreferences( clonedVF ); + + // 2) Display all curves displayed in cloned view + + QList aCurves; + clonedVF->getCurves( aCurves ); + QList::const_iterator anIt = aCurves.begin(), aLast = aCurves.end(); + + for( ; anIt!=aLast; anIt++ ) + if( clonedVF->isVisible( *anIt ) ) + newVF->displayCurve( *anIt, false ); + newVF->Repaint(); + + if ( newVF ) + { + // find view window corresponding to the frame + QWidget* p = newVF->parentWidget(); + while( p && !p->inherits( "SUIT_ViewWindow" ) ) + p = p->parentWidget(); + + // emits signal + if ( p && p->inherits( "SUIT_ViewWindow" ) ) + emit viewCloned( (SUIT_ViewWindow*)p ); + } } /*! diff --git a/src/Plot2d/Plot2d_ViewModel.h b/src/Plot2d/Plot2d_ViewModel.h index 75445ff9b..a61755549 100755 --- a/src/Plot2d/Plot2d_ViewModel.h +++ b/src/Plot2d/Plot2d_ViewModel.h @@ -48,6 +48,9 @@ public: void update(); void clearPrs(); void setAutoDel(bool theDel); + +signals: + void viewCloned( SUIT_ViewWindow* ); protected slots: void onChangeBgColor();