PDA

View Full Version : how to distroy child window which parents is zero



rajesh
21st June 2006, 10:42
how to distroy child window which parents is zero, when exiting from application.
If parent is 0, the new widget becomes a window. then how to distroy explicitly?

in the following examples, how to distroy uartDetachedWidget ?
void UartTab::detachWindow()
{
uartDetachedWidget = new UartWidget(0,m_uartNo, true);
uartDetachedWidget->show();
}

jpn
21st June 2006, 10:45
Set attribute Qt::WA_DeleteOnClose or store it as a member variable and delete manually in the destructor.

rajesh
22nd June 2006, 07:18
hello JPN,
:confused:
how to delete manually in the destructor of parent class?

Regards
Rajesh

zlatko
22nd June 2006, 07:23
class UartTab
{
// all others members here

private:
QWidget *uartDetachedWidget ;
}

UartTab::~UartTab()
{
delete uartDetachedWidget;
}

rajesh
22nd June 2006, 08:52
following code not working, means not closing the window.

UartTab::~UartTab()
{
delete uartDetachedWidget;
}