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);
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 );
}
//----------------------------------------------------------------------------
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() );
}