I’m using the QMdiArea in Qt 4.4.
If a new project is created, I add a number of sub windows to a QMdiArea. I’d like to disallow the user to close a sub window during runtime. The sub windows should only be closed if the whole application is closed or if a new project is created.
How can I do this?
You need to define your own
subWindow. create a subclass ofQMdiSubWindowand override thecloseEvent(QCloseEvent *closeEvent). you can control it by argument. for example:then subclass the
QMdiAreaand overrideQMdiArea::closeAllSubWindows ()like this:you may also need to override
closeslot of your mdi area.