Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Prevent QMdiArea object from removing QMdiSubWindow when user clicks close button
MrFive last edited by
I want the hide the sub window and not remove it when the user clicks the close button on the sub window. How do I prevent the QMdiArea object from removing this object?
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
francescmm last edited by
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)