Prevent QMdiArea object from removing QMdiSubWindow when user clicks close button
-
Hi and welcome to devnet,
From the top of my head: subclass QMdiSubWindow and reimplement it's closeEvent to hide rather than close.
Hope it helps
-
I know two ways to do it:
-
Hidde the close button of the QMdiSubWindow:
@subwindow->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowMinMaxButtonsHint);@ -
Avoid the close accion re-writing the close event of the QWidget of the subwindow:
@void YourWidget::closeEvent(QCloseEvent *e)
{
e->ignore();
}@
-