PDA

View Full Version : closing a widget



steg90
12th June 2007, 10:01
Hi,

I have the following code to close my widget and remove from the workspace :



m_pMessageTree->close();
m_pworkspace->removeSubWindow( m_pMessageTree );
delete m_pMessageTree;



Problem is, the widget/window doesn't close?

Am I doing something obviously wrong? :confused:

Thanks,
Steve

steg90
12th June 2007, 10:57
Just thought I'd post to say I've fixed this, problem was, I was currently using Qt4.2.3 and using QWorkspace, I am now using Qt4.3 which now I changed to QMdiArea and now changed how I create my windows by now using QMdiSubWindow and setting my widget 'into' this, snippet shown below:



m_pCanTree = new CanTree( this );

m_pCanTreeWindow = new QMdiSubWindow;
m_pCanTreeWindow->setWidget( m_pCanTree );
m_pCanTreeWindow->setAttribute( Qt::WA_DeleteOnClose );




and now my close function is just simply :



m_pworkspace->removeSubWindow( m_pCanTreeWindow );


Regards,
Steve