]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
createView() improvement
authorsan <san@opencascade.com>
Fri, 10 Jun 2005 13:31:12 +0000 (13:31 +0000)
committersan <san@opencascade.com>
Fri, 10 Jun 2005 13:31:12 +0000 (13:31 +0000)
src/SUIT/SUIT_ViewManager.cxx

index a2b74dd3f77e92f57ab73d4a59c5b41e7bb020cc..a20ddb7b410e796b2bb4c6d8696d0af4ba4bb102 100755 (executable)
@@ -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 <aView> 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) {