From 3c9083705097bed1d311c7bb50fbbaac1f8892c8 Mon Sep 17 00:00:00 2001 From: asv Date: Tue, 30 Aug 2005 05:55:10 +0000 Subject: [PATCH] switch SVTK/VVTK interactor styles is improved (boolean slot). --- src/VVTK/VVTK_ViewWindow.cxx | 22 ++++++++++++++++------ src/VVTK/VVTK_ViewWindow.h | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-) 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; -- 2.39.2