Qt 6.11 is out! See what's new in the release
blog
Prevent QMdiArea object from removing QMdiSubWindow when user clicks close button
General and Desktop
3
Posts
3
Posters
6.5k
Views
1
Watching
-
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();
}@
-