From: san Date: Fri, 10 Jun 2005 13:31:12 +0000 (+0000) Subject: createView() improvement X-Git-Tag: T3_0_0_a3~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8526620f9f177f6864d59d006d44299394066ac1;p=modules%2Fgui.git createView() improvement --- diff --git a/src/SUIT/SUIT_ViewManager.cxx b/src/SUIT/SUIT_ViewManager.cxx index a2b74dd3f..a20ddb7b4 100755 --- a/src/SUIT/SUIT_ViewManager.cxx +++ b/src/SUIT/SUIT_ViewManager.cxx @@ -64,15 +64,25 @@ SUIT_ViewWindow* SUIT_ViewManager::createViewWindow() { SUIT_ViewWindow* aView = myViewModel->createView(myDesktop); - if ( !insertView( aView ) ) + if ( !insertView( aView ) ){ delete aView; + return 0; + } setViewName( aView ); //myDesktop->addViewWindow( aView ); //it is done automatically during creation of view aView->setViewManager(this); + emit viewCreated(aView); + + // Special treatment for the case when is the first one in this view manager + // -> call onWindowActivated() directly, because somebody may always want + // to use getActiveView() + if ( !myActiveView ) + onWindowActivated( aView ); + return aView; } @@ -160,7 +170,7 @@ void SUIT_ViewManager::onMousePressed(SUIT_ViewWindow* theView, QMouseEvent* the //*************************************************************** void SUIT_ViewManager::onWindowActivated(SUIT_ViewWindow* view) { - if (view) { + if (view && myActiveView != view) { unsigned int aSize = myViews.size(); for (uint i = 0; i < aSize; i++) { if (myViews[i] && myViews[i] == view) {