From: asv Date: Tue, 30 Aug 2005 05:55:10 +0000 (+0000) Subject: switch SVTK/VVTK interactor styles is improved (boolean slot). X-Git-Tag: BR-D5-38-2003_D2005-12-09~80 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3c9083705097bed1d311c7bb50fbbaac1f8892c8;p=modules%2Fvisu.git switch SVTK/VVTK interactor styles is improved (boolean slot). --- diff --git a/src/VVTK/VVTK_ViewWindow.cxx b/src/VVTK/VVTK_ViewWindow.cxx index f42c3050..dce4e48e 100755 --- a/src/VVTK/VVTK_ViewWindow.cxx +++ b/src/VVTK/VVTK_ViewWindow.cxx @@ -18,10 +18,11 @@ VVTK_ViewWindow VVTK_Viewer* theModel ) : SVTK_ViewWindow( theDesktop, theModel ) { + // important! : the default interactor style which is pushed is VVTK + // see onSwitchIS() for details getView()->pushInteractorStyle( VVTK_InteractorStyle::New() ); - connect(this,SIGNAL(selectionChanged()), - theModel,SLOT(onSelectionChanged())); + connect(this,SIGNAL(selectionChanged()),theModel,SLOT(onSelectionChanged())); // create another toolbar myToolBar = new QToolBar(this); @@ -31,9 +32,11 @@ VVTK_ViewWindow SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); // SVTK / VVTK switcher action QtxAction* aAction = new QtxAction(tr("MNU_VVTK_SWITCH"), aResMgr->loadPixmap( "VISU", tr( "ICON_VVTK_SWITCH" ) ), - tr( "MNU_VVTK_SWITCH" ), 0, this); + tr( "MNU_VVTK_SWITCH" ), 0, this, "vvtk/svtk", true); + aAction->setToggleAction(true); // pressed by default + aAction->toggle(); aAction->setStatusTip(tr("DSC_VVTK_SWITCH")); - connect(aAction, SIGNAL(activated()), this, SLOT(onSwitchIS())); + connect(aAction, SIGNAL(toggled(bool)), this, SLOT(onSwitchIS(bool))); aAction->addTo( myToolBar ); } @@ -46,7 +49,14 @@ VVTK_ViewWindow //---------------------------------------------------------------------------- void VVTK_ViewWindow -::onSwitchIS() +::onSwitchIS(bool isVVTK) { - printf( "onswitch IS \n\n" ); + // default interactor style which is pushed in this view window constructor + // is VVTK. If it is a current interactor style -- push SVTK "above" it. + // if SVTK is a current one - pop it (remove from stack), below it there MUST BE + // (logically) a VVTK interactor style. + if ( isVVTK ) + getView()->popInteractorStyle(); + else + getView()->pushInteractorStyle( SVTK_InteractorStyle::New() ); } diff --git a/src/VVTK/VVTK_ViewWindow.h b/src/VVTK/VVTK_ViewWindow.h index e646b925..a946bf05 100755 --- a/src/VVTK/VVTK_ViewWindow.h +++ b/src/VVTK/VVTK_ViewWindow.h @@ -20,7 +20,7 @@ public: virtual ~VVTK_ViewWindow(); protected slots: - void onSwitchIS(); + void onSwitchIS(bool isVVTK); private: QToolBar* myToolBar;