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 )
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).*/
}
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*)));
/*!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 );
}
/*!
*/
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();
}
/*!
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:
/*! 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);