]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
no message
authorstv <stv@opencascade.com>
Thu, 25 May 2006 09:17:00 +0000 (09:17 +0000)
committerstv <stv@opencascade.com>
Thu, 25 May 2006 09:17:00 +0000 (09:17 +0000)
src/STD/STD_Application.cxx
src/SUIT/SUIT_ViewManager.cxx
src/SUIT/SUIT_ViewManager.h
src/SUIT/SUIT_ViewWindow.cxx

index 3e955e6c9239c316d346e9773050b771edaee21f..0b449d185b9074955f570ce04bafee6f9c59a776 100755 (executable)
@@ -676,7 +676,8 @@ void STD_Application::removeViewManager( SUIT_ViewManager* vm )
   emit viewManagerRemoved( vm );
 
   vm->disconnectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
-  vm->disconnect();
+  disconnect( vm, SIGNAL( activated( SUIT_ViewManager* ) ),
+              this, SLOT( onViewManagerActivated( SUIT_ViewManager* ) ) );
   myViewMgrs.removeRef( vm );
 
   if ( myActiveViewMgr == vm )
@@ -690,7 +691,10 @@ void STD_Application::clearViewManagers()
   viewManagers( lst );
 
   for ( QPtrListIterator<SUIT_ViewManager> it( lst ); it.current(); ++it )
+  {
     removeViewManager( it.current() );
+    delete it.current();
+  }
 }
 
 /*!\retval TRUE, if view manager \a vm, already in view manager list (\a myViewMgrs).*/
index 69288994b2cf10a6bacfdf19be8ab3714f6acb7d..6e7f58d41b949e54109500910322257a2e962f4b 100755 (executable)
@@ -131,7 +131,7 @@ bool SUIT_ViewManager::insertView(SUIT_ViewWindow* theView)
   }
   
   connect(theView, SIGNAL(closing(SUIT_ViewWindow*)),
-          this,    SLOT(onDeleteView(SUIT_ViewWindow*)));
+          this,    SLOT(onClosingView(SUIT_ViewWindow*)));
 
   connect(theView, SIGNAL(mousePressed(SUIT_ViewWindow*, QMouseEvent*)),
           this,    SLOT(onMousePressed(SUIT_ViewWindow*, QMouseEvent*)));
@@ -168,24 +168,37 @@ bool SUIT_ViewManager::insertView(SUIT_ViewWindow* theView)
 
 /*!Emit delete view. Remove view window \a theView from view manager.
 */
-void SUIT_ViewManager::onDeleteView(SUIT_ViewWindow* theView)
+void SUIT_ViewManager::onClosingView( SUIT_ViewWindow* theView )
 {
-  emit deleteView(theView);
-  removeView(theView);
+  closeView( theView );
+}
+
+/*!
+  Remove the view window \a theView from view manager and destroy it.
+*/
+void SUIT_ViewManager::closeView( SUIT_ViewWindow* theView )
+{
+  QGuardedPtr<SUIT_ViewWindow> view( theView );
+
+  emit deleteView( view );
+  removeView( view );
+
+  if ( view )
+    delete view;
 }
 
 /*!Remove view window \a theView from view manager.
  *And close the last view, if it has \a theView.
 */
-void SUIT_ViewManager::removeView(SUIT_ViewWindow* theView) 
+void SUIT_ViewManager::removeView( SUIT_ViewWindow* theView )
 {
   theView->disconnect(this);
-  myViews.remove(myViews.find(theView));
-  if (myActiveView == theView)
+  myViews.remove( myViews.find( theView ) );
+  if ( myActiveView == theView )
     myActiveView = 0;
   int aNumItems = myViews.count();
-  if (aNumItems == 0)
-    emit lastViewClosed(this);
+  if ( aNumItems == 0 )
+    emit lastViewClosed( this );
 }
 
 /*!
@@ -223,11 +236,9 @@ void SUIT_ViewManager::onWindowActivated(SUIT_ViewWindow* view)
 */
 void SUIT_ViewManager::closeAllViews()
 {
-  unsigned int aSize = myViews.size();
-  for (uint i = 0; i < aSize; i++) {
-    if (myViews[i])
-      myViews[i]->close();
-  }
+  for ( uint i = 0; i < myViews.size(); i++ )
+    delete myViews[i];
+  myViews.clear();
 }
 
 /*!
index e0ca57fb261dc9d1ef85b71533a1721daf0eddaa..915d7d28f120c261dd0da5316e6e27d082a5482b 100755 (executable)
@@ -84,9 +84,9 @@ signals:
   void             activated(SUIT_ViewManager*);
   
 protected slots:
-  void             onWindowActivated(SUIT_ViewWindow*);
-  void             onDeleteView(SUIT_ViewWindow* theView);
-  void             onMousePressed(SUIT_ViewWindow* theView, QMouseEvent* theEvent);
+  void             onWindowActivated( SUIT_ViewWindow* );
+  void             onClosingView( SUIT_ViewWindow* );
+  void             onMousePressed(SUIT_ViewWindow*, QMouseEvent* );
   void             onDeleteStudy();
 
 private slots:
@@ -100,6 +100,9 @@ protected:
   
   /*! Removes the View from internal Views Vector.*/
   virtual void     removeView(SUIT_ViewWindow* theView);
+
+  /*! Close the specified View.*/
+  virtual void     closeView(SUIT_ViewWindow* theView);
   
   /*! Used to set unique name for the view.*/
   virtual void     setViewName(SUIT_ViewWindow* theView);
index bd4c32e69b7c278483c1b5d2caea1588637e1dfd..6496668d1135ea3ea39530874f8430f1eb2f78bb 100755 (executable)
@@ -91,7 +91,7 @@ bool SUIT_ViewWindow::dumpViewToFormat( const QString& fileName, const QString&
 */
 void SUIT_ViewWindow::closeEvent(QCloseEvent* theEvent)
 {
-  QMainWindow::closeEvent( theEvent );
+//  QMainWindow::closeEvent( theEvent );
   emit closing( this );
 }