PDA

View Full Version : where QMdiSubWindow destructor should be called



tkoomzaaskz
27th January 2013, 11:49
Hi! I'm developing a standard MDI application and I don't know where should I call a MDI child window destructor.

Right now, I'm not calling it anywhere. My child window destructor prints some output do std::cout (some test output). When I close a child window I can see nothing in the Qt Creator console. But when I close the whole application (the QMainWindow), all console outputs are printed (terminating main window terminates all children).

I guess I should call the child destructor manually somewhere, but don't know where (maybe should use connect function anyhow)? Thanks for any help.

tkoomzaaskz
27th January 2013, 15:07
I found a way to destroy the window when the close ("X") button is clicked:


ChildWindow *child = new ChildWindow(ui->mdiArea);
child->setAttribute(Qt::WA_DeleteOnClose);
childWindows.append(child);
child->show();

The second line does the job. The solution is based on qmdiarea.html#addSubWindow